summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/app/app.cxx5
-rw-r--r--desktop/source/app/checkinstall.cxx86
-rw-r--r--framework/collector/cmduicollector.cxx40
-rw-r--r--framework/collector/uicmdstohtml.cxx4
-rw-r--r--framework/inc/classes/addonmenu.hxx7
-rw-r--r--framework/inc/classes/bmkmenu.hxx4
-rw-r--r--framework/inc/classes/eventsconfiguration.hxx39
-rw-r--r--framework/inc/classes/eventsdocumenthandler.hxx198
-rwxr-xr-xframework/inc/classes/fwlresid.hxx49
-rw-r--r--framework/inc/classes/imagesconfiguration.hxx115
-rw-r--r--framework/inc/classes/imagesdocumenthandler.hxx215
-rw-r--r--framework/inc/classes/imagewrapper.hxx18
-rw-r--r--framework/inc/classes/menuconfiguration.hxx126
-rw-r--r--framework/inc/classes/menumanager.hxx38
-rw-r--r--framework/inc/classes/statusbarconfiguration.hxx48
-rw-r--r--framework/inc/classes/statusbardocumenthandler.hxx190
-rwxr-xr-xframework/inc/classes/toolboxconfiguration.hxx96
-rw-r--r--framework/inc/classes/toolboxconfigurationdefines.hxx80
-rwxr-xr-xframework/inc/classes/toolboxdocumenthandler.hxx217
-rw-r--r--framework/inc/classes/toolboxlayoutdocumenthandler.hxx198
-rw-r--r--framework/inc/helper/dockingareadefaultacceptor.hxx15
-rw-r--r--framework/inc/helper/mischelper.hxx15
-rw-r--r--framework/inc/helper/ocomponentaccess.hxx15
-rw-r--r--framework/inc/helper/ocomponentenumeration.hxx16
-rw-r--r--framework/inc/helper/oframes.hxx15
-rw-r--r--framework/inc/helper/opluginframedispatcher.hxx15
-rw-r--r--framework/inc/helper/popupmenucontrollerbase.hxx8
-rw-r--r--framework/inc/helper/uiconfigelementwrapperbase.hxx10
-rw-r--r--framework/inc/interaction/preventduplicateinteraction.hxx4
-rw-r--r--framework/inc/jobs/helponstartup.hxx14
-rw-r--r--framework/inc/jobs/shelljob.hxx13
-rw-r--r--framework/inc/macros/debug/memorymeasure.hxx2
-rw-r--r--framework/inc/macros/xserviceinfo.hxx27
-rw-r--r--framework/inc/mediadescriptor.h76
-rw-r--r--framework/inc/services.h18
-rw-r--r--framework/inc/services/dispatchhelper.hxx12
-rw-r--r--framework/inc/services/frameloaderfactory.hxx12
-rw-r--r--framework/inc/services/mediatypedetectionhelper.hxx10
-rw-r--r--framework/inc/services/menudocumenthandler.hxx317
-rw-r--r--framework/inc/services/popupmenucontrollerfactory.hxx97
-rw-r--r--framework/inc/services/saxnamespacefilter.hxx119
-rw-r--r--framework/inc/services/substitutepathvars.hxx11
-rw-r--r--framework/inc/services/uriabbreviation.hxx10
-rw-r--r--framework/inc/services/urltransformer.hxx10
-rw-r--r--framework/inc/tabwin/tabwinfactory.hxx11
-rw-r--r--framework/inc/uiconfiguration/imagemanager.hxx62
-rw-r--r--framework/inc/uiconfiguration/moduleimagemanager.hxx115
-rw-r--r--framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx92
-rw-r--r--framework/inc/uiconfiguration/uicategorydescription.hxx50
-rw-r--r--framework/inc/uiconfiguration/uiconfigurationmanager.hxx81
-rw-r--r--framework/inc/uiconfiguration/windowstateconfiguration.hxx9
-rw-r--r--framework/inc/uielement/comboboxtoolbarcontroller.hxx4
-rw-r--r--framework/inc/uielement/complextoolbarcontroller.hxx1
-rw-r--r--framework/inc/uielement/controlmenucontroller.hxx7
-rw-r--r--framework/inc/uielement/dropdownboxtoolbarcontroller.hxx4
-rw-r--r--framework/inc/uielement/edittoolbarcontroller.hxx4
-rw-r--r--framework/inc/uielement/fontmenucontroller.hxx11
-rw-r--r--framework/inc/uielement/fontsizemenucontroller.hxx12
-rw-r--r--framework/inc/uielement/footermenucontroller.hxx61
-rw-r--r--framework/inc/uielement/headermenucontroller.hxx14
-rw-r--r--framework/inc/uielement/imagebuttontoolbarcontroller.hxx3
-rw-r--r--framework/inc/uielement/itemcontainer.hxx10
-rw-r--r--framework/inc/uielement/langselectionmenucontroller.hxx9
-rw-r--r--framework/inc/uielement/langselectionstatusbarcontroller.hxx3
-rw-r--r--framework/inc/uielement/macrosmenucontroller.hxx13
-rw-r--r--framework/inc/uielement/menubarmanager.hxx21
-rw-r--r--framework/inc/uielement/menubarwrapper.hxx7
-rw-r--r--framework/inc/uielement/newmenucontroller.hxx11
-rw-r--r--framework/inc/uielement/objectmenucontroller.hxx13
-rw-r--r--framework/inc/uielement/recentfilesmenucontroller.hxx8
-rw-r--r--framework/inc/uielement/spinfieldtoolbarcontroller.hxx4
-rw-r--r--framework/inc/uielement/statusbarmanager.hxx4
-rw-r--r--framework/inc/uielement/statusbarwrapper.hxx3
-rw-r--r--framework/inc/uielement/statusindicatorinterfacewrapper.hxx12
-rw-r--r--framework/inc/uielement/togglebuttontoolbarcontroller.hxx2
-rw-r--r--framework/inc/uielement/toolbarmanager.hxx6
-rw-r--r--framework/inc/uielement/toolbarsmenucontroller.hxx4
-rw-r--r--framework/inc/uielement/toolbarwrapper.hxx9
-rw-r--r--framework/inc/uielement/uicommanddescription.hxx22
-rw-r--r--framework/inc/uifactory/addonstoolboxfactory.hxx12
-rwxr-xr-xframework/inc/uifactory/factoryconfiguration.hxx127
-rw-r--r--framework/inc/uifactory/menubarfactory.hxx24
-rw-r--r--framework/inc/uifactory/popupmenucontrollerfactory.hxx38
-rw-r--r--framework/inc/uifactory/statusbarcontrollerfactory.hxx40
-rw-r--r--framework/inc/uifactory/statusbarfactory.hxx26
-rw-r--r--framework/inc/uifactory/toolbarcontrollerfactory.hxx21
-rw-r--r--framework/inc/uifactory/toolboxfactory.hxx25
-rw-r--r--framework/inc/uifactory/uielementfactorymanager.hxx75
-rw-r--r--framework/inc/uifactory/windowcontentfactorymanager.hxx21
-rw-r--r--framework/inc/xml/eventsdocumenthandler.hxx20
-rw-r--r--framework/inc/xml/imagesdocumenthandler.hxx15
-rw-r--r--framework/inc/xml/menudocumenthandler.hxx17
-rw-r--r--framework/inc/xml/saxnamespacefilter.hxx15
-rw-r--r--framework/inc/xml/statusbardocumenthandler.hxx15
-rw-r--r--framework/inc/xml/toolboxdocumenthandler.hxx15
-rw-r--r--framework/prj/d.lst11
-rw-r--r--framework/source/accelerators/acceleratorcache.cxx4
-rw-r--r--framework/source/accelerators/acceleratorconfiguration.cxx83
-rw-r--r--framework/source/accelerators/acceleratorexecute.cxx10
-rw-r--r--framework/source/accelerators/moduleacceleratorconfiguration.cxx3
-rw-r--r--framework/source/classes/addonmenu.cxx15
-rw-r--r--framework/source/classes/addonsoptions.cxx2
-rw-r--r--framework/source/classes/bmkmenu.cxx23
-rw-r--r--framework/source/classes/framelistanalyzer.cxx6
-rw-r--r--framework/source/classes/fwktabwindow.cxx19
-rwxr-xr-xframework/source/classes/fwlresid.cxx68
-rw-r--r--framework/source/classes/imagewrapper.cxx86
-rw-r--r--framework/source/classes/makefile.mk1
-rw-r--r--framework/source/classes/menumanager.cxx553
-rw-r--r--framework/source/classes/propertysethelper.cxx3
-rw-r--r--framework/source/classes/protocolhandlercache.cxx15
-rw-r--r--framework/source/classes/taskcreator.cxx3
-rw-r--r--framework/source/dispatch/closedispatcher.cxx5
-rw-r--r--framework/source/dispatch/interceptionhelper.cxx4
-rw-r--r--framework/source/dispatch/menudispatcher.cxx6
-rw-r--r--framework/source/dispatch/popupmenudispatcher.cxx8
-rwxr-xr-xframework/source/dispatch/windowcommanddispatch.cxx1
-rw-r--r--framework/source/helper/actiontriggerhelper.cxx4
-rw-r--r--framework/source/helper/dockingareadefaultacceptor.cxx13
-rw-r--r--framework/source/helper/mischelper.cxx90
-rw-r--r--framework/source/helper/ocomponentaccess.cxx15
-rw-r--r--framework/source/helper/ocomponentenumeration.cxx17
-rw-r--r--framework/source/helper/oframes.cxx19
-rw-r--r--framework/source/helper/persistentwindowstate.cxx5
-rw-r--r--framework/source/helper/popupmenucontrollerbase.cxx79
-rw-r--r--framework/source/helper/titlebarupdate.cxx3
-rw-r--r--framework/source/helper/titlehelper.cxx44
-rw-r--r--framework/source/helper/uiconfigelementwrapperbase.cxx61
-rw-r--r--framework/source/helper/uielementwrapperbase.cxx1
-rw-r--r--framework/source/inc/accelerators/acceleratorconfiguration.hxx2
-rw-r--r--framework/source/inc/dispatch/uieventloghelper.hxx3
-rw-r--r--framework/source/inc/pattern/frame.hxx1
-rw-r--r--framework/source/jobs/helponstartup.cxx13
-rw-r--r--framework/source/jobs/job.cxx3
-rw-r--r--framework/source/jobs/jobdata.cxx9
-rw-r--r--framework/source/jobs/jobresult.cxx2
-rw-r--r--framework/source/jobs/shelljob.cxx11
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx582
-rw-r--r--framework/source/loadenv/loadenv.cxx4
-rw-r--r--framework/source/recording/dispatchrecorder.cxx2
-rw-r--r--framework/source/register/registerservices.cxx134
-rw-r--r--framework/source/register/registertemp.cxx71
-rw-r--r--framework/source/services/autorecovery.cxx8
-rw-r--r--framework/source/services/backingwindow.cxx13
-rw-r--r--framework/source/services/desktop.cxx1
-rw-r--r--framework/source/services/dispatchhelper.cxx14
-rw-r--r--framework/source/services/frame.cxx10
-rw-r--r--framework/source/services/license.cxx7
-rw-r--r--framework/source/services/mediatypedetectionhelper.cxx18
-rw-r--r--framework/source/services/modulemanager.cxx7
-rw-r--r--framework/source/services/pathsettings.cxx10
-rw-r--r--framework/source/services/substitutepathvars.cxx53
-rw-r--r--framework/source/services/uriabbreviation.cxx13
-rw-r--r--framework/source/services/urltransformer.cxx178
-rw-r--r--framework/source/tabwin/tabwindow.cxx2
-rw-r--r--framework/source/tabwin/tabwinfactory.cxx13
-rw-r--r--framework/source/threadhelp/transactionmanager.cxx2
-rw-r--r--framework/source/uiconfiguration/graphicnameaccess.cxx2
-rw-r--r--framework/source/uiconfiguration/imagemanager.cxx926
-rwxr-xr-xframework/source/uiconfiguration/imagemanagerimpl.cxx1466
-rwxr-xr-xframework/source/uiconfiguration/imagemanagerimpl.hxx225
-rw-r--r--framework/source/uiconfiguration/makefile.mk2
-rw-r--r--framework/source/uiconfiguration/moduleimagemanager.cxx1346
-rw-r--r--framework/source/uiconfiguration/moduleuicfgsupplier.cxx76
-rw-r--r--framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx1428
-rw-r--r--framework/source/uiconfiguration/uicategorydescription.cxx219
-rw-r--r--framework/source/uiconfiguration/uiconfigurationmanager.cxx1157
-rwxr-xr-xframework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx1713
-rwxr-xr-xframework/source/uiconfiguration/uiconfigurationmanagerimpl.hxx221
-rw-r--r--framework/source/uiconfiguration/windowstateconfiguration.cxx19
-rw-r--r--framework/source/uielement/addonstoolbarmanager.cxx30
-rw-r--r--framework/source/uielement/addonstoolbarwrapper.cxx1
-rw-r--r--framework/source/uielement/buttontoolbarcontroller.cxx2
-rw-r--r--framework/source/uielement/comboboxtoolbarcontroller.cxx55
-rw-r--r--framework/source/uielement/complextoolbarcontroller.cxx19
-rw-r--r--framework/source/uielement/constitemcontainer.cxx12
-rw-r--r--framework/source/uielement/controlmenucontroller.cxx146
-rw-r--r--framework/source/uielement/dropdownboxtoolbarcontroller.cxx55
-rw-r--r--framework/source/uielement/edittoolbarcontroller.cxx55
-rw-r--r--framework/source/uielement/fontmenucontroller.cxx111
-rw-r--r--framework/source/uielement/fontsizemenucontroller.cxx107
-rw-r--r--framework/source/uielement/footermenucontroller.cxx250
-rw-r--r--framework/source/uielement/headermenucontroller.cxx124
-rw-r--r--framework/source/uielement/imagebuttontoolbarcontroller.cxx8
-rw-r--r--framework/source/uielement/itemcontainer.cxx37
-rw-r--r--framework/source/uielement/langselectionmenucontroller.cxx210
-rw-r--r--framework/source/uielement/langselectionstatusbarcontroller.cxx20
-rw-r--r--framework/source/uielement/logoimagestatusbarcontroller.cxx4
-rw-r--r--framework/source/uielement/logotextstatusbarcontroller.cxx4
-rw-r--r--framework/source/uielement/macrosmenucontroller.cxx169
-rw-r--r--framework/source/uielement/menubarmanager.cxx698
-rw-r--r--framework/source/uielement/menubarmerger.cxx8
-rw-r--r--framework/source/uielement/menubarwrapper.cxx91
-rw-r--r--framework/source/uielement/newmenucontroller.cxx126
-rw-r--r--framework/source/uielement/objectmenucontroller.cxx89
-rw-r--r--framework/source/uielement/recentfilesmenucontroller.cxx83
-rw-r--r--framework/source/uielement/rootitemcontainer.cxx9
-rw-r--r--framework/source/uielement/spinfieldtoolbarcontroller.cxx63
-rw-r--r--framework/source/uielement/statusbarmanager.cxx175
-rw-r--r--framework/source/uielement/statusbarwrapper.cxx50
-rw-r--r--framework/source/uielement/statusindicatorinterfacewrapper.cxx16
-rw-r--r--framework/source/uielement/togglebuttontoolbarcontroller.cxx58
-rw-r--r--framework/source/uielement/toolbar.cxx1
-rw-r--r--framework/source/uielement/toolbarmanager.cxx262
-rw-r--r--framework/source/uielement/toolbarsmenucontroller.cxx74
-rw-r--r--framework/source/uielement/toolbarwrapper.cxx74
-rw-r--r--framework/source/uielement/uicommanddescription.cxx236
-rw-r--r--framework/source/uifactory/addonstoolboxfactory.cxx17
-rwxr-xr-xframework/source/uifactory/factoryconfiguration.cxx344
-rw-r--r--framework/source/uifactory/makefile.mk1
-rw-r--r--framework/source/uifactory/menubarfactory.cxx115
-rw-r--r--framework/source/uifactory/popupmenucontrollerfactory.cxx447
-rw-r--r--framework/source/uifactory/statusbarcontrollerfactory.cxx536
-rw-r--r--framework/source/uifactory/statusbarfactory.cxx112
-rw-r--r--framework/source/uifactory/toolbarcontrollerfactory.cxx360
-rw-r--r--framework/source/uifactory/toolboxfactory.cxx116
-rw-r--r--framework/source/uifactory/uielementfactorymanager.cxx230
-rw-r--r--framework/source/uifactory/windowcontentfactorymanager.cxx292
-rw-r--r--framework/source/xml/eventsconfiguration.cxx9
-rw-r--r--framework/source/xml/eventsdocumenthandler.cxx13
-rw-r--r--framework/source/xml/imagesconfiguration.cxx9
-rw-r--r--framework/source/xml/imagesdocumenthandler.cxx13
-rw-r--r--framework/source/xml/menuconfiguration.cxx7
-rw-r--r--framework/source/xml/menudocumenthandler.cxx27
-rw-r--r--framework/source/xml/saxnamespacefilter.cxx16
-rw-r--r--framework/source/xml/statusbarconfiguration.cxx5
-rw-r--r--framework/source/xml/statusbardocumenthandler.cxx23
-rw-r--r--framework/source/xml/toolboxconfiguration.cxx5
-rw-r--r--framework/source/xml/toolboxdocumenthandler.cxx26
-rw-r--r--framework/util/makefile.mk66
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx153
-rw-r--r--sfx2/source/doc/objxtor.cxx55
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx48
-rw-r--r--svx/inc/svx/SmartTagMgr.hxx4
-rwxr-xr-x[-rw-r--r--]svx/inc/svx/dbcharsethelper.hxx (renamed from svx/source/inc/dbcharsethelper.hxx)6
-rwxr-xr-x[-rw-r--r--]svx/inc/svx/dbtoolsclient.hxx (renamed from svx/source/inc/dbtoolsclient.hxx)32
-rw-r--r--svx/inc/svx/svdetc.hxx10
-rw-r--r--svx/inc/svx/tstpitem.hxx12
-rw-r--r--svx/prj/d.lst2
-rw-r--r--svx/source/dialog/txencbox.cxx2
-rw-r--r--svx/source/fmcomp/gridctrl.cxx2
-rw-r--r--svx/source/form/dbcharsethelper.cxx2
-rw-r--r--svx/source/form/dbtoolsclient.cxx2
-rw-r--r--svx/source/form/fmdocumentclassification.cxx2
-rw-r--r--svx/source/form/fmpgeimp.cxx2
-rw-r--r--svx/source/form/fmtools.cxx2
-rw-r--r--svx/source/form/fmundo.cxx2
-rw-r--r--svx/source/form/formcontrolfactory.cxx2
-rw-r--r--svx/source/form/tabwin.cxx2
-rw-r--r--svx/source/inc/fmshimp.hxx2
-rw-r--r--svx/source/inc/sqlparserclient.hxx2
-rw-r--r--svx/source/inc/tabwin.hxx2
-rw-r--r--svx/source/inc/typeconversionclient.hxx2
-rw-r--r--svx/source/items/numitem.cxx22
-rw-r--r--svx/source/items/paraitem.cxx13
-rw-r--r--svx/source/smarttags/SmartTagMgr.cxx18
-rw-r--r--svx/source/svdraw/svdetc.cxx28
257 files changed, 7221 insertions, 14639 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index f893ed07c8..75533bcd0f 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1730,9 +1730,12 @@ sal_Bool Desktop::InitializeQuickstartMode( Reference< XMultiServiceFactory >& r
// Try to instanciate quickstart service. This service is not mandatory, so
// do nothing if service is not available.
- Reference < XComponent > xQuickstart( rSMgr->createInstanceWithArguments(
+ if ( bQuickstart )
+ {
+ Reference < XComponent > xQuickstart( rSMgr->createInstanceWithArguments(
DEFINE_CONST_UNICODE( "com.sun.star.office.Quickstart" ), aSeq ),
UNO_QUERY );
+ }
return sal_True;
}
catch( ::com::sun::star::uno::Exception& )
diff --git a/desktop/source/app/checkinstall.cxx b/desktop/source/app/checkinstall.cxx
index 9826754b6c..acdd15a0c8 100644
--- a/desktop/source/app/checkinstall.cxx
+++ b/desktop/source/app/checkinstall.cxx
@@ -51,63 +51,69 @@ namespace desktop
sal_Bool CheckInstallation( OUString& rTitle )
{
- Reference< XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory();
- Reference< XExactName > xExactName( xSMgr->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.comp.desktop.Evaluation" ))),
- UNO_QUERY );
- if ( xExactName.is() )
+ try
{
- try
+ Reference< XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory();
+ Reference< XExactName > xExactName( xSMgr->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.desktop.Evaluation" ))),
+ UNO_QUERY );
+ if ( xExactName.is() )
{
- rTitle = xExactName->getExactName( rTitle );
- Reference< XMaterialHolder > xMaterialHolder( xExactName, UNO_QUERY );
- if ( xMaterialHolder.is() )
+ try
{
- com::sun::star::util::Date aExpirationDate;
- Any a = xMaterialHolder->getMaterial();
- if ( a >>= aExpirationDate )
+ rTitle = xExactName->getExactName( rTitle );
+ Reference< XMaterialHolder > xMaterialHolder( xExactName, UNO_QUERY );
+ if ( xMaterialHolder.is() )
{
- Date aToday;
- Date aTimeBombDate( aExpirationDate.Day, aExpirationDate.Month, aExpirationDate.Year );
- if ( aToday > aTimeBombDate )
+ com::sun::star::util::Date aExpirationDate;
+ Any a = xMaterialHolder->getMaterial();
+ if ( a >>= aExpirationDate )
{
- InfoBox aInfoBox( NULL, String::CreateFromAscii( "This version has expired" ) );
- aInfoBox.Execute();
- return sal_False;
+ Date aToday;
+ Date aTimeBombDate( aExpirationDate.Day, aExpirationDate.Month, aExpirationDate.Year );
+ if ( aToday > aTimeBombDate )
+ {
+ InfoBox aInfoBox( NULL, String::CreateFromAscii( "This version has expired" ) );
+ aInfoBox.Execute();
+ return sal_False;
+ }
}
+
+ return sal_True;
+ }
+ else
+ {
+ InfoBox aInfoBox( NULL, rTitle );
+ aInfoBox.Execute();
+ return sal_False;
}
-
- return sal_True;
}
- else
+ catch ( RuntimeException& )
{
- InfoBox aInfoBox( NULL, rTitle );
- aInfoBox.Execute();
+ // Evaluation version expired!
return sal_False;
}
}
- catch ( RuntimeException& )
- {
- // Evaluation version expired!
- return sal_False;
- }
- }
- else
- {
- Reference< com::sun::star::container::XContentEnumerationAccess > rContent( xSMgr , UNO_QUERY );
- if( rContent.is() )
+ else
{
- OUString sEvalService = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.Evaluation" ) );
- Reference < com::sun::star::container::XEnumeration > rEnum = rContent->createContentEnumeration( sEvalService );
- if ( rEnum.is() )
+ Reference< com::sun::star::container::XContentEnumerationAccess > rContent( xSMgr , UNO_QUERY );
+ if( rContent.is() )
{
- InfoBox aInfoBox( NULL, rTitle );
- aInfoBox.Execute();
- return sal_False;
+ OUString sEvalService = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.Evaluation" ) );
+ Reference < com::sun::star::container::XEnumeration > rEnum = rContent->createContentEnumeration( sEvalService );
+ if ( rEnum.is() )
+ {
+ InfoBox aInfoBox( NULL, rTitle );
+ aInfoBox.Execute();
+ return sal_False;
+ }
}
}
}
+ catch(Exception)
+ {
+ }
return sal_True;
}
diff --git a/framework/collector/cmduicollector.cxx b/framework/collector/cmduicollector.cxx
index 9e30602487..94cbf563c6 100644
--- a/framework/collector/cmduicollector.cxx
+++ b/framework/collector/cmduicollector.cxx
@@ -865,8 +865,9 @@ bool impl_isDuplicateKey(const KeyCommandInfoList& rList,
const KeyCommandInfo& aInfo)
{
KeyCommandInfoList::const_iterator pInfo;
+ KeyCommandInfoList::const_iterator aEnd = rList.end();
for ( pInfo = rList.begin();
- pInfo != rList.end() ;
+ pInfo != aEnd ;
++pInfo )
{
if (
@@ -886,6 +887,7 @@ bool ReadAccelerators( int nLangIndex, ResMgr* pResMgr, MODULES eModule, const :
KeyCommandInfoList& rAccs = rLocale[nLangIndex];
USHORT c = pAcc->GetItemCount();
+ rAccs.reserve(rAccs.size()+c);
USHORT i = 0;
for (i=0; i<c; ++i)
{
@@ -1067,11 +1069,12 @@ SfxSlotInfo::SfxSlotInfo( const ResId &rResId ) :
bool ReadSlotInfos( int nLangIndex, ResMgr* pResMgr, MODULES eModule, const OUString& aProjectName )
{
- CommandIDToLabelsMap::iterator pIter = moduleMapFiles[MODULE_GLOBAL].begin();;
+ CommandIDToLabelsMap::iterator pIter = moduleMapFiles[MODULE_GLOBAL].begin();
+ CommandIDToLabelsMap::iterator pEnd = moduleMapFiles[MODULE_GLOBAL].end();
if ( eModule != MODULE_GLOBAL )
{
- while ( pIter != moduleMapFiles[MODULE_GLOBAL].end() )
+ while ( pIter != pEnd )
{
int nId = pIter->first;
CommandLabels& rCmdLabels = pIter->second;
@@ -1091,7 +1094,8 @@ bool ReadSlotInfos( int nLangIndex, ResMgr* pResMgr, MODULES eModule, const OUSt
}
pIter = moduleMapFiles[eModule].begin();
- while ( pIter != moduleMapFiles[eModule].end() )
+ pEnd = moduleMapFiles[eModule].end();
+ while ( pIter != pEnd )
{
int nId = pIter->first;
CommandLabels& rCmdLabels = pIter->second;
@@ -1261,13 +1265,15 @@ void FindAndMarkModulePopupMenuCmds()
for ( int i = 0; i < int( MODULE_COUNT ); i++ )
{
CommandToLabelsMap::iterator pCmdIter = modulePopupMenusCmd[i].begin();
- while ( pCmdIter != modulePopupMenusCmd[i].end() )
+ CommandToLabelsMap::iterator pCmdEnd = modulePopupMenusCmd[i].end();
+ while ( pCmdIter != pCmdEnd )
{
CommandLabels& rCmdLabel = pCmdIter->second;
if ( rCmdLabel.bPopupMenu )
{
CommandIDToLabelsMap::iterator pIDIter = moduleMapFiles[i].begin();
- while ( pIDIter != moduleMapFiles[i].end() )
+ CommandIDToLabelsMap::iterator pIDEnd = moduleMapFiles[i].end();
+ while ( pIDIter != pIDEnd )
{
CommandLabels& rIDLabel = pIDIter->second;
if ( rIDLabel.aCommand.equals( rCmdLabel.aCommand ))
@@ -1311,7 +1317,8 @@ bool FindAndMoveGlobalPopupMenus()
for ( int i = 1; i < int( MODULE_COUNT ); i++ )
{
CommandToLabelsMap::iterator pCmdIter = modulePopupMenusCmd[i].begin();
- while ( pCmdIter != modulePopupMenusCmd[i].end() )
+ CommandToLabelsMap::iterator pCmdEnd = modulePopupMenusCmd[i].end();
+ while ( pCmdIter != pCmdEnd )
{
CommandLabels& rCmdLabel = pCmdIter->second;
if ( rCmdLabel.bPopupMenu )
@@ -1409,8 +1416,8 @@ bool WriteXMLFiles( const OUString& aOutputDirURL)
aXMLFile.write( ComponentDataStartEnd, strlen( ComponentDataStartEnd ), nWritten );
aXMLFile.write( GroupText, strlen( GroupText ), nWritten );
- if (( moduleMapFiles[i].size() > 0 ) ||
- ( modulePopupMenusCmd[i].size() > 0 ) )
+ if (( !moduleMapFiles[i].empty() ) ||
+ ( !modulePopupMenusCmd[i].empty() ) )
{
for ( int nSets = 0; nSets < 2; nSets++ )
{
@@ -1420,7 +1427,8 @@ bool WriteXMLFiles( const OUString& aOutputDirURL)
aXMLFile.write( SetTextPopups, strlen( SetTextPopups ), nWritten );
CommandIDToLabelsMap::iterator pIter = moduleMapFiles[i].begin();
- while ( pIter != moduleMapFiles[i].end() )
+ CommandIDToLabelsMap::iterator pEnd = moduleMapFiles[i].end();
+ while ( pIter != pEnd )
{
CommandLabels& rCmdLabels = pIter->second;
@@ -1813,8 +1821,9 @@ bool impl_isAccListDuplicate(const KeyCommandInfoList& rAccsReference,
const KeyCommandInfoList& rAccs )
{
KeyCommandInfoList::const_iterator pIt1;
+ KeyCommandInfoList::const_iterator aEnd = rAccsReference.end();
for ( pIt1 = rAccsReference.begin();
- pIt1 != rAccsReference.end() ;
+ pIt1 != aEnd ;
++pIt1 )
{
KeyCommandInfoList::const_iterator pIt2 = ::std::find(rAccs.begin(), rAccs.end(), *pIt1);
@@ -1839,7 +1848,7 @@ bool ReadResourceWriteAcceleratorXMLLang( const ::rtl::OUString& aOutDirURL,
KeyCommandInfoList& rAccsReference = rLocale[1]; // en-US!
// dont write empty files :-)
- if (rAccs.size()<1)
+ if ( rAccs.empty() )
return true;
::rtl::OUString sLanguage = ::rtl::OUString::createFromAscii(Language_codes[nLanguage].pLanguage);
@@ -1901,8 +1910,9 @@ bool ReadResourceWriteAcceleratorXMLLang( const ::rtl::OUString& aOutDirURL,
::rtl::OUStringBuffer sAccBuf(10000);
KeyCommandInfoList::const_iterator pIt;
+ KeyCommandInfoList::const_iterator aEnd = rAccs.end();
for ( pIt = rAccs.begin();
- pIt != rAccs.end() ;
+ pIt != aEnd ;
++pIt )
{
const KeyCommandInfo& aInfo = *pIt;
@@ -2620,7 +2630,7 @@ bool GetCommandOptions( const ::std::vector< OUString >& rArgs, const OUString&
}
}
- return( rParams.size() > 0 );
+ return( !rParams.empty() );
}
void ShowUsage()
@@ -2694,7 +2704,7 @@ void Main()
if ( aVersion.getLength() > 0 &&
aPlatformName.getLength() > 0 &&
aUseRes.getLength() > 0 &&
- aInDirVector.size() > 0 )
+ !aInDirVector.empty() )
{
Convert( bUseProduct, aUseRes, aVersion, aOutputDirName, aPlatformName, aInDirVector, aErrOutputFileName );
}
diff --git a/framework/collector/uicmdstohtml.cxx b/framework/collector/uicmdstohtml.cxx
index 0194114556..8b685b3e3d 100644
--- a/framework/collector/uicmdstohtml.cxx
+++ b/framework/collector/uicmdstohtml.cxx
@@ -697,7 +697,7 @@ bool WriteJumpTable( osl::File& rFile )
sal_uInt32 i = 0;
while ( ModuleName[i] != 0 )
{
- if ( moduleMapFiles[i].size() > 0 )
+ if ( !moduleMapFiles[i].empty() )
{
OString aTableNameStr( ModuleName[i] );
OStringBuffer aJumpMark( aTableNameStr );
@@ -850,7 +850,7 @@ bool WriteHTMLFile( const OUString& aOutputDirURL)
while ( ModuleToXML_Mapping[i] != 0 )
{
SortCommandTable( MODULES( i ));
- if ( moduleCmdVector[i].size() > 0 )
+ if ( !moduleCmdVector[i].empty() )
{
WriteHTMLTable( aHTMLFile, OUString::createFromAscii( ModuleName[i] ));
diff --git a/framework/inc/classes/addonmenu.hxx b/framework/inc/classes/addonmenu.hxx
index 679d8d283b..37e5e05933 100644
--- a/framework/inc/classes/addonmenu.hxx
+++ b/framework/inc/classes/addonmenu.hxx
@@ -56,12 +56,12 @@ class AddonMenu : public PopupMenu
AddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
~AddonMenu();
- private:
+ protected:
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
};
class AddonMenuManager;
-class AddonPopupMenu : public PopupMenu
+class AddonPopupMenu : public AddonMenu
{
public:
~AddonPopupMenu();
@@ -78,8 +78,7 @@ class AddonPopupMenu : public PopupMenu
private:
AddonPopupMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame );
- rtl::OUString m_aCommandURL;
- ::com::sun::star::uno::Reference< com::sun::star::frame::XFrame > m_xFrame;
+ rtl::OUString m_aCommandURL;
friend class AddonMenuManager;
};
diff --git a/framework/inc/classes/bmkmenu.hxx b/framework/inc/classes/bmkmenu.hxx
index 5b17b1f014..4155140114 100644
--- a/framework/inc/classes/bmkmenu.hxx
+++ b/framework/inc/classes/bmkmenu.hxx
@@ -30,6 +30,7 @@
#ifndef __FRAMEWORK_CLASSES_BMKMENU_HXX
#define __FRAMEWORK_CLASSES_BMKMENU_HXX
+#include "classes/addonmenu.hxx"
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
@@ -52,7 +53,7 @@ namespace framework
{
class BmkMenu_Impl;
-class BmkMenu : public PopupMenu
+class BmkMenu : public AddonMenu
{
public:
enum BmkMenuType
@@ -76,7 +77,6 @@ class BmkMenu : public PopupMenu
BmkMenuType, BmkMenu* pRoot );
BmkMenu_Impl* _pImp;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& m_xFrame;
};
} // namespace framework
diff --git a/framework/inc/classes/eventsconfiguration.hxx b/framework/inc/classes/eventsconfiguration.hxx
deleted file mode 100644
index 402330a14d..0000000000
--- a/framework/inc/classes/eventsconfiguration.hxx
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef __FRAMEWORK_CLASSES_EVENTSCONFIGURATION_HXX_
-#define __FRAMEWORK_CLASSES_EVENTSCONFIGURATION_HXX_
-
-#include <svtools/svarray.hxx>
-#include <tools/string.hxx>
-#include <tools/stream.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-
-// #110897#
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-namespace framework
-{
-
-struct EventsConfig
-{
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aEventNames;
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aEventsProperties;
-};
-
-class EventsConfiguration
-{
- public:
-
- // #110897#
- static sal_Bool LoadEventsConfig(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- SvStream& rInStream, EventsConfig& aItems );
-
- // #110897#
- static sal_Bool StoreEventsConfig(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- SvStream& rOutStream, const EventsConfig& aItems );
-};
-
-} // namespace framework
-
-#endif // __FRAMEWORK_CLASSES_EVENTSCONFIGURATION_HXX_
diff --git a/framework/inc/classes/eventsdocumenthandler.hxx b/framework/inc/classes/eventsdocumenthandler.hxx
deleted file mode 100644
index 758c34043d..0000000000
--- a/framework/inc/classes/eventsdocumenthandler.hxx
+++ /dev/null
@@ -1,198 +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: eventsdocumenthandler.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 __FRAMEWORK_CLASSES_EVENTSDOCUMENTHANDLER_HXX_
-#define __FRAMEWORK_CLASSES_EVENTSDOCUMENTHANDLER_HXX_
-
-#ifndef __FRAMEWORK_CLASSES_TOOLBOXCONFIGURATION_HXX_
-#include <classes/eventsconfiguration.hxx>
-#endif
-
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
-
-#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#endif
-
-//_________________________________________________________________________________________________________________
-// other includes
-//_________________________________________________________________________________________________________________
-#include <threadhelp/threadhelpbase.hxx>
-#include <rtl/ustring.hxx>
-#include <cppuhelper/weak.hxx>
-
-#ifndef __SGI_STL_HASH_MAP
-#include <hash_map>
-#endif
-#include <stdtypes.h>
-
-//_________________________________________________________________________________________________________________
-// namespace
-//_________________________________________________________________________________________________________________
-
-namespace framework{
-
-//*****************************************************************************************************************
-// Hash code function for using in all hash maps of follow implementation.
-
-class OReadEventsDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler,
- private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
- public ::cppu::OWeakObject
-{
- public:
- enum Events_XML_Entry
- {
- EV_ELEMENT_EVENTS,
- EV_ELEMENT_EVENT,
- EV_ATTRIBUTE_TYPE,
- EV_ATTRIBUTE_NAME,
- XL_ATTRIBUTE_HREF,
- XL_ATTRIBUTE_TYPE,
- EV_ATTRIBUTE_MACRONAME,
- EV_ATTRIBUTE_LIBRARY,
- EV_XML_ENTRY_COUNT
- };
-
- enum Event_XML_Namespace
- {
- EV_NS_EVENT,
- EV_NS_XLINK,
- EV_XML_NAMESPACES_COUNT
- };
-
- OReadEventsDocumentHandler( EventsConfig& aItems );
- virtual ~OReadEventsDocumentHandler();
-
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
-
- // XDocumentHandler
- virtual void SAL_CALL startDocument(void)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endDocument(void)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL startElement(
- const rtl::OUString& aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endElement(const rtl::OUString& aName)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL characters(const rtl::OUString& aChars)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget,
- const rtl::OUString& aData)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setDocumentLocator(
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- private:
- ::rtl::OUString getErrorLineString();
-
- class EventsHashMap : public ::std::hash_map< ::rtl::OUString ,
- Events_XML_Entry ,
- OUStringHashCode ,
- ::std::equal_to< ::rtl::OUString > >
- {
- public:
- inline void free()
- {
- EventsHashMap().swap( *this );
- }
- };
-
- sal_Bool m_bEventsStartFound;
- sal_Bool m_bEventsEndFound;
- sal_Bool m_bEventStartFound;
- EventsHashMap m_aEventsMap;
- EventsConfig& m_aEventItems;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator;
-};
-
-class OWriteEventsDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses.
-{
- public:
- OWriteEventsDocumentHandler(
- const EventsConfig& aItems,
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > );
- virtual ~OWriteEventsDocumentHandler();
-
- void WriteEventsDocument() throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- protected:
- virtual void WriteEvent(
- const ::rtl::OUString& aEventName,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aPropertyValue ) throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- const EventsConfig& m_aItems;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList;
- ::rtl::OUString m_aXMLEventNS;
- ::rtl::OUString m_aXMLXlinkNS;
- ::rtl::OUString m_aAttributeType;
- ::rtl::OUString m_aAttributeURL;
- ::rtl::OUString m_aAttributeLanguage;
- ::rtl::OUString m_aAttributeLinkType;
- ::rtl::OUString m_aAttributeMacroName;
- ::rtl::OUString m_aAttributeLibrary;
- ::rtl::OUString m_aAttributeName;
-};
-
-} // namespace framework
-
-#endif
diff --git a/framework/inc/classes/fwlresid.hxx b/framework/inc/classes/fwlresid.hxx
new file mode 100755
index 0000000000..f81e093ed8
--- /dev/null
+++ b/framework/inc/classes/fwlresid.hxx
@@ -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: FwlResId.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 __FRAMEWORK_CLASSES_FwlResId_HXX_
+#define __FRAMEWORK_CLASSES_FwlResId_HXX_
+
+#include <tools/resid.hxx>
+
+namespace framework
+{
+
+class FwlResId : public ResId
+{
+ public:
+ FwlResId( USHORT nId );
+
+ static ResMgr* GetResManager();
+};
+
+}
+
+#endif // __FRAMEWORK_CLASSES_FwlResId
diff --git a/framework/inc/classes/imagesconfiguration.hxx b/framework/inc/classes/imagesconfiguration.hxx
deleted file mode 100644
index e902b148a6..0000000000
--- a/framework/inc/classes/imagesconfiguration.hxx
+++ /dev/null
@@ -1,115 +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: imagesconfiguration.hxx,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 __FRAMEWORK_CLASSES_IMAGESCONFIGURATION_HXX_
-#define __FRAMEWORK_CLASSES_IMAGESCONFIGURATION_HXX_
-
-#include <svtools/svarray.hxx>
-#include <tools/string.hxx>
-#include <tools/stream.hxx>
-#include <tools/color.hxx>
-
-// #110897#
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-namespace framework
-{
-
-enum ImageMaskMode
-{
- ImageMaskMode_Color,
- ImageMaskMode_Bitmap
-};
-
-struct ImageItemDescriptor
-{
- ImageItemDescriptor() : nIndex( -1 ) {}
-
- String aCommandURL; // URL command to dispatch
- long nIndex; // index of the bitmap inside the bitmaplist
-};
-
-struct ExternalImageItemDescriptor
-{
- String aCommandURL; // URL command to dispatch
- String aURL; // a URL to an external bitmap
-};
-
-typedef ImageItemDescriptor* ImageItemDescriptorPtr;
-SV_DECL_PTRARR_DEL( ImageItemListDescriptor, ImageItemDescriptorPtr, 10, 2)
-
-typedef ExternalImageItemDescriptor* ExternalImageItemDescriptorPtr;
-SV_DECL_PTRARR_DEL( ExternalImageItemListDescriptor, ExternalImageItemDescriptorPtr, 10, 2)
-
-struct ImageListItemDescriptor
-{
- ImageListItemDescriptor() : nMaskMode( ImageMaskMode_Color )
- , pImageItemList( 0 ) {}
- ~ImageListItemDescriptor() { delete pImageItemList; }
-
- String aURL; // an URL to a bitmap with several images inside
- Color aMaskColor; // a color used as transparent
- String aMaskURL; // an URL to an optional bitmap used as a mask
- ImageMaskMode nMaskMode; // an enum to describe the current mask mode
- ImageItemListDescriptor* pImageItemList; // an array of ImageItemDescriptors that describes every image
- String aHighContrastURL; // an URL to an optional high contrast bitmap with serveral images inside
- String aHighContrastMaskURL; // an URL to an optional high contrast bitmap as a mask
-};
-
-typedef ImageListItemDescriptor* ImageListItemDescriptorPtr;
-SV_DECL_PTRARR_DEL( ImageListDescriptor, ImageListItemDescriptorPtr, 10, 2)
-
-struct ImageListsDescriptor
-{
- ImageListsDescriptor() : pImageList( 0 ),
- pExternalImageList( 0 ) {}
- ~ImageListsDescriptor() { delete pImageList; delete pExternalImageList; }
-
- ImageListDescriptor* pImageList;
- ExternalImageItemListDescriptor* pExternalImageList;
-};
-
-class ImagesConfiguration
-{
- public:
- // #110897#
- static sal_Bool LoadImages(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- SvStream& rInStream, ImageListsDescriptor& aItems );
-
- // #110897#
- static sal_Bool StoreImages(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- SvStream& rOutStream, const ImageListsDescriptor& aItems );
-};
-
-} // namespace framework
-
-#endif // __FRAMEWORK_CLASSES_IMAGES
diff --git a/framework/inc/classes/imagesdocumenthandler.hxx b/framework/inc/classes/imagesdocumenthandler.hxx
deleted file mode 100644
index c98cf3c162..0000000000
--- a/framework/inc/classes/imagesdocumenthandler.hxx
+++ /dev/null
@@ -1,215 +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: imagesdocumenthandler.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 __FRAMEWORK_CLASSES_IMAGEDOCUMENTHANDLER_HXX_
-#define __FRAMEWORK_CLASSES_IMAGEDOCUMENTHANDLER_HXX_
-
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
-
-#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#endif
-
-//_________________________________________________________________________________________________________________
-// other includes
-//_________________________________________________________________________________________________________________
-#include <classes/imagesconfiguration.hxx>
-#include <threadhelp/threadhelpbase.hxx>
-#include <rtl/ustring.hxx>
-#include <cppuhelper/weak.hxx>
-
-#ifndef __SGI_STL_HASH_MAP
-#include <hash_map>
-#endif
-#include <stdtypes.h>
-
-//_________________________________________________________________________________________________________________
-// namespace
-//_________________________________________________________________________________________________________________
-
-namespace framework{
-
-//*****************************************************************************************************************
-// Hash code function for using in all hash maps of follow implementation.
-
-class OReadImagesDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler,
- private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
- public ::cppu::OWeakObject
-{
- public:
- enum Image_XML_Entry
- {
- IMG_ELEMENT_IMAGECONTAINER,
- IMG_ELEMENT_IMAGES,
- IMG_ELEMENT_ENTRY,
- IMG_ELEMENT_EXTERNALIMAGES,
- IMG_ELEMENT_EXTERNALENTRY,
- IMG_ATTRIBUTE_HREF,
- IMG_ATTRIBUTE_MASKCOLOR,
- IMG_ATTRIBUTE_COMMAND,
- IMG_ATTRIBUTE_BITMAPINDEX,
- IMG_ATTRIBUTE_MASKURL,
- IMG_ATTRIBUTE_MASKMODE,
- IMG_ATTRIBUTE_HIGHCONTRASTURL,
- IMG_ATTRIBUTE_HIGHCONTRASTMASKURL,
- IMG_XML_ENTRY_COUNT
- };
-
- enum Image_XML_Namespace
- {
- IMG_NS_IMAGE,
- IMG_NS_XLINK,
- TBL_XML_NAMESPACES_COUNT
- };
-
- OReadImagesDocumentHandler( ImageListsDescriptor& aItems );
- virtual ~OReadImagesDocumentHandler();
-
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
-
- // XDocumentHandler
- virtual void SAL_CALL startDocument(void)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endDocument(void)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL startElement(
- const rtl::OUString& aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endElement(const rtl::OUString& aName)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL characters(const rtl::OUString& aChars)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget,
- const rtl::OUString& aData)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setDocumentLocator(
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- private:
- ::rtl::OUString getErrorLineString();
-
- class ImageHashMap : public ::std::hash_map< ::rtl::OUString ,
- Image_XML_Entry ,
- OUStringHashCode ,
- ::std::equal_to< ::rtl::OUString > >
- {
- public:
- inline void free()
- {
- ImageHashMap().swap( *this );
- }
- };
-
- sal_Bool m_bImageContainerStartFound;
- sal_Bool m_bImageContainerEndFound;
- sal_Bool m_bImagesStartFound;
- sal_Bool m_bImagesEndFound;
- sal_Bool m_bImageStartFound;
- sal_Bool m_bExternalImagesStartFound;
- sal_Bool m_bExternalImagesEndFound;
- sal_Bool m_bExternalImageStartFound;
- sal_Int32 m_nHashMaskModeBitmap;
- sal_Int32 m_nHashMaskModeColor;
- ImageHashMap m_aImageMap;
- ImageListsDescriptor& m_aImageList;
- ImageListItemDescriptor* m_pImages;
- ExternalImageItemListDescriptor* m_pExternalImages;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator;
-};
-
-class OWriteImagesDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses.
-{
- public:
- OWriteImagesDocumentHandler(
- const ImageListsDescriptor& aItems,
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > );
- virtual ~OWriteImagesDocumentHandler();
-
- void WriteImagesDocument() throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- protected:
- virtual void WriteImageList( const ImageListItemDescriptor* ) throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void WriteExternalImageList( const ExternalImageItemListDescriptor* ) throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void WriteImage( const ImageItemDescriptor* ) throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void WriteExternalImage( const ExternalImageItemDescriptor* ) throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- const ImageListsDescriptor& m_aImageListsItems;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList;
- ::rtl::OUString m_aXMLXlinkNS;
- ::rtl::OUString m_aXMLImageNS;
- ::rtl::OUString m_aAttributeType;
- ::rtl::OUString m_aAttributeXlinkType;
- ::rtl::OUString m_aAttributeValueSimple;
-};
-
-} // namespace framework
-
-#endif
diff --git a/framework/inc/classes/imagewrapper.hxx b/framework/inc/classes/imagewrapper.hxx
index 428474fd14..2ac4f42b8f 100644
--- a/framework/inc/classes/imagewrapper.hxx
+++ b/framework/inc/classes/imagewrapper.hxx
@@ -35,17 +35,15 @@
#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <vcl/image.hxx>
namespace framework
{
class ImageWrapper : public ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::com::sun::star::awt::XBitmap ,
- public ::com::sun::star::lang::XUnoTunnel ,
- public ::com::sun::star::lang::XTypeProvider ,
- public ::cppu::OWeakObject
+ public ::cppu::WeakImplHelper2< ::com::sun::star::awt::XBitmap,
+ ::com::sun::star::lang::XUnoTunnel >
{
public:
ImageWrapper( const Image& aImage );
@@ -58,12 +56,6 @@ class ImageWrapper : public ThreadHelpBase , // Struct for right initaliza
static ::com::sun::star::uno::Sequence< sal_Int8 > GetUnoTunnelId();
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw ();
- virtual void SAL_CALL release() throw ();
-
// XBitmap
virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getDIB() throw (::com::sun::star::uno::RuntimeException);
@@ -72,10 +64,6 @@ class ImageWrapper : public ThreadHelpBase , // Struct for right initaliza
// XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException);
- // XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
-
private:
Image m_aImage;
};
diff --git a/framework/inc/classes/menuconfiguration.hxx b/framework/inc/classes/menuconfiguration.hxx
deleted file mode 100644
index a8f7f3976f..0000000000
--- a/framework/inc/classes/menuconfiguration.hxx
+++ /dev/null
@@ -1,126 +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: menuconfiguration.hxx,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 __FRAMEWORK_CLASSES_MENUCONFIGURATION_HXX_
-#define __FRAMEWORK_CLASSES_MENUCONFIGURATION_HXX_
-
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/WrappedTargetException.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XDispatchProvider.hpp>
-
-//_________________________________________________________________________________________________________________
-// includes of other projects
-//_________________________________________________________________________________________________________________
-
-#include <vcl/menu.hxx>
-#include <vcl/toolbox.hxx>
-#include <cppuhelper/weak.hxx>
-
-#define BOOKMARK_NEWMENU ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_bookmark_new" ))
-#define BOOKMARK_WIZARDMENU ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_bookmark_wizard" ))
-#define ADDONS_POPUPMENU ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_addons_popup" ))
-
-// Prepare for inclusion by framework and sfx
-// Please consider that there is a corresponding define also in sfxsids.hrc!! (SID_SFX_START)/(SID_ADDONS)
-#define FWK_SID_SFX_START 5000
-#define FWK_SID_ADDONS (FWK_SID_SFX_START+1678)
-#define FWK_SID_ADDONHELP (FWK_SID_SFX_START+1684)
-
-const USHORT START_ITEMID_PICKLIST = 4500;
-const USHORT END_ITEMID_PICKLIST = 4599;
-const USHORT MAX_ITEMCOUNT_PICKLIST = 99; // difference between START_... & END_... for picklist / must be changed too, if these values are changed!
-const USHORT START_ITEMID_WINDOWLIST = 4600;
-const USHORT END_ITEMID_WINDOWLIST = 4699;
-const USHORT ITEMID_ADDONLIST = FWK_SID_ADDONS;
-const USHORT ITEMID_ADDONHELP = FWK_SID_ADDONHELP;
-
-namespace framework
-{
-
-class MenuConfiguration
-{
- public:
- struct Attributes
- {
- Attributes() {}
- Attributes( const ::rtl::OUString& aFrame, const ::rtl::OUString& aImageIdStr ) :
- aTargetFrame( aFrame ), aImageId( aImageIdStr ) {}
-
- ::rtl::OUString aTargetFrame;
- ::rtl::OUString aImageId;
- ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProvider > xDispatchProvider;
- };
-
- MenuConfiguration(
- // #110897#-1 use const when giving a uno reference by reference
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
-
- virtual ~MenuConfiguration();
-
- MenuBar* CreateMenuBarFromConfiguration(
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream )
- throw ( ::com::sun::star::lang::WrappedTargetException );
-
- PopupMenu* CreateBookmarkMenu(
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
- const ::rtl::OUString& aURL )
- throw ( ::com::sun::star::lang::WrappedTargetException );
-
- ToolBox* CreateToolBoxFromConfiguration(
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream )
- throw ( ::com::sun::star::lang::WrappedTargetException );
-
- void StoreMenuBar( MenuBar* pMenuBar,
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream )
- throw ( ::com::sun::star::lang::WrappedTargetException );
-
- void StoreToolBox( ToolBox* pToolBox,
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream )
- throw ( ::com::sun::star::lang::WrappedTargetException );
-
- static BOOL IsPickListItemId( USHORT nId );
- static BOOL IsWindowListItemId( USHORT nId );
-
- private:
- // #110897#-1 do not hold the uno reference by reference
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& m_rxServiceManager;
-};
-
-}
-
-#endif // __FRAMEWORK_CLASSES_MENUCONFIGURATION_HXX_
-
diff --git a/framework/inc/classes/menumanager.hxx b/framework/inc/classes/menumanager.hxx
index a379d70eac..50a7457f0f 100644
--- a/framework/inc/classes/menumanager.hxx
+++ b/framework/inc/classes/menumanager.hxx
@@ -43,6 +43,7 @@
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/FeatureStateEvent.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
//_________________________________________________________________________________________________________________
// other includes
@@ -50,7 +51,7 @@
#include <rtl/ustring.hxx>
#include <vcl/menu.hxx>
#include <vcl/accel.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <threadhelp/threadhelpbase.hxx>
#include <macros/debug.hxx>
@@ -73,9 +74,8 @@ namespace framework
class BmkMenu;
class AddonMenu;
class AddonPopupMenu;
-class MenuManager : public XSTATUSLISTENER ,
- public ThreadHelpBase ,
- public ::cppu::OWeakObject
+class MenuManager : public ThreadHelpBase ,
+ public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XStatusListener >
{
public:
// #110897#
@@ -89,34 +89,12 @@ class MenuManager : public XSTATUSLISTENER ,
MenuManager(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
REFERENCE< XFRAME >& rFrame,
- BmkMenu* pBmkMenu,
- sal_Bool bDelete,
- sal_Bool bDeleteChildren );
-
- MenuManager(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- REFERENCE< XFRAME >& rFrame,
AddonMenu* pAddonMenu,
sal_Bool bDelete,
sal_Bool bDeleteChildren );
- MenuManager(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- REFERENCE< XFRAME >& rFrame,
- AddonPopupMenu* pAddonMenu,
- sal_Bool bDelete,
- sal_Bool bDeleteChildren );
-
virtual ~MenuManager();
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( RUNTIMEEXCEPTION );
-
// XStatusListener
virtual void SAL_CALL statusChanged( const FEATURSTATEEVENT& Event ) throw ( RUNTIMEEXCEPTION );
@@ -132,6 +110,9 @@ class MenuManager : public XSTATUSLISTENER ,
// #110897#
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory();
+ static void UpdateSpecialWindowMenu( Menu* pMenu ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,IMutex& _rMutex);
+ static void FillMenuImages(::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame,Menu* _pMenu,sal_Bool bIsHiContrast,sal_Bool bShowMenuImages);
+
protected:
DECL_LINK( Highlight, Menu * );
DECL_LINK( Activate, Menu * );
@@ -140,6 +121,10 @@ class MenuManager : public XSTATUSLISTENER ,
private:
void UpdateSpecialFileMenu( Menu* pMenu );
void UpdateSpecialWindowMenu( Menu* pMenu );
+ void ClearMenuDispatch(const EVENTOBJECT& Source = EVENTOBJECT(),bool _bRemoveOnly = true);
+ void SetHdl();
+ void AddMenu(PopupMenu* _pPopupMenu,const ::rtl::OUString& _sItemCommand,USHORT _nItemId,sal_Bool _bDelete,sal_Bool _bDeleteChildren);
+ USHORT FillItemCommand(::rtl::OUString& _rItemCommand,Menu* _pMenu,USHORT _nIndex) const;
struct MenuItemHandler
@@ -177,6 +162,7 @@ class MenuManager : public XSTATUSLISTENER ,
// #110897#
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& mxServiceFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
};
} // namespace
diff --git a/framework/inc/classes/statusbarconfiguration.hxx b/framework/inc/classes/statusbarconfiguration.hxx
deleted file mode 100644
index 72555dfcd9..0000000000
--- a/framework/inc/classes/statusbarconfiguration.hxx
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef __FRAMEWORK_CLASSES_STATUSBARCONFIGURATION_HXX_
-#define __FRAMEWORK_CLASSES_STATUSBARCONFIGURATION_HXX_
-
-#include <svtools/svarray.hxx>
-#include <tools/string.hxx>
-#include <tools/stream.hxx>
-#include <vcl/status.hxx>
-
-// #110897#
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-namespace framework
-{
-
-struct StatusBarItemDescriptor
-{
- String aURL; // URL command to dispatch
- long nItemBits; // properties for this statusbar item (WinBits)
- long nWidth; // width of a statusbar item
- long nOffset; // offset
-
- public:
-
- StatusBarItemDescriptor() : nItemBits( SIB_CENTER | SIB_IN )
- ,nWidth( 0 )
- ,nOffset( STATUSBAR_OFFSET ) {}
-};
-
-typedef StatusBarItemDescriptor* StatusBarItemDescriptorPtr;
-SV_DECL_PTRARR_DEL( StatusBarDescriptor, StatusBarItemDescriptorPtr, 10, 2)
-
-class StatusBarConfiguration
-{
- public:
- // #110897#
- static sal_Bool LoadStatusBar(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- SvStream& rInStream, StatusBarDescriptor& aItems );
-
- // #110897#
- static sal_Bool StoreStatusBar(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- SvStream& rOutStream, const StatusBarDescriptor& aItems );
-};
-
-} // namespace framework
-
-#endif // __FRAMEWORK_CLASSES_STATUSBARCONFIGURATION_HXX_
diff --git a/framework/inc/classes/statusbardocumenthandler.hxx b/framework/inc/classes/statusbardocumenthandler.hxx
deleted file mode 100644
index 5dce26dec2..0000000000
--- a/framework/inc/classes/statusbardocumenthandler.hxx
+++ /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: statusbardocumenthandler.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 __FRAMEWORK_CLASSES_STATUSBARDOCUMENTHANDLER_HXX_
-#define __FRAMEWORK_CLASSES_STATUSBARDOCUMENTHANDLER_HXX_
-
-#include <classes/statusbarconfiguration.hxx>
-
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
-
-#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#endif
-
-//_________________________________________________________________________________________________________________
-// other includes
-//_________________________________________________________________________________________________________________
-#include <threadhelp/threadhelpbase.hxx>
-#include <rtl/ustring.hxx>
-#include <cppuhelper/weak.hxx>
-
-#ifndef __SGI_STL_HASH_MAP
-#include <hash_map>
-#endif
-#include <stdtypes.h>
-
-//_________________________________________________________________________________________________________________
-// namespace
-//_________________________________________________________________________________________________________________
-
-namespace framework{
-
-//*****************************************************************************************************************
-// Hash code function for using in all hash maps of follow implementation.
-
-class OReadStatusBarDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler,
- private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
- public ::cppu::OWeakObject
-{
- public:
- enum StatusBar_XML_Entry
- {
- SB_ELEMENT_STATUSBAR,
- SB_ELEMENT_STATUSBARITEM,
- SB_ATTRIBUTE_URL,
- SB_ATTRIBUTE_ALIGN,
- SB_ATTRIBUTE_STYLE,
- SB_ATTRIBUTE_AUTOSIZE,
- SB_ATTRIBUTE_OWNERDRAW,
- SB_ATTRIBUTE_WIDTH,
- SB_ATTRIBUTE_OFFSET,
- SB_XML_ENTRY_COUNT
- };
-
- enum StatusBar_XML_Namespace
- {
- SB_NS_STATUSBAR,
- SB_NS_XLINK,
- SB_XML_NAMESPACES_COUNT
- };
-
- OReadStatusBarDocumentHandler( StatusBarDescriptor& aStatusBarItems );
- virtual ~OReadStatusBarDocumentHandler();
-
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
-
- // XDocumentHandler
- virtual void SAL_CALL startDocument(void)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endDocument(void)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL startElement(
- const rtl::OUString& aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endElement(const rtl::OUString& aName)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL characters(const rtl::OUString& aChars)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget,
- const rtl::OUString& aData)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setDocumentLocator(
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- private:
- ::rtl::OUString getErrorLineString();
-
- class StatusBarHashMap : public ::std::hash_map< ::rtl::OUString ,
- StatusBar_XML_Entry ,
- OUStringHashCode ,
- ::std::equal_to< ::rtl::OUString > >
- {
- public:
- inline void free()
- {
- StatusBarHashMap().swap( *this );
- }
- };
-
- sal_Bool m_bStatusBarStartFound;
- sal_Bool m_bStatusBarEndFound;
- sal_Bool m_bStatusBarItemStartFound;
- StatusBarHashMap m_aStatusBarMap;
- StatusBarDescriptor& m_aStatusBarItems;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator;
-};
-
-class OWriteStatusBarDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses.
-{
- public:
- OWriteStatusBarDocumentHandler(
- const StatusBarDescriptor& aStatusBarItems,
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > );
- virtual ~OWriteStatusBarDocumentHandler();
-
- void WriteStatusBarDocument() throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- protected:
- virtual void WriteStatusBarItem( const StatusBarItemDescriptor* ) throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- const StatusBarDescriptor& m_aStatusBarItems;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList;
- ::rtl::OUString m_aXMLStatusBarNS;
- ::rtl::OUString m_aXMLXlinkNS;
- ::rtl::OUString m_aAttributeType;
- ::rtl::OUString m_aAttributeURL;
-};
-
-} // namespace framework
-
-#endif
diff --git a/framework/inc/classes/toolboxconfiguration.hxx b/framework/inc/classes/toolboxconfiguration.hxx
deleted file mode 100755
index 0c0e1949be..0000000000
--- a/framework/inc/classes/toolboxconfiguration.hxx
+++ /dev/null
@@ -1,96 +0,0 @@
-#ifndef __FRAMEWORK_CLASSES_TOOLBOXCONFIGURATION_HXX_
-#define __FRAMEWORK_CLASSES_TOOLBOXCONFIGURATION_HXX_
-
-#include <svtools/svarray.hxx>
-#ifndef _SV_BITMAP_HXX
-#include <vcl/bitmapex.hxx>
-#endif
-#include <tools/string.hxx>
-#include <tools/stream.hxx>
-#include <vcl/toolbox.hxx>
-#include <vcl/toolbox.hxx>
-
-// #110897#
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-namespace framework
-{
-
-struct ToolBoxItemDescriptor
-{
- BitmapEx* pBmpEx; // Bitmap ptr not used by xml configuration
- String aBitmapName; // bitmap name => use to find correct bmp file
- String aItemText; // label for this toolbox item
- String aURL; // URL command to dispatch
- USHORT nId; // internal id not used by xml configuration
- USHORT nItemBits; // properties for this toolbox item (WinBits)
- USHORT nItemType; // toolbox item type (BUTTON, SPACE, BREAK, SEPARATOR)
- USHORT nVisible; // toolbox item visible?
- USHORT nWidth; // width of a toolbox window (edit field, etc.)
- USHORT nUserDef; // user defined toolbox item (1=yes/0=no)
- String aHelpId; // A help id associated with this toolbox item
-
- public:
-
- ToolBoxItemDescriptor() : pBmpEx( 0 )
- ,nId( 0 )
- ,nItemBits( 0 )
- ,nItemType( (USHORT)TOOLBOXITEM_SPACE )
- ,nVisible( sal_True )
- ,nWidth( 0 )
- ,nUserDef( sal_False ) {}
-};
-
-typedef ToolBoxItemDescriptor* ToolBoxItemDescriptorPtr;
-SV_DECL_PTRARR_DEL( ToolBoxDescriptor, ToolBoxItemDescriptorPtr, 10, 2)
-
-struct ToolBoxLayoutItemDescriptor
-{
- String aName; // Unique name of the toolbox ( Objectbar, Toolbar etc. )
- String aUserName; // Userspecified name for this toolbar
- Point aFloatingPos; // Position in floating mode
- USHORT nFloatingLines; // Number of lines in floating mode
- USHORT nLines; // Number of lines in docking mode
- WindowAlign eAlign; // Aligned position in docking mode
- BOOL bVisible; // Visible or not
- BOOL bFloating; // Floating mode on/off
- ButtonType eType; // text, symbol or text+symbol
-
- ToolBoxLayoutItemDescriptor() : nFloatingLines( 0 )
- ,nLines( 1 )
- ,eAlign( WINDOWALIGN_LEFT )
- ,bVisible( sal_False )
- ,bFloating( sal_False )
- ,eType( BUTTON_SYMBOL ) {}
-};
-
-typedef ToolBoxLayoutItemDescriptor* ToolBoxLayoutItemDescriptorPtr;
-SV_DECL_PTRARR_DEL( ToolBoxLayoutDescriptor, ToolBoxLayoutItemDescriptorPtr, 10, 2)
-
-class ToolBoxConfiguration
-{
- public:
- // #110897#
- static sal_Bool LoadToolBox(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- SvStream& rInStream, ToolBoxDescriptor& aItems );
-
- // #110897#
- static sal_Bool StoreToolBox(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- SvStream& rOutStream, const ToolBoxDescriptor& aItems );
-
- // #110897#
- static sal_Bool LoadToolBoxLayout(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- SvStream& rInStream, ToolBoxLayoutDescriptor& aItems );
-
- // #110897#
- static sal_Bool StoreToolBoxLayout(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- SvStream& rOutStream, ToolBoxLayoutDescriptor& aItems );
-};
-
-} // namespace framework
-
-#endif // __FRAMEWORK_CLASSES_TOOLBOXCONFIGURATION_HXX_
diff --git a/framework/inc/classes/toolboxconfigurationdefines.hxx b/framework/inc/classes/toolboxconfigurationdefines.hxx
deleted file mode 100644
index 842c59be16..0000000000
--- a/framework/inc/classes/toolboxconfigurationdefines.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef __FRAMEWORK_TOOLBOXCONFIGURATIONDEFINES_HXX_
-#define __FRAMEWORK_TOOLBOXCONFIGURATIONDEFINES_HXX_
-
-#define XMLNS_TOOLBAR "http://openoffice.org/2001/toolbar"
-#define XMLNS_XLINK "http://www.w3.org/1999/xlink"
-#define XMLNS_TOOLBAR_PREFIX "toolbar:"
-#define XMLNS_XLINK_PREFIX "xlink:"
-
-#define XMLNS_FILTER_SEPARATOR "^"
-
-#define ELEMENT_TOOLBAR "toolbar"
-#define ELEMENT_TOOLBARITEM "toolbaritem"
-#define ELEMENT_TOOLBARSPACE "toolbarspace"
-#define ELEMENT_TOOLBARBREAK "toolbarbreak"
-#define ELEMENT_TOOLBARSEPARATOR "toolbarseparator"
-
-#define ELEMENT_TOOLBARLAYOUTS "toolbarlayouts"
-#define ELEMENT_TOOLBARLAYOUT "toolbarlayout"
-#define ELEMENT_TOOLBARCONFIGITEMS "toolbarconfigitems"
-#define ELEMENT_TOOLBARCONFIGITEM "toolbarconfigitem"
-
-#define ATTRIBUTE_BITMAP "bitmap"
-#define ATTRIBUTE_TEXT "text"
-#define ATTRIBUTE_URL "href"
-#define ATTRIBUTE_ITEMBITS "property"
-#define ATTRIBUTE_VISIBLE "visible"
-#define ATTRIBUTE_WIDTH "width"
-#define ATTRIBUTE_USER "userdefined"
-#define ATTRIBUTE_HELPID "helpid"
-#define ATTRIBUTE_ITEMSTYLE "style"
-
-#define ATTRIBUTE_ID "id"
-#define ATTRIBUTE_FLOATINGPOSLEFT "floatingposleft"
-#define ATTRIBUTE_FLOATINGPOSTOP "floatingpostop"
-#define ATTRIBUTE_TOOLBARNAME "toolbarname"
-#define ATTRIBUTE_CONTEXT "context"
-#define ATTRIBUTE_FLOATINGLINES "floatinglines"
-#define ATTRIBUTE_DOCKINGLINES "dockinglines"
-#define ATTRIBUTE_ALIGN "align"
-#define ATTRIBUTE_FLOATING "floating"
-#define ATTRIBUTE_BUTTONTYPE "style"
-#define ATTRIBUTE_USERDEFNAME "userdefname"
-
-#define ELEMENT_NS_TOOLBAR "toolbar:toolbar"
-#define ELEMENT_NS_TOOLBARITEM "toolbar:toolbaritem"
-#define ELEMENT_NS_TOOLBARSPACE "toolbar:toolbarspace"
-#define ELEMENT_NS_TOOLBARBREAK "toolbar:toolbarbreak"
-#define ELEMENT_NS_TOOLBARSEPARATOR "toolbar:toolbarseparator"
-
-#define ELEMENT_NS_TOOLBARLAYOUTS "toolbar:toolbarlayouts"
-#define ELEMENT_NS_TOOLBARLAYOUT "toolbar:toolbarlayout"
-#define ELEMENT_NS_TOOLBARCONFIGITEMS "toolbar:toolbarconfigitems"
-#define ELEMENT_NS_TOOLBARCONFIGITEM "toolbar:toolbarconfigitem"
-
-#define ATTRIBUTE_XMLNS_TOOLBAR "xmlns:toolbar"
-#define ATTRIBUTE_XMLNS_XLINK "xmlns:xlink"
-
-#define ATTRIBUTE_TYPE_CDATA "CDATA"
-
-#define ATTRIBUTE_BOOLEAN_TRUE "true"
-#define ATTRIBUTE_BOOLEAN_FALSE "false"
-
-#define ATTRIBUTE_ALIGN_LEFT "left"
-#define ATTRIBUTE_ALIGN_RIGHT "right"
-#define ATTRIBUTE_ALIGN_TOP "top"
-#define ATTRIBUTE_ALIGN_BOTTOM "bottom"
-
-#define ATTRIBUTE_STYLE_TEXT "text"
-#define ATTRIBUTE_STYLE_SYMBOL "symbol"
-#define ATTRIBUTE_STYLE_SYMBOLTEXT "symboltext"
-#define ATTRIBUTE_STYLE_SYMBOLPLUSTEXT "symbol+text"
-
-#define ATTRIBUTE_ITEMSTYLE_RADIO "radio"
-#define ATTRIBUTE_ITEMSTYLE_AUTO "auto"
-#define ATTRIBUTE_ITEMSTYLE_LEFT "left"
-#define ATTRIBUTE_ITEMSTYLE_AUTOSIZE "autosize"
-#define ATTRIBUTE_ITEMSTYLE_DROPDOWN "dropdown"
-#define ATTRIBUTE_ITEMSTYLE_REPEAT "repeat"
-
-#endif
diff --git a/framework/inc/classes/toolboxdocumenthandler.hxx b/framework/inc/classes/toolboxdocumenthandler.hxx
deleted file mode 100755
index 3db49370e5..0000000000
--- a/framework/inc/classes/toolboxdocumenthandler.hxx
+++ /dev/null
@@ -1,217 +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: toolboxdocumenthandler.hxx,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.
- *
- ************************************************************************/
-
-#ifndef __FRAMEWORK_CLASSES_TOOLBOXDOCUMENTHANDLER_HXX_
-#define __FRAMEWORK_CLASSES_TOOLBOXDOCUMENTHANDLER_HXX_
-
-#include <classes/toolboxconfiguration.hxx>
-
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
-
-#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#endif
-
-//_________________________________________________________________________________________________________________
-// other includes
-//_________________________________________________________________________________________________________________
-#include <threadhelp/threadhelpbase.hxx>
-#include <rtl/ustring.hxx>
-#include <cppuhelper/weak.hxx>
-
-#ifndef __SGI_STL_HASH_MAP
-#include <hash_map>
-#endif
-#include <stdtypes.h>
-
-//_________________________________________________________________________________________________________________
-// namespace
-//_________________________________________________________________________________________________________________
-
-namespace framework{
-
-//*****************************************************************************************************************
-// Hash code function for using in all hash maps of follow implementation.
-
-class OReadToolBoxDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler,
- private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
- public ::cppu::OWeakObject
-{
- public:
- enum ToolBox_XML_Entry
- {
- TB_ELEMENT_TOOLBAR,
- TB_ELEMENT_TOOLBARITEM,
- TB_ELEMENT_TOOLBARSPACE,
- TB_ELEMENT_TOOLBARBREAK,
- TB_ELEMENT_TOOLBARSEPARATOR,
- TB_ATTRIBUTE_TEXT,
- TB_ATTRIBUTE_BITMAP,
- TB_ATTRIBUTE_URL,
- TB_ATTRIBUTE_ITEMBITS,
- TB_ATTRIBUTE_VISIBLE,
- TB_ATTRIBUTE_WIDTH,
- TB_ATTRIBUTE_USER,
- TB_ATTRIBUTE_HELPID,
- TB_ATTRIBUTE_STYLE,
- TB_XML_ENTRY_COUNT
- };
-
- enum ToolBox_XML_Namespace
- {
- TB_NS_TOOLBAR,
- TB_NS_XLINK,
- TB_XML_NAMESPACES_COUNT
- };
-
- OReadToolBoxDocumentHandler( ToolBoxDescriptor& aToolBoxItems );
- virtual ~OReadToolBoxDocumentHandler();
-
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
-
- // XDocumentHandler
- virtual void SAL_CALL startDocument(void)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endDocument(void)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL startElement(
- const rtl::OUString& aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endElement(const rtl::OUString& aName)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL characters(const rtl::OUString& aChars)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget,
- const rtl::OUString& aData)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setDocumentLocator(
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- private:
- ::rtl::OUString getErrorLineString();
-
- class ToolBoxHashMap : public ::std::hash_map< ::rtl::OUString ,
- ToolBox_XML_Entry ,
- OUStringHashCode ,
- ::std::equal_to< ::rtl::OUString > >
- {
- public:
- inline void free()
- {
- ToolBoxHashMap().swap( *this );
- }
- };
-
- sal_Bool m_bToolBarStartFound;
- sal_Bool m_bToolBarEndFound;
- sal_Bool m_bToolBarItemStartFound;
- sal_Bool m_bToolBarSpaceStartFound;
- sal_Bool m_bToolBarBreakStartFound;
- sal_Bool m_bToolBarSeparatorStartFound;
- ToolBoxHashMap m_aToolBoxMap;
- ToolBoxDescriptor& m_aToolBoxItems;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator;
-
- sal_Int32 m_nHashCode_Style_Radio;
- sal_Int32 m_nHashCode_Style_Auto;
- sal_Int32 m_nHashCode_Style_Left;
- sal_Int32 m_nHashCode_Style_AutoSize;
- sal_Int32 m_nHashCode_Style_DropDown;
- sal_Int32 m_nHashCode_Style_Repeat;
-};
-
-class OWriteToolBoxDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses.
-{
- public:
- OWriteToolBoxDocumentHandler(
- const ToolBoxDescriptor& aToolBoxItems,
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > );
- virtual ~OWriteToolBoxDocumentHandler();
-
- void WriteToolBoxDocument() throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- protected:
- virtual void WriteToolBoxItem( const ToolBoxItemDescriptor* ) throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void WriteToolBoxSpace() throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void WriteToolBoxBreak() throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void WriteToolBoxSeparator() throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- const ToolBoxDescriptor& m_aToolBoxItems;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList;
- ::rtl::OUString m_aXMLToolbarNS;
- ::rtl::OUString m_aXMLXlinkNS;
- ::rtl::OUString m_aAttributeType;
- ::rtl::OUString m_aAttributeURL;
-};
-
-} // namespace framework
-
-#endif
diff --git a/framework/inc/classes/toolboxlayoutdocumenthandler.hxx b/framework/inc/classes/toolboxlayoutdocumenthandler.hxx
deleted file mode 100644
index 2c02e806da..0000000000
--- a/framework/inc/classes/toolboxlayoutdocumenthandler.hxx
+++ /dev/null
@@ -1,198 +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: toolboxlayoutdocumenthandler.hxx,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 __FRAMEWORK_CLASSES_TOOLBOXLAYOUTDOCUMENTHANDLER_HXX_
-#define __FRAMEWORK_CLASSES_TOOLBOXLAYOUTDOCUMENTHANDLER_HXX_
-
-#include <classes/toolboxconfiguration.hxx>
-
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
-
-#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#endif
-
-//_________________________________________________________________________________________________________________
-// other includes
-//_________________________________________________________________________________________________________________
-#include <threadhelp/threadhelpbase.hxx>
-#include <rtl/ustring.hxx>
-#include <cppuhelper/weak.hxx>
-
-#ifndef __SGI_STL_HASH_MAP
-#include <hash_map>
-#endif
-#include <stdtypes.h>
-
-//_________________________________________________________________________________________________________________
-// namespace
-//_________________________________________________________________________________________________________________
-
-namespace framework{
-
-//*****************************************************************************************************************
-// Hash code function for using in all hash maps of follow implementation.
-
-class OReadToolBoxLayoutDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler,
- private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
- public ::cppu::OWeakObject
-{
- public:
- enum ToolBoxLayout_XML_Entry
- {
- TBL_ELEMENT_TOOLBARLAYOUTS,
- TBL_ELEMENT_TOOLBARLAYOUT,
- TBL_ELEMENT_TOOLBARCONFIGITEMS,
- TBL_ELEMENT_TOOLBARCONFIGITEM,
- TBL_ATTRIBUTE_ID,
- TBL_ATTRIBUTE_TOOLBARNAME,
- TBL_ATTRIBUTE_CONTEXT,
- TBL_ATTRIBUTE_FLOATINGLINES,
- TBL_ATTRIBUTE_DOCKINGLINES,
- TBL_ATTRIBUTE_ALIGN,
- TBL_ATTRIBUTE_FLOATING,
- TBL_ATTRIBUTE_FLOATINGPOSLEFT,
- TBL_ATTRIBUTE_FLOATINGPOSTOP,
- TBL_ATTRIBUTE_VISIBLE,
- TBL_ATTRIBUTE_STYLE,
- TBL_ATTRIBUTE_USERDEFNAME,
- TBL_XML_ENTRY_COUNT
- };
-
- enum ToolBox_XML_Namespace
- {
- TBL_NS_TOOLBAR,
- TBL_XML_NAMESPACES_COUNT
- };
-
- OReadToolBoxLayoutDocumentHandler( ToolBoxLayoutDescriptor& aToolBoxLayoutItems );
- virtual ~OReadToolBoxLayoutDocumentHandler();
-
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
-
- // XDocumentHandler
- virtual void SAL_CALL startDocument(void)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endDocument(void)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL startElement(
- const rtl::OUString& aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endElement(const rtl::OUString& aName)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL characters(const rtl::OUString& aChars)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget,
- const rtl::OUString& aData)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setDocumentLocator(
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- private:
- ::rtl::OUString getErrorLineString();
-
- class ToolBoxLayoutHashMap : public ::std::hash_map< ::rtl::OUString ,
- ToolBoxLayout_XML_Entry ,
- OUStringHashCode ,
- ::std::equal_to< ::rtl::OUString > >
- {
- public:
- inline void free()
- {
- ToolBoxLayoutHashMap().swap( *this );
- }
- };
-
- sal_Bool m_bToolBarLayoutsStartFound;
- sal_Bool m_bToolBarLayoutsEndFound;
- sal_Bool m_bToolBarLayoutStartFound;
- sal_Bool m_bToolBarConfigListStartFound;
- sal_Bool m_bToolBarConfigItemStartFound;
- ToolBoxLayoutHashMap m_aToolBoxMap;
- ToolBoxLayoutDescriptor& m_aToolBoxItems;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator;
-};
-
-class OWriteToolBoxLayoutDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses.
-{
- public:
- OWriteToolBoxLayoutDocumentHandler(
- const ToolBoxLayoutDescriptor& aToolBoxLayoutItems,
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > );
- virtual ~OWriteToolBoxLayoutDocumentHandler();
-
- void WriteToolBoxLayoutDocument() throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- protected:
- virtual void WriteToolBoxLayoutItem( const ToolBoxLayoutItemDescriptor* ) throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- const ToolBoxLayoutDescriptor& m_aToolBoxLayoutItems;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList;
- ::rtl::OUString m_aXMLToolbarNS;
- ::rtl::OUString m_aAttributeType;
- ::rtl::OUString m_aTrueValue;
- ::rtl::OUString m_aFalseValue;
-};
-
-} // namespace framework
-
-#endif
diff --git a/framework/inc/helper/dockingareadefaultacceptor.hxx b/framework/inc/helper/dockingareadefaultacceptor.hxx
index 9ca23ce518..13133a408d 100644
--- a/framework/inc/helper/dockingareadefaultacceptor.hxx
+++ b/framework/inc/helper/dockingareadefaultacceptor.hxx
@@ -51,7 +51,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/weakref.hxx>
//_________________________________________________________________________________________________________________
@@ -63,10 +63,8 @@ namespace framework{
//_________________________________________________________________________________________________________________
-class DockingAreaDefaultAcceptor : public css::lang::XTypeProvider ,
- public ::com::sun::star::ui::XDockingAreaAcceptor ,
- private ThreadHelpBase ,
- public ::cppu::OWeakObject
+class DockingAreaDefaultAcceptor : private ThreadHelpBase ,
+ public ::cppu::WeakImplHelper1< ::com::sun::star::ui::XDockingAreaAcceptor >
{
public:
@@ -93,13 +91,6 @@ class DockingAreaDefaultAcceptor : public css::lang::XTypeProvider
virtual ~DockingAreaDefaultAcceptor();
//---------------------------------------------------------------------------------------------------------
- // XInterface
- //---------------------------------------------------------------------------------------------------------
-
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
- //---------------------------------------------------------------------------------------------------------
// XDockingAreaAcceptor
//---------------------------------------------------------------------------------------------------------
diff --git a/framework/inc/helper/mischelper.hxx b/framework/inc/helper/mischelper.hxx
index 1d9df9caa4..435b87a4f2 100644
--- a/framework/inc/helper/mischelper.hxx
+++ b/framework/inc/helper/mischelper.hxx
@@ -32,6 +32,8 @@
#define __MISC_HELPER_HXX_
#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
#include <i18npool/lang.h>
#include <svtools/languageoptions.hxx>
@@ -48,12 +50,21 @@ inline bool IsScriptTypeMatchingToLanguage( sal_Int16 nScriptType, LanguageType
class LanguageGuessingHelper
{
mutable ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > m_xLanguageGuesser;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
public:
- LanguageGuessingHelper() {}
+ LanguageGuessingHelper(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager) : m_xServiceManager(_xServiceManager){}
::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > GetGuesser() const;
-};
+};
+
+::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory
+ ,::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xUICommandLabels
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame
+ ,::rtl::OUString& _rModuleIdentifier
+ ,sal_Bool& _rIni
+ ,const sal_Char* _pName);
} // namespace framework
diff --git a/framework/inc/helper/ocomponentaccess.hxx b/framework/inc/helper/ocomponentaccess.hxx
index 12c10f38b8..5d7ee6e1be 100644
--- a/framework/inc/helper/ocomponentaccess.hxx
+++ b/framework/inc/helper/ocomponentaccess.hxx
@@ -55,7 +55,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/weakref.hxx>
//_________________________________________________________________________________________________________________
@@ -90,10 +90,8 @@ namespace framework{
@devstatus ready to use
*//*-*************************************************************************************************************/
-class OComponentAccess : public css::lang::XTypeProvider ,
- public css::container::XEnumerationAccess , // => XElementAccess
- private ThreadHelpBase , // Must be the first of baseclasses - Is neccessary for right initialization of objects!
- public ::cppu::OWeakObject
+class OComponentAccess : private ThreadHelpBase , // Must be the first of baseclasses - Is neccessary for right initialization of objects!
+ public ::cppu::WeakImplHelper1< ::com::sun::star::container::XEnumerationAccess >
{
//-------------------------------------------------------------------------------------------------------------
// public methods
@@ -123,13 +121,6 @@ class OComponentAccess : public css::lang::XTypeProvider ,
OComponentAccess( const css::uno::Reference< css::frame::XDesktop >& xOwner );
//---------------------------------------------------------------------------------------------------------
- // XInterface
- //---------------------------------------------------------------------------------------------------------
-
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
- //---------------------------------------------------------------------------------------------------------
// XEnumerationAccess
//---------------------------------------------------------------------------------------------------------
diff --git a/framework/inc/helper/ocomponentenumeration.hxx b/framework/inc/helper/ocomponentenumeration.hxx
index 78cb1be408..bdb031413b 100644
--- a/framework/inc/helper/ocomponentenumeration.hxx
+++ b/framework/inc/helper/ocomponentenumeration.hxx
@@ -54,7 +54,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
//_________________________________________________________________________________________________________________
// namespace
@@ -88,11 +88,8 @@ namespace framework{
@threadsafe yes
*//*-*************************************************************************************************************/
-class OComponentEnumeration : public css::lang::XTypeProvider ,
- public css::lang::XEventListener ,
- public css::container::XEnumeration ,
- public ThreadHelpBase ,
- public ::cppu::OWeakObject
+class OComponentEnumeration : public ThreadHelpBase ,
+ public ::cppu::WeakImplHelper2< ::com::sun::star::container::XEnumeration,::com::sun::star::lang::XEventListener >
{
//-------------------------------------------------------------------------------------------------------------
// public methods
@@ -120,13 +117,6 @@ class OComponentEnumeration : public css::lang::XTypeProvider ,
OComponentEnumeration( const css::uno::Sequence< css::uno::Reference< css::lang::XComponent > >& seqComponents );
//---------------------------------------------------------------------------------------------------------
- // XInterface
- //---------------------------------------------------------------------------------------------------------
-
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
- //---------------------------------------------------------------------------------------------------------
// XEventListener
//---------------------------------------------------------------------------------------------------------
diff --git a/framework/inc/helper/oframes.hxx b/framework/inc/helper/oframes.hxx
index eaf35a3df2..2e16c8f716 100644
--- a/framework/inc/helper/oframes.hxx
+++ b/framework/inc/helper/oframes.hxx
@@ -53,7 +53,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/weakref.hxx>
//_________________________________________________________________________________________________________________
@@ -90,10 +90,8 @@ namespace framework{
@devstatus deprecated
*//*-*************************************************************************************************************/
-class OFrames : public css::lang::XTypeProvider ,
- public css::frame::XFrames , //=> XIndexAccess => XElementAccess
- private ThreadHelpBase , // Must be the first of baseclasses - Is neccessary for right initialization of objects!
- public ::cppu::OWeakObject
+class OFrames : private ThreadHelpBase , // Must be the first of baseclasses - Is neccessary for right initialization of objects!
+ public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XFrames >
{
//-------------------------------------------------------------------------------------------------------------
// public methods
@@ -125,13 +123,6 @@ class OFrames : public css::lang::XTypeProvider ,
FrameContainer* pFrameContainer );
//---------------------------------------------------------------------------------------------------------
- // XInterface
- //---------------------------------------------------------------------------------------------------------
-
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
- //---------------------------------------------------------------------------------------------------------
// XFrames
//---------------------------------------------------------------------------------------------------------
diff --git a/framework/inc/helper/opluginframedispatcher.hxx b/framework/inc/helper/opluginframedispatcher.hxx
index 226a8cc4aa..c3000e67a4 100644
--- a/framework/inc/helper/opluginframedispatcher.hxx
+++ b/framework/inc/helper/opluginframedispatcher.hxx
@@ -58,7 +58,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/weakref.hxx>
#include <cppuhelper/interfacecontainer.hxx>
@@ -106,11 +106,8 @@ typedef ::cppu::OMultiTypeInterfaceContainerHelperVar< ::rtl::OUString ,
@devstatus ready to use
*//*-*************************************************************************************************************/
-class OPlugInFrameDispatcher : public css::frame::XDispatchProvider ,
- public css::frame::XDispatch ,
- public css::mozilla::XPluginInstanceNotifySink ,
- private ThreadHelpBase ,
- public ::cppu::OWeakObject
+class OPlugInFrameDispatcher : private ThreadHelpBase ,
+ public ::cppu::WeakImplHelper3< ::com::sun::star::frame::XDispatchProvider, ::com::sun::star::frame::XDispatch, ::com::sun::star::mozilla::XPluginInstanceNotifySink >
{
//-------------------------------------------------------------------------------------------------------------
// public methods
@@ -144,12 +141,6 @@ class OPlugInFrameDispatcher : public css::frame::XDispatchProvider ,
const css::uno::Reference< css::mozilla::XPluginInstancePeer >& xPlugInDLL );
//---------------------------------------------------------------------------------------------------------
- // XInterface
- //---------------------------------------------------------------------------------------------------------
-
- DECLARE_XINTERFACE
-
- //---------------------------------------------------------------------------------------------------------
// XDispatchProvider
//---------------------------------------------------------------------------------------------------------
diff --git a/framework/inc/helper/popupmenucontrollerbase.hxx b/framework/inc/helper/popupmenucontrollerbase.hxx
index 0c7c04e3dd..18bc9c29d9 100644
--- a/framework/inc/helper/popupmenucontrollerbase.hxx
+++ b/framework/inc/helper/popupmenucontrollerbase.hxx
@@ -56,7 +56,7 @@
#include <com/sun/star/frame/XPopupMenuController.hpp>
#include <com/sun/star/uri/XUriReferenceFactory.hpp>
#include <com/sun/star/uri/XUriReference.hpp>
-
+#include <com/sun/star/util/XURLTransformer.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
@@ -93,7 +93,7 @@ namespace framework
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) = 0;
// XPopupMenuController
- virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException);
// XInitialization
@@ -127,8 +127,11 @@ namespace framework
protected:
virtual void resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
+ virtual void impl_setPopupMenu();
+ virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL);
::rtl::OUString determineBaseURL( const ::rtl::OUString& aURL );
+
bool m_bInitialized;
bool m_bDisposed;
rtl::OUString m_aCommandURL;
@@ -136,6 +139,7 @@ namespace framework
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xDispatch;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > m_xPopupMenu;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener
};
diff --git a/framework/inc/helper/uiconfigelementwrapperbase.hxx b/framework/inc/helper/uiconfigelementwrapperbase.hxx
index 7159af4970..cffe6f6777 100644
--- a/framework/inc/helper/uiconfigelementwrapperbase.hxx
+++ b/framework/inc/helper/uiconfigelementwrapperbase.hxx
@@ -52,6 +52,7 @@
#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
//_________________________________________________________________________________________________________________
// other includes
@@ -80,7 +81,7 @@ class UIConfigElementWrapperBase : public ::com::sun::star::lang::XTypeProvider
// public methods
//-------------------------------------------------------------------------------------------------------------
public:
- UIConfigElementWrapperBase( sal_Int16 nType );
+ UIConfigElementWrapperBase( sal_Int16 nType,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory );
virtual ~UIConfigElementWrapperBase();
//---------------------------------------------------------------------------------------------------------
@@ -99,8 +100,8 @@ class UIConfigElementWrapperBase : public ::com::sun::star::lang::XTypeProvider
// XUIElementSettings
virtual void SAL_CALL updateSettings() throw (::com::sun::star::uno::RuntimeException) = 0;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getSettings( sal_Bool bWriteable ) throw (::com::sun::star::uno::RuntimeException) = 0;
- virtual void SAL_CALL setSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& UISettings ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getSettings( sal_Bool bWriteable ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& UISettings ) throw (::com::sun::star::uno::RuntimeException);
// XUIElement
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException) = 0;
@@ -135,6 +136,8 @@ class UIConfigElementWrapperBase : public ::com::sun::star::lang::XTypeProvider
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException);
+ virtual void impl_fillNewData();
+
static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor();
sal_Int16 m_nType;
@@ -145,6 +148,7 @@ class UIConfigElementWrapperBase : public ::com::sun::star::lang::XTypeProvider
m_bDisposed : 1,
m_bNoClose : 1;
rtl::OUString m_aResourceURL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xConfigSource;
com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_xConfigData;
com::sun::star::uno::WeakReference< com::sun::star::frame::XFrame > m_xWeakFrame;
diff --git a/framework/inc/interaction/preventduplicateinteraction.hxx b/framework/inc/interaction/preventduplicateinteraction.hxx
index 2443ec3eec..5ba991bf32 100644
--- a/framework/inc/interaction/preventduplicateinteraction.hxx
+++ b/framework/inc/interaction/preventduplicateinteraction.hxx
@@ -85,8 +85,8 @@ struct ThreadHelpBase2
mutable ::osl::Mutex m_aLock;
};
-class PreventDuplicateInteraction : public ::cppu::WeakImplHelper1< css::task::XInteractionHandler >
- , private ThreadHelpBase2
+class PreventDuplicateInteraction : private ThreadHelpBase2
+ ,public ::cppu::WeakImplHelper1< css::task::XInteractionHandler >
{
//_____________________________________
// structs, types etcp.
diff --git a/framework/inc/jobs/helponstartup.hxx b/framework/inc/jobs/helponstartup.hxx
index e954964a69..c8df521a65 100644
--- a/framework/inc/jobs/helponstartup.hxx
+++ b/framework/inc/jobs/helponstartup.hxx
@@ -41,7 +41,7 @@
//_______________________________________________
// other includes
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase3.hxx>
//_______________________________________________
// uno includes
@@ -66,12 +66,8 @@ namespace framework{
@author as96863
*/
-class HelpOnStartup : public css::lang::XTypeProvider
- , public css::lang::XServiceInfo
- , public css::task::XJob
- , public css::lang::XEventListener
- , private ThreadHelpBase
- , public ::cppu::OWeakObject
+class HelpOnStartup : private ThreadHelpBase
+ ,public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,::com::sun::star::lang::XEventListener,::com::sun::star::task::XJob >
{
//-------------------------------------------
// member
@@ -132,11 +128,7 @@ class HelpOnStartup : public css::lang::XTypeProvider
public:
//---------------------------------------
- // css.uno.XInterface
- // css.lang.XTypeProvider
// css.lang.XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
// css.task.XJob
diff --git a/framework/inc/jobs/shelljob.hxx b/framework/inc/jobs/shelljob.hxx
index 956290cd7d..68d5136da3 100644
--- a/framework/inc/jobs/shelljob.hxx
+++ b/framework/inc/jobs/shelljob.hxx
@@ -41,7 +41,7 @@
//_______________________________________________
// other includes
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
//_______________________________________________
// uno includes
@@ -71,11 +71,8 @@ namespace framework{
@author as96863
*/
-class ShellJob : public css::lang::XTypeProvider
- , public css::lang::XServiceInfo
- , public css::task::XJob
- , private ThreadHelpBase
- , public ::cppu::OWeakObject
+class ShellJob : private ThreadHelpBase
+ ,public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo,::com::sun::star::task::XJob >
{
//-------------------------------------------
// member
@@ -112,11 +109,7 @@ class ShellJob : public css::lang::XTypeProvider
public:
//---------------------------------------
- // css.uno.XInterface
- // css.lang.XTypeProvider
// css.lang.XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
// css.task.XJob
diff --git a/framework/inc/macros/debug/memorymeasure.hxx b/framework/inc/macros/debug/memorymeasure.hxx
index 0de0204285..19d510fae9 100644
--- a/framework/inc/macros/debug/memorymeasure.hxx
+++ b/framework/inc/macros/debug/memorymeasure.hxx
@@ -111,7 +111,7 @@
{
::rtl::OStringBuffer sBuffer( 10000 );
- if( m_lSnapshots.size() > 0 )
+ if( !m_lSnapshots.empty() )
{
// Write informations to return buffer
::std::vector< _MemoryInfo >::const_iterator pItem1;
diff --git a/framework/inc/macros/xserviceinfo.hxx b/framework/inc/macros/xserviceinfo.hxx
index 5f71fb01d7..ee2880a554 100644
--- a/framework/inc/macros/xserviceinfo.hxx
+++ b/framework/inc/macros/xserviceinfo.hxx
@@ -55,7 +55,9 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <cppuhelper/factory.hxx>
+#include <comphelper/sequence.hxx>
#include <rtl/ustring.hxx>
+#include <rtl/logfile.hxx>
//_________________________________________________________________________________________________________________
// namespace
@@ -93,29 +95,7 @@ ________________________________________________________________________________
/*===========================================================================================================*/ \
sal_Bool SAL_CALL CLASS::supportsService( const ::rtl::OUString& sServiceName ) throw( css::uno::RuntimeException ) \
{ \
- /* Set default return value. */ \
- sal_Bool bReturn = sal_False ; \
- /* Get names of all supported servicenames. */ \
- css::uno::Sequence< ::rtl::OUString > seqServiceNames = getSupportedServiceNames(); \
- const ::rtl::OUString* pArray = seqServiceNames.getConstArray(); \
- sal_Int32 nCounter = 0; \
- sal_Int32 nLength = seqServiceNames.getLength(); \
- /* Search for right name in list. */ \
- while ( \
- ( nCounter < nLength ) && \
- ( bReturn == sal_False ) \
- ) \
- { \
- /* Is name was found, say "YES, SERVICE IS SUPPORTED." and break loop. */ \
- if ( pArray[nCounter] == sServiceName ) \
- { \
- bReturn = sal_True ; \
- } \
- /* Else step to next element in list. */ \
- ++nCounter; \
- } \
- /* Return state of search. */ \
- return bReturn; \
+ return ::comphelper::findValue(getSupportedServiceNames(), sServiceName, sal_True).getLength() != 0; \
} \
\
/*===========================================================================================================*/ \
@@ -155,6 +135,7 @@ ________________________________________________________________________________
/*===========================================================================================================*/ \
css::uno::Reference< css::uno::XInterface > SAL_CALL CLASS::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ) \
{ \
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework","Ocke.Janssen@sun.com",U2B(IMPLEMENTATIONNAME).getStr()); \
/* create new instance of service */ \
CLASS* pClass = new CLASS( xServiceManager ); \
/* hold it alive by increasing his ref count!!! */ \
diff --git a/framework/inc/mediadescriptor.h b/framework/inc/mediadescriptor.h
index 356e320e65..8daf743e76 100644
--- a/framework/inc/mediadescriptor.h
+++ b/framework/inc/mediadescriptor.h
@@ -36,44 +36,44 @@
namespace framework{
-static const ::rtl::OUString MEDIADESCRIPTOR_ASTEMPLATE = ::rtl::OUString::createFromAscii("AsTemplate" );
-static const ::rtl::OUString MEDIADESCRIPTOR_CHARACTERSET = ::rtl::OUString::createFromAscii("CharacterSet" );
-static const ::rtl::OUString MEDIADESCRIPTOR_DEEPDETECTION = ::rtl::OUString::createFromAscii("DeepDetection" );
-static const ::rtl::OUString MEDIADESCRIPTOR_DETECTSERVICE = ::rtl::OUString::createFromAscii("DetectService" );
-static const ::rtl::OUString MEDIADESCRIPTOR_EXTENSION = ::rtl::OUString::createFromAscii("Extension" );
-static const ::rtl::OUString MEDIADESCRIPTOR_FILENAME = ::rtl::OUString::createFromAscii("FileName" ); // deprecated!
-static const ::rtl::OUString MEDIADESCRIPTOR_FILTERNAME = ::rtl::OUString::createFromAscii("FilterName" );
-static const ::rtl::OUString MEDIADESCRIPTOR_FILTEROPTIONS = ::rtl::OUString::createFromAscii("FilterOptions" );
-static const ::rtl::OUString MEDIADESCRIPTOR_FORMAT = ::rtl::OUString::createFromAscii("Format" );
-static const ::rtl::OUString MEDIADESCRIPTOR_FRAMENAME = ::rtl::OUString::createFromAscii("FrameName" );
-static const ::rtl::OUString MEDIADESCRIPTOR_HIDDEN = ::rtl::OUString::createFromAscii("Hidden" );
-static const ::rtl::OUString MEDIADESCRIPTOR_INPUTSTREAM = ::rtl::OUString::createFromAscii("InputStream" );
-static const ::rtl::OUString MEDIADESCRIPTOR_INTERACTIONHANDLER = ::rtl::OUString::createFromAscii("InteractionHandler");
-static const ::rtl::OUString MEDIADESCRIPTOR_JUMPMARK = ::rtl::OUString::createFromAscii("JumpMark" );
-static const ::rtl::OUString MEDIADESCRIPTOR_MACROEXECUTIONMODE = ::rtl::OUString::createFromAscii("MacroExecutionMode");
-static const ::rtl::OUString MEDIADESCRIPTOR_MEDIATYPE = ::rtl::OUString::createFromAscii("MediaType" );
-static const ::rtl::OUString MEDIADESCRIPTOR_MINIMIZED = ::rtl::OUString::createFromAscii("Minimized" );
-static const ::rtl::OUString MEDIADESCRIPTOR_OPENNEWVIEW = ::rtl::OUString::createFromAscii("OpenNewView" );
-static const ::rtl::OUString MEDIADESCRIPTOR_OUTPUTSTREAM = ::rtl::OUString::createFromAscii("OutputStream" );
-static const ::rtl::OUString MEDIADESCRIPTOR_PATTERN = ::rtl::OUString::createFromAscii("Pattern" );
-static const ::rtl::OUString MEDIADESCRIPTOR_POSSIZE = ::rtl::OUString::createFromAscii("PosSize" );
-static const ::rtl::OUString MEDIADESCRIPTOR_POSTDATA = ::rtl::OUString::createFromAscii("PostData" );
-static const ::rtl::OUString MEDIADESCRIPTOR_POSTSTRING = ::rtl::OUString::createFromAscii("PostString" );
-static const ::rtl::OUString MEDIADESCRIPTOR_PREVIEW = ::rtl::OUString::createFromAscii("Preview" );
-static const ::rtl::OUString MEDIADESCRIPTOR_READONLY = ::rtl::OUString::createFromAscii("ReadOnly" );
-static const ::rtl::OUString MEDIADESCRIPTOR_REFERRER = ::rtl::OUString::createFromAscii("Referer" );
-static const ::rtl::OUString MEDIADESCRIPTOR_SILENT = ::rtl::OUString::createFromAscii("Silent" );
-static const ::rtl::OUString MEDIADESCRIPTOR_STATUSINDICATOR = ::rtl::OUString::createFromAscii("StatusIndicator" );
-static const ::rtl::OUString MEDIADESCRIPTOR_TEMPLATENAME = ::rtl::OUString::createFromAscii("TemplateName" );
-static const ::rtl::OUString MEDIADESCRIPTOR_TEMPLATEREGIONNAME = ::rtl::OUString::createFromAscii("TemplateRegionName");
-static const ::rtl::OUString MEDIADESCRIPTOR_TYPENAME = ::rtl::OUString::createFromAscii("TypeName" );
-static const ::rtl::OUString MEDIADESCRIPTOR_UPDATEDOCMODE = ::rtl::OUString::createFromAscii("UpdateDocMode" );
-static const ::rtl::OUString MEDIADESCRIPTOR_URL = ::rtl::OUString::createFromAscii("URL" );
-static const ::rtl::OUString MEDIADESCRIPTOR_VERSION = ::rtl::OUString::createFromAscii("Version" );
-static const ::rtl::OUString MEDIADESCRIPTOR_VIEWID = ::rtl::OUString::createFromAscii("ViewId" );
-static const ::rtl::OUString MEDIADESCRIPTOR_REPAIRPACKAGE = ::rtl::OUString::createFromAscii("RepairPackage" );
-static const ::rtl::OUString MEDIADESCRIPTOR_DOCUMENTTITLE = ::rtl::OUString::createFromAscii("DocumentTitle" );
-static const ::rtl::OUString MEDIADESCRIPTOR_MODEL = ::rtl::OUString::createFromAscii("Model" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_ASTEMPLATE = ::rtl::OUString::createFromAscii("AsTemplate" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_CHARACTERSET = ::rtl::OUString::createFromAscii("CharacterSet" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_DEEPDETECTION = ::rtl::OUString::createFromAscii("DeepDetection" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_DETECTSERVICE = ::rtl::OUString::createFromAscii("DetectService" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_EXTENSION = ::rtl::OUString::createFromAscii("Extension" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_FILENAME = ::rtl::OUString::createFromAscii("FileName" ); // deprecated!
+//static const ::rtl::OUString MEDIADESCRIPTOR_FILTERNAME = ::rtl::OUString::createFromAscii("FilterName" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_FILTEROPTIONS = ::rtl::OUString::createFromAscii("FilterOptions" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_FORMAT = ::rtl::OUString::createFromAscii("Format" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_FRAMENAME = ::rtl::OUString::createFromAscii("FrameName" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_HIDDEN = ::rtl::OUString::createFromAscii("Hidden" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_INPUTSTREAM = ::rtl::OUString::createFromAscii("InputStream" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_INTERACTIONHANDLER = ::rtl::OUString::createFromAscii("InteractionHandler");
+//static const ::rtl::OUString MEDIADESCRIPTOR_JUMPMARK = ::rtl::OUString::createFromAscii("JumpMark" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_MACROEXECUTIONMODE = ::rtl::OUString::createFromAscii("MacroExecutionMode");
+//static const ::rtl::OUString MEDIADESCRIPTOR_MEDIATYPE = ::rtl::OUString::createFromAscii("MediaType" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_MINIMIZED = ::rtl::OUString::createFromAscii("Minimized" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_OPENNEWVIEW = ::rtl::OUString::createFromAscii("OpenNewView" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_OUTPUTSTREAM = ::rtl::OUString::createFromAscii("OutputStream" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_PATTERN = ::rtl::OUString::createFromAscii("Pattern" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_POSSIZE = ::rtl::OUString::createFromAscii("PosSize" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_POSTDATA = ::rtl::OUString::createFromAscii("PostData" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_POSTSTRING = ::rtl::OUString::createFromAscii("PostString" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_PREVIEW = ::rtl::OUString::createFromAscii("Preview" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_READONLY = ::rtl::OUString::createFromAscii("ReadOnly" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_REFERRER = ::rtl::OUString::createFromAscii("Referer" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_SILENT = ::rtl::OUString::createFromAscii("Silent" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_STATUSINDICATOR = ::rtl::OUString::createFromAscii("StatusIndicator" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_TEMPLATENAME = ::rtl::OUString::createFromAscii("TemplateName" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_TEMPLATEREGIONNAME = ::rtl::OUString::createFromAscii("TemplateRegionName");
+//static const ::rtl::OUString MEDIADESCRIPTOR_TYPENAME = ::rtl::OUString::createFromAscii("TypeName" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_UPDATEDOCMODE = ::rtl::OUString::createFromAscii("UpdateDocMode" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_URL = ::rtl::OUString::createFromAscii("URL" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_VERSION = ::rtl::OUString::createFromAscii("Version" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_VIEWID = ::rtl::OUString::createFromAscii("ViewId" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_REPAIRPACKAGE = ::rtl::OUString::createFromAscii("RepairPackage" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_DOCUMENTTITLE = ::rtl::OUString::createFromAscii("DocumentTitle" );
+//static const ::rtl::OUString MEDIADESCRIPTOR_MODEL = ::rtl::OUString::createFromAscii("Model" );
} // namespace framework
diff --git a/framework/inc/services.h b/framework/inc/services.h
index ac9dde220e..5d3d248b3c 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -135,17 +135,17 @@ namespace framework{
#define IMPLEMENTATIONNAME_FRAME DECLARE_ASCII("com.sun.star.comp.framework.Frame" )
#define IMPLEMENTATIONNAME_DESKTOP DECLARE_ASCII("com.sun.star.comp.framework.Desktop" )
#define IMPLEMENTATIONNAME_TASK DECLARE_ASCII("com.sun.star.comp.framework.Task" )
-#define IMPLEMENTATIONNAME_FRAMELOADERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.FrameLoaderFactory" )
-#define IMPLEMENTATIONNAME_FILTERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.FilterFactory" )
+//#define IMPLEMENTATIONNAME_FRAMELOADERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.FrameLoaderFactory" )
+//#define IMPLEMENTATIONNAME_FILTERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.FilterFactory" )
#define IMPLEMENTATIONNAME_URLTRANSFORMER DECLARE_ASCII("com.sun.star.comp.framework.URLTransformer" )
-#define IMPLEMENTATIONNAME_PLUGINFRAME DECLARE_ASCII("com.sun.star.comp.framework.PluginFrame" )
+// #define IMPLEMENTATIONNAME_PLUGINFRAME DECLARE_ASCII("com.sun.star.comp.framework.PluginFrame" )
#define IMPLEMENTATIONNAME_GENERICFRAMELOADER DECLARE_ASCII("com.sun.star.comp.office.FrameLoader" )
#define IMPLEMENTATIONNAME_MEDIATYPEDETECTIONHELPER DECLARE_ASCII("com.sun.star.comp.framework.MediaTypeDetectionHelper")
-#define IMPLEMENTATIONNAME_LOGINDIALOG DECLARE_ASCII("com.sun.star.comp.framework.LoginDialog" )
-#define IMPLEMENTATIONNAME_TYPEDETECTION DECLARE_ASCII("com.sun.star.comp.framework.TypeDetection" )
-#define IMPLEMENTATIONNAME_DOCUMENTPROPERTIES DECLARE_ASCII("com.sun.star.comp.framework.DocumentProperties" )
+//#define IMPLEMENTATIONNAME_LOGINDIALOG DECLARE_ASCII("com.sun.star.comp.framework.LoginDialog" )
+//#define IMPLEMENTATIONNAME_TYPEDETECTION DECLARE_ASCII("com.sun.star.comp.framework.TypeDetection" )
+//#define IMPLEMENTATIONNAME_DOCUMENTPROPERTIES DECLARE_ASCII("com.sun.star.comp.framework.DocumentProperties" )
#define IMPLEMENTATIONNAME_OXT_HANDLER DECLARE_ASCII("com.sun.star.comp.framework.OXTFileHandler" )
-#define IMPLEMENTATIONNAME_CONTENTHANDLERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.ContentHandlerFactory" )
+//#define IMPLEMENTATIONNAME_CONTENTHANDLERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.ContentHandlerFactory" )
#define IMPLEMENTATIONNAME_SFXTERMINATOR DECLARE_ASCII("com.sun.star.comp.sfx2.SfxTerminateListener" )
#define IMPLEMENTATIONNAME_PIPETERMINATOR DECLARE_ASCII("com.sun.star.comp.OfficeIPCThreadController" )
#define IMPLEMENTATIONNAME_QUICKLAUNCHER DECLARE_ASCII("com.sun.star.comp.desktop.QuickstartWrapper" )
@@ -160,13 +160,13 @@ namespace framework{
#define IMPLEMENTATIONNAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.comp.framework.PathSettings" )
#define IMPLEMENTATIONNAME_JOBDISPATCH DECLARE_ASCII("com.sun.star.comp.framework.jobs.JobDispatch" )
#define IMPLEMENTATIONNAME_DISPATCHHELPER DECLARE_ASCII("com.sun.star.comp.framework.services.DispatchHelper" )
-#define IMPLEMENTATIONNAME_DETECTORFACTORY DECLARE_ASCII("com.sun.star.comp.framework.DetectorFactory" )
+//#define IMPLEMENTATIONNAME_DETECTORFACTORY DECLARE_ASCII("com.sun.star.comp.framework.DetectorFactory" )
#define IMPLEMENTATIONNAME_LAYOUTMANAGER DECLARE_ASCII("com.sun.star.comp.framework.LayoutManager" )
#define IMPLEMENTATIONNAME_POPUPMENUCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.PopupMenuControllerFactory" )
#define IMPLEMENTATIONNAME_MACROSMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.MacrosMenuController" )
#define IMPLEMENTATIONNAME_FONTMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.FontMenuController" )
#define IMPLEMENTATIONNAME_FONTSIZEMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.FontSizeMenuController" )
-#define IMPLEMENTATIONNAME_FORMATMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.FormatMenuController" )
+// #define IMPLEMENTATIONNAME_FORMATMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.FormatMenuController" )
#define IMPLEMENTATIONNAME_OBJECTMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.ObjectMenuController" )
#define IMPLEMENTATIONNAME_HEADERMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.HeaderMenuController" )
#define IMPLEMENTATIONNAME_FOOTERMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.FooterMenuController" )
diff --git a/framework/inc/services/dispatchhelper.hxx b/framework/inc/services/dispatchhelper.hxx
index d6bae3833a..7708a8944f 100644
--- a/framework/inc/services/dispatchhelper.hxx
+++ b/framework/inc/services/dispatchhelper.hxx
@@ -51,7 +51,7 @@
//_______________________________________________
// other includes
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <osl/conditn.hxx>
//_______________________________________________
@@ -74,12 +74,8 @@ namespace framework{
All these steps are done inside one method call here.
*/
-class DispatchHelper : public css::lang::XTypeProvider
- , public css::lang::XServiceInfo
- , public css::frame::XDispatchHelper
- , public css::frame::XDispatchResultListener // => XEventListener
- , public ThreadHelpBase // must be the first base class!
- , public ::cppu::OWeakObject // => XInterface, XWeak
+class DispatchHelper : public ThreadHelpBase // must be the first base class!
+ ,public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,::com::sun::star::frame::XDispatchHelper,::com::sun::star::frame::XDispatchResultListener >
{
//-------------------------------------------
@@ -112,8 +108,6 @@ class DispatchHelper : public css::lang::XTypeProvider
//---------------------------------------
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
//---------------------------------------
diff --git a/framework/inc/services/frameloaderfactory.hxx b/framework/inc/services/frameloaderfactory.hxx
index 10e026b244..41945500f2 100644
--- a/framework/inc/services/frameloaderfactory.hxx
+++ b/framework/inc/services/frameloaderfactory.hxx
@@ -57,7 +57,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase3.hxx>
//_________________________________________________________________________________________________________________
// namespace
@@ -107,12 +107,8 @@ struct tIMPLExtractedArguments
@devstatus deprecated
*//*-*************************************************************************************************************/
-class FrameLoaderFactory : public css::lang::XTypeProvider ,
- public css::lang::XServiceInfo ,
- public css::lang::XMultiServiceFactory ,
- public css::container::XNameAccess , // => XElementAccess
- public ThreadHelpBase , // Struct for right initalization of mutex member! Mst first of baseclasses
- public ::cppu::OWeakObject
+class FrameLoaderFactory : public ThreadHelpBase , // Struct for right initalization of mutex member! Mst first of baseclasses
+ public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,::com::sun::star::lang::XMultiServiceFactory,::com::sun::star::container::XNameAccess >
{
//-------------------------------------------------------------------------------------------------------------
// public methods
@@ -158,8 +154,6 @@ class FrameLoaderFactory : public css::lang::XTypeProvider ,
// XInterface, XTypeProvider, XServiceInfo
//---------------------------------------------------------------------------------------------------------
- DECLARE_XINTERFACE
- DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
//---------------------------------------------------------------------------------------------------------
diff --git a/framework/inc/services/mediatypedetectionhelper.hxx b/framework/inc/services/mediatypedetectionhelper.hxx
index 6b710e2189..f8f5996f37 100644
--- a/framework/inc/services/mediatypedetectionhelper.hxx
+++ b/framework/inc/services/mediatypedetectionhelper.hxx
@@ -50,8 +50,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
-
+#include <cppuhelper/implbase2.hxx>
//_________________________________________________________________________________________________________________
// namespaces
//_________________________________________________________________________________________________________________
@@ -75,10 +74,7 @@ namespace framework{
@devstatus deprecated
*//*-*************************************************************************************************************/
-class MediaTypeDetectionHelper : public css::lang::XTypeProvider
- , public css::lang::XServiceInfo
- , public css::util::XStringMapping
- , public ::cppu::OWeakObject
+class MediaTypeDetectionHelper : public ::cppu::WeakImplHelper2< ::com::sun::star::util::XStringMapping, css::lang::XServiceInfo>
{
//-------------------------------------------------------------------------------------------------------------
// public methods
@@ -122,8 +118,6 @@ class MediaTypeDetectionHelper : public css::lang::XTypeProvider
// XInterface, XTypeProvider, XServiceInfo
//---------------------------------------------------------------------------------------------------------
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
//---------------------------------------------------------------------------------------------------------
diff --git a/framework/inc/services/menudocumenthandler.hxx b/framework/inc/services/menudocumenthandler.hxx
deleted file mode 100644
index b59117ff8d..0000000000
--- a/framework/inc/services/menudocumenthandler.hxx
+++ /dev/null
@@ -1,317 +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: menudocumenthandler.hxx,v $
- * $Revision: 1.8 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __FRAMEWORK_SERVICES_MENUDOCUMENTHANDLER_HXX_
-#define __FRAMEWORK_SERVICES_MENUDOCUMENTHANDLER_HXX_
-
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
-
-#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#endif
-
-//_________________________________________________________________________________________________________________
-// other includes
-//_________________________________________________________________________________________________________________
-#include <threadhelp/threadhelpbase.hxx>
-#include <rtl/ustring.hxx>
-#include <vcl/menu.hxx>
-#include <cppuhelper/weak.hxx>
-
-// #110897#
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-//_________________________________________________________________________________________________________________
-// namespace
-//_________________________________________________________________________________________________________________
-
-namespace framework{
-
-class ReadMenuDocumentHandlerBase : public ::com::sun::star::xml::sax::XDocumentHandler,
- public ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
-{
- public:
- ReadMenuDocumentHandlerBase();
- virtual ~ReadMenuDocumentHandlerBase();
-
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
-
- // XDocumentHandler
- virtual void SAL_CALL startDocument(void)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException ) = 0;
-
- virtual void SAL_CALL endDocument(void)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException ) = 0;
-
- virtual void SAL_CALL startElement(
- const rtl::OUString& aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException ) = 0;
-
- virtual void SAL_CALL endElement(const rtl::OUString& aName)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException ) = 0;
-
- virtual void SAL_CALL characters(const rtl::OUString& aChars)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException ) = 0;
-
- virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget,
- const rtl::OUString& aData)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setDocumentLocator(
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- protected:
- ::rtl::OUString getErrorLineString();
-
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler> m_xReader;
-};
-
-
-class OReadMenuDocumentHandler : public ReadMenuDocumentHandlerBase
-{
- public:
- // #110897#
- OReadMenuDocumentHandler(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- MenuBar* pMenuBar );
- virtual ~OReadMenuDocumentHandler();
-
- // #110897#
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory();
-
- // XDocumentHandler
- virtual void SAL_CALL startDocument(void)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endDocument(void)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL startElement(
- const rtl::OUString& aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endElement(const rtl::OUString& aName)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL characters(const rtl::OUString& aChars)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- private:
- USHORT m_nItemId;
- int m_nElementDepth;
- sal_Bool m_bMenuBarMode;
- MenuBar* m_pMenuBar;
-
- // #110897#
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& mxServiceFactory;
-}; // OReadMenuDocumentHandler
-
-
-class OReadMenuBarHandler : public ReadMenuDocumentHandlerBase
-{
- public:
- // #110897#
- OReadMenuBarHandler(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- MenuBar* pMenuBar, USHORT* pItemId );
- virtual ~OReadMenuBarHandler();
-
- // #110897#
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory();
-
- // XDocumentHandler
- virtual void SAL_CALL startDocument(void)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endDocument(void)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL startElement(
- const rtl::OUString& aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endElement(const rtl::OUString& aName)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL characters(const rtl::OUString& aChars)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- private:
- USHORT* m_pItemId;
- int m_nElementDepth;
- sal_Bool m_bMenuMode;
- MenuBar* m_pMenuBar;
-
- // #110897#
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& mxServiceFactory;
-}; // OReadMenuBarHandler
-
-
-class OReadMenuHandler : public ReadMenuDocumentHandlerBase
-{
- public:
- OReadMenuHandler( Menu* pMenu, USHORT* pItemId );
- virtual ~OReadMenuHandler();
-
- // XDocumentHandler
- virtual void SAL_CALL startDocument(void)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endDocument(void)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL startElement(
- const rtl::OUString& aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endElement(const rtl::OUString& aName)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL characters(const rtl::OUString& aChars)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- private:
- USHORT* m_pItemId;
- int m_nElementDepth;
- sal_Bool m_bMenuPopupMode;
- Menu* m_pMenu;
-}; // OReadMenuHandler
-
-
-class OReadMenuPopupHandler : public ReadMenuDocumentHandlerBase
-{
- public:
- OReadMenuPopupHandler( Menu* pMenu, USHORT* pItemId );
- virtual ~OReadMenuPopupHandler();
-
- // XDocumentHandler
- virtual void SAL_CALL startDocument(void)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endDocument(void)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL startElement(
- const rtl::OUString& aName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endElement(const rtl::OUString& aName)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL characters(const rtl::OUString& aChars)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- private:
- enum NextElementClose { ELEM_CLOSE_NONE, ELEM_CLOSE_MENUITEM, ELEM_CLOSE_MENUSEPARATOR };
-
- int m_nElementDepth;
- USHORT* m_pItemId;
- sal_Bool m_bMenuMode;
- Menu* m_pMenu;
- NextElementClose m_nNextElementExpected;
-}; // OReadMenuPopupHandler
-
-
-class OWriteMenuDocumentHandler
-{
- public:
- OWriteMenuDocumentHandler(
- MenuBar* pMenu,
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > );
- virtual ~OWriteMenuDocumentHandler();
-
- void WriteMenuDocument() throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
- protected:
- virtual void WriteMenu( Menu* pMenu ) throw
- ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void WriteMenuItem( Menu* pMenu, USHORT nItemId );
- virtual void WriteMenuSeparator();
-
- MenuBar* m_pMenuBar;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList;
- ::rtl::OUString m_aAttributeType;
-};
-
-} // namespace framework
-
-#endif // #ifndef __FRAMEWORK_SERVICES_MENUDOCUMENTHANDLER_HXX_
diff --git a/framework/inc/services/popupmenucontrollerfactory.hxx b/framework/inc/services/popupmenucontrollerfactory.hxx
deleted file mode 100644
index bf1a4ee7c7..0000000000
--- a/framework/inc/services/popupmenucontrollerfactory.hxx
+++ /dev/null
@@ -1,97 +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: popupmenucontrollerfactory.hxx,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.
- *
- ************************************************************************/
-
-#ifndef __FRAMEWORK_SERVICES_POPUPMENUCONTROLLERFACTORY_HXX_
-#define __FRAMEWORK_SERVICES_POPUPMENUCONTROLLERFACTORY_HXX_
-
-//_________________________________________________________________________________________________________________
-// my own includes
-//_________________________________________________________________________________________________________________
-
-#include <threadhelp/threadhelpbase.hxx>
-#include <macros/generic.hxx>
-#include <macros/xinterface.hxx>
-#include <macros/xtypeprovider.hxx>
-#include <macros/xserviceinfo.hxx>
-#include <stdtypes.h>
-
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/frame/XUIControllerRegistration.hpp>
-
-//_________________________________________________________________________________________________________________
-// other includes
-//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
-#include <rtl/ustring.hxx>
-
-namespace framework
-{
-
-class ConfigurationAccess_PopupMenuControllerFactory;
-class PopupMenuControllerFactory : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public com::sun::star::lang::XMultiComponentFactory ,
- public ::com::sun::star::frame::XUIControllerRegistration ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
-{
- public:
- PopupMenuControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
- virtual ~PopupMenuControllerFactory();
-
- // XInterface, XTypeProvider, XServiceInfo
- DECLARE_XINTERFACE
- DECLARE_XTYPEPROVIDER
- DECLARE_XSERVICEINFO
-
- // XMultiComponentFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::rtl::OUString& aServiceSpecifier, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException);
-
- // XUIControllerRegistration
- virtual sal_Bool SAL_CALL hasController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModelName ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL registerController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModelName, const ::rtl::OUString& aControllerImplementationName ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deregisterController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModelName ) throw (::com::sun::star::uno::RuntimeException);
-
- private:
- sal_Bool m_bConfigRead;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ConfigurationAccess_PopupMenuControllerFactory* m_pConfigAccess;
-};
-
-} // namespace framework
-
-#endif // __FRAMEWORK_SERVICES_POPUPMENUCONTROLLERFACTORY_HXX_
diff --git a/framework/inc/services/saxnamespacefilter.hxx b/framework/inc/services/saxnamespacefilter.hxx
deleted file mode 100644
index 8aff13ff6f..0000000000
--- a/framework/inc/services/saxnamespacefilter.hxx
+++ /dev/null
@@ -1,119 +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: saxnamespacefilter.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 __FRAMEWORK_SERVICES_SAXNAMESPACEFILTER_HXX_
-#define __FRAMEWORK_SERVICES_SAXNAMESPACEFILTER_HXX_
-
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <threadhelp/threadhelpbase.hxx>
-#include <classes/xmlnamespaces.hxx>
-
-#ifndef _RTL_USTRING_
-#include <rtl/ustring>
-#endif
-#include <vcl/menu.hxx>
-#include <cppuhelper/weak.hxx>
-
-#include <stack>
-
-//_________________________________________________________________________________________________________________
-// namespace
-//_________________________________________________________________________________________________________________
-
-namespace framework
-{
-
-class SaxNamespaceFilter : public ::com::sun::star::xml::sax::XDocumentHandler,
- public ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
-{
- public:
- SaxNamespaceFilter( ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& rSax1DocumentHandler );
- virtual ~SaxNamespaceFilter();
-
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
-
- // XDocumentHandler
- virtual void SAL_CALL startDocument(void)
- throw ( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endDocument(void)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL startElement(
- const rtl::OUString& aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL endElement(const rtl::OUString& aName)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL characters(const rtl::OUString& aChars)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget,
- const rtl::OUString& aData)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setDocumentLocator(
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator)
- throw( ::com::sun::star::xml::sax::SAXException,
- ::com::sun::star::uno::RuntimeException );
-
- protected:
- typedef ::std::stack< XMLNamespaces > NamespaceStack;
-
- ::rtl::OUString getErrorLineString();
-
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler> xDocumentHandler;
- NamespaceStack m_aNamespaceStack;
- sal_Int32 m_nDepth;
-};
-
-}
-
-#endif // __FRAMEWORK_SERVICES_SAXNAMESPACEFILTER_HXX_
diff --git a/framework/inc/services/substitutepathvars.hxx b/framework/inc/services/substitutepathvars.hxx
index 8bd7c9db42..675d16ceb3 100644
--- a/framework/inc/services/substitutepathvars.hxx
+++ b/framework/inc/services/substitutepathvars.hxx
@@ -59,7 +59,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <rtl/ustring.hxx>
#include <unotools/configitem.hxx>
#include <tools/link.hxx>
@@ -236,11 +236,8 @@ struct ReSubstUserVarOrder
typedef std::list< ReSubstFixedVarOrder > ReSubstFixedVarOrderVector;
typedef std::list< ReSubstUserVarOrder > ReSubstUserVarOrderVector;
-class SubstitutePathVariables : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public com::sun::star::util::XStringSubstitution,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class SubstitutePathVariables : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper2< ::com::sun::star::util::XStringSubstitution, css::lang::XServiceInfo>
{
friend class SubstitutePathVariables_Impl;
@@ -249,8 +246,6 @@ class SubstitutePathVariables : public com::sun::star::lang::XTypeProvider ,
virtual ~SubstitutePathVariables();
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
// XStringSubstitution
diff --git a/framework/inc/services/uriabbreviation.hxx b/framework/inc/services/uriabbreviation.hxx
index 0b7abc93df..8be2c30dc1 100644
--- a/framework/inc/services/uriabbreviation.hxx
+++ b/framework/inc/services/uriabbreviation.hxx
@@ -40,22 +40,16 @@
#include <com/sun/star/util/XStringAbbreviation.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
namespace framework
{
-class UriAbbreviation:
- public ::com::sun::star::lang::XTypeProvider,
- public ::com::sun::star::lang::XServiceInfo,
- public ::com::sun::star::util::XStringAbbreviation,
- public ::cppu::OWeakObject // helper implements XInterface, XWeak
+class UriAbbreviation: public ::cppu::WeakImplHelper2< ::com::sun::star::util::XStringAbbreviation, css::lang::XServiceInfo>
{
public:
explicit UriAbbreviation(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context);
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
// ::com::sun::star::util::XStringAbbreviation:
diff --git a/framework/inc/services/urltransformer.hxx b/framework/inc/services/urltransformer.hxx
index ce0ce27635..df7b69dc91 100644
--- a/framework/inc/services/urltransformer.hxx
+++ b/framework/inc/services/urltransformer.hxx
@@ -54,7 +54,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
//_________________________________________________________________________________________________________________
// namespace
@@ -84,11 +84,7 @@ namespace framework{
OWeakObject
*//*-*************************************************************************************************************/
-class URLTransformer : public css::lang::XTypeProvider ,
- public css::lang::XServiceInfo ,
- public css::util::XURLTransformer ,
- public ThreadHelpBase ,
- public ::cppu::OWeakObject
+class URLTransformer : public ::cppu::WeakImplHelper2< ::com::sun::star::util::XURLTransformer, css::lang::XServiceInfo>
{
//-------------------------------------------------------------------------------------------------------------
// public methods
@@ -132,8 +128,6 @@ class URLTransformer : public css::lang::XTypeProvider ,
// XInterface, XTypeProvider, XServiceInfo
//---------------------------------------------------------------------------------------------------------
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
//---------------------------------------------------------------------------------------------------------
diff --git a/framework/inc/tabwin/tabwinfactory.hxx b/framework/inc/tabwin/tabwinfactory.hxx
index 46c62d177f..28b2098943 100644
--- a/framework/inc/tabwin/tabwinfactory.hxx
+++ b/framework/inc/tabwin/tabwinfactory.hxx
@@ -56,26 +56,21 @@
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <rtl/ustring.hxx>
namespace framework
{
-class TabWinFactory : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public com::sun::star::lang::XSingleComponentFactory ,
- protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class TabWinFactory : protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleComponentFactory, com::sun::star::lang::XServiceInfo>
{
public:
TabWinFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
virtual ~TabWinFactory();
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
DECLARE_XSERVICEINFO
- FWK_DECLARE_XTYPEPROVIDER
// XSingleComponentFactory
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
diff --git a/framework/inc/uiconfiguration/imagemanager.hxx b/framework/inc/uiconfiguration/imagemanager.hxx
index 997826b10a..b7326f7e11 100644
--- a/framework/inc/uiconfiguration/imagemanager.hxx
+++ b/framework/inc/uiconfiguration/imagemanager.hxx
@@ -38,6 +38,7 @@
#include <vector>
#include <list>
#include <hash_map>
+#include <memory>
//_________________________________________________________________________________________________________________
// my own includes
@@ -68,7 +69,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <rtl/ustring.hxx>
@@ -80,16 +81,12 @@
namespace framework
{
- class ImageManager : public com::sun::star::lang::XTypeProvider ,
- public css::lang::XServiceInfo ,
- public ::com::sun::star::ui::XImageManager ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+ class ImageManagerImpl;
+ class ImageManager : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper2< ::com::sun::star::ui::XImageManager, css::lang::XServiceInfo>
{
public:
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
ImageManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager );
@@ -127,54 +124,7 @@ namespace framework
void setStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::uno::RuntimeException);
private:
- typedef std::hash_map< rtl::OUString,
- sal_Bool,
- OUStringHashCode,
- ::std::equal_to< ::rtl::OUString > > ImageNameMap;
-
- // private data types
- enum Layer
- {
- LAYER_DEFAULT,
- LAYER_USERDEFINED,
- LAYER_COUNT
- };
-
- enum NotifyOp
- {
- NotifyOp_Remove,
- NotifyOp_Insert,
- NotifyOp_Replace
- };
-
- typedef ::std::vector< ::com::sun::star::ui::ConfigurationEvent > ConfigEventNotifyContainer;
-
- // private methods
- void implts_initialize();
- void implts_notifyContainerListener( const ::com::sun::star::ui::ConfigurationEvent& aEvent, NotifyOp eOp );
- ImageList* implts_getUserImageList( ImageType nImageType );
- sal_Bool implts_loadUserImages( ImageType nImageType,
- const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xUserImageStorage,
- const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xUserBitmapsStorage );
- sal_Bool implts_storeUserImages( ImageType nImageType,
- const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xUserImageStorage,
- const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xUserBitmapsStorage );
-
- com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserConfigStorage;
- com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserImageStorage;
- com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserBitmapsStorage;
- bool m_bReadOnly;
- bool m_bInitialized;
- bool m_bModified;
- bool m_bConfigRead;
- bool m_bDisposed;
- rtl::OUString m_aXMLPostfix;
- rtl::OUString m_aModuleIdentifier;
- rtl::OUString m_aResourceString;
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
- ImageList* m_pUserImageList[ImageType_COUNT];
- bool m_bUserImageListModified[ImageType_COUNT];
+ ::std::auto_ptr<ImageManagerImpl> m_pImpl;
};
}
diff --git a/framework/inc/uiconfiguration/moduleimagemanager.hxx b/framework/inc/uiconfiguration/moduleimagemanager.hxx
index b19ff34bb3..5e24d2a377 100644
--- a/framework/inc/uiconfiguration/moduleimagemanager.hxx
+++ b/framework/inc/uiconfiguration/moduleimagemanager.hxx
@@ -38,6 +38,7 @@
#include <vector>
#include <list>
#include <hash_map>
+#include <memory>
//_________________________________________________________________________________________________________________
// my own includes
@@ -68,7 +69,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <rtl/ustring.hxx>
@@ -80,64 +81,12 @@
namespace framework
{
- class CmdImageList
- {
- public:
- CmdImageList( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
- const ::rtl::OUString& aModuleIdentifier );
- virtual ~CmdImageList();
-
- virtual Image getImageFromCommandURL( sal_Int16 nImageType, const rtl::OUString& rCommandURL );
- virtual bool hasImage( sal_Int16 nImageType, const rtl::OUString& rCommandURL );
- virtual ::std::vector< rtl::OUString >& getImageNames();
- virtual ::std::vector< rtl::OUString >& getImageCommandNames();
-
- protected:
- void impl_fillCommandToImageNameMap();
- ImageList* impl_getImageList( sal_Int16 nImageType );
- std::vector< ::rtl::OUString >& impl_getImageNameVector();
- std::vector< ::rtl::OUString >& impl_getImageCommandNameVector();
+ class ImageManagerImpl;
- private:
- sal_Bool m_bVectorInit;
- rtl::OUString m_aModuleIdentifier;
- ImageList* m_pImageList[ImageType_COUNT];
- CommandToImageNameMap m_aCommandToImageNameMap;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ::std::vector< rtl::OUString > m_aImageNameVector;
- ::std::vector< rtl::OUString > m_aImageCommandNameVector;
- sal_Int16 m_nSymbolsStyle;
- };
-
- class GlobalImageList : public CmdImageList, public rtl::IReference
+ class ModuleImageManager : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper1< ::com::sun::star::ui::XImageManager>
{
public:
- GlobalImageList( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
- virtual ~GlobalImageList();
-
- virtual Image getImageFromCommandURL( sal_Int16 nImageType, const rtl::OUString& rCommandURL );
- virtual bool hasImage( sal_Int16 nImageType, const rtl::OUString& rCommandURL );
- virtual ::std::vector< rtl::OUString >& getImageNames();
- virtual ::std::vector< rtl::OUString >& getImageCommandNames();
-
- // ÍReference
- virtual oslInterlockedCount SAL_CALL acquire();
- virtual oslInterlockedCount SAL_CALL release();
-
- private:
- oslInterlockedCount m_nRefCount;
- };
-
- class ModuleImageManager : public com::sun::star::lang::XTypeProvider ,
- public ::com::sun::star::ui::XImageManager ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
- {
- public:
- // XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
ModuleImageManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager );
virtual ~ModuleImageManager();
@@ -170,59 +119,7 @@ namespace framework
virtual sal_Bool SAL_CALL isReadOnly() throw (::com::sun::star::uno::RuntimeException);
private:
- typedef std::hash_map< rtl::OUString,
- sal_Bool,
- OUStringHashCode,
- ::std::equal_to< ::rtl::OUString > > ImageNameMap;
-
- // private data types
- enum Layer
- {
- LAYER_DEFAULT,
- LAYER_USERDEFINED,
- LAYER_COUNT
- };
-
- enum NotifyOp
- {
- NotifyOp_Remove,
- NotifyOp_Insert,
- NotifyOp_Replace
- };
-
- typedef ::std::vector< ::com::sun::star::ui::ConfigurationEvent > ConfigEventNotifyContainer;
-
- // private methods
- void implts_initialize();
- void implts_notifyContainerListener( const ::com::sun::star::ui::ConfigurationEvent& aEvent, NotifyOp eOp );
- const rtl::Reference< GlobalImageList >& implts_getGlobalImageList();
- CmdImageList* implts_getDefaultImageList();
- ImageList* implts_getUserImageList( ImageType nImageType );
- sal_Bool implts_loadUserImages( ImageType nImageType,
- const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xUserImageStorage,
- const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xUserBitmapsStorage );
- sal_Bool implts_storeUserImages( ImageType nImageType,
- const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xUserImageStorage,
- const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xUserBitmapsStorage );
-
- com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserConfigStorage;
- com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserImageStorage;
- com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserBitmapsStorage;
- bool m_bReadOnly;
- bool m_bInitialized;
- bool m_bModified;
- bool m_bConfigRead;
- bool m_bDisposed;
- rtl::OUString m_aXMLPostfix;
- rtl::OUString m_aModuleIdentifier;
- rtl::OUString m_aResourceString;
- com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject > m_xUserRootCommit;
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
- rtl::Reference< GlobalImageList > m_pGlobalImageList;
- CmdImageList* m_pDefaultImageList;
- ImageList* m_pUserImageList[ImageType_COUNT];
- bool m_bUserImageListModified[ImageType_COUNT];
+ ::std::auto_ptr<ImageManagerImpl> m_pImpl;
};
}
diff --git a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx
index 05fd57f3d8..37584d5a3b 100644
--- a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx
+++ b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx
@@ -38,6 +38,7 @@
#include <vector>
#include <list>
#include <hash_map>
+#include <memory>
//_________________________________________________________________________________________________________________
// my own includes
@@ -77,6 +78,7 @@
namespace framework
{
+ class UIConfigurationManagerImpl;
class ModuleUIConfigurationManager : public com::sun::star::lang::XTypeProvider ,
public com::sun::star::lang::XServiceInfo ,
public com::sun::star::lang::XComponent ,
@@ -85,7 +87,6 @@ namespace framework
public ::com::sun::star::ui::XUIConfigurationManager ,
public ::com::sun::star::ui::XModuleUIConfigurationManager ,
public ::com::sun::star::ui::XUIConfigurationPersistence ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
public ::cppu::OWeakObject
{
public:
@@ -134,94 +135,7 @@ namespace framework
virtual sal_Bool SAL_CALL isReadOnly() throw (::com::sun::star::uno::RuntimeException);
private:
- // private data types
- enum Layer
- {
- LAYER_DEFAULT,
- LAYER_USERDEFINED,
- LAYER_COUNT
- };
-
- enum NotifyOp
- {
- NotifyOp_Remove,
- NotifyOp_Insert,
- NotifyOp_Replace
- };
-
- struct UIElementInfo
- {
- UIElementInfo( const rtl::OUString& rResourceURL, const rtl::OUString& rUIName ) :
- aResourceURL( rResourceURL), aUIName( rUIName ) {}
- rtl::OUString aResourceURL;
- rtl::OUString aUIName;
- };
-
- struct UIElementData
- {
- UIElementData() : bModified( false ), bDefault( true ), bDefaultNode( true ) {};
-
- rtl::OUString aResourceURL;
- rtl::OUString aName;
- bool bModified; // has been changed since last storing
- bool bDefault; // default settings
- bool bDefaultNode; // this is a default layer element data
- com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > xSettings;
- };
-
- struct UIElementType;
- friend struct UIElementType;
- typedef ::std::hash_map< rtl::OUString, UIElementData, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementDataHashMap;
-
- struct UIElementType
- {
- UIElementType() : bModified( false ),
- bLoaded( false ),
- bDefaultLayer( false ),
- nElementType( ::com::sun::star::ui::UIElementType::UNKNOWN ) {}
-
-
- bool bModified;
- bool bLoaded;
- bool bDefaultLayer;
- sal_Int16 nElementType;
- UIElementDataHashMap aElementsHashMap;
- com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage;
- };
-
- typedef ::std::vector< UIElementType > UIElementTypesVector;
- typedef ::std::vector< ::com::sun::star::ui::ConfigurationEvent > ConfigEventNotifyContainer;
- typedef ::std::hash_map< rtl::OUString, UIElementInfo, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementInfoHashMap;
-
- // private methods
- void impl_Initialize();
- void implts_notifyContainerListener( const ::com::sun::star::ui::ConfigurationEvent& aEvent, NotifyOp eOp );
- void impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType );
- void impl_preloadUIElementTypeList( Layer eLayer, sal_Int16 nElementType );
- UIElementData* impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad = true );
- void impl_requestUIElementData( sal_Int16 nElementType, Layer eLayer, UIElementData& aUIElementData );
- void impl_storeElementTypeData( com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage, UIElementType& rElementType, bool bResetModifyState = true );
- void impl_resetElementTypeData( UIElementType& rUserElementType, UIElementType& rDefaultElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer );
- void impl_reloadElementTypeData( UIElementType& rUserElementType, UIElementType& rDefaultElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer );
-
- UIElementTypesVector m_aUIElements[LAYER_COUNT];
- PresetHandler* m_pStorageHandler[::com::sun::star::ui::UIElementType::COUNT];
- com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xDefaultConfigStorage;
- com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserConfigStorage;
- bool m_bReadOnly;
- bool m_bInitialized;
- bool m_bModified;
- bool m_bConfigRead;
- bool m_bDisposed;
- rtl::OUString m_aXMLPostfix;
- rtl::OUString m_aPropUIName;
- rtl::OUString m_aPropResourceURL;
- rtl::OUString m_aModuleIdentifier;
- rtl::OUString m_aModuleShortName;
- com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject > m_xUserRootCommit;
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
- com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xModuleImageManager;
+ ::std::auto_ptr<UIConfigurationManagerImpl> m_pImpl;
};
}
diff --git a/framework/inc/uiconfiguration/uicategorydescription.hxx b/framework/inc/uiconfiguration/uicategorydescription.hxx
index 825dff1145..0990715390 100644
--- a/framework/inc/uiconfiguration/uicategorydescription.hxx
+++ b/framework/inc/uiconfiguration/uicategorydescription.hxx
@@ -43,9 +43,8 @@
//_________________________________________________________________________________________________________________
#include <threadhelp/threadhelpbase.hxx>
#include <macros/generic.hxx>
-#include <macros/xinterface.hxx>
-#include <macros/xtypeprovider.hxx>
#include <macros/xserviceinfo.hxx>
+#include <uielement/uicommanddescription.hxx>
#include <stdtypes.h>
//_________________________________________________________________________________________________________________
@@ -59,61 +58,18 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
-#include <rtl/ustring.hxx>
namespace framework
{
-
-class ConfigurationAccess_UICategory;
-class UICategoryDescription : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public com::sun::star::container::XNameAccess ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class UICategoryDescription : public UICommandDescription
{
public:
UICategoryDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
virtual ~UICategoryDescription();
- // XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
-
- // XNameAccess
- 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);
-
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
- throw (::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);
-
- typedef ::std::hash_map< ::rtl::OUString,
- ::rtl::OUString,
- OUStringHashCode,
- ::std::equal_to< ::rtl::OUString > > ModuleToCategoryFileMap;
-
- typedef ::std::hash_map< ::rtl::OUString,
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >,
- OUStringHashCode,
- ::std::equal_to< ::rtl::OUString > > CategoryHashMap;
-
private:
- sal_Bool m_bConfigRead;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ModuleToCategoryFileMap m_aModuleToCategoryFileMap;
- CategoryHashMap m_aCategoryHashMap;
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xGenericCategories;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > impl_createConfigAccess(const ::rtl::OUString& _sName);
};
} // namespace framework
diff --git a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx
index 66ebbd0f13..d907d64c83 100644
--- a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx
+++ b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx
@@ -38,6 +38,7 @@
#include <vector>
#include <list>
#include <hash_map>
+#include <memory>
//_________________________________________________________________________________________________________________
// my own includes
@@ -77,6 +78,7 @@
namespace framework
{
+ class UIConfigurationManagerImpl;
class UIConfigurationManager : public com::sun::star::lang::XTypeProvider ,
public com::sun::star::lang::XServiceInfo ,
public com::sun::star::lang::XComponent ,
@@ -84,7 +86,6 @@ namespace framework
public ::com::sun::star::ui::XUIConfigurationManager ,
public ::com::sun::star::ui::XUIConfigurationPersistence ,
public ::com::sun::star::ui::XUIConfigurationStorage ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
public ::cppu::OWeakObject
{
public:
@@ -130,83 +131,7 @@ namespace framework
virtual sal_Bool SAL_CALL hasStorage() throw (::com::sun::star::uno::RuntimeException);
private:
- // private data types
- enum NotifyOp
- {
- NotifyOp_Remove,
- NotifyOp_Insert,
- NotifyOp_Replace
- };
-
- struct UIElementInfo
- {
- UIElementInfo( const rtl::OUString& rResourceURL, const rtl::OUString& rUIName ) :
- aResourceURL( rResourceURL), aUIName( rUIName ) {}
- rtl::OUString aResourceURL;
- rtl::OUString aUIName;
- };
-
- struct UIElementData
- {
- UIElementData() : bModified( false ), bDefault( true ) {};
-
- rtl::OUString aResourceURL;
- rtl::OUString aName;
- bool bModified; // has been changed since last storing
- bool bDefault; // default settings
- com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > xSettings;
- };
-
- struct UIElementType;
- friend struct UIElementType;
- typedef ::std::hash_map< rtl::OUString, UIElementData, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementDataHashMap;
-
- struct UIElementType
- {
- UIElementType() : bModified( false ),
- bLoaded( false ),
- bDefaultLayer( false ),
- nElementType( ::com::sun::star::ui::UIElementType::UNKNOWN ) {}
-
-
- bool bModified;
- bool bLoaded;
- bool bDefaultLayer;
- sal_Int16 nElementType;
- UIElementDataHashMap aElementsHashMap;
- com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage;
- };
-
- typedef ::std::vector< UIElementType > UIElementTypesVector;
- typedef ::std::vector< ::com::sun::star::ui::ConfigurationEvent > ConfigEventNotifyContainer;
- typedef ::std::hash_map< rtl::OUString, UIElementInfo, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementInfoHashMap;
-
- // private methods
- void impl_Initialize();
- void implts_notifyContainerListener( const ::com::sun::star::ui::ConfigurationEvent& aEvent, NotifyOp eOp );
- void impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType );
- void impl_preloadUIElementTypeList( sal_Int16 nElementType );
- UIElementData* impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad = true );
- void impl_requestUIElementData( sal_Int16 nElementType, UIElementData& aUIElementData );
- void impl_storeElementTypeData( com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xStorage, UIElementType& rElementType, bool bResetModifyState = true );
- void impl_resetElementTypeData( UIElementType& rDocElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer );
- void impl_reloadElementTypeData( UIElementType& rDocElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer );
-
- UIElementTypesVector m_aUIElements;
- com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xDocConfigStorage;
- bool m_bReadOnly;
- bool m_bInitialized;
- bool m_bModified;
- bool m_bConfigRead;
- bool m_bDisposed;
- rtl::OUString m_aXMLPostfix;
- rtl::OUString m_aPropUIName;
- rtl::OUString m_aPropResourceURL;
- rtl::OUString m_aModuleIdentifier;
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
- com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xImageManager;
- com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xAccConfig;
+ ::std::auto_ptr<UIConfigurationManagerImpl> m_pImpl;
};
}
diff --git a/framework/inc/uiconfiguration/windowstateconfiguration.hxx b/framework/inc/uiconfiguration/windowstateconfiguration.hxx
index a4aba0a402..7d78e981dc 100644
--- a/framework/inc/uiconfiguration/windowstateconfiguration.hxx
+++ b/framework/inc/uiconfiguration/windowstateconfiguration.hxx
@@ -59,7 +59,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <rtl/ustring.hxx>
namespace framework
@@ -83,11 +83,8 @@ namespace framework
#define WINDOWSTATE_PROPERTY_CONTEXTACTIVE "ContextActive"
class ConfigurationAccess_Windows;
-class WindowStateConfiguration : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public com::sun::star::container::XNameAccess ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class WindowStateConfiguration : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameAccess, css::lang::XServiceInfo>
{
public:
WindowStateConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
diff --git a/framework/inc/uielement/comboboxtoolbarcontroller.hxx b/framework/inc/uielement/comboboxtoolbarcontroller.hxx
index 48943f23b9..ffa2d64810 100644
--- a/framework/inc/uielement/comboboxtoolbarcontroller.hxx
+++ b/framework/inc/uielement/comboboxtoolbarcontroller.hxx
@@ -77,9 +77,6 @@ class ComboboxToolbarController : public IComboBoxListener,
// XComponent
virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
- // XToolbarController
- virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
-
// IComboBoxListener
virtual void Select();
virtual void DoubleClick();
@@ -91,6 +88,7 @@ class ComboboxToolbarController : public IComboBoxListener,
protected:
virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const;
private:
ComboBoxControl* m_pComboBox;
diff --git a/framework/inc/uielement/complextoolbarcontroller.hxx b/framework/inc/uielement/complextoolbarcontroller.hxx
index 97e13c60ab..1c120fe71e 100644
--- a/framework/inc/uielement/complextoolbarcontroller.hxx
+++ b/framework/inc/uielement/complextoolbarcontroller.hxx
@@ -95,6 +95,7 @@ class ComplexToolbarController : public svt::ToolboxController
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rInfo );
virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ) = 0;
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const;
const ::com::sun::star::util::URL& getInitializedURL();
void notifyFocusGet();
void notifyFocusLost();
diff --git a/framework/inc/uielement/controlmenucontroller.hxx b/framework/inc/uielement/controlmenucontroller.hxx
index 6f1802fd15..1ab4391ddf 100644
--- a/framework/inc/uielement/controlmenucontroller.hxx
+++ b/framework/inc/uielement/controlmenucontroller.hxx
@@ -72,7 +72,6 @@ namespace framework
DECLARE_XSERVICEINFO
// XPopupMenuController
- virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException);
// XInitialization
@@ -82,15 +81,15 @@ namespace framework
virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
// XMenuListener
- virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
// XEventListener
virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
private:
+ virtual void impl_setPopupMenu();
+ virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL);
+
class UrlToDispatchMap : public ::std::hash_map< ::rtl::OUString,
com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >,
OUStringHashCode,
diff --git a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx
index 8efa6c2848..a5002ec624 100644
--- a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx
+++ b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx
@@ -75,9 +75,6 @@ class DropdownToolbarController : public IListBoxListener,
// XComponent
virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
- // XToolbarController
- virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
-
// IComboBoxListener
virtual void Select();
virtual void DoubleClick();
@@ -87,6 +84,7 @@ class DropdownToolbarController : public IListBoxListener,
protected:
virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const;
private:
ListBoxControl* m_pListBoxControl;
diff --git a/framework/inc/uielement/edittoolbarcontroller.hxx b/framework/inc/uielement/edittoolbarcontroller.hxx
index a81c0d82b5..385f5cc6f4 100644
--- a/framework/inc/uielement/edittoolbarcontroller.hxx
+++ b/framework/inc/uielement/edittoolbarcontroller.hxx
@@ -75,9 +75,6 @@ class EditToolbarController : public IEditListener,
// XComponent
virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
- // XToolbarController
- virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
-
// IEditListener
virtual void Modify();
virtual void KeyInput( const KeyEvent& rKEvt );
@@ -87,6 +84,7 @@ class EditToolbarController : public IEditListener,
protected:
virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const;
private:
EditControl* m_pEditControl;
diff --git a/framework/inc/uielement/fontmenucontroller.hxx b/framework/inc/uielement/fontmenucontroller.hxx
index ec315fe6e7..4746d09d97 100644
--- a/framework/inc/uielement/fontmenucontroller.hxx
+++ b/framework/inc/uielement/fontmenucontroller.hxx
@@ -69,25 +69,20 @@ namespace framework
DECLARE_XSERVICEINFO
// XPopupMenuController
- virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException);
-
- // XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
// XStatusListener
virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
// XMenuListener
- virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
-
+
// XEventListener
virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
private:
+ virtual void impl_setPopupMenu();
+ virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL);
void fillPopupMenu( const com::sun::star::uno::Sequence< ::rtl::OUString >& rFontNameSeq, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
rtl::OUString m_aFontFamilyName;
diff --git a/framework/inc/uielement/fontsizemenucontroller.hxx b/framework/inc/uielement/fontsizemenucontroller.hxx
index 2367d7c6ac..b111a02c35 100644
--- a/framework/inc/uielement/fontsizemenucontroller.hxx
+++ b/framework/inc/uielement/fontsizemenucontroller.hxx
@@ -70,25 +70,17 @@ namespace framework
DECLARE_XSERVICEINFO
// XPopupMenuController
- virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException);
- // XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
// XStatusListener
virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
- // XMenuListener
- virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
-
// XEventListener
virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
private:
+ virtual void impl_setPopupMenu();
+ virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL);
void setCurHeight( long nHeight, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
rtl::OUString retrievePrinterName( com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame );
diff --git a/framework/inc/uielement/footermenucontroller.hxx b/framework/inc/uielement/footermenucontroller.hxx
index 48bef39df0..e4669aa236 100644
--- a/framework/inc/uielement/footermenucontroller.hxx
+++ b/framework/inc/uielement/footermenucontroller.hxx
@@ -34,65 +34,26 @@
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
-
-#include <helper/popupmenucontrollerbase.hxx>
-#include <stdtypes.h>
-
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XDispatch.hpp>
-#include <com/sun/star/frame/XStatusListener.hpp>
-#include <com/sun/star/frame/XPopupMenuController.hpp>
-#include <com/sun/star/frame/status/Verb.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-
-//_________________________________________________________________________________________________________________
-// includes of other projects
-//_________________________________________________________________________________________________________________
-#include <toolkit/awt/vclxmenu.hxx>
-#include <cppuhelper/weak.hxx>
-#include <rtl/ustring.hxx>
+#include <uielement/headermenucontroller.hxx>
namespace framework
{
- class FooterMenuController : public PopupMenuControllerBase
+ class FooterMenuController : public HeaderMenuController
{
public:
FooterMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
virtual ~FooterMenuController();
// XServiceInfo
- DECLARE_XSERVICEINFO
-
- // XPopupMenuController
- virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException);
-
- // XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XStatusListener
- virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
-
- // XMenuListener
- virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
-
- // XEventListener
- virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
-
- private:
- void fillPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
+ virtual ::rtl::OUString SAL_CALL getImplementationName ( ) throw( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService ( const ::rtl::OUString& sServiceName ) throw( css::uno::RuntimeException );
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames ( ) throw( css::uno::RuntimeException );
+ /* Helper for XServiceInfo */
+ static css::uno::Sequence< ::rtl::OUString > SAL_CALL impl_getStaticSupportedServiceNames( );
+ static ::rtl::OUString SAL_CALL impl_getStaticImplementationName ( );
+ /* Helper for registry */
+ static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception );
+ static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
};
}
diff --git a/framework/inc/uielement/headermenucontroller.hxx b/framework/inc/uielement/headermenucontroller.hxx
index f4e1d2c1dc..8440d5f706 100644
--- a/framework/inc/uielement/headermenucontroller.hxx
+++ b/framework/inc/uielement/headermenucontroller.hxx
@@ -64,35 +64,27 @@ namespace framework
class HeaderMenuController : public PopupMenuControllerBase
{
public:
- HeaderMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+ HeaderMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool _bFooter = sal_False );
virtual ~HeaderMenuController();
// XServiceInfo
DECLARE_XSERVICEINFO
// XPopupMenuController
- virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException);
- // XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
// XStatusListener
virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
- // XMenuListener
- virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
-
// XEventListener
virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
private:
+ virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL);
void fillPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
+ bool m_bFooter;
};
}
diff --git a/framework/inc/uielement/imagebuttontoolbarcontroller.hxx b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx
index b621822e76..ce92d25d3b 100644
--- a/framework/inc/uielement/imagebuttontoolbarcontroller.hxx
+++ b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx
@@ -61,9 +61,6 @@ class ImageButtonToolbarController : public ComplexToolbarController
// XComponent
virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
- // XToolbarController
- virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
-
protected:
virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand );
diff --git a/framework/inc/uielement/itemcontainer.hxx b/framework/inc/uielement/itemcontainer.hxx
index a4c48ba95a..e1933851c0 100644
--- a/framework/inc/uielement/itemcontainer.hxx
+++ b/framework/inc/uielement/itemcontainer.hxx
@@ -52,7 +52,7 @@
// other includes
//_________________________________________________________________________________________________________________
#include <rtl/ustring.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <vector>
@@ -60,10 +60,7 @@ namespace framework
{
class ConstItemContainer;
-class ItemContainer : public ::com::sun::star::lang::XTypeProvider ,
- public ::com::sun::star::container::XIndexContainer ,
- public ::com::sun::star::lang::XUnoTunnel ,
- public ::cppu::OWeakObject
+class ItemContainer : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XIndexContainer>
{
friend class ConstItemContainer;
@@ -76,9 +73,6 @@ class ItemContainer : public ::com::sun::star::lang::XTypeProvider ,
//---------------------------------------------------------------------------------------------------------
// XInterface, XTypeProvider
//---------------------------------------------------------------------------------------------------------
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
// XUnoTunnel
static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
static ItemContainer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
diff --git a/framework/inc/uielement/langselectionmenucontroller.hxx b/framework/inc/uielement/langselectionmenucontroller.hxx
index 505706d489..fcd250a37f 100644
--- a/framework/inc/uielement/langselectionmenucontroller.hxx
+++ b/framework/inc/uielement/langselectionmenucontroller.hxx
@@ -72,7 +72,6 @@ namespace framework
DECLARE_XSERVICEINFO
// XPopupMenuController
- virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException);
// XInitialization
@@ -81,16 +80,12 @@ namespace framework
// XStatusListener
virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
- // XMenuListener
- virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
-
// XEventListener
virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
private:
+ virtual void impl_setPopupMenu();
+ virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL);
enum Mode
{
MODE_SetLanguageSelectionMenu,
diff --git a/framework/inc/uielement/langselectionstatusbarcontroller.hxx b/framework/inc/uielement/langselectionstatusbarcontroller.hxx
index 9cba647195..a4862b5b5e 100644
--- a/framework/inc/uielement/langselectionstatusbarcontroller.hxx
+++ b/framework/inc/uielement/langselectionstatusbarcontroller.hxx
@@ -87,7 +87,8 @@ class LangSelectionStatusbarController : public svt::StatusbarController
virtual ~LangSelectionStatusbarController() {}
LangSelectionStatusbarController(LangSelectionStatusbarController &); // not defined
void operator =(LangSelectionStatusbarController &); // not defined
-
+
+
sal_Bool m_bShowMenu;
sal_Int16 m_nScriptType;
::rtl::OUString m_aCurrentLanguage;
diff --git a/framework/inc/uielement/macrosmenucontroller.hxx b/framework/inc/uielement/macrosmenucontroller.hxx
index 8d4c048104..8d5b3e14f1 100644
--- a/framework/inc/uielement/macrosmenucontroller.hxx
+++ b/framework/inc/uielement/macrosmenucontroller.hxx
@@ -71,25 +71,14 @@ namespace framework
// XServiceInfo
DECLARE_XSERVICEINFO
- // XPopupMenuController
- virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
-
- // XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
// XStatusListener
virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
- // XMenuListener
- virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
-
// XEventListener
virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
private:
+ virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL);
void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
String RetrieveLabelFromCommand( const String& aCmdURL );
void addScriptItems( PopupMenu* pPopupMenu, USHORT startItemId );
diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx
index 7fba779a5e..0832686000 100644
--- a/framework/inc/uielement/menubarmanager.hxx
+++ b/framework/inc/uielement/menubarmanager.hxx
@@ -103,6 +103,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
MenuBarManager(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
const ::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer,
AddonMenu* pAddonMenu,
sal_Bool bDelete,
sal_Bool bDeleteChildren );
@@ -111,6 +112,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
MenuBarManager(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
const ::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer,
AddonPopupMenu* pAddonMenu,
sal_Bool bDelete,
sal_Bool bDeleteChildren );
@@ -120,6 +122,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
MenuBarManager(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider,
const rtl::OUString& aModuleIdentifier,
Menu* pMenu,
@@ -192,11 +195,12 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
void RequestImages();
void RetrieveImageManagers();
static sal_Bool MustBeHidden( PopupMenu* pPopupMenu, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& rTransformer );
-
+ String RetrieveLabelFromCommand( const String& aCmdURL );
+
private:
- String RetrieveLabelFromCommand( const String& aCmdURL );
- void UpdateSpecialFileMenu( Menu* pMenu );
- void UpdateSpecialWindowMenu( Menu* pMenu );
+
+
+
void Destroy();
struct MenuItemHandler
@@ -235,6 +239,10 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
MenuItemHandler* GetMenuItemHandler( USHORT nItemId );
sal_Bool CreatePopupMenuController( MenuItemHandler* pMenuItemHandler );
+ void AddMenu(MenuBarManager* pSubMenuManager,const ::rtl::OUString& _sItemCommand,USHORT _nItemId);
+ USHORT FillItemCommand(::rtl::OUString& _rItemCommand,Menu* _pMenu,USHORT _nIndex) const;
+ void Init(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,AddonMenu* pAddonMenu,sal_Bool bDelete,sal_Bool bDeleteChildren,bool _bHandlePopUp = false);
+ void SetHdl();
sal_Bool m_bDisposed : 1,
m_bInitialized : 1,
@@ -244,9 +252,9 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
m_bIsBookmarkMenu : 1,
m_bWasHiContrast : 1,
m_bShowMenuImages : 1;
- sal_Bool m_bModuleIdentified : 1,
- m_bRetrieveImages : 1,
+ sal_Bool m_bRetrieveImages : 1,
m_bAcceleratorCfg : 1;
+ sal_Bool m_bModuleIdentified;
::rtl::OUString m_aMenuItemCommand;
::rtl::OUString m_aModuleIdentifier;
Menu* m_pVCLMenu;
@@ -262,6 +270,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager;
::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xGlobalAcceleratorManager;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xDeferedItemContainer;
sal_Int16 m_nSymbolsStyle;
Timer m_aAsyncSettingsTimer;
diff --git a/framework/inc/uielement/menubarwrapper.hxx b/framework/inc/uielement/menubarwrapper.hxx
index 48596269aa..f10c66afe5 100644
--- a/framework/inc/uielement/menubarwrapper.hxx
+++ b/framework/inc/uielement/menubarwrapper.hxx
@@ -74,9 +74,6 @@ class MenuBarWrapper : public UIConfigElementWrapperBase,
FWK_DECLARE_XINTERFACE
FWK_DECLARE_XTYPEPROVIDER
- // #110897#
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory();
-
MenuBarManager* GetMenuBarManager() const { return static_cast< MenuBarManager* >( m_xMenuBarManager.get() ); }
void InvalidatePopupControllerCache() { m_bRefreshPopupControllerCache = sal_True; }
@@ -91,8 +88,6 @@ class MenuBarWrapper : public UIConfigElementWrapperBase,
// XUIElementSettings
virtual void SAL_CALL updateSettings( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getSettings( sal_Bool bWriteable ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& UISettings ) throw (::com::sun::star::uno::RuntimeException);
// XElementAccess
virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException);
@@ -104,11 +99,11 @@ class MenuBarWrapper : public UIConfigElementWrapperBase,
virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
private:
+ virtual void impl_fillNewData();
void fillPopupControllerCache();
sal_Bool m_bRefreshPopupControllerCache : 1;
com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xMenuBarManager;
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& mxServiceFactory;
PopupControllerCache m_aPopupControllerCache;
};
diff --git a/framework/inc/uielement/newmenucontroller.hxx b/framework/inc/uielement/newmenucontroller.hxx
index 8f8c265b59..bdeb5bc871 100644
--- a/framework/inc/uielement/newmenucontroller.hxx
+++ b/framework/inc/uielement/newmenucontroller.hxx
@@ -51,7 +51,6 @@
#include <com/sun/star/frame/XStatusListener.hpp>
#include <com/sun/star/frame/XPopupMenuController.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
//_________________________________________________________________________________________________________________
@@ -83,11 +82,7 @@ namespace framework
// XServiceInfo
DECLARE_XSERVICEINFO
-
- // XPopupMenuController
- virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
-
+
// XInitialization
virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
@@ -95,10 +90,8 @@ namespace framework
virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
// XMenuListener
- virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
// XEventListener
virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
@@ -106,6 +99,7 @@ namespace framework
DECL_STATIC_LINK( NewMenuController, ExecuteHdl_Impl, NewDocument* );
private:
+ virtual void impl_setPopupMenu();
struct AddInfo
{
rtl::OUString aTargetFrame;
@@ -133,7 +127,6 @@ namespace framework
rtl::OUString m_aTargetFrame;
rtl::OUString m_aModuleIdentifier;
rtl::OUString m_aEmptyDocURL;
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xDocAcceleratorManager;
::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager;
::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xGlobalAcceleratorManager;
diff --git a/framework/inc/uielement/objectmenucontroller.hxx b/framework/inc/uielement/objectmenucontroller.hxx
index 18f7f3473c..671a9f9a80 100644
--- a/framework/inc/uielement/objectmenucontroller.hxx
+++ b/framework/inc/uielement/objectmenucontroller.hxx
@@ -69,26 +69,15 @@ namespace framework
// XServiceInfo
DECLARE_XSERVICEINFO
- // XPopupMenuController
- virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
-
- // XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
// XStatusListener
virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
- // XMenuListener
- virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
-
// XEventListener
virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
private:
void fillPopupMenu( const com::sun::star::uno::Sequence< com::sun::star::embed::VerbDescriptor >& rVerbCommandSeq, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
+ virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL);
com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > m_xObjectUpdateDispatch;
};
diff --git a/framework/inc/uielement/recentfilesmenucontroller.hxx b/framework/inc/uielement/recentfilesmenucontroller.hxx
index f9a32b3944..8c646c9e6e 100644
--- a/framework/inc/uielement/recentfilesmenucontroller.hxx
+++ b/framework/inc/uielement/recentfilesmenucontroller.hxx
@@ -79,23 +79,16 @@ namespace framework
// XPopupMenuController
virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
- // XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
// XStatusListener
virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
// XMenuListener
- virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
// XDispatchProvider
virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& sTarget, sal_Int32 nFlags ) throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& lDescriptor ) throw( ::com::sun::star::uno::RuntimeException );
// XDispatch
virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& seqProperties ) throw( ::com::sun::star::uno::RuntimeException );
@@ -108,6 +101,7 @@ namespace framework
DECL_STATIC_LINK( RecentFilesMenuController, ExecuteHdl_Impl, LoadRecentFile* );
private:
+ virtual void impl_setPopupMenu();
struct RecentFile
{
rtl::OUString aURL;
diff --git a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx
index 96193f88ec..d7b73e1f5c 100644
--- a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx
+++ b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx
@@ -81,9 +81,6 @@ class SpinfieldToolbarController : public ISpinfieldListener,
// XComponent
virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
- // XToolbarController
- virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
-
// ISpinfieldListener
virtual void Up();
virtual void Down();
@@ -99,6 +96,7 @@ class SpinfieldToolbarController : public ISpinfieldListener,
protected:
virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const;
private:
bool impl_getValue( const ::com::sun::star::uno::Any& rAny, sal_Int32& nValue, double& fValue, bool& bFloat );
diff --git a/framework/inc/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx
index 70772b5476..bcda17c17a 100644
--- a/framework/inc/uielement/statusbarmanager.hxx
+++ b/framework/inc/uielement/statusbarmanager.hxx
@@ -46,6 +46,7 @@
//_________________________________________________________________________________________________________________
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XStatusbarController.hpp>
#include <com/sun/star/frame/XUIControllerRegistration.hpp>
#include <com/sun/star/ui/XUIConfiguration.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
@@ -120,14 +121,15 @@ class StatusBarManager : public ::com::sun::star::frame::XFrameActionListener
void CreateControllers();
void UpdateControllers();
void AddFrameActionListener();
+ void MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL ::com::sun::star::frame::XStatusbarController::*_pMethod )(const ::com::sun::star::awt::MouseEvent&));
protected:
typedef std::vector< ::com::sun::star::uno::Reference< com::sun::star::frame::XStatusListener > > StatusBarControllerVector;
sal_Bool m_bDisposed : 1,
- m_bModuleIdentified : 1,
m_bFrameActionRegistered : 1,
m_bUpdateControllers : 1;
+ sal_Bool m_bModuleIdentified;
StatusBar* m_pStatusBar;
rtl::OUString m_aModuleIdentifier;
rtl::OUString m_aResourceName;
diff --git a/framework/inc/uielement/statusbarwrapper.hxx b/framework/inc/uielement/statusbarwrapper.hxx
index 3f07d89271..26663ace26 100644
--- a/framework/inc/uielement/statusbarwrapper.hxx
+++ b/framework/inc/uielement/statusbarwrapper.hxx
@@ -70,12 +70,9 @@ class StatusBarWrapper : public UIConfigElementWrapperBase
// XUIElementSettings
virtual void SAL_CALL updateSettings() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getSettings( sal_Bool bWriteable ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& UISettings ) throw (::com::sun::star::uno::RuntimeException);
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xStatusBarManager;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
};
} // namespace framework
diff --git a/framework/inc/uielement/statusindicatorinterfacewrapper.hxx b/framework/inc/uielement/statusindicatorinterfacewrapper.hxx
index 5101f74716..940fe8f1b2 100644
--- a/framework/inc/uielement/statusindicatorinterfacewrapper.hxx
+++ b/framework/inc/uielement/statusindicatorinterfacewrapper.hxx
@@ -51,28 +51,20 @@
// other includes
//_________________________________________________________________________________________________________________
#include <rtl/ustring.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <vector>
namespace framework
{
-class StatusIndicatorInterfaceWrapper : public ::com::sun::star::lang::XTypeProvider ,
- public ::com::sun::star::task::XStatusIndicator ,
- public ::cppu::OWeakObject
+class StatusIndicatorInterfaceWrapper : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XStatusIndicator>
{
public:
StatusIndicatorInterfaceWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rStatusIndicatorImpl );
virtual ~StatusIndicatorInterfaceWrapper();
//---------------------------------------------------------------------------------------------------------
- // XInterface, XTypeProvider
- //---------------------------------------------------------------------------------------------------------
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
- //---------------------------------------------------------------------------------------------------------
// XStatusIndicator
//---------------------------------------------------------------------------------------------------------
virtual void SAL_CALL start ( const ::rtl::OUString& sText ,
diff --git a/framework/inc/uielement/togglebuttontoolbarcontroller.hxx b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx
index 253eb42bdc..218d7d1f17 100644
--- a/framework/inc/uielement/togglebuttontoolbarcontroller.hxx
+++ b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx
@@ -70,11 +70,11 @@ class ToggleButtonToolbarController : public ComplexToolbarController
virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
// XToolbarController
- virtual void SAL_CALL execute( sal_Int16 KeyModifier ) 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);
protected:
virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const;
private:
DECL_LINK( MenuSelectHdl, Menu *);
diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx
index a6e991d4e8..9f1c2cdaaa 100644
--- a/framework/inc/uielement/toolbarmanager.hxx
+++ b/framework/inc/uielement/toolbarmanager.hxx
@@ -56,7 +56,9 @@
#include <com/sun/star/ui/XImageManager.hpp>
#include <com/sun/star/frame/XStatusListener.hpp>
#include <com/sun/star/frame/XSubToolbarController.hpp>
+#include <com/sun/star/frame/XToolbarController.hpp>
#include <com/sun/star/ui/ItemStyle.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
//_________________________________________________________________________________________________________________
// other includes
@@ -189,6 +191,9 @@ class ToolBarManager : public ::com::sun::star::frame::XFrameActionListener
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetModelFromFrame() const;
sal_Bool IsPluginMode() const;
Image QueryAddonsImage( const ::rtl::OUString& aCommandURL, bool bBigImages, bool bHiContrast );
+ long HandleClick(void ( SAL_CALL ::com::sun::star::frame::XToolbarController::*_pClick )( ));
+ void setToolBarImage(const Image& _aImage,const CommandToInfoMap::const_iterator& _pIter);
+ void impl_elementChanged(bool _bRemove,const ::com::sun::star::ui::ConfigurationEvent& Event );
protected:
typedef ::std::hash_map< sal_uInt16, ::com::sun::star::uno::Reference< com::sun::star::frame::XStatusListener > > ToolBarControllerMap;
@@ -210,6 +215,7 @@ class ToolBarManager : public ::com::sun::star::frame::XFrameActionListener
ToolBar* m_pToolBar;
rtl::OUString m_aModuleIdentifier;
rtl::OUString m_aResourceName;
+ com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
com::sun::star::uno::Reference< com::sun::star::frame::XFrame > m_xFrame;
com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_xUICommandLabels;
ToolBarControllerMap m_aControllerMap;
diff --git a/framework/inc/uielement/toolbarsmenucontroller.hxx b/framework/inc/uielement/toolbarsmenucontroller.hxx
index 653152a38f..22196995c7 100644
--- a/framework/inc/uielement/toolbarsmenucontroller.hxx
+++ b/framework/inc/uielement/toolbarsmenucontroller.hxx
@@ -52,7 +52,6 @@
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/ui/XUIConfigurationManager.hpp>
//_________________________________________________________________________________________________________________
@@ -86,10 +85,8 @@ namespace framework
virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
// XMenuListener
- virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
// XEventListener
virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
@@ -112,7 +109,6 @@ namespace framework
sal_Bool isContextSensitiveToolbarNonVisible();
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState;
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandDescription;
::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xModuleCfgMgr;
::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocCfgMgr;
diff --git a/framework/inc/uielement/toolbarwrapper.hxx b/framework/inc/uielement/toolbarwrapper.hxx
index 67f43915af..342a19ad9a 100644
--- a/framework/inc/uielement/toolbarwrapper.hxx
+++ b/framework/inc/uielement/toolbarwrapper.hxx
@@ -79,13 +79,6 @@ class ToolBarWrapper : public ::com::sun::star::ui::XUIFunctionListener,
// XUIElementSettings
virtual void SAL_CALL updateSettings() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getSettings( sal_Bool bWriteable ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& UISettings ) throw (::com::sun::star::uno::RuntimeException);
-
- // XUIConfigurationListener
- virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
// XUIFunctionListener
virtual void SAL_CALL functionExecute( const ::rtl::OUString& aUIElementName, const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException);
@@ -99,9 +92,9 @@ class ToolBarWrapper : public ::com::sun::star::ui::XUIFunctionListener,
//-------------------------------------------------------------------------------------------------------------
protected:
virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception );
+ virtual void impl_fillNewData();
private:
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xToolBarManager;
com::sun::star::uno::Reference< com::sun::star::awt::XWindow > m_xToolBarWindow;
};
diff --git a/framework/inc/uielement/uicommanddescription.hxx b/framework/inc/uielement/uicommanddescription.hxx
index d9fdd86149..0e72cec566 100644
--- a/framework/inc/uielement/uicommanddescription.hxx
+++ b/framework/inc/uielement/uicommanddescription.hxx
@@ -59,28 +59,22 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <rtl/ustring.hxx>
namespace framework
{
-
-class ConfigurationAccess_UICommand;
-class UICommandDescription : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public com::sun::star::container::XNameAccess ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class UICommandDescription : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo ,
+ com::sun::star::container::XNameAccess >
{
public:
UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
virtual ~UICommandDescription();
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
-
+private:
// XNameAccess
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);
@@ -97,6 +91,7 @@ class UICommandDescription : public com::sun::star::lang::XTypeProvider ,
virtual sal_Bool SAL_CALL hasElements()
throw (::com::sun::star::uno::RuntimeException);
+public:
typedef ::std::hash_map< ::rtl::OUString,
::rtl::OUString,
OUStringHashCode,
@@ -107,7 +102,10 @@ class UICommandDescription : public com::sun::star::lang::XTypeProvider ,
OUStringHashCode,
::std::equal_to< ::rtl::OUString > > UICommandsHashMap;
- private:
+ protected:
+ UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > impl_createConfigAccess(const ::rtl::OUString& _sName);
+ void impl_fillElements(const sal_Char* _pName);
sal_Bool m_bConfigRead;
rtl::OUString m_aPrivateResourceURL;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
diff --git a/framework/inc/uifactory/addonstoolboxfactory.hxx b/framework/inc/uifactory/addonstoolboxfactory.hxx
index 7bcc93d0e0..4953f2076a 100644
--- a/framework/inc/uifactory/addonstoolboxfactory.hxx
+++ b/framework/inc/uifactory/addonstoolboxfactory.hxx
@@ -58,26 +58,22 @@
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <rtl/ustring.hxx>
namespace framework
{
-class AddonsToolBoxFactory : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public ::com::sun::star::ui::XUIElementFactory ,
- protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class AddonsToolBoxFactory : protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo ,
+ com::sun::star::ui::XUIElementFactory >
{
public:
AddonsToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
virtual ~AddonsToolBoxFactory();
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
DECLARE_XSERVICEINFO
- FWK_DECLARE_XTYPEPROVIDER
// XUIElementFactory
virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
diff --git a/framework/inc/uifactory/factoryconfiguration.hxx b/framework/inc/uifactory/factoryconfiguration.hxx
new file mode 100755
index 0000000000..7c5dd1d340
--- /dev/null
+++ b/framework/inc/uifactory/factoryconfiguration.hxx
@@ -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: toolbarcontrollerfactory.hxx,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 __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_
+#define __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_
+#include <threadhelp/threadhelpbase.hxx>
+#include <macros/generic.hxx>
+#include <macros/xinterface.hxx>
+#include <macros/xtypeprovider.hxx>
+#include <macros/xserviceinfo.hxx>
+#include <stdtypes.h>
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/frame/XUIControllerRegistration.hpp>
+
+//_________________________________________________________________________________________________________________
+// other includes
+//_________________________________________________________________________________________________________________
+#include <cppuhelper/implbase1.hxx>
+#include <rtl/ustring.hxx>
+
+//_________________________________________________________________________________________________________________
+// Namespace
+//_________________________________________________________________________________________________________________
+//
+
+namespace framework
+{
+
+//*****************************************************************************************************************
+// Configuration access class for PopupMenuControllerFactory implementation
+//*****************************************************************************************************************
+class ConfigurationAccess_ControllerFactory : // interfaces
+ private ThreadHelpBase,
+ public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener>
+{
+public:
+ ConfigurationAccess_ControllerFactory( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot,bool _bAskValue = false );
+ virtual ~ConfigurationAccess_ControllerFactory();
+
+ void readConfigurationData();
+ void updateConfigurationData();
+
+ rtl::OUString getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const;
+ rtl::OUString getValueFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const;
+ void addServiceToCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule, const rtl::OUString& rServiceSpecifier );
+ void removeServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule );
+ inline bool hasValue() const { return m_bAskValue; }
+
+ // container.XContainerListener
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // lang.XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ struct ControllerInfo
+ {
+ rtl::OUString m_aImplementationName;
+ rtl::OUString m_aValue;
+ ControllerInfo(const ::rtl::OUString& _aImplementationName,const ::rtl::OUString& _aValue) : m_aImplementationName(_aImplementationName),m_aValue(_aValue){}
+ ControllerInfo(){}
+ };
+ class MenuControllerMap : public std::hash_map< rtl::OUString,
+ ControllerInfo,
+ OUStringHashCode,
+ ::std::equal_to< ::rtl::OUString > >
+ {
+ inline void free()
+ {
+ MenuControllerMap().swap( *this );
+ }
+ };
+
+ sal_Bool impl_getElementProps( const ::com::sun::star::uno::Any& aElement, rtl::OUString& aCommand, rtl::OUString& aModule, rtl::OUString& aServiceSpecifier,rtl::OUString& aValue ) const;
+
+ rtl::OUString m_aPropCommand;
+ rtl::OUString m_aPropModule;
+ rtl::OUString m_aPropController;
+ rtl::OUString m_aPropValue;
+ rtl::OUString m_sRoot;
+ MenuControllerMap m_aMenuControllerMap;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess;
+ sal_Bool m_bConfigAccessInitialized;
+ bool m_bAskValue;
+};
+
+} // namespace framework
+#endif // __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_
diff --git a/framework/inc/uifactory/menubarfactory.hxx b/framework/inc/uifactory/menubarfactory.hxx
index db0177e4a0..2895bbcaba 100644
--- a/framework/inc/uifactory/menubarfactory.hxx
+++ b/framework/inc/uifactory/menubarfactory.hxx
@@ -56,30 +56,36 @@
// includes of other projects
//_________________________________________________________________________________________________________________
#include <toolkit/awt/vclxmenu.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <rtl/ustring.hxx>
namespace framework
{
- class MenuBarFactory : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public ::com::sun::star::ui::XUIElementFactory ,
- protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+ class MenuBarFactory : protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::ui::XUIElementFactory>
{
public:
MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
virtual ~MenuBarFactory();
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
DECLARE_XSERVICEINFO
- FWK_DECLARE_XTYPEPROVIDER
// XUIElementFactory
virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
- private:
+ static void CreateUIElement(const ::rtl::OUString& ResourceURL
+ , const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args
+ ,const char* _pExtraMode
+ ,const char* _pAsciiName
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& _xMenuBar
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager >& _xModuleManager
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager);
+
+ protected:
+ MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool );
+
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager;
};
diff --git a/framework/inc/uifactory/popupmenucontrollerfactory.hxx b/framework/inc/uifactory/popupmenucontrollerfactory.hxx
index 98e707e05e..3d9a47641c 100644
--- a/framework/inc/uifactory/popupmenucontrollerfactory.hxx
+++ b/framework/inc/uifactory/popupmenucontrollerfactory.hxx
@@ -40,61 +40,29 @@
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
-#include <threadhelp/threadhelpbase.hxx>
-#include <macros/generic.hxx>
-#include <macros/xinterface.hxx>
-#include <macros/xtypeprovider.hxx>
#include <macros/xserviceinfo.hxx>
#include <stdtypes.h>
+#include <uifactory/toolbarcontrollerfactory.hxx>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/frame/XUIControllerRegistration.hpp>
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
-#include <rtl/ustring.hxx>
namespace framework
{
-class ConfigurationAccess_PopupMenuControllerFactory;
-class PopupMenuControllerFactory : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public com::sun::star::lang::XMultiComponentFactory ,
- public ::com::sun::star::frame::XUIControllerRegistration ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class ConfigurationAccess_ControllerFactory;
+class PopupMenuControllerFactory : public ToolbarControllerFactory
{
public:
PopupMenuControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
- virtual ~PopupMenuControllerFactory();
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
-
- // XMultiComponentFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::rtl::OUString& aServiceSpecifier, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException);
-
- // XUIControllerRegistration
- virtual sal_Bool SAL_CALL hasController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL registerController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName, const ::rtl::OUString& aControllerImplementationName ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deregisterController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException);
-
- private:
- sal_Bool m_bConfigRead;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ConfigurationAccess_PopupMenuControllerFactory* m_pConfigAccess;
};
} // namespace framework
diff --git a/framework/inc/uifactory/statusbarcontrollerfactory.hxx b/framework/inc/uifactory/statusbarcontrollerfactory.hxx
index f3149d242b..c797771a6d 100644
--- a/framework/inc/uifactory/statusbarcontrollerfactory.hxx
+++ b/framework/inc/uifactory/statusbarcontrollerfactory.hxx
@@ -34,62 +34,30 @@
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
-
-#include <threadhelp/threadhelpbase.hxx>
-#include <macros/generic.hxx>
-#include <macros/xinterface.hxx>
-#include <macros/xtypeprovider.hxx>
#include <macros/xserviceinfo.hxx>
+#include <uifactory/toolbarcontrollerfactory.hxx>
#include <stdtypes.h>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/frame/XUIControllerRegistration.hpp>
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
-#include <rtl/ustring.hxx>
+
namespace framework
{
-class ConfigurationAccess_StatusbarControllerFactory;
-class StatusbarControllerFactory : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public com::sun::star::lang::XMultiComponentFactory ,
- public ::com::sun::star::frame::XUIControllerRegistration ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class ConfigurationAccess_ControllerFactory;
+class StatusbarControllerFactory : public ToolbarControllerFactory
{
public:
StatusbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
- virtual ~StatusbarControllerFactory();
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
-
- // XMultiComponentFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::rtl::OUString& aServiceSpecifier, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException);
-
- // XUIControllerRegistration
- virtual sal_Bool SAL_CALL hasController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL registerController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName, const ::rtl::OUString& aControllerImplementationName ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deregisterController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException);
-
- private:
- sal_Bool m_bConfigRead;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ConfigurationAccess_StatusbarControllerFactory* m_pConfigAccess;
};
} // namespace framework
diff --git a/framework/inc/uifactory/statusbarfactory.hxx b/framework/inc/uifactory/statusbarfactory.hxx
index d168801cfd..b586e10a27 100644
--- a/framework/inc/uifactory/statusbarfactory.hxx
+++ b/framework/inc/uifactory/statusbarfactory.hxx
@@ -36,53 +36,33 @@
//_________________________________________________________________________________________________________________
#include <stdtypes.h>
-#include <threadhelp/threadhelpbase.hxx>
-#include <macros/generic.hxx>
-#include <macros/xinterface.hxx>
-#include <macros/xtypeprovider.hxx>
+
#include <macros/xserviceinfo.hxx>
#include <services.h>
+#include <uifactory/menubarfactory.hxx>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/ui/XUIElementFactory.hpp>
-#include <com/sun/star/frame/XModuleManager.hpp>
-
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
#include <rtl/ustring.hxx>
namespace framework
{
-class StatusBarFactory : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public ::com::sun::star::ui::XUIElementFactory ,
- protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class StatusBarFactory : public MenuBarFactory
{
public:
StatusBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
- virtual ~StatusBarFactory();
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
DECLARE_XSERVICEINFO
- FWK_DECLARE_XTYPEPROVIDER
// XUIElementFactory
virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
- private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager;
};
}
diff --git a/framework/inc/uifactory/toolbarcontrollerfactory.hxx b/framework/inc/uifactory/toolbarcontrollerfactory.hxx
index 32830c67c6..f36a6a59f5 100644
--- a/framework/inc/uifactory/toolbarcontrollerfactory.hxx
+++ b/framework/inc/uifactory/toolbarcontrollerfactory.hxx
@@ -53,27 +53,23 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <rtl/ustring.hxx>
namespace framework
{
-class ConfigurationAccess_ToolbarControllerFactory;
-class ToolbarControllerFactory : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public com::sun::star::lang::XMultiComponentFactory ,
- public ::com::sun::star::frame::XUIControllerRegistration ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class ConfigurationAccess_ControllerFactory;
+class ToolbarControllerFactory : protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo,
+ com::sun::star::lang::XMultiComponentFactory,
+ com::sun::star::frame::XUIControllerRegistration>
{
public:
ToolbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
virtual ~ToolbarControllerFactory();
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
// XMultiComponentFactory
@@ -86,10 +82,11 @@ class ToolbarControllerFactory : public com::sun::star::lang::XTypeProvider
virtual void SAL_CALL registerController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName, const ::rtl::OUString& aControllerImplementationName ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL deregisterController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException);
- private:
+ protected:
+ ToolbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool );
sal_Bool m_bConfigRead;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ConfigurationAccess_ToolbarControllerFactory* m_pConfigAccess;
+ ConfigurationAccess_ControllerFactory* m_pConfigAccess;
};
} // namespace framework
diff --git a/framework/inc/uifactory/toolboxfactory.hxx b/framework/inc/uifactory/toolboxfactory.hxx
index a917b6535c..59f9f984f6 100644
--- a/framework/inc/uifactory/toolboxfactory.hxx
+++ b/framework/inc/uifactory/toolboxfactory.hxx
@@ -36,23 +36,13 @@
//_________________________________________________________________________________________________________________
#include <stdtypes.h>
-#include <threadhelp/threadhelpbase.hxx>
-#include <macros/generic.hxx>
-#include <macros/xinterface.hxx>
-#include <macros/xtypeprovider.hxx>
#include <macros/xserviceinfo.hxx>
#include <services.h>
+#include <uifactory/menubarfactory.hxx>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/ui/XUIElementFactory.hpp>
-#include <com/sun/star/frame/XModuleManager.hpp>
-
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
@@ -62,27 +52,16 @@
namespace framework
{
-class ToolBoxFactory : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public ::com::sun::star::ui::XUIElementFactory ,
- protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class ToolBoxFactory : public MenuBarFactory
{
public:
ToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
- virtual ~ToolBoxFactory();
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
DECLARE_XSERVICEINFO
- FWK_DECLARE_XTYPEPROVIDER
// XUIElementFactory
virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
-
- private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager;
};
}
diff --git a/framework/inc/uifactory/uielementfactorymanager.hxx b/framework/inc/uifactory/uielementfactorymanager.hxx
index d4d1519674..046062c388 100644
--- a/framework/inc/uifactory/uielementfactorymanager.hxx
+++ b/framework/inc/uifactory/uielementfactorymanager.hxx
@@ -51,35 +51,85 @@
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/ui/XUIElementFactory.hpp>
#include <com/sun/star/ui/XUIElementFactoryRegistration.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
#include "com/sun/star/frame/XModuleManager.hpp"
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <rtl/ustring.hxx>
namespace framework
{
-class ConfigurationAccess_UIElementFactoryManager;
-class UIElementFactoryManager : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public ::com::sun::star::ui::XUIElementFactory ,
- public ::com::sun::star::ui::XUIElementFactoryRegistration ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+ class ConfigurationAccess_FactoryManager : // interfaces
+ // baseclasses
+ // Order is neccessary for right initialization!
+ private ThreadHelpBase ,
+ public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener>
+{
+ public:
+ ConfigurationAccess_FactoryManager( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot );
+ virtual ~ConfigurationAccess_FactoryManager();
+
+ void readConfigurationData();
+
+ rtl::OUString getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule ) const;
+ void addFactorySpecifierToTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule, const rtl::OUString& aServiceSpecifier );
+ void removeFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule );
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > getFactoriesDescription() const;
+
+ // container.XContainerListener
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // lang.XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ class FactoryManagerMap : public std::hash_map< rtl::OUString,
+ rtl::OUString,
+ OUStringHashCode,
+ ::std::equal_to< ::rtl::OUString > >
+ {
+ inline void free()
+ {
+ FactoryManagerMap().swap( *this );
+ }
+ };
+
+ sal_Bool impl_getElementProps( const ::com::sun::star::uno::Any& rElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const;
+
+ rtl::OUString m_aPropType;
+ rtl::OUString m_aPropName;
+ rtl::OUString m_aPropModule;
+ rtl::OUString m_aPropFactory;
+ ::rtl::OUString m_sRoot;
+ FactoryManagerMap m_aFactoryManagerMap;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess;
+ sal_Bool m_bConfigAccessInitialized;
+ bool m_bConfigDirty;
+};
+
+
+class UIElementFactoryManager : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::ui::XUIElementFactory,
+ ::com::sun::star::ui::XUIElementFactoryRegistration>
{
public:
UIElementFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
virtual ~UIElementFactoryManager();
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
// XUIElementFactory
@@ -92,12 +142,11 @@ class UIElementFactoryManager : public com::sun::star::lang::XTypeProvider
virtual void SAL_CALL deregisterFactory( const ::rtl::OUString& aType, const ::rtl::OUString& aName, const ::rtl::OUString& aModuleIdentifier ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
private:
- void RetrieveTypeNameFromResourceURL( const ::rtl::OUString& aResourceURL, rtl::OUString& aType, rtl::OUString& aName );
sal_Bool m_bConfigRead;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager;
- ConfigurationAccess_UIElementFactoryManager* m_pConfigAccess;
+ ConfigurationAccess_FactoryManager* m_pConfigAccess;
};
} // namespace framework
diff --git a/framework/inc/uifactory/windowcontentfactorymanager.hxx b/framework/inc/uifactory/windowcontentfactorymanager.hxx
index 69dd2d3e8a..225e03e5fc 100644
--- a/framework/inc/uifactory/windowcontentfactorymanager.hxx
+++ b/framework/inc/uifactory/windowcontentfactorymanager.hxx
@@ -51,46 +51,41 @@
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include "com/sun/star/frame/XModuleManager.hpp"
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <rtl/ustring.hxx>
namespace framework
{
-class ConfigurationAccess_WindowContentFactoryManager;
-class WindowContentFactoryManager : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::lang::XServiceInfo ,
- public com::sun::star::lang::XSingleComponentFactory ,
- private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class ConfigurationAccess_FactoryManager;
+class WindowContentFactoryManager : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo ,
+ com::sun::star::lang::XSingleComponentFactory>
{
public:
WindowContentFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
virtual ~WindowContentFactoryManager();
// XInterface, XTypeProvider, XServiceInfo
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
// XSingleComponentFactory
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- private:
- void RetrieveTypeNameFromResourceURL( const ::rtl::OUString& aResourceURL, rtl::OUString& aType, rtl::OUString& aName );
+ static void RetrieveTypeNameFromResourceURL( const ::rtl::OUString& aResourceURL, rtl::OUString& aType, rtl::OUString& aName );
+ private:
sal_Bool m_bConfigRead;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager;
- ConfigurationAccess_WindowContentFactoryManager* m_pConfigAccess;
+ ConfigurationAccess_FactoryManager* m_pConfigAccess;
};
} // namespace framework
diff --git a/framework/inc/xml/eventsdocumenthandler.hxx b/framework/inc/xml/eventsdocumenthandler.hxx
index c34411c8cd..44f87697b6 100644
--- a/framework/inc/xml/eventsdocumenthandler.hxx
+++ b/framework/inc/xml/eventsdocumenthandler.hxx
@@ -48,7 +48,7 @@
//_________________________________________________________________________________________________________________
#include <threadhelp/threadhelpbase.hxx>
#include <rtl/ustring.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <hash_map>
#include <stdtypes.h>
@@ -62,9 +62,8 @@ namespace framework{
//*****************************************************************************************************************
// Hash code function for using in all hash maps of follow implementation.
-class OReadEventsDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler,
- private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class OReadEventsDocumentHandler : private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler >
{
public:
enum Events_XML_Entry
@@ -88,15 +87,7 @@ class OReadEventsDocumentHandler : public ::com::sun::star::xml::sax::XDocumentH
};
OReadEventsDocumentHandler( EventsConfig& aItems );
- virtual ~OReadEventsDocumentHandler();
-
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
+
// XDocumentHandler
virtual void SAL_CALL startDocument(void)
@@ -135,6 +126,9 @@ class OReadEventsDocumentHandler : public ::com::sun::star::xml::sax::XDocumentH
throw( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
+ protected:
+ virtual ~OReadEventsDocumentHandler();
+
private:
::rtl::OUString getErrorLineString();
diff --git a/framework/inc/xml/imagesdocumenthandler.hxx b/framework/inc/xml/imagesdocumenthandler.hxx
index 7bde7db628..52aa6d8e33 100644
--- a/framework/inc/xml/imagesdocumenthandler.hxx
+++ b/framework/inc/xml/imagesdocumenthandler.hxx
@@ -45,7 +45,7 @@
#include <xml/imagesconfiguration.hxx>
#include <threadhelp/threadhelpbase.hxx>
#include <rtl/ustring.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <hash_map>
#include <stdtypes.h>
@@ -59,9 +59,8 @@ namespace framework{
//*****************************************************************************************************************
// Hash code function for using in all hash maps of follow implementation.
-class OReadImagesDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler,
- private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class OReadImagesDocumentHandler : private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler >
{
public:
enum Image_XML_Entry
@@ -92,14 +91,6 @@ class OReadImagesDocumentHandler : public ::com::sun::star::xml::sax::XDocumentH
OReadImagesDocumentHandler( ImageListsDescriptor& aItems );
virtual ~OReadImagesDocumentHandler();
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
-
// XDocumentHandler
virtual void SAL_CALL startDocument(void)
throw ( ::com::sun::star::xml::sax::SAXException,
diff --git a/framework/inc/xml/menudocumenthandler.hxx b/framework/inc/xml/menudocumenthandler.hxx
index 63e109d2df..b6148ca820 100644
--- a/framework/inc/xml/menudocumenthandler.hxx
+++ b/framework/inc/xml/menudocumenthandler.hxx
@@ -42,13 +42,14 @@
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/uno/XComponentContext.hpp>
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
#include <threadhelp/threadhelpbase.hxx>
#include <rtl/ustring.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
//_________________________________________________________________________________________________________________
@@ -57,22 +58,13 @@
namespace framework{
-class ReadMenuDocumentHandlerBase : public ::com::sun::star::xml::sax::XDocumentHandler,
- public ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class ReadMenuDocumentHandlerBase : public ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler >
{
public:
ReadMenuDocumentHandlerBase();
virtual ~ReadMenuDocumentHandlerBase();
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
-
// XDocumentHandler
virtual void SAL_CALL startDocument(void)
throw ( ::com::sun::star::xml::sax::SAXException,
@@ -295,6 +287,7 @@ class OReadMenuPopupHandler : public ReadMenuDocumentHandlerBase
sal_Bool m_bMenuMode;
com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > m_xMenuContainer;
com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory > m_xContainerFactory;
+ com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xComponentContext;
NextElementClose m_nNextElementExpected;
}; // OReadMenuPopupHandler
diff --git a/framework/inc/xml/saxnamespacefilter.hxx b/framework/inc/xml/saxnamespacefilter.hxx
index 4168d52288..1dc04e46fb 100644
--- a/framework/inc/xml/saxnamespacefilter.hxx
+++ b/framework/inc/xml/saxnamespacefilter.hxx
@@ -36,7 +36,7 @@
#include <xml/xmlnamespaces.hxx>
#include <rtl/ustring.hxx>
#include <vcl/menu.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <stack>
@@ -47,22 +47,13 @@
namespace framework
{
-class SaxNamespaceFilter : public ::com::sun::star::xml::sax::XDocumentHandler,
- public ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class SaxNamespaceFilter : public ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler >
{
public:
SaxNamespaceFilter( ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& rSax1DocumentHandler );
virtual ~SaxNamespaceFilter();
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
-
// XDocumentHandler
virtual void SAL_CALL startDocument(void)
throw ( ::com::sun::star::xml::sax::SAXException,
diff --git a/framework/inc/xml/statusbardocumenthandler.hxx b/framework/inc/xml/statusbardocumenthandler.hxx
index 9e1e2637aa..c27c4e6c4b 100644
--- a/framework/inc/xml/statusbardocumenthandler.hxx
+++ b/framework/inc/xml/statusbardocumenthandler.hxx
@@ -48,7 +48,7 @@
//_________________________________________________________________________________________________________________
#include <threadhelp/threadhelpbase.hxx>
#include <rtl/ustring.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <hash_map>
#include <stdtypes.h>
@@ -62,9 +62,8 @@ namespace framework{
//*****************************************************************************************************************
// Hash code function for using in all hash maps of follow implementation.
-class OReadStatusBarDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler,
- private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class OReadStatusBarDocumentHandler : private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler >
{
public:
enum StatusBar_XML_Entry
@@ -92,14 +91,6 @@ class OReadStatusBarDocumentHandler : public ::com::sun::star::xml::sax::XDocume
OReadStatusBarDocumentHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& aStatusBarItems );
virtual ~OReadStatusBarDocumentHandler();
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
-
// XDocumentHandler
virtual void SAL_CALL startDocument(void)
throw ( ::com::sun::star::xml::sax::SAXException,
diff --git a/framework/inc/xml/toolboxdocumenthandler.hxx b/framework/inc/xml/toolboxdocumenthandler.hxx
index abd14938b7..e903135420 100644
--- a/framework/inc/xml/toolboxdocumenthandler.hxx
+++ b/framework/inc/xml/toolboxdocumenthandler.hxx
@@ -44,7 +44,7 @@
//_________________________________________________________________________________________________________________
#include <threadhelp/threadhelpbase.hxx>
#include <rtl/ustring.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <stdtypes.h>
//_________________________________________________________________________________________________________________
@@ -56,9 +56,8 @@ namespace framework{
//*****************************************************************************************************************
// Hash code function for using in all hash maps of follow implementation.
-class OReadToolBoxDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler,
- private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
- public ::cppu::OWeakObject
+class OReadToolBoxDocumentHandler : private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler >
{
public:
enum ToolBox_XML_Entry
@@ -91,14 +90,6 @@ class OReadToolBoxDocumentHandler : public ::com::sun::star::xml::sax::XDocument
OReadToolBoxDocumentHandler( const ::com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rItemContainer );
virtual ~OReadToolBoxDocumentHandler();
- // XInterface
- virtual void SAL_CALL acquire() throw()
- { OWeakObject::acquire(); }
- virtual void SAL_CALL release() throw()
- { OWeakObject::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
-
// XDocumentHandler
virtual void SAL_CALL startDocument(void)
throw ( ::com::sun::star::xml::sax::SAXException,
diff --git a/framework/prj/d.lst b/framework/prj/d.lst
index bf7a67d091..a8640138ba 100644
--- a/framework/prj/d.lst
+++ b/framework/prj/d.lst
@@ -30,15 +30,14 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\StartModule\statusbar
..\inc\helper\imageproducer.hxx %_DEST%\inc%_EXT%\framework\imageproducer.hxx
..\inc\helper\acceleratorinfo.hxx %_DEST%\inc%_EXT%\framework\acceleratorinfo.hxx
..\inc\helper\actiontriggerhelper.hxx %_DEST%\inc%_EXT%\framework\actiontriggerhelper.hxx
-..\inc\classes\menuconfiguration.hxx %_DEST%\inc%_EXT%\framework\menuconfiguration.hxx
+..\inc\xml\menuconfiguration.hxx %_DEST%\inc%_EXT%\framework\menuconfiguration.hxx
..\inc\classes\bmkmenu.hxx %_DEST%\inc%_EXT%\framework\bmkmenu.hxx
-..\inc\classes\toolboxconfiguration.hxx %_DEST%\inc%_EXT%\framework\toolboxconfiguration.hxx
-..\inc\classes\statusbarconfiguration.hxx %_DEST%\inc%_EXT%\framework\statusbarconfiguration.hxx
-..\inc\classes\eventsconfiguration.hxx %_DEST%\inc%_EXT%\framework\eventsconfiguration.hxx
-..\inc\classes\imagesconfiguration.hxx %_DEST%\inc%_EXT%\framework\imagesconfiguration.hxx
+..\inc\xml\toolboxconfiguration.hxx %_DEST%\inc%_EXT%\framework\toolboxconfiguration.hxx
+..\inc\xml\statusbarconfiguration.hxx %_DEST%\inc%_EXT%\framework\statusbarconfiguration.hxx
+..\inc\xml\eventsconfiguration.hxx %_DEST%\inc%_EXT%\framework\eventsconfiguration.hxx
+..\inc\xml\imagesconfiguration.hxx %_DEST%\inc%_EXT%\framework\imagesconfiguration.hxx
..\inc\classes\addonsoptions.hxx %_DEST%\inc%_EXT%\framework\addonsoptions.hxx
..\inc\dispatch\interaction.hxx %_DEST%\inc%_EXT%\framework\interaction.hxx
-..\inc\classes\addonsoptions.hxx %_DEST%\inc%_EXT%\framework\addonsoptions.hxx
..\inc\classes\addonmenu.hxx %_DEST%\inc%_EXT%\framework\addonmenu.hxx
..\inc\classes\sfxhelperfunctions.hxx %_DEST%\inc%_EXT%\framework\sfxhelperfunctions.hxx
..\inc\helper\configimporter.hxx %_DEST%\inc%_EXT%\framework\configimporter.hxx
diff --git a/framework/source/accelerators/acceleratorcache.cxx b/framework/source/accelerators/acceleratorcache.cxx
index c438592153..db62188f83 100644
--- a/framework/source/accelerators/acceleratorcache.cxx
+++ b/framework/source/accelerators/acceleratorcache.cxx
@@ -127,10 +127,12 @@ AcceleratorCache::TKeyList AcceleratorCache::getAllKeys() const
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
+ lKeys.reserve(m_lKey2Commands.size());
TKey2Commands::const_iterator pIt;
+ TKey2Commands::const_iterator pEnd = m_lKey2Commands.end();
for ( pIt = m_lKey2Commands.begin();
- pIt != m_lKey2Commands.end() ;
+ pIt != pEnd ;
++pIt )
{
lKeys.push_back(pIt->first);
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index 20488d8145..7fc92feca1 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -115,6 +115,24 @@ namespace framework
namespace fpc = ::framework::pattern::configuration;
#endif
+ ::rtl::OUString lcl_getKeyString(const css::awt::KeyEvent& aKeyEvent)
+ {
+ KeyMapping aKeyMapping;
+ const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier...
+ ::rtl::OUStringBuffer sKeyBuffer((aKeyMapping.mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex));
+
+ if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT )
+ sKeyBuffer.appendAscii("_SHIFT");
+ if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 )
+ sKeyBuffer.appendAscii("_MOD1");
+ if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 )
+ sKeyBuffer.appendAscii("_MOD2");
+ if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD3 ) == css::awt::KeyModifier::MOD3 )
+ sKeyBuffer.appendAscii("_MOD3");
+
+ return sKeyBuffer.makeStringAndClear();
+ }
+
//-----------------------------------------------
// XInterface, XTypeProvider
DEFINE_XINTERFACE_6(XMLBasedAcceleratorConfiguration ,
@@ -285,7 +303,7 @@ css::uno::Sequence< css::uno::Any > SAL_CALL XMLBasedAcceleratorConfiguration::g
continue;
AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(rCommand);
- if (lKeys.size()<1)
+ if ( lKeys.empty() )
continue;
css::uno::Any& rAny = lPreferredOnes[i];
@@ -694,6 +712,8 @@ XCUBasedAcceleratorConfiguration::XCUBasedAcceleratorConfiguration(const css::un
, m_pPrimaryWriteCache(0 )
, m_pSecondaryWriteCache(0 )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::XCUBasedAcceleratorConfiguration" );
+ static const ::rtl::OUString CFG_ENTRY_ACCELERATORS(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Accelerators"));
m_xCfg = css::uno::Reference< css::container::XNameAccess > (
::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_ACCELERATORS, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ),
css::uno::UNO_QUERY );
@@ -708,14 +728,17 @@ XCUBasedAcceleratorConfiguration::~XCUBasedAcceleratorConfiguration()
css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfiguration::getAllKeyEvents()
throw(css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::getAllKeyEvents" );
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
AcceleratorCache::TKeyList lKeys = impl_getCFG(sal_True).getAllKeys(); //get keys from PrimaryKeys set
AcceleratorCache::TKeyList lSecondaryKeys = impl_getCFG(sal_False).getAllKeys(); //get keys from SecondaryKeys set
+ lKeys.reserve(lKeys.size()+lSecondaryKeys.size());
AcceleratorCache::TKeyList::const_iterator pIt;
- for ( pIt = lSecondaryKeys.begin(); pIt != lSecondaryKeys.end(); ++pIt )
+ AcceleratorCache::TKeyList::const_iterator pEnd = lSecondaryKeys.end();
+ for ( pIt = lSecondaryKeys.begin(); pIt != pEnd; ++pIt )
lKeys.push_back(*pIt);
return lKeys.getAsConstList();
@@ -728,6 +751,7 @@ css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfigurati
throw(css::container::NoSuchElementException,
css::uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::getCommandByKeyEvent" );
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
@@ -753,6 +777,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::setKeyEvent(const css::awt::KeyE
throw(css::lang::IllegalArgumentException,
css::uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::setKeyEvent" );
RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::setKeyEvent" );
if (
@@ -841,6 +866,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::removeKeyEvent(const css::awt::K
throw(css::container::NoSuchElementException,
css::uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::removeKeyEvent" );
// SAFE -> ----------------------------------
WriteGuard aWriteLock(m_aLock);
@@ -885,6 +911,7 @@ css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfigurati
css::container::NoSuchElementException,
css::uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::getKeyEventsByCommand" );
if (!sCommand.getLength())
throw css::lang::IllegalArgumentException(
::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
@@ -938,6 +965,7 @@ css::uno::Sequence< css::uno::Any > SAL_CALL XCUBasedAcceleratorConfiguration::g
throw(css::lang::IllegalArgumentException ,
css::uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList" );
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
@@ -959,7 +987,7 @@ css::uno::Sequence< css::uno::Any > SAL_CALL XCUBasedAcceleratorConfiguration::g
continue;
AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(rCommand);
- if (lKeys.size()<1)
+ if ( lKeys.empty() )
continue;
AcceleratorCache::TKeyList::const_iterator pPreferredKey = lcl_getPreferredKey(lKeys);
@@ -982,6 +1010,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(co
css::container::NoSuchElementException,
css::uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents" );
if (!sCommand.getLength())
throw css::lang::IllegalArgumentException(
::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
@@ -1013,6 +1042,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::reload()
throw(css::uno::Exception ,
css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::reload" );
RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::reload()" );
// SAFE -> ----------------------------------
@@ -1056,6 +1086,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::store()
throw(css::uno::Exception ,
css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::reload" );
RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::store()" );
// SAFE -> ----------------------------------
@@ -1087,6 +1118,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::storeToStorage(const css::uno::R
throw(css::uno::Exception ,
css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::storeToStorage" );
// todo implement me
// use m_aCache + old AcceleratorXMLWriter to store data directly on storage given as parameter ...
}
@@ -1095,6 +1127,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::storeToStorage(const css::uno::R
::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::isModified()
throw(css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::isModified" );
return sal_False;
}
@@ -1102,6 +1135,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::storeToStorage(const css::uno::R
::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::isReadOnly()
throw(css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::isReadOnly" );
return sal_False;
}
@@ -1109,6 +1143,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::storeToStorage(const css::uno::R
void SAL_CALL XCUBasedAcceleratorConfiguration::setStorage(const css::uno::Reference< css::embed::XStorage >& /*xStorage*/)
throw(css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::setStorage" );
LOG_WARNING("XCUBasedAcceleratorConfiguration::setStorage()", "TODO implement this HACK .-)")
}
@@ -1116,6 +1151,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::setStorage(const css::uno::Refer
::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::hasStorage()
throw(css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::hasStorage" );
LOG_WARNING("XCUBasedAcceleratorConfiguration::hasStorage()", "TODO implement this HACK .-)")
return sal_False;
}
@@ -1124,6 +1160,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::setStorage(const css::uno::Refer
void SAL_CALL XCUBasedAcceleratorConfiguration::addConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
throw(css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::addConfigurationListener" );
LOG_WARNING("XCUBasedAcceleratorConfiguration::addConfigurationListener()", "TODO implement me")
}
@@ -1131,6 +1168,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::addConfigurationListener(const c
void SAL_CALL XCUBasedAcceleratorConfiguration::removeConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
throw(css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::removeConfigurationListener" );
LOG_WARNING("XCUBasedAcceleratorConfiguration::removeConfigurationListener()", "TODO implement me")
}
@@ -1138,6 +1176,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::removeConfigurationListener(cons
void SAL_CALL XCUBasedAcceleratorConfiguration::reset()
throw(css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::reset" );
css::uno::Reference< css::container::XNamed > xNamed(m_xCfg, css::uno::UNO_QUERY);
::rtl::OUString sConfig = xNamed->getName();
if ( sConfig.equalsAscii("Global") )
@@ -1160,6 +1199,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::reset()
void SAL_CALL XCUBasedAcceleratorConfiguration::addResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
throw(css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::reload" );
LOG_WARNING("XCUBasedAcceleratorConfiguration::addResetListener()", "TODO implement me")
}
@@ -1167,6 +1207,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::addResetListener(const css::uno:
void SAL_CALL XCUBasedAcceleratorConfiguration::removeResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
throw(css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::removeResetListener" );
LOG_WARNING("XCUBasedAcceleratorConfiguration::removeResetListener()", "TODO implement me")
}
@@ -1174,6 +1215,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::removeResetListener(const css::u
void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util::ChangesEvent& aEvent)
throw(css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::changesOccurred" );
RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::changesOccurred()" );
css::uno::Reference< css::container::XHierarchicalNameAccess > xHAccess;
@@ -1230,11 +1272,13 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util:
void SAL_CALL XCUBasedAcceleratorConfiguration::disposing(const css::lang::EventObject& /*aSource*/)
throw(css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::changesOccurred" );
}
//-----------------------------------------------
void XCUBasedAcceleratorConfiguration::impl_ts_load( sal_Bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& xCfg )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::impl_ts_load" );
AcceleratorCache aReadCache = AcceleratorCache();
css::uno::Reference< css::container::XNameAccess > xAccess;
if (m_sGlobalOrModules.equalsAscii("Global"))
@@ -1346,6 +1390,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_load( sal_Bool bPreferred, const
//-----------------------------------------------
void XCUBasedAcceleratorConfiguration::impl_ts_save(sal_Bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& /*xCfg*/)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::impl_ts_save" );
if (bPreferred)
{
AcceleratorCache::TKeyList::const_iterator pIt;
@@ -1439,6 +1484,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_save(sal_Bool bPreferred, const c
//-----------------------------------------------
void XCUBasedAcceleratorConfiguration::insertKeyToConfiguration( const css::awt::KeyEvent& aKeyEvent, const ::rtl::OUString& sCommand, const sal_Bool bPreferred )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::insertKeyToConfiguration" );
css::uno::Reference< css::container::XNameAccess > xAccess;
css::uno::Reference< css::container::XNameContainer > xContainer;
css::uno::Reference< css::lang::XSingleServiceFactory > xFac;
@@ -1464,18 +1510,7 @@ void XCUBasedAcceleratorConfiguration::insertKeyToConfiguration( const css::awt:
xModules->getByName(m_sModuleCFG) >>= xContainer;
}
- KeyMapping aKeyMapping;
- const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier...
- ::rtl::OUString sKey = (aKeyMapping.mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex);
-
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT )
- sKey += ::rtl::OUString::createFromAscii("_SHIFT");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 )
- sKey += ::rtl::OUString::createFromAscii("_MOD1");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 )
- sKey += ::rtl::OUString::createFromAscii("_MOD2");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD3 ) == css::awt::KeyModifier::MOD3 )
- sKey += ::rtl::OUString::createFromAscii("_MOD3");
+ const ::rtl::OUString sKey = lcl_getKeyString(aKeyEvent);
css::uno::Reference< css::container::XNameAccess > xKey;
css::uno::Reference< css::container::XNameContainer > xCommand;
if ( !xContainer->hasByName(sKey) )
@@ -1497,6 +1532,7 @@ void XCUBasedAcceleratorConfiguration::insertKeyToConfiguration( const css::awt:
//-----------------------------------------------
void XCUBasedAcceleratorConfiguration::removeKeyFromConfiguration( const css::awt::KeyEvent& aKeyEvent, const sal_Bool bPreferred )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::removeKeyFromConfiguration" );
css::uno::Reference< css::container::XNameAccess > xAccess;
css::uno::Reference< css::container::XNameContainer > xContainer;
@@ -1516,25 +1552,14 @@ void XCUBasedAcceleratorConfiguration::removeKeyFromConfiguration( const css::aw
xModules->getByName(m_sModuleCFG) >>= xContainer;
}
- KeyMapping aKeyMapping;
- const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier...
- ::rtl::OUString sKey = (aKeyMapping.mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex);
-
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT )
- sKey += ::rtl::OUString::createFromAscii("_SHIFT");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 )
- sKey += ::rtl::OUString::createFromAscii("_MOD1");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 )
- sKey += ::rtl::OUString::createFromAscii("_MOD2");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD3 ) == css::awt::KeyModifier::MOD3 )
- sKey += ::rtl::OUString::createFromAscii("_MOD3");
-
+ const ::rtl::OUString sKey = lcl_getKeyString(aKeyEvent);
xContainer->removeByName(sKey);
}
//-----------------------------------------------
void XCUBasedAcceleratorConfiguration::reloadChanged( const ::rtl::OUString& sPrimarySecondary, const ::rtl::OUString& sGlobalModules, const ::rtl::OUString& sModule, const ::rtl::OUString& sKey )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::reloadChanged" );
css::uno::Reference< css::container::XNameAccess > xAccess;
css::uno::Reference< css::container::XNameContainer > xContainer;
@@ -1607,6 +1632,7 @@ void XCUBasedAcceleratorConfiguration::reloadChanged( const ::rtl::OUString& sPr
//-----------------------------------------------
AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPreferred, sal_Bool bWriteAccessRequested)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::impl_getCFG" );
// SAFE -> ----------------------------------
WriteGuard aWriteLock(m_aLock);
@@ -1656,6 +1682,7 @@ AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPrefer
//-----------------------------------------------
::comphelper::Locale XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "XCUBasedAcceleratorConfiguration::impl_ts_getLocale" );
static ::rtl::OUString LOCALE_PACKAGE = ::rtl::OUString::createFromAscii("/org.openoffice.Setup");
static ::rtl::OUString LOCALE_PATH = ::rtl::OUString::createFromAscii("L10N" );
static ::rtl::OUString LOCALE_KEY = ::rtl::OUString::createFromAscii("ooLocale" );
diff --git a/framework/source/accelerators/acceleratorexecute.cxx b/framework/source/accelerators/acceleratorexecute.cxx
index 91591ed533..a6b0bd7bce 100644
--- a/framework/source/accelerators/acceleratorexecute.cxx
+++ b/framework/source/accelerators/acceleratorexecute.cxx
@@ -123,7 +123,7 @@ void AcceleratorExecute::init(const css::uno::Reference< css::lang::XMultiServic
// <- SAFE ------------------------------
css::uno::Reference< css::frame::XDispatchProvider > xDispatcher(
- xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")),
+ xSMGR->createInstance(SERVICENAME_DESKTOP),
css::uno::UNO_QUERY_THROW);
// SAFE -> ------------------------------
@@ -276,7 +276,7 @@ KeyCode AcceleratorExecute::st_AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey)
css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::impl_st_openGlobalConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
{
css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg(
- xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.ui.GlobalAcceleratorConfiguration")),
+ xSMGR->createInstance(SERVICENAME_GLOBALACCELERATORCONFIGURATION),
css::uno::UNO_QUERY_THROW);
return xAccCfg;
}
@@ -286,7 +286,7 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::im
const css::uno::Reference< css::frame::XFrame >& xFrame)
{
css::uno::Reference< css::frame::XModuleManager > xModuleDetection(
- xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager")),
+ xSMGR->createInstance(SERVICENAME_MODULEMANAGER),
css::uno::UNO_QUERY_THROW);
::rtl::OUString sModule;
@@ -300,7 +300,7 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::im
{ return css::uno::Reference< css::ui::XAcceleratorConfiguration >(); }
css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xUISupplier(
- xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")),
+ xSMGR->createInstance(SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER),
css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::ui::XUIConfigurationManager > xUIManager = xUISupplier->getUIConfigurationManager(sModule);
@@ -331,7 +331,7 @@ css::uno::Reference< css::util::XURLTransformer > AcceleratorExecute::impl_ts_ge
// <- SAFE ----------------------------------
css::uno::Reference< css::util::XURLTransformer > xParser(
- xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer")),
+ xSMGR->createInstance(SERVICENAME_URLTRANSFORMER),
css::uno::UNO_QUERY_THROW);
// SAFE -> ----------------------------------
diff --git a/framework/source/accelerators/moduleacceleratorconfiguration.cxx b/framework/source/accelerators/moduleacceleratorconfiguration.cxx
index 340ffa56d1..36599063ce 100644
--- a/framework/source/accelerators/moduleacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/moduleacceleratorconfiguration.cxx
@@ -109,6 +109,7 @@ DEFINE_INIT_SERVICE(ModuleAcceleratorConfiguration,
ModuleAcceleratorConfiguration::ModuleAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR)
: XCUBasedAcceleratorConfiguration(xSMGR)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleAcceleratorConfiguration::ModuleAcceleratorConfiguration" );
}
//-----------------------------------------------
@@ -122,6 +123,7 @@ void SAL_CALL ModuleAcceleratorConfiguration::initialize(const css::uno::Sequenc
throw(css::uno::Exception ,
css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleAcceleratorConfiguration::initialize" );
// SAFE -> ----------------------------------
WriteGuard aWriteLock(m_aLock);
@@ -143,6 +145,7 @@ void SAL_CALL ModuleAcceleratorConfiguration::initialize(const css::uno::Sequenc
//-----------------------------------------------
void ModuleAcceleratorConfiguration::impl_ts_fillCache()
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleAcceleratorConfiguration::impl_ts_fillCache" );
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
::rtl::OUString sModule = m_sModule;
diff --git a/framework/source/classes/addonmenu.cxx b/framework/source/classes/addonmenu.cxx
index aac8ba9489..35b61510ce 100644
--- a/framework/source/classes/addonmenu.cxx
+++ b/framework/source/classes/addonmenu.cxx
@@ -39,7 +39,7 @@
#include <general.h>
#include <macros/debug/assertion.hxx>
#include <helper/imageproducer.hxx>
-#include <classes/menuconfiguration.hxx>
+#include <xml/menuconfiguration.hxx>
//_________________________________________________________________________________________________________________
// interface includes
@@ -106,23 +106,12 @@ sal_Bool AddonPopupMenu::IsCommandURLPrefix( const ::rtl::OUString& aCmdURL )
}
AddonPopupMenu::AddonPopupMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame ) :
- m_xFrame( rFrame )
+ AddonMenu( rFrame )
{
}
AddonPopupMenu::~AddonPopupMenu()
{
- for ( USHORT i = 0; i < GetItemCount(); i++ )
- {
- if ( GetItemType( i ) != MENUITEM_SEPARATOR )
- {
- // delete user attributes created with new!
- USHORT nId = GetItemId( i );
- MenuConfiguration::Attributes* pUserAttributes = (MenuConfiguration::Attributes*)GetUserValue( nId );
- delete pUserAttributes;
- delete GetPopupMenu( nId );
- }
- }
}
// ------------------------------------------------------------------------
diff --git a/framework/source/classes/addonsoptions.cxx b/framework/source/classes/addonsoptions.cxx
index 26de1c7b24..b94d47c988 100644
--- a/framework/source/classes/addonsoptions.cxx
+++ b/framework/source/classes/addonsoptions.cxx
@@ -789,7 +789,7 @@ sal_Bool AddonsOptions_Impl::ReadOfficeToolBarSet( AddonToolBars& rAddonOfficeTo
ReadToolBarItemSet( aToolBarItemNode, rAddonOfficeToolBars[n] );
}
- return ( rAddonOfficeToolBars.size() > 0 );
+ return ( !rAddonOfficeToolBars.empty() );
}
diff --git a/framework/source/classes/bmkmenu.cxx b/framework/source/classes/bmkmenu.cxx
index 0e6c269464..3c2d17771d 100644
--- a/framework/source/classes/bmkmenu.cxx
+++ b/framework/source/classes/bmkmenu.cxx
@@ -41,7 +41,7 @@
#include <general.h>
#include <macros/debug/assertion.hxx>
#include <helper/imageproducer.hxx>
-#include <classes/menuconfiguration.hxx>
+#include <xml/menuconfiguration.hxx>
//_________________________________________________________________________________________________________________
// interface includes
@@ -130,15 +130,17 @@ USHORT BmkMenu_Impl::GetMID()
// ------------------------------------------------------------------------
-BmkMenu::BmkMenu( com::sun::star::uno::Reference< XFrame >& xFrame, BmkMenu::BmkMenuType nType, BmkMenu* pRoot ) :
- m_nType( nType ), m_xFrame( xFrame )
+BmkMenu::BmkMenu( com::sun::star::uno::Reference< XFrame >& xFrame, BmkMenu::BmkMenuType nType, BmkMenu* pRoot )
+ :AddonMenu(xFrame)
+ ,m_nType( nType )
{
_pImp = new BmkMenu_Impl( pRoot );
Initialize();
}
-BmkMenu::BmkMenu( Reference< XFrame >& xFrame, BmkMenu::BmkMenuType nType ) :
- m_nType( nType ), m_xFrame( xFrame )
+BmkMenu::BmkMenu( Reference< XFrame >& xFrame, BmkMenu::BmkMenuType nType )
+ :AddonMenu(xFrame)
+ ,m_nType( nType )
{
_pImp = new BmkMenu_Impl();
Initialize();
@@ -147,17 +149,6 @@ BmkMenu::BmkMenu( Reference< XFrame >& xFrame, BmkMenu::BmkMenuType nType ) :
BmkMenu::~BmkMenu()
{
delete _pImp;
-
- for ( USHORT i = 0; i < GetItemCount(); i++ )
- {
- if ( GetItemType( i ) != MENUITEM_SEPARATOR )
- {
- // delete user attributes created with new!
- USHORT nId = GetItemId( i );
- MenuConfiguration::Attributes* pUserAttributes = (MenuConfiguration::Attributes*)GetUserValue( nId );
- delete pUserAttributes;
- }
- }
}
void BmkMenu::Initialize()
diff --git a/framework/source/classes/framelistanalyzer.cxx b/framework/source/classes/framelistanalyzer.cxx
index bf16a997d0..84b9e97969 100644
--- a/framework/source/classes/framelistanalyzer.cxx
+++ b/framework/source/classes/framelistanalyzer.cxx
@@ -151,8 +151,7 @@ void FrameListAnalyzer::impl_analyze()
(xSet.is() )
)
{
- css::uno::Any aValue = xSet->getPropertyValue(FRAME_PROPNAME_ISHIDDEN);
- aValue >>= m_bReferenceIsHidden;
+ xSet->getPropertyValue(FRAME_PROPNAME_ISHIDDEN) >>= m_bReferenceIsHidden;
}
// check, if the reference frame includes the backing component.
@@ -272,8 +271,7 @@ void FrameListAnalyzer::impl_analyze()
xSet = css::uno::Reference< css::beans::XPropertySet >(xFrame, css::uno::UNO_QUERY);
if (xSet.is())
{
- css::uno::Any aValue = xSet->getPropertyValue(FRAME_PROPNAME_ISHIDDEN);
- aValue >>= bHidden;
+ xSet->getPropertyValue(FRAME_PROPNAME_ISHIDDEN) >>= bHidden;
}
}
diff --git a/framework/source/classes/fwktabwindow.cxx b/framework/source/classes/fwktabwindow.cxx
index 8628744fbc..973d3cbdc0 100644
--- a/framework/source/classes/fwktabwindow.cxx
+++ b/framework/source/classes/fwktabwindow.cxx
@@ -33,7 +33,7 @@
#include <classes/fwktabwindow.hxx>
#include "framework.hrc"
-#include <classes/fwkresid.hxx>
+#include <classes/fwlresid.hxx>
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
@@ -224,9 +224,9 @@ void FwkTabPage::Save()
FwkTabWindow::FwkTabWindow( Window* pParent ) :
- Window( pParent, FwkResId( WIN_TABWINDOW ) ),
+ Window( pParent, FwlResId( WIN_TABWINDOW ) ),
- m_aTabCtrl ( this, FwkResId( TC_TABCONTROL ) )
+ m_aTabCtrl ( this, FwlResId( TC_TABCONTROL ) )
{
uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
m_xWinProvider = uno::Reference < awt::XContainerWindowProvider >(
@@ -365,20 +365,19 @@ FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< bea
{
beans::NamedValue aValue = rProperties[i];
::rtl::OUString sName = aValue.Name;
- uno::Any aAny = aValue.Value;
if ( sName.equalsAscii("Title") )
- aAny >>= sTitle;
+ aValue.Value >>= sTitle;
else if ( sName.equalsAscii("ToolTip") )
- aAny >>= sToolTip;
+ aValue.Value >>= sToolTip;
else if ( sName.equalsAscii("PageURL") )
- aAny >>= sPageURL;
+ aValue.Value >>= sPageURL;
else if ( sName.equalsAscii("EventHdl") )
- aAny >>= xEventHdl;
+ aValue.Value >>= xEventHdl;
else if ( sName.equalsAscii("Image") )
- aAny >>= xImage;
+ aValue.Value >>= xImage;
else if ( sName.equalsAscii("Disabled") )
- aAny >>= bDisabled;
+ aValue.Value >>= bDisabled;
}
TabEntry* pEntry = new TabEntry( nIndex, sPageURL, xEventHdl );
diff --git a/framework/source/classes/fwlresid.cxx b/framework/source/classes/fwlresid.cxx
new file mode 100755
index 0000000000..d8eeb18dee
--- /dev/null
+++ b/framework/source/classes/fwlresid.cxx
@@ -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: FwlResId.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_framework.hxx"
+
+#include "classes/fwlresid.hxx"
+#include <tools/string.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <rtl/strbuf.hxx>
+
+namespace framework
+{
+
+ResMgr* FwlResId::GetResManager()
+{
+ static ResMgr* pResMgr = NULL;
+
+ if ( !pResMgr )
+ {
+ rtl::OStringBuffer aBuf( 32 );
+ aBuf.append( "fwe" );
+
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ pResMgr = ResMgr::CreateResMgr( aBuf.getStr() );
+ }
+
+ return pResMgr;
+}
+
+// -----------------------------------------------------------------------
+
+FwlResId::FwlResId( USHORT nId ) :
+ ResId( nId, *FwlResId::GetResManager() )
+{
+}
+
+}
+
diff --git a/framework/source/classes/imagewrapper.cxx b/framework/source/classes/imagewrapper.cxx
index cd57d41895..7e001a9e41 100644
--- a/framework/source/classes/imagewrapper.cxx
+++ b/framework/source/classes/imagewrapper.cxx
@@ -54,7 +54,6 @@ static Sequence< sal_Int8 > impl_getStaticIdentifier()
ImageWrapper::ImageWrapper( const Image& aImage ) : ThreadHelpBase( &Application::GetSolarMutex() )
- , cppu::OWeakObject()
, m_aImage( aImage )
{
}
@@ -70,33 +69,6 @@ Sequence< sal_Int8 > ImageWrapper::GetUnoTunnelId()
return impl_getStaticIdentifier();
}
-
-// XInterface
-void SAL_CALL ImageWrapper::acquire() throw ()
-{
- OWeakObject::acquire();
-}
-
-void SAL_CALL ImageWrapper::release() throw ()
-{
- OWeakObject::release();
-}
-
-Any SAL_CALL ImageWrapper::queryInterface( const Type& aType )
-throw ( RuntimeException )
-{
- Any a = ::cppu::queryInterface(
- aType ,
- SAL_STATIC_CAST( com::sun::star::awt::XBitmap*, this ),
- SAL_STATIC_CAST( XUnoTunnel*, this ),
- SAL_STATIC_CAST( XTypeProvider*, this ));
-
- if( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( aType );
-}
-
// XBitmap
com::sun::star::awt::Size SAL_CALL ImageWrapper::getSize() throw ( RuntimeException )
{
@@ -147,63 +119,5 @@ sal_Int64 SAL_CALL ImageWrapper::getSomething( const Sequence< sal_Int8 >& aIden
return 0;
}
-// XTypeProvider
-Sequence< Type > SAL_CALL ImageWrapper::getTypes() throw ( RuntimeException )
-{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
- static ::cppu::OTypeCollection* pTypeCollection = NULL ;
-
- if ( pTypeCollection == NULL )
- {
- // Ready for multithreading; get global mutex for first call of this method only! see before
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
-
- // Control these pointer again ... it can be, that another instance will be faster then these!
- if ( pTypeCollection == NULL )
- {
- // Create a static typecollection ...
- static ::cppu::OTypeCollection aTypeCollection(
- ::getCppuType(( const Reference< XTypeProvider >*)NULL ) ,
- ::getCppuType(( const Reference< XUnoTunnel >*)NULL ) ,
- ::getCppuType(( const Reference< com::sun::star::awt::XBitmap >*)NULL ) ) ;
-
- // ... and set his address to static pointer!
- pTypeCollection = &aTypeCollection ;
- }
- }
-
- return pTypeCollection->getTypes() ;
-}
-
-Sequence< sal_Int8 > SAL_CALL ImageWrapper::getImplementationId() throw ( RuntimeException )
-{
- // Create one Id for all instances of this class.
- // Use ethernet address to do this! (sal_True)
-
- // Optimize this method
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pID is NULL - for the second call pID is different from NULL!
- static ::cppu::OImplementationId* pID = NULL ;
-
- if ( pID == NULL )
- {
- // Ready for multithreading; get global mutex for first call of this method only! see before
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
-
- // Control these pointer again ... it can be, that another instance will be faster then these!
- if ( pID == NULL )
- {
- // Create a new static ID ...
- static ::cppu::OImplementationId aID( sal_False ) ;
- // ... and set his address to static pointer!
- pID = &aID ;
- }
- }
-
- return pID->getImplementationId() ;
-}
-
}
diff --git a/framework/source/classes/makefile.mk b/framework/source/classes/makefile.mk
index a80bf0b87a..c55af1cdf8 100644
--- a/framework/source/classes/makefile.mk
+++ b/framework/source/classes/makefile.mk
@@ -57,6 +57,7 @@ SLOFILES= \
$(SLO)$/addonmenu.obj \
$(SLO)$/addonsoptions.obj \
$(SLO)$/fwkresid.obj \
+ $(SLO)$/fwlresid.obj \
$(SLO)$/framelistanalyzer.obj \
$(SLO)$/sfxhelperfunctions.obj \
$(SLO)$/menuextensionsupplier.obj \
diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx
index 88b573bbf0..0527084adb 100644
--- a/framework/source/classes/menumanager.cxx
+++ b/framework/source/classes/menumanager.cxx
@@ -36,14 +36,14 @@
// my own includes
//_________________________________________________________________________________________________________________
#include <classes/menumanager.hxx>
-#include <classes/menuconfiguration.hxx>
+#include <xml/menuconfiguration.hxx>
#include <classes/bmkmenu.hxx>
#include <classes/addonmenu.hxx>
#include <helper/imageproducer.hxx>
#include <threadhelp/resetableguard.hxx>
#include "classes/addonsoptions.hxx"
#include <classes/fwkresid.hxx>
-
+#include <services.h>
#include "classes/resource.hrc"
//_________________________________________________________________________________________________________________
@@ -92,6 +92,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
@@ -122,9 +123,7 @@ namespace framework
#define SID_HELPMENU (SID_SFX_START + 410)
#define SFX_REFERER_USER "private:user"
-#define DESKTOP_SERVICE ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))
-const ::rtl::OUString aSlotString( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
const ::rtl::OUString aSlotNewDocDirect( RTL_CONSTASCII_USTRINGPARAM( "slot:5537" ));
const ::rtl::OUString aSlotAutoPilot( RTL_CONSTASCII_USTRINGPARAM( "slot:6381" ));
@@ -146,7 +145,6 @@ MenuManager::MenuManager(
REFERENCE< XFRAME >& rFrame, Menu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
: // #110897#
ThreadHelpBase( &Application::GetSolarMutex() ),
- OWeakObject(),
mxServiceFactory(xServiceFactory)
{
m_bActive = sal_False;
@@ -163,61 +161,30 @@ MenuManager::MenuManager(
m_bShowMenuImages = rSettings.GetUseImagesInMenus();
sal_Int32 nAddonsURLPrefixLength = ADDONSPOPUPMENU_URL_PREFIX.getLength();
+#if 0
::std::vector< USHORT > aQueryLabelItemIdVector;
+#endif
USHORT nItemCount = pMenu->GetItemCount();
+ m_aMenuItemHandlerVector.reserve(nItemCount);
+ ::rtl::OUString aItemCommand;
for ( USHORT i = 0; i < nItemCount; i++ )
{
- USHORT nItemId = pMenu->GetItemId( i );
-
- ::rtl::OUString aItemCommand = pMenu->GetItemCommand( nItemId );
- if ( !aItemCommand.getLength() )
- {
- aItemCommand = aSlotString;
- aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
- pMenu->SetItemCommand( nItemId, aItemCommand );
- }
+ USHORT nItemId = FillItemCommand(aItemCommand,pMenu, i );
PopupMenu* pPopupMenu = pMenu->GetPopupMenu( nItemId );
if ( pPopupMenu )
{
- if (( aItemCommand.getLength() > nAddonsURLPrefixLength ) &&
- ( aItemCommand.indexOf( ADDONSPOPUPMENU_URL_PREFIX ) == 0 ))
- {
- // A special addon popup menu, must be created with a different ctor
-
- // #110897#
- // MenuManager* pSubMenuManager = new MenuManager( rFrame, (AddonPopupMenu *)pPopupMenu, bDeleteChildren, bDeleteChildren );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, (AddonPopupMenu *)pPopupMenu, bDeleteChildren, bDeleteChildren );
-
- // store menu item command as we later have to know which menu is active (see Activate handler)
- pSubMenuManager->m_aMenuItemCommand = aItemCommand;
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- else
+ AddMenu(pPopupMenu,aItemCommand,nItemId,bDeleteChildren,bDeleteChildren);
+ if (! (( aItemCommand.getLength() > nAddonsURLPrefixLength ) &&
+ ( aItemCommand.indexOf( ADDONSPOPUPMENU_URL_PREFIX ) == 0 )) )
{
// #110897#
// MenuManager* pSubMenuManager = new MenuManager( rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
- MenuManager* pSubMenuMgr = new MenuManager( getServiceFactory(), rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
-
- // store menu item command as we later have to know which menu is active (see Activate handler)
- pSubMenuMgr->m_aMenuItemCommand = aItemCommand;
-
- REFERENCE< XDISPATCH > aXDispRef;
- MenuItemHandler* pMenuItemHdl = new MenuItemHandler(
- nItemId,
- pSubMenuMgr,
- aXDispRef );
- m_aMenuItemHandlerVector.push_back( pMenuItemHdl );
-
+#if 0
if ( pMenu->GetItemText( nItemId ).Len() == 0 )
aQueryLabelItemIdVector.push_back( nItemId );
+#endif
// Create addon popup menu if there exist elements and this is the tools popup menu
if (( nItemId == SID_ADDONLIST ||
@@ -237,23 +204,18 @@ MenuManager::MenuManager(
pPopupMenu->SetPopupMenu( ITEMID_ADDONLIST, pSubMenu );
// Set item command for popup menu to enable it for GetImageFromURL
+ const static ::rtl::OUString aSlotString( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
aItemCommand = aSlotString;
aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)ITEMID_ADDONLIST );
pPopupMenu->SetItemCommand( ITEMID_ADDONLIST, aItemCommand );
// #110897#
// MenuManager* pSubMenuManager = new MenuManager( rFrame, pSubMenu, sal_True, sal_False );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, pSubMenu, sal_True, sal_False );
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
+ AddMenu(pSubMenu,::rtl::OUString(),nItemId,sal_True,sal_False);
+#if 0
if ( pMenu->GetItemText( nItemId ).Len() == 0 )
aQueryLabelItemIdVector.push_back( nItemId );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
-
+#endif
// Set image for the addon popup menu item
if ( m_bShowMenuImages && !pPopupMenu->GetItemImage( ITEMID_ADDONLIST ))
{
@@ -281,16 +243,11 @@ MenuManager::MenuManager(
// #110897#
// MenuManager* pSubMenuManager = new MenuManager( rFrame, pSubMenu, sal_True, sal_False );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, pSubMenu, sal_True, sal_False );
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
+ AddMenu(pSubMenu,::rtl::OUString(),nItemId,sal_True,sal_False);
+#if 0
if ( pMenu->GetItemText( nItemId ).Len() == 0 )
aQueryLabelItemIdVector.push_back( nItemId );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
+#endif
if ( m_bShowMenuImages && !pMenu->GetItemImage( nItemId ))
{
@@ -311,16 +268,11 @@ MenuManager::MenuManager(
// #110897#
// MenuManager* pSubMenuManager = new MenuManager( rFrame, pSubMenu, sal_True, sal_False );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, pSubMenu, sal_True, sal_False );
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
+ AddMenu(pSubMenu,::rtl::OUString(),nItemId,sal_True,sal_False);
+#if 0
if ( pMenu->GetItemText( nItemId ).Len() == 0 )
aQueryLabelItemIdVector.push_back( nItemId );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
+#endif
if ( m_bShowMenuImages && !pMenu->GetItemImage( nItemId ))
{
@@ -368,8 +320,10 @@ MenuManager::MenuManager(
REFERENCE< XDISPATCH > aXDispatchRef;
m_aMenuItemHandlerVector.push_back( new MenuItemHandler( nItemId, NULL, aXDispatchRef ));
+#if 0
if ( pMenu->GetItemText( nItemId ).Len() == 0 )
aQueryLabelItemIdVector.push_back( nItemId );
+#endif
}
}
}
@@ -397,98 +351,15 @@ MenuManager::MenuManager(
}
}
#endif
- m_pVCLMenu->SetHighlightHdl( LINK( this, MenuManager, Highlight ));
- m_pVCLMenu->SetActivateHdl( LINK( this, MenuManager, Activate ));
- m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuManager, Deactivate ));
- m_pVCLMenu->SetSelectHdl( LINK( this, MenuManager, Select ));
-}
-
-
-// #110897#
-MenuManager::MenuManager(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- REFERENCE< XFRAME >& rFrame, BmkMenu* pBmkMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
-: // #110897#
- ThreadHelpBase( &Application::GetSolarMutex() ),
- OWeakObject(),
- mxServiceFactory(xServiceFactory)
-{
- m_bActive = sal_False;
- m_bDeleteMenu = bDelete;
- m_bDeleteChildren = bDeleteChildren;
- m_pVCLMenu = pBmkMenu;
- m_xFrame = rFrame;
- m_bInitialized = sal_False;
- m_bIsBookmarkMenu = sal_True;
-
- const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- m_bWasHiContrast = rSettings.GetMenuColor().IsDark();
-
- SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, (OWeakObject*)this )->acquire();
-
- USHORT nItemCount = pBmkMenu->GetItemCount();
- for ( USHORT i = 0; i < nItemCount; i++ )
- {
- USHORT nItemId = pBmkMenu->GetItemId( i );
-
- ::rtl::OUString aItemCommand = pBmkMenu->GetItemCommand( nItemId );
- if ( !aItemCommand.getLength() )
- {
- aItemCommand = aSlotString;
- aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
- pBmkMenu->SetItemCommand( nItemId, aItemCommand );
- }
-
- PopupMenu* pPopupMenu = pBmkMenu->GetPopupMenu( nItemId );
- if ( pPopupMenu )
- {
- // #110897#
- // MenuManager* pSubMenuManager = new MenuManager( rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
-
- // store menu item command as we later have to know which menu is active (see Acivate handler)
- pSubMenuManager->m_aMenuItemCommand = aItemCommand;
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- else
- {
- if ( pBmkMenu->GetItemType( i ) != MENUITEM_SEPARATOR )
- {
- MenuConfiguration::Attributes* pBmkAttributes = (MenuConfiguration::Attributes *)(pBmkMenu->GetUserValue( nItemId ));
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler( nItemId, NULL, aXDispatchRef );
-
- if ( pBmkAttributes )
- {
- // read additional attributes from attributes struct and BmkMenu implementation will delete all attributes itself!!
- pMenuItemHandler->aTargetFrame = pBmkAttributes->aTargetFrame;
- }
-
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- }
- }
-
- m_pVCLMenu->SetHighlightHdl( LINK( this, MenuManager, Highlight ));
- m_pVCLMenu->SetActivateHdl( LINK( this, MenuManager, Activate ));
- m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuManager, Deactivate ));
- m_pVCLMenu->SetSelectHdl( LINK( this, MenuManager, Select ));
+ SetHdl();
}
-
// #110897#
MenuManager::MenuManager(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
REFERENCE< XFRAME >& rFrame, AddonMenu* pAddonMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
: // #110897#
ThreadHelpBase( &Application::GetSolarMutex() ),
- OWeakObject(),
mxServiceFactory(xServiceFactory)
{
m_bActive = sal_False;
@@ -505,34 +376,18 @@ MenuManager::MenuManager(
SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, (OWeakObject*)this )->acquire();
USHORT nItemCount = pAddonMenu->GetItemCount();
+ m_aMenuItemHandlerVector.reserve(nItemCount);
+ ::rtl::OUString aItemCommand;
for ( USHORT i = 0; i < nItemCount; i++ )
{
- USHORT nItemId = pAddonMenu->GetItemId( i );
-
- ::rtl::OUString aItemCommand = pAddonMenu->GetItemCommand( nItemId );
- if ( !aItemCommand.getLength() )
- {
- aItemCommand = aSlotString;
- aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
- pAddonMenu->SetItemCommand( nItemId, aItemCommand );
- }
+ USHORT nItemId = FillItemCommand(aItemCommand,pAddonMenu, i );
PopupMenu* pPopupMenu = pAddonMenu->GetPopupMenu( nItemId );
if ( pPopupMenu )
{
// #110897#
// MenuManager* pSubMenuManager = new MenuManager( rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
-
- // store menu item command as we later have to know which menu is active (see Acivate handler)
- pSubMenuManager->m_aMenuItemCommand = aItemCommand;
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
+ AddMenu(pPopupMenu,aItemCommand,nItemId,bDeleteChildren,bDeleteChildren);
}
else
{
@@ -553,110 +408,27 @@ MenuManager::MenuManager(
}
}
- m_pVCLMenu->SetHighlightHdl( LINK( this, MenuManager, Highlight ));
- m_pVCLMenu->SetActivateHdl( LINK( this, MenuManager, Activate ));
- m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuManager, Deactivate ));
- m_pVCLMenu->SetSelectHdl( LINK( this, MenuManager, Select ));
+ SetHdl();
}
-
-// #110897#
-MenuManager::MenuManager(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- REFERENCE< XFRAME >& rFrame, AddonPopupMenu* pAddonPopupMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
-: // #110897#
- ThreadHelpBase( &Application::GetSolarMutex() ),
- OWeakObject(),
- mxServiceFactory(xServiceFactory)
+void MenuManager::SetHdl()
{
- m_bActive = sal_False;
- m_bDeleteMenu = bDelete;
- m_bDeleteChildren = bDeleteChildren;
- m_pVCLMenu = pAddonPopupMenu;
- m_xFrame = rFrame;
- m_bInitialized = sal_False;
- m_bIsBookmarkMenu = sal_True;
-
- const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- m_bWasHiContrast = rSettings.GetMenuColor().IsDark();
-
- SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, (OWeakObject*)this )->acquire();
-
- USHORT nItemCount = pAddonPopupMenu->GetItemCount();
- for ( USHORT i = 0; i < nItemCount; i++ )
- {
- USHORT nItemId = pAddonPopupMenu->GetItemId( i );
-
- ::rtl::OUString aItemCommand = pAddonPopupMenu->GetItemCommand( nItemId );
- if ( !aItemCommand.getLength() )
- {
- aItemCommand = aSlotString;
- aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
- pAddonPopupMenu->SetItemCommand( nItemId, aItemCommand );
- }
-
- PopupMenu* pPopupMenu = pAddonPopupMenu->GetPopupMenu( nItemId );
- if ( pPopupMenu )
- {
- // #110897#
- // MenuManager* pSubMenuManager = new MenuManager( rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
-
- // store menu item command as we later have to know which menu is active (see Acivate handler)
- pSubMenuManager->m_aMenuItemCommand = aItemCommand;
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- else
- {
- if ( pAddonPopupMenu->GetItemType( i ) != MENUITEM_SEPARATOR )
- {
- MenuConfiguration::Attributes* pAttributes = (MenuConfiguration::Attributes *)(pAddonPopupMenu->GetUserValue( nItemId ));
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler( nItemId, NULL, aXDispatchRef );
-
- if ( pAttributes )
- {
- // read additional attributes from attributes struct and BmkMenu implementation will delete all attributes itself!!
- pMenuItemHandler->aTargetFrame = pAttributes->aTargetFrame;
- }
-
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- }
- }
-
m_pVCLMenu->SetHighlightHdl( LINK( this, MenuManager, Highlight ));
m_pVCLMenu->SetActivateHdl( LINK( this, MenuManager, Activate ));
m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuManager, Deactivate ));
m_pVCLMenu->SetSelectHdl( LINK( this, MenuManager, Select ));
-}
-Any SAL_CALL MenuManager::queryInterface( const ::com::sun::star::uno::Type & rType ) throw ( RuntimeException )
-{
- Any a = ::cppu::queryInterface(
- rType ,
- SAL_STATIC_CAST( XSTATUSLISTENER*, this ),
- SAL_STATIC_CAST( XEVENTLISTENER*, this ));
- if ( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( rType );
+ if ( mxServiceFactory.is() )
+ m_xURLTransformer.set( mxServiceFactory->createInstance(SERVICENAME_URLTRANSFORMER),UNO_QUERY );
}
-
MenuManager::~MenuManager()
{
std::vector< MenuItemHandler* >::iterator p;
for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); p++ )
{
MenuItemHandler* pItemHandler = *p;
- pItemHandler->xMenuItemDispatch = REFERENCE< XDISPATCH >();
+ pItemHandler->xMenuItemDispatch.clear();
if ( pItemHandler->pSubMenuManager )
SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, (OWeakObject*)pItemHandler->pSubMenuManager )->release();
delete pItemHandler;
@@ -730,11 +502,7 @@ throw ( RuntimeException )
aTargetURL.Complete = pStatusChangedMenu->aMenuItemURL;
// #110897#
- // REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
REFERENCE< XDISPATCHPROVIDER > xDispatchProvider( m_xFrame, UNO_QUERY );
REFERENCE< XDISPATCH > xMenuItemDispatch = xDispatchProvider->queryDispatch(
@@ -754,16 +522,15 @@ throw ( RuntimeException )
void MenuManager::RemoveListener()
{
ResetableGuard aGuard( m_aLock );
+ ClearMenuDispatch();
+}
+void MenuManager::ClearMenuDispatch(const EVENTOBJECT& Source,bool _bRemoveOnly)
+{
// disposing called from parent dispatcher
// remove all listener to prepare shutdown
// #110897#
- //REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-
std::vector< MenuItemHandler* >::iterator p;
for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); p++ )
{
@@ -772,15 +539,20 @@ void MenuManager::RemoveListener()
{
URL aTargetURL;
aTargetURL.Complete = pItemHandler->aMenuItemURL;
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
pItemHandler->xMenuItemDispatch->removeStatusListener(
SAL_STATIC_CAST( XSTATUSLISTENER*, this ), aTargetURL );
}
- pItemHandler->xMenuItemDispatch = REFERENCE< XDISPATCH >();
+ pItemHandler->xMenuItemDispatch.clear();
if ( pItemHandler->pSubMenuManager )
- pItemHandler->pSubMenuManager->RemoveListener();
+ {
+ if ( _bRemoveOnly )
+ pItemHandler->pSubMenuManager->RemoveListener();
+ else
+ pItemHandler->pSubMenuManager->disposing( Source );
+ }
}
}
@@ -790,34 +562,7 @@ void SAL_CALL MenuManager::disposing( const EVENTOBJECT& Source ) throw ( RUNTIM
if ( Source.Source == m_xFrame )
{
ResetableGuard aGuard( m_aLock );
-
- // disposing called from parent dispatcher
- // remove all listener to prepare shutdown
-
- // #110897#
- // REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-
- std::vector< MenuItemHandler* >::iterator p;
- for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); p++ )
- {
- MenuItemHandler* pItemHandler = *p;
- if ( pItemHandler->xMenuItemDispatch.is() )
- {
- URL aTargetURL;
- aTargetURL.Complete = pItemHandler->aMenuItemURL;
- xTrans->parseStrict( aTargetURL );
-
- pItemHandler->xMenuItemDispatch->removeStatusListener(
- SAL_STATIC_CAST( XSTATUSLISTENER*, this ), aTargetURL );
- }
-
- pItemHandler->xMenuItemDispatch = REFERENCE< XDISPATCH >();
- if ( pItemHandler->pSubMenuManager )
- pItemHandler->pSubMenuManager->disposing( Source );
- }
+ ClearMenuDispatch(Source,false);
}
else
{
@@ -844,15 +589,10 @@ void SAL_CALL MenuManager::disposing( const EVENTOBJECT& Source ) throw ( RUNTIM
aTargetURL.Complete = pMenuItemDisposing->aMenuItemURL;
// #110897#
- // REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- xTrans->parseStrict( aTargetURL );
-
- pMenuItemDisposing->xMenuItemDispatch->removeStatusListener(
- SAL_STATIC_CAST( XSTATUSLISTENER*, this ), aTargetURL );
- pMenuItemDisposing->xMenuItemDispatch = REFERENCE< XDISPATCH >();
+ m_xURLTransformer->parseStrict( aTargetURL );
+
+ pMenuItemDisposing->xMenuItemDispatch->removeStatusListener(SAL_STATIC_CAST( XSTATUSLISTENER*, this ), aTargetURL );
+ pMenuItemDisposing->xMenuItemDispatch.clear();
}
}
}
@@ -869,6 +609,7 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
USHORT nPickItemId = START_ITEMID_PICKLIST;
int nPickListMenuItems = ( aHistoryList.getLength() > 99 ) ? 99 : aHistoryList.getLength();
+ aNewPickVector.reserve(nPickListMenuItems);
for ( int i = 0; i < nPickListMenuItems; i++ )
{
Sequence< PropertyValue > aPickListEntry = aHistoryList[i];
@@ -896,19 +637,15 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
aNewPickVector.push_back( pNewMenuItemHandler );
}
- if ( aNewPickVector.size() > 0 )
+ if ( !aNewPickVector.empty() )
{
URL aTargetURL;
REFERENCE< XDISPATCHPROVIDER > xDispatchProvider( m_xFrame, UNO_QUERY );
// #110897#
- // REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-
REFERENCE< XDISPATCH > xMenuItemDispatch;
+ static const ::rtl::OUString s_sDefault(RTL_CONSTASCII_USTRINGPARAM("_default"));
// query for dispatcher
std::vector< MenuItemHandler* >::iterator p;
for ( p = aNewPickVector.begin(); p != aNewPickVector.end(); p++ )
@@ -916,12 +653,12 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
MenuItemHandler* pMenuItemHandler = *p;
aTargetURL.Complete = pMenuItemHandler->aMenuItemURL;
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
if ( !xMenuItemDispatch.is() )
{
// attention: this code assume that "_blank" can only be consumed by desktop service
- xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString::createFromAscii("_default"), 0 );
+ xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, s_sDefault, 0 );
}
if ( xMenuItemDispatch.is() )
@@ -963,8 +700,10 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
}
// append new picklist menu entries
+ aNewPickVector.reserve(aNewPickVector.size());
pMenu->InsertSeparator();
- for ( sal_uInt32 i = 0; i < aNewPickVector.size(); i++ )
+ const sal_uInt32 nCount = aNewPickVector.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
char menuShortCut[5] = "~n: ";
@@ -1027,17 +766,13 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
}
}
-
-void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu )
+void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XMultiServiceFactory >& xServiceFactory,framework::IMutex& _rMutex )
{
// update window list
::std::vector< ::rtl::OUString > aNewWindowListVector;
// #110897#
- // Reference< XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
- // DESKTOP_SERVICE ), UNO_QUERY );
- Reference< XDesktop > xDesktop( getServiceFactory()->createInstance(
- DESKTOP_SERVICE ), UNO_QUERY );
+ Reference< XDesktop > xDesktop( xServiceFactory->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY );
USHORT nActiveItemId = 0;
USHORT nItemId = START_ITEMID_WINDOWLIST;
@@ -1048,11 +783,12 @@ void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu )
Reference< XFrame > xCurrentFrame = xDesktop->getCurrentFrame();
Reference< XIndexAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY );
sal_Int32 nCount = xList->getCount();
+ aNewWindowListVector.reserve(nCount);
for (sal_Int32 i=0; i<nCount; ++i )
{
- Any aItem = xList->getByIndex(i);
Reference< XFrame > xFrame;
- aItem >>= xFrame;
+ xList->getByIndex(i) >>= xFrame;
+
if (xFrame.is())
{
if ( xFrame == xCurrentFrame )
@@ -1069,9 +805,9 @@ void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu )
}
{
- ResetableGuard aGuard( m_aLock );
+ ResetableGuard aGuard( _rMutex );
- int nItemCount = pMenu->GetItemCount();
+ int nItemCount = pMenu->GetItemCount();
if ( nItemCount > 0 )
{
@@ -1084,12 +820,13 @@ void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu )
pMenu->RemoveItem( pMenu->GetItemCount()-1 );
}
- if ( aNewWindowListVector.size() > 0 )
+ if ( !aNewWindowListVector.empty() )
{
// append new window list entries to menu
pMenu->InsertSeparator();
nItemId = START_ITEMID_WINDOWLIST;
- for ( sal_uInt32 i = 0; i < aNewWindowListVector.size(); i++ )
+ const sal_uInt32 nCount = aNewWindowListVector.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
pMenu->InsertItem( nItemId, aNewWindowListVector.at( i ), MIB_RADIOCHECK );
if ( nItemId == nActiveItemId )
@@ -1179,7 +916,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
else if ( m_aMenuItemCommand == aSpecialWindowMenu ||
m_aMenuItemCommand == aSlotSpecialWindowMenu ||
aCommand == aSpecialWindowCommand )
- UpdateSpecialWindowMenu( pMenu );
+ UpdateSpecialWindowMenu( pMenu,getServiceFactory(),m_aLock );
// Check if some modes have changed so we have to update our menu images
sal_Bool bIsHiContrast = rSettings.GetMenuColor().IsDark();
@@ -1189,48 +926,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
// The mode changed so we have to replace all images
m_bWasHiContrast = bIsHiContrast;
m_bShowMenuImages = bShowMenuImages;
- AddonsOptions aAddonOptions;
-
- for ( USHORT nPos = 0; nPos < pMenu->GetItemCount(); nPos++ )
- {
- USHORT nId = pMenu->GetItemId( nPos );
- if ( pMenu->GetItemType( nPos ) != MENUITEM_SEPARATOR )
- {
- if ( bShowMenuImages )
- {
- sal_Bool bImageSet = sal_False;
- ::rtl::OUString aImageId;
-
- ::framework::MenuConfiguration::Attributes* pMenuAttributes =
- (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( nId );
-
- if ( pMenuAttributes )
- aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes
-
- if ( aImageId.getLength() > 0 )
- {
- Image aImage = GetImageFromURL( m_xFrame, aImageId, FALSE, bIsHiContrast );
- if ( !!aImage )
- {
- bImageSet = sal_True;
- pMenu->SetItemImage( nId, aImage );
- }
- }
-
- if ( !bImageSet )
- {
- rtl::OUString aMenuItemCommand = pMenu->GetItemCommand( nId );
- Image aImage = GetImageFromURL( m_xFrame, aMenuItemCommand, FALSE, bIsHiContrast );
- if ( !aImage )
- aImage = aAddonOptions.GetImageFromURL( aMenuItemCommand, FALSE, bIsHiContrast );
-
- pMenu->SetItemImage( nId, aImage );
- }
- }
- else
- pMenu->SetItemImage( nId, Image() );
- }
- }
+ FillMenuImages(m_xFrame,pMenu,bIsHiContrast,bShowMenuImages);
}
if ( m_bInitialized )
@@ -1240,11 +936,6 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
URL aTargetURL;
// #110897#
- // REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-
ResetableGuard aGuard( m_aLock );
REFERENCE< XDISPATCHPROVIDER > xDispatchProvider( m_xFrame, UNO_QUERY );
@@ -1266,14 +957,15 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
::rtl::OUString aItemCommand = pMenu->GetItemCommand( pMenuItemHandler->nItemId );
if ( !aItemCommand.getLength() )
{
- aItemCommand = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
+ const static ::rtl::OUString aSlotString( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
+ aItemCommand = aSlotString;
aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)pMenuItemHandler->nItemId );
pMenu->SetItemCommand( pMenuItemHandler->nItemId, aItemCommand );
}
aTargetURL.Complete = aItemCommand;
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
REFERENCE< XDISPATCH > xMenuItemDispatch;
if ( m_bIsBookmarkMenu )
@@ -1330,8 +1022,7 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu )
// #110897#
// Reference< XFramesSupplier > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
// DESKTOP_SERVICE ), UNO_QUERY );
- Reference< XFramesSupplier > xDesktop( getServiceFactory()->createInstance(
- DESKTOP_SERVICE ), UNO_QUERY );
+ Reference< XFramesSupplier > xDesktop( getServiceFactory()->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY );
if ( xDesktop.is() )
{
@@ -1340,9 +1031,9 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu )
sal_Int32 nCount = xList->getCount();
for ( sal_Int32 i=0; i<nCount; ++i )
{
- Any aItem = xList->getByIndex(i);
Reference< XFrame > xFrame;
- aItem >>= xFrame;
+ xList->getByIndex(i) >>= xFrame;
+
if ( xFrame.is() && nTaskId == nCurItemId )
{
Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
@@ -1360,14 +1051,8 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu )
MenuItemHandler* pMenuItemHandler = GetMenuItemHandler( nCurItemId );
if ( pMenuItemHandler && pMenuItemHandler->xMenuItemDispatch.is() )
{
- // #110897#
- // REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-
aTargetURL.Complete = pMenuItemHandler->aMenuItemURL;
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
if ( nCurItemId >= START_ITEMID_PICKLIST &&
nCurItemId < START_ITEMID_WINDOWLIST )
@@ -1378,11 +1063,9 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu )
else if ( m_bIsBookmarkMenu )
{
// bookmark menu item selected
- Any a;
aArgs.realloc( 1 );
aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Referer" ));
- a <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SFX_REFERER_USER ));
- aArgs[0].Value = a;
+ aArgs[0].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SFX_REFERER_USER ));
}
xDispatch = pMenuItemHandler->xMenuItemDispatch;
@@ -1410,4 +1093,78 @@ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFac
return mxServiceFactory;
}
+void MenuManager::AddMenu(PopupMenu* _pPopupMenu,const ::rtl::OUString& _sItemCommand,USHORT _nItemId,sal_Bool _bDelete,sal_Bool _bDeleteChildren)
+{
+ MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), m_xFrame, _pPopupMenu, _bDelete, _bDeleteChildren );
+
+ // store menu item command as we later have to know which menu is active (see Activate handler)
+ pSubMenuManager->m_aMenuItemCommand = _sItemCommand;
+
+ REFERENCE< XDISPATCH > aXDispatchRef;
+ MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
+ _nItemId,
+ pSubMenuManager,
+ aXDispatchRef );
+ m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
+}
+
+USHORT MenuManager::FillItemCommand(::rtl::OUString& _rItemCommand,Menu* _pMenu,USHORT _nIndex) const
+{
+ USHORT nItemId = _pMenu->GetItemId( _nIndex );
+
+ _rItemCommand = _pMenu->GetItemCommand( nItemId );
+ if ( !_rItemCommand.getLength() )
+ {
+ const static ::rtl::OUString aSlotString( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
+ _rItemCommand = aSlotString;
+ _rItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
+ _pMenu->SetItemCommand( nItemId, _rItemCommand );
+ }
+ return nItemId;
+}
+void MenuManager::FillMenuImages(Reference< XFrame >& _xFrame,Menu* _pMenu,sal_Bool bIsHiContrast,sal_Bool bShowMenuImages)
+{
+ AddonsOptions aAddonOptions;
+
+ for ( USHORT nPos = 0; nPos < _pMenu->GetItemCount(); nPos++ )
+ {
+ USHORT nId = _pMenu->GetItemId( nPos );
+ if ( _pMenu->GetItemType( nPos ) != MENUITEM_SEPARATOR )
+ {
+ if ( bShowMenuImages )
+ {
+ sal_Bool bImageSet = sal_False;
+ ::rtl::OUString aImageId;
+
+ ::framework::MenuConfiguration::Attributes* pMenuAttributes =
+ (::framework::MenuConfiguration::Attributes*)_pMenu->GetUserValue( nId );
+
+ if ( pMenuAttributes )
+ aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes
+
+ if ( aImageId.getLength() > 0 )
+ {
+ Image aImage = GetImageFromURL( _xFrame, aImageId, FALSE, bIsHiContrast );
+ if ( !!aImage )
+ {
+ bImageSet = sal_True;
+ _pMenu->SetItemImage( nId, aImage );
+ }
+ }
+
+ if ( !bImageSet )
+ {
+ rtl::OUString aMenuItemCommand = _pMenu->GetItemCommand( nId );
+ Image aImage = GetImageFromURL( _xFrame, aMenuItemCommand, FALSE, bIsHiContrast );
+ if ( !aImage )
+ aImage = aAddonOptions.GetImageFromURL( aMenuItemCommand, FALSE, bIsHiContrast );
+
+ _pMenu->SetItemImage( nId, aImage );
+ }
+ }
+ else
+ _pMenu->SetItemImage( nId, Image() );
+ }
+ }
+}
}
diff --git a/framework/source/classes/propertysethelper.cxx b/framework/source/classes/propertysethelper.cxx
index 40bb50cec8..5e1c2d5604 100644
--- a/framework/source/classes/propertysethelper.cxx
+++ b/framework/source/classes/propertysethelper.cxx
@@ -301,8 +301,7 @@ css::uno::Any SAL_CALL PropertySetHelper::getPropertyValue(const ::rtl::OUString
// <- SAFE
}
- css::uno::Any aValue = impl_getPropertyValue(aPropInfo.Name, aPropInfo.Handle);
- return aValue;
+ return impl_getPropertyValue(aPropInfo.Name, aPropInfo.Handle);
}
//-----------------------------------------------------------------------------
diff --git a/framework/source/classes/protocolhandlercache.cxx b/framework/source/classes/protocolhandlercache.cxx
index 1b05108568..3a1c4131c5 100644
--- a/framework/source/classes/protocolhandlercache.cxx
+++ b/framework/source/classes/protocolhandlercache.cxx
@@ -56,6 +56,7 @@
//_________________________________________________________________________________________________________________
#include <tools/wldcrd.hxx>
#include <unotools/configpathes.hxx>
+#include <rtl/ustrbuf.hxx>
//_________________________________________________________________________________________________________________
// namespace
@@ -299,15 +300,13 @@ void HandlerCFGAccess::read( HandlerHash** ppHandler ,
sal_Int32 nTarget=0;
for( nSource=0; nSource<nSourceCount; ++nSource )
{
- ::rtl::OUString sPath;
+ ::rtl::OUStringBuffer sPath( SETNAME_HANDLER );
+ sPath.append(CFG_PATH_SEPERATOR);
+ sPath.append(lNames[nSource]);
+ sPath.append(CFG_PATH_SEPERATOR);
+ sPath.append(PROPERTY_PROTOCOLS);
- sPath = SETNAME_HANDLER ;
- sPath += CFG_PATH_SEPERATOR ;
- sPath += lNames[nSource] ;
- sPath += CFG_PATH_SEPERATOR ;
-
- lFullNames[nTarget] = sPath;
- lFullNames[nTarget] += PROPERTY_PROTOCOLS;
+ lFullNames[nTarget] = sPath.makeStringAndClear();
++nTarget;
}
diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx
index 3471a22b86..2ab4e33b50 100644
--- a/framework/source/classes/taskcreator.cxx
+++ b/framework/source/classes/taskcreator.cxx
@@ -127,8 +127,7 @@ css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const ::rtl::
( TargetHelper::matchSpecialTarget(sName, TargetHelper::E_DEFAULT) )
)
{
- css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(xSMGR, PACKAGE, RELPATH, KEY, ::comphelper::ConfigurationHelper::E_READONLY);
- aVal >>= sCreator;
+ ::comphelper::ConfigurationHelper::readDirectKey(xSMGR, PACKAGE, RELPATH, KEY, ::comphelper::ConfigurationHelper::E_READONLY) >>= sCreator;
}
xCreator = css::uno::Reference< css::lang::XSingleServiceFactory >(
diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx
index a35e3d2512..f93613bcf9 100644
--- a/framework/source/dispatch/closedispatcher.cxx
+++ b/framework/source/dispatch/closedispatcher.cxx
@@ -46,11 +46,8 @@
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/frame/CommandGroup.hpp>
-
-#ifndef __COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
-#endif
-
#include "com/sun/star/beans/XFastPropertySet.hpp"
#include <toolkit/helper/vclunohelper.hxx>
diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx
index b48a6568db..1bb33a3350 100644
--- a/framework/source/dispatch/interceptionhelper.cxx
+++ b/framework/source/dispatch/interceptionhelper.cxx
@@ -185,7 +185,7 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css:
// a) no interceptor at all - set this instance as master for given interceptor
// and set our slave as it's slave - and put this interceptor to the list.
// It's place there doesn matter. Because this list is currently empty.
- if (m_lInterceptionRegs.size()<1)
+ if (m_lInterceptionRegs.empty())
{
xInterceptor->setMasterDispatchProvider(xThis );
xInterceptor->setSlaveDispatchProvider (m_xSlave);
@@ -333,7 +333,7 @@ void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent
#if OSL_DEBUG_LEVEL > 0
// SAFE ->
aReadLock.lock();
- if (m_lInterceptionRegs.size() > 0)
+ if (!m_lInterceptionRegs.empty() )
OSL_ENSURE(sal_False, "There are some pending interceptor objects, which seams to be registered during (!) the destruction of a frame.");
aReadLock.unlock();
// <- SAFE
diff --git a/framework/source/dispatch/menudispatcher.cxx b/framework/source/dispatch/menudispatcher.cxx
index 43c0da312d..5fd964341d 100644
--- a/framework/source/dispatch/menudispatcher.cxx
+++ b/framework/source/dispatch/menudispatcher.cxx
@@ -36,8 +36,9 @@
//_________________________________________________________________________________________________________________
#include <dispatch/menudispatcher.hxx>
#include <general.h>
-#include <classes/menuconfiguration.hxx>
+#include <xml/menuconfiguration.hxx>
#include <classes/addonmenu.hxx>
+#include <services.h>
//_________________________________________________________________________________________________________________
// interface includes
@@ -62,6 +63,7 @@
#include <tools/rcid.h>
#include <vos/mutex.hxx>
#include <toolkit/helper/vclunohelper.hxx>
+#include <rtl/logfile.hxx>
//_________________________________________________________________________________________________________________
// includes of other projects
@@ -388,7 +390,7 @@ IMPL_LINK( MenuDispatcher, Close_Impl, void*, EMPTYARG )
css::util::URL aURL;
aURL.Complete = ::rtl::OUString::createFromAscii(".uno:CloseWin");
css::uno::Reference< css::util::XURLTransformer > xTrans ( m_xFactory->createInstance(
- ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer") ), css::uno::UNO_QUERY );
+ SERVICENAME_URLTRANSFORMER ), css::uno::UNO_QUERY );
if( xTrans.is() )
{
// Datei laden
diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx
index 73b94f43bb..507f6a998f 100644
--- a/framework/source/dispatch/popupmenudispatcher.cxx
+++ b/framework/source/dispatch/popupmenudispatcher.cxx
@@ -37,7 +37,7 @@
#include <dispatch/popupmenudispatcher.hxx>
#include <general.h>
-#include <classes/menuconfiguration.hxx>
+#include <xml/menuconfiguration.hxx>
#include <classes/addonmenu.hxx>
#include <services.h>
#include <properties.h>
@@ -241,8 +241,7 @@ throw( css::uno::RuntimeException )
css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider;
// Find popup menu controller using the base URL
- Any a = xPopupCtrlQuery->getByName( aBaseURL );
- a >>= xDispatchProvider;
+ xPopupCtrlQuery->getByName( aBaseURL ) >>= xDispatchProvider;
aGuard.unlock();
// Ask popup menu dispatch provider for dispatch object
@@ -384,8 +383,7 @@ void PopupMenuDispatcher::impl_RetrievePopupControllerQuery()
{
try
{
- Any a = xPropSet->getPropertyValue( FRAME_PROPNAME_LAYOUTMANAGER );
- a >>= xLayoutManager;
+ xPropSet->getPropertyValue( FRAME_PROPNAME_LAYOUTMANAGER ) >>= xLayoutManager;
if ( xLayoutManager.is() )
{
diff --git a/framework/source/dispatch/windowcommanddispatch.cxx b/framework/source/dispatch/windowcommanddispatch.cxx
index 6eb340ccb2..531d6807ee 100755
--- a/framework/source/dispatch/windowcommanddispatch.cxx
+++ b/framework/source/dispatch/windowcommanddispatch.cxx
@@ -55,6 +55,7 @@
#include <vcl/cmdevt.hxx>
#include <vos/mutex.hxx>
#include <toolkit/helper/vclunohelper.hxx>
+#include <rtl/logfile.hxx>
//_______________________________________________
// namespace
diff --git a/framework/source/helper/actiontriggerhelper.cxx b/framework/source/helper/actiontriggerhelper.cxx
index ce533b2c14..6075495848 100644
--- a/framework/source/helper/actiontriggerhelper.cxx
+++ b/framework/source/helper/actiontriggerhelper.cxx
@@ -128,9 +128,7 @@ void InsertSubMenuItems( Menu* pSubMenu, USHORT& nItemId, Reference< XIndexConta
try
{
Reference< XPropertySet > xPropSet;
- Any a = xIndexAccess->getByIndex( i );
-
- if (( a >>= xPropSet ) && ( xPropSet.is() ))
+ if (( xIndexAccess->getByIndex( i ) >>= xPropSet ) && ( xPropSet.is() ))
{
if ( IsSeparator( xPropSet ))
{
diff --git a/framework/source/helper/dockingareadefaultacceptor.cxx b/framework/source/helper/dockingareadefaultacceptor.cxx
index f6c33c7003..cf88201459 100644
--- a/framework/source/helper/dockingareadefaultacceptor.cxx
+++ b/framework/source/helper/dockingareadefaultacceptor.cxx
@@ -82,7 +82,6 @@ using namespace ::rtl ;
DockingAreaDefaultAcceptor::DockingAreaDefaultAcceptor( const Reference< XFrame >& xOwner )
// Init baseclasses first
: ThreadHelpBase ( &Application::GetSolarMutex() )
- , OWeakObject ( )
// Init member
, m_xOwner ( xOwner )
{
@@ -96,18 +95,6 @@ DockingAreaDefaultAcceptor::~DockingAreaDefaultAcceptor()
}
//*****************************************************************************************************************
-// XInterface, XTypeProvider
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_2( DockingAreaDefaultAcceptor ,
- OWeakObject ,
- DIRECT_INTERFACE(XTypeProvider ) ,
- DIRECT_INTERFACE(::com::sun::star::ui::XDockingAreaAcceptor ) )
-
-DEFINE_XTYPEPROVIDER_2( DockingAreaDefaultAcceptor ,
- XTypeProvider ,
- ::com::sun::star::ui::XDockingAreaAcceptor )
-
-//*****************************************************************************************************************
// XDockingAreaAcceptor
//*****************************************************************************************************************
css::uno::Reference< css::awt::XWindow > SAL_CALL DockingAreaDefaultAcceptor::getContainerWindow() throw (css::uno::RuntimeException)
diff --git a/framework/source/helper/mischelper.cxx b/framework/source/helper/mischelper.cxx
index 395d592592..8e0f79b260 100644
--- a/framework/source/helper/mischelper.cxx
+++ b/framework/source/helper/mischelper.cxx
@@ -32,13 +32,21 @@
#include "precompiled_framework.hxx"
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
#include <tools/debug.hxx>
#include <comphelper/processfactory.hxx>
#include <helper/mischelper.hxx>
+#include <services.h>
using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
namespace framework
{
@@ -49,14 +57,10 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues
{
try
{
- uno::Reference< lang::XMultiServiceFactory > xMgr ( comphelper::getProcessServiceFactory() );
- if (xMgr.is())
- {
- m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
- xMgr->createInstance(
- rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ),
- uno::UNO_QUERY );
- }
+ m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
+ m_xServiceManager->createInstance(
+ rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ),
+ uno::UNO_QUERY );
}
catch (uno::Exception &r)
{
@@ -66,6 +70,76 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues
}
return m_xLanguageGuesser;
}
+
+::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory
+ ,::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xUICommandLabels
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame
+ ,::rtl::OUString& _rModuleIdentifier
+ ,sal_Bool& _rIni
+ ,const sal_Char* _pName)
+{
+ ::rtl::OUString aLabel;
+
+ // Retrieve popup menu labels
+ if ( !_xUICommandLabels.is() )
+ {
+ try
+ {
+ if ( !_rIni )
+ {
+ _rIni = sal_True;
+ Reference< XModuleManager > xModuleManager( _xServiceFactory->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW );
+
+ try
+ {
+ _rModuleIdentifier = xModuleManager->identify( _xFrame );
+ }
+ catch( Exception& )
+ {
+ }
+ }
+
+ Reference< XNameAccess > xNameAccess( _xServiceFactory->createInstance( SERVICENAME_UICOMMANDDESCRIPTION ), UNO_QUERY );
+ if ( xNameAccess.is() )
+ {
+ xNameAccess->getByName( _rModuleIdentifier ) >>= _xUICommandLabels;
+ }
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+
+ if ( _xUICommandLabels.is() )
+ {
+ try
+ {
+ if ( aCmdURL.getLength() > 0 )
+ {
+ rtl::OUString aStr;
+ Sequence< PropertyValue > aPropSeq;
+ if ( _xUICommandLabels->getByName( aCmdURL ) >>= aPropSeq )
+ {
+ for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
+ {
+ if ( aPropSeq[i].Name.equalsAscii( _pName/*"Label"*/ ))
+ {
+ aPropSeq[i].Value >>= aStr;
+ break;
+ }
+ }
+ }
+ aLabel = aStr;
+ }
+ }
+ catch ( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+
+ return aLabel;
+}
} // namespace framework
diff --git a/framework/source/helper/ocomponentaccess.cxx b/framework/source/helper/ocomponentaccess.cxx
index 7ae53db8a1..274f3cdd6b 100644
--- a/framework/source/helper/ocomponentaccess.cxx
+++ b/framework/source/helper/ocomponentaccess.cxx
@@ -83,7 +83,6 @@ using namespace ::rtl ;
OComponentAccess::OComponentAccess( const Reference< XDesktop >& xOwner )
// Init baseclasses first
: ThreadHelpBase ( &Application::GetSolarMutex() )
- , OWeakObject ( )
// Init member
, m_xOwner ( xOwner )
{
@@ -99,20 +98,6 @@ OComponentAccess::~OComponentAccess()
}
//*****************************************************************************************************************
-// XInterface, XTypeProvider
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_3( OComponentAccess ,
- OWeakObject ,
- DIRECT_INTERFACE(XTypeProvider ) ,
- DIRECT_INTERFACE(XEnumerationAccess ) ,
- DIRECT_INTERFACE(XElementAccess ) )
-
-DEFINE_XTYPEPROVIDER_3( OComponentAccess ,
- XTypeProvider ,
- XEnumerationAccess ,
- XElementAccess )
-
-//*****************************************************************************************************************
// XEnumerationAccess
//*****************************************************************************************************************
Reference< XEnumeration > SAL_CALL OComponentAccess::createEnumeration() throw( RuntimeException )
diff --git a/framework/source/helper/ocomponentenumeration.cxx b/framework/source/helper/ocomponentenumeration.cxx
index 347d09e6ed..ed38666380 100644
--- a/framework/source/helper/ocomponentenumeration.cxx
+++ b/framework/source/helper/ocomponentenumeration.cxx
@@ -85,7 +85,6 @@ OComponentEnumeration::OComponentEnumeration( const Sequence< Reference< XCompon
// we must garant right initialization and a valid value of this! First initialize
// baseclasses and then members. And we need the mutex for other baseclasses !!!
: ThreadHelpBase ( &Application::GetSolarMutex() )
- , OWeakObject ( )
// Init member
, m_nPosition ( 0 ) // 0 is the first position for a valid list and the right value for an invalid list to!
, m_seqComponents ( seqComponents )
@@ -105,22 +104,6 @@ OComponentEnumeration::~OComponentEnumeration()
}
//*****************************************************************************************************************
-// XInterface, XTypeProvider
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( OComponentEnumeration ,
- OWeakObject ,
- DIRECT_INTERFACE(XTypeProvider ),
- DIRECT_INTERFACE(XEventListener ),
- DIRECT_INTERFACE(XEnumeration )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( OComponentEnumeration ,
- XTypeProvider ,
- XEventListener ,
- XEnumeration
- )
-
-//*****************************************************************************************************************
// XEventListener
//*****************************************************************************************************************
void SAL_CALL OComponentEnumeration::disposing( const EventObject&
diff --git a/framework/source/helper/oframes.cxx b/framework/source/helper/oframes.cxx
index 68730bc59a..43f968225c 100644
--- a/framework/source/helper/oframes.cxx
+++ b/framework/source/helper/oframes.cxx
@@ -87,7 +87,6 @@ OFrames::OFrames( const Reference< XMultiServiceFactory >& xFactory ,
FrameContainer* pFrameContainer )
// Init baseclasses first
: ThreadHelpBase ( &Application::GetSolarMutex() )
- , OWeakObject ( )
// Init member
, m_xFactory ( xFactory )
, m_xOwner ( xOwner )
@@ -109,24 +108,6 @@ OFrames::~OFrames()
}
//*****************************************************************************************************************
-// XInterface
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_4 ( OFrames ,
- OWeakObject ,
- DIRECT_INTERFACE(XTypeProvider ),
- DIRECT_INTERFACE(XFrames ),
- DIRECT_INTERFACE(XIndexAccess ),
- DIRECT_INTERFACE(XElementAccess )
- )
-
-DEFINE_XTYPEPROVIDER_4 ( OFrames ,
- XTypeProvider ,
- XFrames ,
- XIndexAccess ,
- XElementAccess
- )
-
-//*****************************************************************************************************************
// XFrames
//*****************************************************************************************************************
void SAL_CALL OFrames::append( const Reference< XFrame >& xFrame ) throw( RuntimeException )
diff --git a/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx
index 02eb74d98b..de7fa59eea 100644
--- a/framework/source/helper/persistentwindowstate.cxx
+++ b/framework/source/helper/persistentwindowstate.cxx
@@ -240,12 +240,11 @@ void SAL_CALL PersistentWindowState::disposing(const css::lang::EventObject&)
try
{
- css::uno::Any aWindowState = ::comphelper::ConfigurationHelper::readDirectKey(xSMGR,
+ ::comphelper::ConfigurationHelper::readDirectKey(xSMGR,
sPackage,
sRelPath,
sKey,
- ::comphelper::ConfigurationHelper::E_READONLY);
- aWindowState >>= sWindowState;
+ ::comphelper::ConfigurationHelper::E_READONLY) >>= sWindowState;
}
catch(const css::uno::RuntimeException& exRun)
{ throw exRun; }
diff --git a/framework/source/helper/popupmenucontrollerbase.cxx b/framework/source/helper/popupmenucontrollerbase.cxx
index 29a9a06888..e8215eccca 100644
--- a/framework/source/helper/popupmenucontrollerbase.cxx
+++ b/framework/source/helper/popupmenucontrollerbase.cxx
@@ -44,9 +44,8 @@
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/awt/MenuItemStyle.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
-
+#include <com/sun/star/lang/DisposedException.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
@@ -57,7 +56,7 @@
#endif
#include <vcl/svapp.hxx>
#include <rtl/ustrbuf.hxx>
-
+#include <rtl/logfile.hxx>
//_________________________________________________________________________________________________________________
// Defines
//_________________________________________________________________________________________________________________
@@ -111,6 +110,10 @@ PopupMenuControllerBase::PopupMenuControllerBase( const ::com::sun::star::uno::R
m_xServiceManager( xServiceManager ),
m_aListenerContainer( m_aLock.getShareableOslMutex() )
{
+ if ( m_xServiceManager.is() )
+ m_xURLTransformer.set( m_xServiceManager->createInstance(
+ SERVICENAME_URLTRANSFORMER),
+ UNO_QUERY );
}
PopupMenuControllerBase::~PopupMenuControllerBase()
@@ -178,10 +181,12 @@ void SAL_CALL PopupMenuControllerBase::disposing( const EventObject& ) throw ( R
// XMenuListener
void SAL_CALL PopupMenuControllerBase::highlight( const css::awt::MenuEvent& ) throw (RuntimeException)
{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
+}
+
+void PopupMenuControllerBase::impl_select(const Reference< XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL)
+{
+ Sequence<PropertyValue> aArgs;
+ _xDispatch->dispatch( aURL, aArgs );
}
void SAL_CALL PopupMenuControllerBase::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException)
@@ -205,37 +210,24 @@ void SAL_CALL PopupMenuControllerBase::select( const css::awt::MenuEvent& rEvent
if ( pPopupMenu )
{
css::util::URL aTargetURL;
- Sequence<PropertyValue> aArgs;
- Reference< XURLTransformer > xURLTransformer( xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
-
{
vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
aTargetURL.Complete = pVCLPopupMenu->GetItemCommand( rEvent.MenuId );
}
- xURLTransformer->parseStrict( aTargetURL );
- xDispatch->dispatch( aTargetURL, aArgs );
+ m_xURLTransformer->parseStrict( aTargetURL );
+ impl_select(xDispatch,aTargetURL);
}
}
}
void SAL_CALL PopupMenuControllerBase::activate( const css::awt::MenuEvent& ) throw (RuntimeException)
{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
}
void SAL_CALL PopupMenuControllerBase::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException)
{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
}
void SAL_CALL PopupMenuControllerBase::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException )
@@ -247,12 +239,9 @@ void SAL_CALL PopupMenuControllerBase::updatePopupMenu() throw ( ::com::sun::sta
Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
Reference< XDispatch > xDispatch( m_xDispatch );
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
com::sun::star::util::URL aTargetURL;
aTargetURL.Complete = m_aCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
aLock.unlock();
// Add/remove status listener to get a status update once
@@ -279,10 +268,7 @@ throw( RuntimeException )
return Reference< XDispatch >();
}
-Sequence< Reference< XDispatch > > SAL_CALL
-PopupMenuControllerBase::queryDispatches(
- const Sequence< DispatchDescriptor >& lDescriptor )
-throw( RuntimeException )
+Sequence< Reference< XDispatch > > SAL_CALL PopupMenuControllerBase::queryDispatches( const Sequence< DispatchDescriptor >& lDescriptor ) throw( RuntimeException )
{
// Create return list - which must have same size then the given descriptor
// It's not allowed to pack it!
@@ -381,9 +367,6 @@ throw( ::com::sun::star::uno::RuntimeException )
// XInitialization
void SAL_CALL PopupMenuControllerBase::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
{
- const rtl::OUString aFrameName( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- const rtl::OUString aCommandURLName( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
-
ResetableGuard aLock( m_aLock );
sal_Bool bInitalized( m_bInitialized );
@@ -413,5 +396,35 @@ void SAL_CALL PopupMenuControllerBase::initialize( const Sequence< Any >& aArgum
}
}
}
+// XPopupMenuController
+void SAL_CALL PopupMenuControllerBase::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException )
+{
+ ResetableGuard aLock( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_xFrame.is() && !m_xPopupMenu.is() )
+ {
+ // Create popup menu on demand
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ m_xPopupMenu = xPopupMenu;
+ m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY ));
+
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
+
+ com::sun::star::util::URL aTargetURL;
+ aTargetURL.Complete = m_aCommandURL;
+ m_xURLTransformer->parseStrict( aTargetURL );
+ m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
+
+ impl_setPopupMenu();
+
+ updatePopupMenu();
+ }
+}
+void PopupMenuControllerBase::impl_setPopupMenu()
+{
+}
}
diff --git a/framework/source/helper/titlebarupdate.cxx b/framework/source/helper/titlebarupdate.cxx
index ec2ca00715..1db613237d 100644
--- a/framework/source/helper/titlebarupdate.cxx
+++ b/framework/source/helper/titlebarupdate.cxx
@@ -336,8 +336,7 @@ void TitleBarUpdate::impl_updateIcon(const css::uno::Reference< css::frame::XFra
{
try
{
- css::uno::Any aID = xSet->getPropertyValue( CONTROLLER_PROPNAME_ICONID );
- aID >>= nIcon;
+ xSet->getPropertyValue( CONTROLLER_PROPNAME_ICONID ) >>= nIcon;
}
catch(const css::uno::Exception&)
{}
diff --git a/framework/source/helper/titlehelper.cxx b/framework/source/helper/titlehelper.cxx
index 4c83be7f6c..2eb1707ae3 100644
--- a/framework/source/helper/titlehelper.cxx
+++ b/framework/source/helper/titlehelper.cxx
@@ -521,7 +521,7 @@ void TitleHelper::impl_updateTitleForFrame (const css::uno::Reference< css::fram
impl_appendProductName (sTitle);
impl_appendModuleName (sTitle);
impl_appendProductExtension (sTitle);
- impl_appendEvalVersion (sTitle);
+ //impl_appendEvalVersion (sTitle);
impl_appendDebugVersion (sTitle);
// SYNCHRONIZED ->
@@ -633,29 +633,29 @@ void TitleHelper::impl_appendDebugVersion (::rtl::OUStringBuffer&)
#endif
//*****************************************************************************************************************
-void TitleHelper::impl_appendEvalVersion (::rtl::OUStringBuffer& sTitle)
+void TitleHelper::impl_appendEvalVersion (::rtl::OUStringBuffer& /*sTitle*/)
{
// SYNCHRONIZED ->
- ::osl::ResettableMutexGuard aLock(m_aMutex);
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR ;
- aLock.clear ();
- // <- SYNCHRONIZED
-
- css::uno::Reference< css::beans::XMaterialHolder > xHolder(
- xSMGR->createInstance(SERVICENAME_TABREG),
- css::uno::UNO_QUERY);
-
- if ( ! xHolder.is())
- return;
-
- ::comphelper::SequenceAsHashMap aMaterial(xHolder->getMaterial());
- const ::rtl::OUString sEvalTitle = aMaterial.getUnpackedValueOrDefault(TABREG_PROPNAME_TITLE, ::rtl::OUString());
-
- if (sEvalTitle.getLength())
- {
- sTitle.appendAscii (" " );
- sTitle.append (sEvalTitle);
- }
+ // ::osl::ResettableMutexGuard aLock(m_aMutex);
+ // css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR ;
+ //aLock.clear ();
+ //// <- SYNCHRONIZED
+
+ //css::uno::Reference< css::beans::XMaterialHolder > xHolder(
+ // xSMGR->createInstance(SERVICENAME_TABREG),
+ // css::uno::UNO_QUERY);
+
+ // if ( ! xHolder.is())
+ // return;
+
+ // ::comphelper::SequenceAsHashMap aMaterial(xHolder->getMaterial());
+ //const ::rtl::OUString sEvalTitle = aMaterial.getUnpackedValueOrDefault(TABREG_PROPNAME_TITLE, ::rtl::OUString());
+
+ //if (sEvalTitle.getLength())
+ //{
+ // sTitle.appendAscii (" " );
+ // sTitle.append (sEvalTitle);
+ //}
}
//-----------------------------------------------
diff --git a/framework/source/helper/uiconfigelementwrapperbase.cxx b/framework/source/helper/uiconfigelementwrapperbase.cxx
index 87a19fa5fd..23ac2c8a79 100644
--- a/framework/source/helper/uiconfigelementwrapperbase.cxx
+++ b/framework/source/helper/uiconfigelementwrapperbase.cxx
@@ -38,6 +38,8 @@
#include <general.h>
#include <properties.h>
#include <threadhelp/resetableguard.hxx>
+#include <uielement/constitemcontainer.hxx>
+#include <uielement/rootitemcontainer.hxx>
//_________________________________________________________________________________________________________________
// interface includes
@@ -46,11 +48,13 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/ui/XUIConfiguration.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
#include <vcl/svapp.hxx>
+#include <rtl/logfile.hxx>
const int UIELEMENT_PROPHANDLE_CONFIGSOURCE = 1;
const int UIELEMENT_PROPHANDLE_FRAME = 2;
@@ -75,6 +79,7 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::uno;
using namespace com::sun::star::frame;
using namespace com::sun::star::lang;
+using namespace com::sun::star::container;
using namespace ::com::sun::star::ui;
namespace framework
@@ -110,7 +115,7 @@ DEFINE_XTYPEPROVIDER_10 ( UIConfigElementWrapperBase
::com::sun::star::ui::XUIConfigurationListener
)
-UIConfigElementWrapperBase::UIConfigElementWrapperBase( sal_Int16 nType )
+UIConfigElementWrapperBase::UIConfigElementWrapperBase( sal_Int16 nType,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory )
: ThreadHelpBase ( &Application::GetSolarMutex() )
, ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aLock.getShareableOslMutex() )
, ::cppu::OPropertySetHelper ( *(static_cast< ::cppu::OBroadcastHelper* >(this)) )
@@ -122,6 +127,7 @@ UIConfigElementWrapperBase::UIConfigElementWrapperBase( sal_Int16 nType )
, m_bConfigListening ( sal_False )
, m_bDisposed ( sal_False )
, m_bNoClose ( sal_False )
+ , m_xServiceFactory ( _xServiceFactory )
, m_aListenerContainer ( m_aLock.getShareableOslMutex() )
{
}
@@ -493,5 +499,58 @@ const com::sun::star::uno::Sequence< com::sun::star::beans::Property > UIConfigE
// Return static "PropertyDescriptor"
return lPropertyDescriptor;
}
+void SAL_CALL UIConfigElementWrapperBase::setSettings( const Reference< XIndexAccess >& xSettings ) throw ( RuntimeException )
+{
+ ResetableGuard aLock( m_aLock );
+
+ //if ( m_bDisposed )
+ // throw DisposedException();
+
+ if ( xSettings.is() )
+ {
+ // Create a copy of the data if the container is not const
+ Reference< XIndexReplace > xReplace( xSettings, UNO_QUERY );
+ if ( xReplace.is() )
+ m_xConfigData = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( xSettings ) ), UNO_QUERY );
+ else
+ m_xConfigData = xSettings;
+
+ if ( m_xConfigSource.is() && m_bPersistent )
+ {
+ ::rtl::OUString aResourceURL( m_aResourceURL );
+ Reference< XUIConfigurationManager > xUICfgMgr( m_xConfigSource );
+
+ aLock.unlock();
+
+ try
+ {
+ xUICfgMgr->replaceSettings( aResourceURL, m_xConfigData );
+ }
+ catch( NoSuchElementException& )
+ {
+ }
+ }
+ else if ( !m_bPersistent )
+ {
+ // Transient menubar => Fill menubar with new data
+ impl_fillNewData();
+ }
+ }
+}
+void UIConfigElementWrapperBase::impl_fillNewData()
+{
+}
+Reference< XIndexAccess > SAL_CALL UIConfigElementWrapperBase::getSettings( sal_Bool bWriteable ) throw ( RuntimeException )
+{
+ ResetableGuard aLock( m_aLock );
+
+ //if ( m_bDisposed )
+ // throw DisposedException();
+
+ if ( bWriteable )
+ return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( m_xConfigData ) ), UNO_QUERY );
+
+ return m_xConfigData;
+}
}
diff --git a/framework/source/helper/uielementwrapperbase.cxx b/framework/source/helper/uielementwrapperbase.cxx
index e417ac95b1..64a08326e7 100644
--- a/framework/source/helper/uielementwrapperbase.cxx
+++ b/framework/source/helper/uielementwrapperbase.cxx
@@ -50,6 +50,7 @@
// includes of other projects
//_________________________________________________________________________________________________________________
#include <vcl/svapp.hxx>
+#include <rtl/logfile.hxx>
const int UIELEMENT_PROPHANDLE_RESOURCEURL = 1;
const int UIELEMENT_PROPHANDLE_TYPE = 2;
diff --git a/framework/source/inc/accelerators/acceleratorconfiguration.hxx b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
index 5e4594dc94..5b0da6ddc2 100644
--- a/framework/source/inc/accelerators/acceleratorconfiguration.hxx
+++ b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
@@ -75,7 +75,7 @@ namespace framework
{
//-----------------------------------------------
// Accelerators.xcu
-static const ::rtl::OUString CFG_ENTRY_ACCELERATORS = ::rtl::OUString::createFromAscii("org.openoffice.Office.Accelerators");
+
static const ::rtl::OUString CFG_ENTRY_PRIMARY = ::rtl::OUString::createFromAscii("PrimaryKeys");
static const ::rtl::OUString CFG_ENTRY_SECONDARY = ::rtl::OUString::createFromAscii("SecondaryKeys");
diff --git a/framework/source/inc/dispatch/uieventloghelper.hxx b/framework/source/inc/dispatch/uieventloghelper.hxx
index 8725454481..9b425077c4 100644
--- a/framework/source/inc/dispatch/uieventloghelper.hxx
+++ b/framework/source/inc/dispatch/uieventloghelper.hxx
@@ -40,6 +40,7 @@
#include <com/sun/star/util/URL.hpp>
#include <comphelper/uieventslogger.hxx>
#include <rtl/ustring.hxx>
+#include <services.h>
namespace framework
{
@@ -61,7 +62,7 @@ namespace framework
{
try
{
- static ::rtl::OUString our_aModuleManagerName = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager");
+ static ::rtl::OUString our_aModuleManagerName = SERVICENAME_MODULEMANAGER;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > xModuleManager(
rServiceManager->createInstance(our_aModuleManagerName)
, ::com::sun::star::uno::UNO_QUERY_THROW);
diff --git a/framework/source/inc/pattern/frame.hxx b/framework/source/inc/pattern/frame.hxx
index 6e8a967300..16167e39ce 100644
--- a/framework/source/inc/pattern/frame.hxx
+++ b/framework/source/inc/pattern/frame.hxx
@@ -42,6 +42,7 @@
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/util/XCloseable.hpp>
//_______________________________________________
diff --git a/framework/source/jobs/helponstartup.cxx b/framework/source/jobs/helponstartup.cxx
index ec383a8313..0c47659339 100644
--- a/framework/source/jobs/helponstartup.cxx
+++ b/framework/source/jobs/helponstartup.cxx
@@ -85,19 +85,6 @@ static ::rtl::OUString ENVTYPE_DOCUMENTEVENT = ::rtl::OUString::createFromAsc
//-----------------------------------------------
-DEFINE_XINTERFACE_4(HelpOnStartup ,
- OWeakObject ,
- DIRECT_INTERFACE(css::lang::XTypeProvider ),
- DIRECT_INTERFACE(css::lang::XServiceInfo ),
- DIRECT_INTERFACE(css::task::XJob ),
- DIRECT_INTERFACE(css::lang::XEventListener))
-
-DEFINE_XTYPEPROVIDER_4(HelpOnStartup ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- css::task::XJob ,
- css::lang::XEventListener)
-
DEFINE_XSERVICEINFO_MULTISERVICE(HelpOnStartup ,
::cppu::OWeakObject ,
SERVICENAME_JOB ,
diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx
index 257c8772ac..2609a57734 100644
--- a/framework/source/jobs/job.cxx
+++ b/framework/source/jobs/job.cxx
@@ -45,11 +45,13 @@
#include <com/sun/star/task/XAsyncJob.hpp>
#include <com/sun/star/util/XCloseBroadcaster.hpp>
#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
//________________________________
// includes of other projects
#include <rtl/ustrbuf.hxx>
#include <vcl/svapp.hxx>
+#include <comphelper/uieventslogger.hxx>
//________________________________
// namespace
@@ -236,6 +238,7 @@ void Job::execute( /*IN*/ const css::uno::Sequence< css::beans::NamedValue >& lD
// Otherwhise we might die by ref count ...
css::uno::Reference< css::task::XJobListener > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
+ if ( ::comphelper::UiEventsLogger::isEnabled() )
try
{
// create the job
diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx
index 8e395a15a5..bb04f4f09f 100644
--- a/framework/source/jobs/jobdata.cxx
+++ b/framework/source/jobs/jobdata.cxx
@@ -660,23 +660,20 @@ css::uno::Sequence< ::rtl::OUString > JobData::getEnabledJobsForEvent( const css
for (sal_Int32 s=0; s<c; ++s)
{
- css::uno::Any aNode = xJobList->getByName(pAllJobs[s]);
css::uno::Reference< css::beans::XPropertySet > xJob;
if (
- !(aNode >>= xJob) ||
+ !(xJobList->getByName(pAllJobs[s]) >>= xJob) ||
!(xJob.is() )
)
{
continue;
}
- aNode = xJob->getPropertyValue(ADMINTIME);
::rtl::OUString sAdminTime;
- aNode >>= sAdminTime;
+ xJob->getPropertyValue(ADMINTIME) >>= sAdminTime;
- aNode = xJob->getPropertyValue(USERTIME);
::rtl::OUString sUserTime;
- aNode >>= sUserTime;
+ xJob->getPropertyValue(USERTIME) >>= sUserTime;
if (!isEnabled(sAdminTime, sUserTime))
continue;
diff --git a/framework/source/jobs/jobresult.cxx b/framework/source/jobs/jobresult.cxx
index faffb74ab7..98a0821180 100644
--- a/framework/source/jobs/jobresult.cxx
+++ b/framework/source/jobs/jobresult.cxx
@@ -138,7 +138,7 @@ JobResult::JobResult( /*IN*/ const css::uno::Any& aResult )
// analyze the result and actualize our other members
::comphelper::SequenceAsHashMap aProtocol(aResult);
- if (aProtocol.size() < 1)
+ if ( aProtocol.empty() )
return;
::comphelper::SequenceAsHashMap::const_iterator pIt = aProtocol.end();
diff --git a/framework/source/jobs/shelljob.cxx b/framework/source/jobs/shelljob.cxx
index 9745619155..0bafb763a4 100644
--- a/framework/source/jobs/shelljob.cxx
+++ b/framework/source/jobs/shelljob.cxx
@@ -80,17 +80,6 @@ static const ::rtl::OUString PROP_CHECKEXITCODE = ::rtl::OUString::createFromAsc
//-----------------------------------------------
-DEFINE_XINTERFACE_3(ShellJob ,
- OWeakObject ,
- DIRECT_INTERFACE(css::lang::XTypeProvider ),
- DIRECT_INTERFACE(css::lang::XServiceInfo ),
- DIRECT_INTERFACE(css::task::XJob ))
-
-DEFINE_XTYPEPROVIDER_3(ShellJob ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- css::task::XJob )
-
DEFINE_XSERVICEINFO_MULTISERVICE(ShellJob ,
::cppu::OWeakObject ,
SERVICENAME_JOB ,
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 9e81fae21b..3ea3d2759d 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -86,6 +86,7 @@
#include <com/sun/star/frame/LayoutManagerEvents.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/frame/XDispatchHelper.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
//_________________________________________________________________________________________________________________
// other includes
@@ -107,7 +108,7 @@
#include <svtools/cmdoptions.hxx>
#include <algorithm>
-
+#include <boost/bind.hpp>
// ______________________________________________
// using namespace
@@ -131,6 +132,26 @@ using namespace ::com::sun::star::frame;
// You have to change BOTH values, see sfx2/inc/sfx2/sfxsids.hrc (SID_DOCKWIN_START)
static const sal_Int32 DOCKWIN_ID_BASE = 9800;
+bool lcl_checkUIElement(const Reference< XUIElement >& xUIElement,css::awt::Rectangle& _rPosSize,Reference< css::awt::XWindow >& _xWindow)
+{
+ bool bRet = xUIElement.is();
+ if ( bRet )
+ {
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ _xWindow.set( xUIElement->getRealInterface(), UNO_QUERY );
+ _rPosSize = _xWindow->getPosSize();
+
+ Window* pWindow = VCLUnoHelper::GetWindow( _xWindow );
+ if ( pWindow->GetType() == WINDOW_TOOLBOX )
+ {
+ ::Size aSize = ((ToolBox*)pWindow)->CalcWindowSizePixel( 1 );
+ _rPosSize.Width = aSize.Width();
+ _rPosSize.Height = aSize.Height();
+ }
+ } // if ( xUIElement.is() )
+ return bRet;
+}
+
// convert alignment constant to vcl's WindowAlign type
static WindowAlign ImplConvertAlignment( sal_Int16 aAlignment )
{
@@ -200,15 +221,10 @@ bool LayoutManager::UIElement::operator< ( const LayoutManager::UIElement& aUIEl
bool bEqual = ( m_aDockedData.m_aPos.X() == aUIElement.m_aDockedData.m_aPos.X() );
if ( bEqual )
{
- if ( m_bUserActive && !aUIElement.m_bUserActive )
- return sal_True;
- else if ( !m_bUserActive && aUIElement.m_bUserActive )
- return sal_False;
- else
- return sal_False;
+ return m_bUserActive && !aUIElement.m_bUserActive;
}
else
- return ( m_aDockedData.m_aPos.X() <= aUIElement.m_aDockedData.m_aPos.X() );
+ return ( m_aDockedData.m_aPos.X() < aUIElement.m_aDockedData.m_aPos.X() );
}
}
else
@@ -220,15 +236,10 @@ bool LayoutManager::UIElement::operator< ( const LayoutManager::UIElement& aUIEl
bool bEqual = ( m_aDockedData.m_aPos.Y() == aUIElement.m_aDockedData.m_aPos.Y() );
if ( bEqual )
{
- if ( m_bUserActive && !aUIElement.m_bUserActive )
- return sal_True;
- else if ( !m_bUserActive && aUIElement.m_bUserActive )
- return sal_False;
- else
- return sal_False;
+ return m_bUserActive && !aUIElement.m_bUserActive;
}
else
- return ( m_aDockedData.m_aPos.Y() <= aUIElement.m_aDockedData.m_aPos.Y() );
+ return ( m_aDockedData.m_aPos.Y() < aUIElement.m_aDockedData.m_aPos.Y() );
}
}
}
@@ -394,7 +405,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM
, ::cppu::OWeakObject ( )
, m_xSMGR( xServiceManager )
, m_xURLTransformer( Reference< XURLTransformer >( xServiceManager->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
+ SERVICENAME_URLTRANSFORMER),
UNO_QUERY ))
, m_nLockCount( 0 )
, m_bActive( sal_False )
@@ -493,8 +504,7 @@ void LayoutManager::impl_clearUpMenuBar()
{
try
{
- Any a = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XMenuBar" )));
- a >>= xMenuBar;
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XMenuBar" ))) >>= xMenuBar;
}
catch ( com::sun::star::beans::UnknownPropertyException )
{
@@ -821,7 +831,8 @@ void LayoutManager::implts_destroyDockingAreaWindows()
aWriteLock.unlock();
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- for ( sal_Int32 i=0; i < (sal_Int32)oldDockingAreaWindows.size(); i++ )
+ const sal_uInt32 nCount = oldDockingAreaWindows.size();
+ for ( sal_uInt32 i=0; i < nCount; i++ )
{
if ( oldDockingAreaWindows[i].is() )
{
@@ -957,13 +968,13 @@ void LayoutManager::implts_createAddonsToolBars()
Sequence< PropertyValue > aPropSeq( 2 );
aPropSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- aPropSeq[0].Value = makeAny( xFrame );
+ aPropSeq[0].Value <<= xFrame;
aPropSeq[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationData" ));
for ( sal_uInt32 i = 0; i < nCount; i++ )
{
::rtl::OUString aAddonToolBarName( aAddonsToolBarStaticName + m_pAddonOptions->GetAddonsToolbarResourceName(i) );
aAddonToolBarData = m_pAddonOptions->GetAddonsToolBarPart( i );
- aPropSeq[1].Value = makeAny( aAddonToolBarData );
+ aPropSeq[1].Value <<= aAddonToolBarData;
aWriteLock.lock();
UIElement aElement = impl_findElement( aAddonToolBarName );
@@ -1072,15 +1083,16 @@ void LayoutManager::implts_createNonContextSensitiveToolBars()
try
{
- rtl::OUString aElementType;
- rtl::OUString aElementName;
- rtl::OUString aName;
-
- Reference< ::com::sun::star::ui::XUIElement > xUIElement;
Sequence< rtl::OUString > aToolbarNames = xPersistentWindowState->getElementNames();
if ( aToolbarNames.getLength() > 0 )
{
+ rtl::OUString aElementType;
+ rtl::OUString aElementName;
+ rtl::OUString aName;
+
+ Reference< ::com::sun::star::ui::XUIElement > xUIElement;
+ aMakeVisibleToolbars.reserve(aToolbarNames.getLength());
WriteGuard aWriteLock( m_aLock );
const rtl::OUString* pTbNames = aToolbarNames.getConstArray();
@@ -1120,12 +1132,10 @@ void LayoutManager::implts_createNonContextSensitiveToolBars()
{
}
- if ( aMakeVisibleToolbars.size() > 0 )
+ if ( !aMakeVisibleToolbars.empty() )
{
implts_lock();
- for ( sal_uInt32 i = 0; i < aMakeVisibleToolbars.size(); i++ )
- requestElement( aMakeVisibleToolbars[i] );
-
+ ::std::for_each( aMakeVisibleToolbars.begin(), aMakeVisibleToolbars.end(),::boost::bind( &LayoutManager::requestElement, this,_1 ));
implts_unlock();
}
}
@@ -1368,7 +1378,8 @@ void LayoutManager::implts_refreshContextToolbarsVisibility()
aReadLock.unlock();
UIElement aUIElement;
- for ( sal_uInt32 i = 0; i < aToolbarVisibleVector.size(); i++ )
+ const sal_uInt32 nCount = aToolbarVisibleVector.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
UIElementVisibility& rToolbar = aToolbarVisibleVector[i];
@@ -1411,10 +1422,8 @@ sal_Bool LayoutManager::implts_readWindowStateData( const rtl::OUString& aName,
try
{
- Any a;
Sequence< PropertyValue > aWindowState;
- a = xPersistentWindowState->getByName( aName );
- if ( a >>= aWindowState )
+ if ( xPersistentWindowState->getByName( aName ) >>= aWindowState )
{
sal_Bool bValue( sal_False );
for ( sal_Int32 n = 0; n < aWindowState.getLength(); n++ )
@@ -1579,18 +1588,18 @@ void LayoutManager::implts_writeWindowStateData( const rtl::OUString& aName, con
aPos.X = rElementData.m_aDockedData.m_aPos.X();
aPos.Y = rElementData.m_aDockedData.m_aPos.Y();
aWindowState[3].Name = m_aPropDockPos;
- aWindowState[3].Value = makeAny( aPos );
+ aWindowState[3].Value <<= aPos;
aPos.X = rElementData.m_aFloatingData.m_aPos.X();
aPos.Y = rElementData.m_aFloatingData.m_aPos.Y();
aWindowState[4].Name = m_aPropPos;
- aWindowState[4].Value = makeAny( aPos );
+ aWindowState[4].Value <<= aPos;
css::awt::Size aSize;
aSize.Width = rElementData.m_aFloatingData.m_aSize.Width();
aSize.Height = rElementData.m_aFloatingData.m_aSize.Height();
aWindowState[5].Name = m_aPropSize;
- aWindowState[5].Value = makeAny( aSize );
+ aWindowState[5].Value <<= aSize;
aWindowState[6].Name = m_aPropUIName;
aWindowState[6].Value = makeAny( rElementData.m_aUIName );
aWindowState[7].Name = m_aPropLocked;
@@ -1799,7 +1808,7 @@ void LayoutManager::implts_setElementData( UIElement& rElement, const Reference<
{
Reference< css::awt::XDockableWindow > xDockWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY );
Reference< css::awt::XWindow > xWindow( xDockWindow, UNO_QUERY );
- if ( xDockWindow.is() && xWindow.is() && xDockWindow->isFloating() )
+ if ( xDockWindow.is() && xDockWindow->isFloating() )
{
vos::OGuard aGuard( Application::GetSolarMutex() );
Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
@@ -1864,7 +1873,8 @@ void LayoutManager::implts_findNextDockingPos( DockingArea DockingArea, const ::
implts_getDockingAreaElementInfos( DockingArea, aRowColumnsWindowData );
sal_Int32 nPixelPos( 0 );
- for ( sal_Int32 i = 0; i < sal_Int32( aRowColumnsWindowData.size()); i++ )
+ const sal_uInt32 nCount = aRowColumnsWindowData.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
SingleRowColumnWindowData& rRowColumnWindowData = aRowColumnsWindowData[i];
@@ -1877,7 +1887,8 @@ void LayoutManager::implts_findNextDockingPos( DockingArea DockingArea, const ::
{
// Check current row where we can find the needed space
sal_Int32 nCurrPos( 0 );
- for ( sal_Int32 j = 0; j < sal_Int32( rRowColumnWindowData.aRowColumnWindowSizes.size()); j++ )
+ const sal_uInt32 nWindowSizesCount = rRowColumnWindowData.aRowColumnWindowSizes.size();
+ for ( sal_uInt32 j = 0; j < nWindowSizesCount; j++ )
{
css::awt::Rectangle rRect = rRowColumnWindowData.aRowColumnWindowSizes[j];
sal_Int32& rSpace = rRowColumnWindowData.aRowColumnSpace[j];
@@ -1999,7 +2010,8 @@ void LayoutManager::implts_sortUIElements()
UIElementVector::iterator pIter;
for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
- if ( pIter->m_bUserActive )
+ // why check, just set it to false
+ //if ( pIter->m_bUserActive )
pIter->m_bUserActive = sal_False;
}
@@ -2021,24 +2033,22 @@ void LayoutManager::implts_getDockingAreaElementInfos( DockingArea eDockingArea,
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
ReadGuard aReadLock( m_aLock );
+ aWindowVector.reserve(m_aUIElements.size());
xDockAreaWindow = m_xDockAreaWindows[eDockingArea];
UIElementVector::iterator pIter;
for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
- if ( pIter->m_aDockedData.m_nDockedArea == eDockingArea )
+ if ( pIter->m_aDockedData.m_nDockedArea == eDockingArea && pIter->m_bVisible && !pIter->m_bFloating )
{
Reference< XUIElement > xUIElement( pIter->m_xUIElement );
if ( xUIElement.is() )
{
Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY );
- if ( xWindow.is() )
+ Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY );
+ if ( xDockWindow.is() )
{
- Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY );
- if ( xDockWindow.is() && pIter->m_bVisible && !pIter->m_bFloating )
- {
- // docked windows
- aWindowVector.push_back( *pIter );
- }
+ // docked windows
+ aWindowVector.push_back( *pIter );
}
}
}
@@ -2068,29 +2078,15 @@ void LayoutManager::implts_getDockingAreaElementInfos( DockingArea eDockingArea,
else
nLastRowColPixelPos = aDockAreaRect.Width;
- for ( j = 0; j < sal_Int32( aWindowVector.size()); j++ )
+ const sal_uInt32 nCount = aWindowVector.size();
+ for ( j = 0; j < sal_Int32( nCount); j++ )
{
const UIElement& rElement = aWindowVector[j];
Reference< css::awt::XWindow > xWindow;
Reference< XUIElement > xUIElement( rElement.m_xUIElement );
css::awt::Rectangle aPosSize;
- if ( xUIElement.is() )
- {
- vos::OGuard aGuard( Application::GetSolarMutex() );
- xWindow = Reference< css::awt::XWindow >( xUIElement->getRealInterface(), UNO_QUERY );
- aPosSize = xWindow->getPosSize();
-
- Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow->GetType() == WINDOW_TOOLBOX )
- {
- ::Size aSize = ((ToolBox*)pWindow)->CalcWindowSizePixel( 1 );
- aPosSize.Width = aSize.Width();
- aPosSize.Height = aSize.Height();
- }
- }
- else
+ if ( !lcl_checkUIElement(xUIElement,aPosSize,xWindow) )
continue;
-
if (( eDockingArea == DockingArea_DOCKINGAREA_TOP ) ||
( eDockingArea == DockingArea_DOCKINGAREA_BOTTOM ))
{
@@ -2225,7 +2221,8 @@ void LayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( DockingArea
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
ReadGuard aReadLock( m_aLock );
UIElementVector::iterator pIter;
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
+ UIElementVector::iterator pEnd = m_aUIElements.end();
+ for ( pIter = m_aUIElements.begin(); pIter != pEnd; pIter++ )
{
if ( pIter->m_aDockedData.m_nDockedArea == eDockingArea )
{
@@ -2268,33 +2265,21 @@ void LayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( DockingArea
sal_Int32 j;
sal_Int32 nLastPos( 0 );
- for ( j = 0; j < sal_Int32( aWindowVector.size()); j++ )
+ const sal_uInt32 nCount = aWindowVector.size();
+ for ( j = 0; j < sal_Int32( nCount); j++ )
{
const UIElement& rElement = aWindowVector[j];
Reference< css::awt::XWindow > xWindow;
Reference< XUIElement > xUIElement( rElement.m_xUIElement );
css::awt::Rectangle aPosSize;
- if ( xUIElement.is() )
- {
- vos::OGuard aGuard( Application::GetSolarMutex() );
- xWindow = Reference< css::awt::XWindow >( xUIElement->getRealInterface(), UNO_QUERY );
- aPosSize = xWindow->getPosSize();
-
- Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow->GetType() == WINDOW_TOOLBOX )
- {
- ::Size aSize = ((ToolBox*)pWindow)->CalcWindowSizePixel( 1 );
- aPosSize.Width = aSize.Width();
- aPosSize.Height = aSize.Height();
- }
- }
- else
+ if ( !lcl_checkUIElement(xUIElement,aPosSize,xWindow) )
continue;
+ sal_Int32 nSpace;
if (( eDockingArea == DockingArea_DOCKINGAREA_TOP ) ||
( eDockingArea == DockingArea_DOCKINGAREA_BOTTOM ))
{
- sal_Int32 nSpace( rElement.m_aDockedData.m_aPos.X() - nLastPos );
+ nSpace = ( rElement.m_aDockedData.m_aPos.X() - nLastPos );
// Calc space before an element and store it
if ( rElement.m_aDockedData.m_aPos.X() > nLastPos )
@@ -2302,11 +2287,9 @@ void LayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( DockingArea
else
nSpace = 0;
- rRowColumnWindowData.aRowColumnSpace.push_back( nSpace );
nLastPos = rElement.m_aDockedData.m_aPos.X() + aPosSize.Width;
- rRowColumnWindowData.aRowColumnWindows.push_back( xWindow );
- rRowColumnWindowData.aUIElementNames.push_back( rElement.m_aName );
+
rRowColumnWindowData.aRowColumnWindowSizes.push_back(
css::awt::Rectangle( rElement.m_aDockedData.m_aPos.X(),
rElement.m_aDockedData.m_aPos.Y(),
@@ -2314,21 +2297,19 @@ void LayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( DockingArea
aPosSize.Height ));
if ( rRowColumnWindowData.nStaticSize < aPosSize.Height )
rRowColumnWindowData.nStaticSize = aPosSize.Height;
- rRowColumnWindowData.nVarSize += aPosSize.Width + nSpace;
+ rRowColumnWindowData.nVarSize += aPosSize.Width;
}
else
{
// Calc space before an element and store it
- sal_Int32 nSpace( rElement.m_aDockedData.m_aPos.Y() - nLastPos );
+ nSpace = ( rElement.m_aDockedData.m_aPos.Y() - nLastPos );
if ( rElement.m_aDockedData.m_aPos.Y() > nLastPos )
rRowColumnWindowData.nSpace += nSpace;
else
nSpace = 0;
- rRowColumnWindowData.aRowColumnSpace.push_back( nSpace );
+
nLastPos = rElement.m_aDockedData.m_aPos.Y() + aPosSize.Height;
- rRowColumnWindowData.aRowColumnWindows.push_back( xWindow );
- rRowColumnWindowData.aUIElementNames.push_back( rElement.m_aName );
rRowColumnWindowData.aRowColumnWindowSizes.push_back(
css::awt::Rectangle( rElement.m_aDockedData.m_aPos.X(),
rElement.m_aDockedData.m_aPos.Y(),
@@ -2336,8 +2317,13 @@ void LayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( DockingArea
aPosSize.Height ));
if ( rRowColumnWindowData.nStaticSize < aPosSize.Width )
rRowColumnWindowData.nStaticSize = aPosSize.Width;
- rRowColumnWindowData.nVarSize += aPosSize.Height + nSpace;
+ rRowColumnWindowData.nVarSize += aPosSize.Height;
}
+
+ rRowColumnWindowData.aUIElementNames.push_back( rElement.m_aName );
+ rRowColumnWindowData.aRowColumnWindows.push_back( xWindow );
+ rRowColumnWindowData.aRowColumnSpace.push_back( nSpace );
+ rRowColumnWindowData.nVarSize += nSpace;
}
}
@@ -2354,13 +2340,14 @@ void LayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( DockingArea
( eDockingArea == DockingArea_DOCKINGAREA_BOTTOM ));
implts_getDockingAreaElementInfoOnSingleRowCol( eDockingArea, nRowCol, aRowColumnWindowData );
- if ( aRowColumnWindowData.aRowColumnWindows.size() == 0 )
+ if ( aRowColumnWindowData.aRowColumnWindows.empty() )
return rMovedElementRect;
else
{
sal_Int32 nSpace( 0 );
::Rectangle aFrontDockingRect( rMovedElementRect );
- for ( sal_uInt32 i = 0; i < aRowColumnWindowData.aRowColumnWindows.size(); i++ )
+ const sal_uInt32 nCount = aRowColumnWindowData.aRowColumnWindows.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
if ( bHorzDockArea )
{
@@ -2415,7 +2402,7 @@ void LayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( DockingArea
( DockingArea > DockingArea_DOCKINGAREA_RIGHT ))
DockingArea = DockingArea_DOCKINGAREA_TOP;
- if ( rRowColumnWindowData.aRowColumnWindows.size() == 0 )
+ if ( rRowColumnWindowData.aRowColumnWindows.empty() )
return aWinRect;
else
{
@@ -2432,7 +2419,8 @@ void LayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( DockingArea
Window* pDockingAreaWindow( VCLUnoHelper::GetWindow( xDockingAreaWindow ));
if ( pDockingAreaWindow && pContainerWindow )
{
- for ( sal_uInt32 i = 0; i < rRowColumnWindowData.aRowColumnWindows.size(); i++ )
+ const sal_uInt32 nCount = rRowColumnWindowData.aRowColumnWindows.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
css::awt::Rectangle aWindowRect = rRowColumnWindowData.aRowColumnWindows[i]->getPosSize();
::Rectangle aRect( aWindowRect.X, aWindowRect.Y, aWindowRect.X+aWindowRect.Width, aWindowRect.Y+aWindowRect.Height );
@@ -2660,7 +2648,8 @@ void LayoutManager::implts_calcDockingPosSize(
// determine current first row/column and last row/column
sal_Int32 nMaxRowCol( -1 );
sal_Int32 nMinRowCol( SAL_MAX_INT32 );
- for ( sal_uInt32 i = 0; i < aRowColumnsWindowData.size(); i++ )
+ const sal_uInt32 nCount = aRowColumnsWindowData.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
if ( aRowColumnsWindowData[i].nRowColumn > nMaxRowCol )
nMaxRowCol = aRowColumnsWindowData[i].nRowColumn;
@@ -2676,7 +2665,8 @@ void LayoutManager::implts_calcDockingPosSize(
::Rectangle aWindowRect;
::Rectangle aRowColumnRect;
- for ( sal_uInt32 i = 0; i < aRowColumnsWindowData.size(); i++ )
+ const sal_uInt32 nWindowDataCount = aRowColumnsWindowData.size();
+ for ( sal_uInt32 i = 0; i < nWindowDataCount; i++ )
{
::Rectangle aRect( aRowColumnsWindowData[i].aRowColumnRect.X,
aRowColumnsWindowData[i].aRowColumnRect.Y,
@@ -3163,6 +3153,7 @@ void LayoutManager::implts_updateUIElementsVisibleState( sal_Bool bSetVisible )
}
ReadGuard aReadLock( m_aLock );
+ aWinVector.reserve(m_aUIElements.size());
UIElementVector::iterator pIter;
for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
@@ -3187,7 +3178,8 @@ void LayoutManager::implts_updateUIElementsVisibleState( sal_Bool bSetVisible )
try
{
vos::OGuard aGuard( Application::GetSolarMutex() );
- for ( sal_uInt32 i = 0; i < aWinVector.size(); i++ )
+ const sal_uInt32 nCount = aWinVector.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
Reference< css::awt::XWindow > xWindow( aWinVector[i] );
if ( xWindow.is() )
@@ -3653,7 +3645,7 @@ throw (::com::sun::star::uno::RuntimeException)
Reference< XDispatchProvider > xDispatchProvider;
MenuBar* pMenuBar = new MenuBar;
- m_pInplaceMenuBar = new MenuBarManager( m_xSMGR, m_xFrame, xDispatchProvider, aModuleIdentifier, pMenuBar, sal_True, sal_True );
+ m_pInplaceMenuBar = new MenuBarManager( m_xSMGR, m_xFrame, m_xURLTransformer,xDispatchProvider, aModuleIdentifier, pMenuBar, sal_True, sal_True );
m_pInplaceMenuBar->SetItemContainer( xMergedMenuBar );
Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
@@ -3895,9 +3887,10 @@ throw ( RuntimeException )
else
implts_destroyElements(); // remove all elements
- if ( oldDockingAreaWindows.size() > 0 )
+ if ( !oldDockingAreaWindows.empty() )
{
- for ( sal_Int32 i=0; i < (sal_Int32)oldDockingAreaWindows.size(); i++ )
+ const sal_uInt32 nCount = oldDockingAreaWindows.size();
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
{
if ( oldDockingAreaWindows[i].is() )
{
@@ -4079,7 +4072,8 @@ IMPL_LINK( LayoutManager, WindowEventListener, VclSimpleEvent*, pEvent )
aReadLock.unlock();
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- for ( sal_uInt32 i = 0; i < aListenerArray.size(); i++ )
+ const sal_uInt32 nCount = aListenerArray.size();
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
{
try
{
@@ -4125,7 +4119,6 @@ throw (RuntimeException)
ReadGuard aReadLock( m_aLock );
Reference< XFrame > xFrame = m_xFrame;
Reference< XURLTransformer > xURLTransformer = m_xURLTransformer;
- Reference< XModel > xModel;
sal_Bool bInPlaceMenu = m_bInplaceMenuSet;
aReadLock.unlock();
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -4133,7 +4126,7 @@ throw (RuntimeException)
if ( !xFrame.is() )
return;
- xModel = impl_getModelFromFrame( xFrame );
+ Reference< XModel > xModel( impl_getModelFromFrame( xFrame ) );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
WriteGuard aWriteLock( m_aLock );
@@ -4147,7 +4140,7 @@ throw (RuntimeException)
implts_findElement( aName, aElementType, aElementName, xUIElement );
bFound = xUIElement.is();
- if ( xFrame.is() && m_xContainerWindow.is() && !implts_isPreviewModel( xModel ) ) // no bars on preview mode
+ if ( /*xFrame.is() && */m_xContainerWindow.is() && !implts_isPreviewModel( xModel ) ) // no bars on preview mode
{
if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" ))
{
@@ -4243,8 +4236,7 @@ throw (RuntimeException)
{
try
{
- Any a = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XMenuBar" )));
- a >>= xMenuBar;
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XMenuBar" ))) >>= xMenuBar;
}
catch ( com::sun::star::beans::UnknownPropertyException )
{
@@ -4263,13 +4255,11 @@ throw (RuntimeException)
if ( pMenuBar )
{
pSysWindow->SetMenuBar( pMenuBar );
+ pMenuBar->SetDisplayable( m_bMenuVisible );
if ( m_bMenuVisible )
{
- pMenuBar->SetDisplayable( sal_True );
bNotify = sal_True;
}
- else
- pMenuBar->SetDisplayable( sal_False );
implts_updateMenuBarClose();
}
}
@@ -4304,8 +4294,7 @@ throw (RuntimeException)
if ( bNotify )
{
// UI element is invisible - provide information to listeners
- uno::Any a = uno::makeAny( aName );
- implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_VISIBLE, a );
+ implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_VISIBLE, uno::makeAny( aName ) );
}
}
@@ -4362,7 +4351,7 @@ throw (RuntimeException)
{
if ( pIter->m_aName == aName )
{
- xComponent = Reference< XComponent >( pIter->m_xUIElement, UNO_QUERY );
+ xComponent.set( pIter->m_xUIElement, UNO_QUERY );
Reference< XUIElement > xUIElement( pIter->m_xUIElement );
if ( xUIElement.is() )
{
@@ -4444,8 +4433,7 @@ throw (RuntimeException)
if ( bNotify )
{
// UI element is invisible - provide information to listeners
- uno::Any a = uno::makeAny( aName );
- implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_INVISIBLE, a );
+ implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_INVISIBLE, uno::makeAny( aName ) );
}
}
@@ -4530,7 +4518,7 @@ throw (::com::sun::star::uno::RuntimeException)
if ( xDockWindow.is() && xDockWindow->isFloating() )
bShowElement = ( bShowElement && xContainerWindow->isActive() );
- if ( xWindow.is() && xDockWindow.is() && bShowElement )
+ if ( xDockWindow.is() && bShowElement )
{
pIter->m_bVisible = sal_True;
aWriteLock.unlock();
@@ -4550,9 +4538,9 @@ throw (::com::sun::star::uno::RuntimeException)
}
bResult = sal_False;
- break;
}
- }
+ } // if ( pIter->m_xUIElement.is() )
+ break;
}
}
@@ -4597,8 +4585,7 @@ throw (::com::sun::star::uno::RuntimeException)
if ( bNotify )
{
// UI element is visible - provide information to listeners
- uno::Any a = uno::makeAny( ResourceURL );
- implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_VISIBLE, a );
+ implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_VISIBLE, uno::makeAny( ResourceURL ) );
}
return bResult;
@@ -4723,7 +4710,7 @@ throw (RuntimeException)
implts_writeWindowStateData( aUIElement.m_aName, aUIElement );
implts_sortUIElements();
- if ( xWindow.is() && xDockWindow.is() && bShowElement )
+ if ( xDockWindow.is() && bShowElement )
{
// we need VCL here to pass special flags to Show()
vos::OGuard aGuard( Application::GetSolarMutex() );
@@ -4739,7 +4726,8 @@ throw (RuntimeException)
doLayout();
bResult = sal_True;
- }
+ } // if ( xDockWindow.is() && bShowElement )
+ break;
}
}
}
@@ -4757,8 +4745,7 @@ throw (RuntimeException)
if ( bNotify )
{
// UI element is visible - provide information to listeners
- uno::Any a = uno::makeAny( aName );
- implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_VISIBLE, a );
+ implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_VISIBLE, uno::makeAny( aName ) );
}
return bResult;
@@ -4839,7 +4826,7 @@ throw (RuntimeException)
Reference< css::awt::XWindow > xWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY );
Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY );
- if ( xWindow.is() && xDockWindow.is() )
+ if ( xDockWindow.is() )
{
pIter->m_bVisible = sal_False;
aWriteLock.unlock();
@@ -4852,7 +4839,8 @@ throw (RuntimeException)
bResult = sal_True;
bNotify = sal_True;
- }
+ } // if ( xDockWindow.is() )
+ break;
}
}
}
@@ -4870,8 +4858,7 @@ throw (RuntimeException)
if ( bNotify )
{
// UI element is visible - provide information to listeners
- uno::Any a = uno::makeAny( aName );
- implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_INVISIBLE, a );
+ implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_INVISIBLE, uno::makeAny( aName ) );
}
return sal_False;
@@ -4882,96 +4869,93 @@ throw (RuntimeException)
{
UIElement aUIElement;
- if ( implts_findElement( aName, aUIElement ))
+ if ( implts_findElement( aName, aUIElement ) && aUIElement.m_xUIElement.is() )
{
- if ( aUIElement.m_xUIElement.is() )
+ try
{
- try
+ Reference< css::awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), UNO_QUERY );
+ Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY );
+ if ( xDockWindow.is() )
{
- Reference< css::awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), UNO_QUERY );
- Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY );
- if ( xWindow.is() && xDockWindow.is() )
- {
- if ( DockingArea != DockingArea_DOCKINGAREA_DEFAULT )
- aUIElement.m_aDockedData.m_nDockedArea = sal_Int16( DockingArea );
+ if ( DockingArea != DockingArea_DOCKINGAREA_DEFAULT )
+ aUIElement.m_aDockedData.m_nDockedArea = sal_Int16( DockingArea );
- if (( Pos.X != SAL_MAX_INT32 ) && ( Pos.Y != SAL_MAX_INT32 ))
- aUIElement.m_aDockedData.m_aPos = ::Point( Pos.X, Pos.Y );
+ if (( Pos.X != SAL_MAX_INT32 ) && ( Pos.Y != SAL_MAX_INT32 ))
+ aUIElement.m_aDockedData.m_aPos = ::Point( Pos.X, Pos.Y );
- if ( !xDockWindow->isFloating() )
- {
- Window* pWindow( 0 );
- ToolBox* pToolBox( 0 );
+ if ( !xDockWindow->isFloating() )
+ {
+ Window* pWindow( 0 );
+ ToolBox* pToolBox( 0 );
+ {
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ pWindow = VCLUnoHelper::GetWindow( xWindow );
+ if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
- pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
- {
- pToolBox = (ToolBox *)pWindow;
+ pToolBox = (ToolBox *)pWindow;
- // We have to set the alignment of the toolbox. It's possible that the toolbox is moved from a
- // horizontal to a vertical docking area!
- pToolBox->SetAlign( ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ));
- }
+ // We have to set the alignment of the toolbox. It's possible that the toolbox is moved from a
+ // horizontal to a vertical docking area!
+ pToolBox->SetAlign( ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ));
}
+ }
- if (( aUIElement.m_aDockedData.m_aPos.X() == SAL_MAX_INT32 ) ||
- ( aUIElement.m_aDockedData.m_aPos.Y() == SAL_MAX_INT32 ))
- {
- // Docking on its default position without a preset position -
- // we have to find a good place for it.
- ::Size aSize;
-
- vos::OGuard aGuard( Application::GetSolarMutex() );
- {
- if ( pToolBox )
- aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ) );
- else
- aSize = pWindow->GetSizePixel();
- }
+ if (( aUIElement.m_aDockedData.m_aPos.X() == SAL_MAX_INT32 ) ||
+ ( aUIElement.m_aDockedData.m_aPos.Y() == SAL_MAX_INT32 ))
+ {
+ // Docking on its default position without a preset position -
+ // we have to find a good place for it.
+ ::Size aSize;
- ::Point aPixelPos;
- ::Point aDockPos;
- implts_findNextDockingPos( (::com::sun::star::ui::DockingArea)aUIElement.m_aDockedData.m_nDockedArea,
- aSize,
- aDockPos,
- aPixelPos );
- aUIElement.m_aDockedData.m_aPos = aDockPos;
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ {
+ if ( pToolBox )
+ aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ) );
+ else
+ aSize = pWindow->GetSizePixel();
}
- }
- WriteGuard aWriteLock( m_aLock );
- UIElement& rUIElement = LayoutManager::impl_findElement( aUIElement.m_aName );
- if ( rUIElement.m_aName == aName )
- {
- rUIElement.m_aDockedData.m_nDockedArea = aUIElement.m_aDockedData.m_nDockedArea;
- rUIElement.m_aDockedData.m_aPos = aUIElement.m_aDockedData.m_aPos;
+ ::Point aPixelPos;
+ ::Point aDockPos;
+ implts_findNextDockingPos( (::com::sun::star::ui::DockingArea)aUIElement.m_aDockedData.m_nDockedArea,
+ aSize,
+ aDockPos,
+ aPixelPos );
+ aUIElement.m_aDockedData.m_aPos = aDockPos;
}
- aWriteLock.unlock();
+ }
- if ( xDockWindow->isFloating() )
- {
- // Will call toggle floating mode which will do the rest!
- xWindow->setVisible( sal_False );
- xDockWindow->setFloatingMode( sal_False );
- xWindow->setVisible( sal_True );
- }
- else
- {
- implts_writeWindowStateData( aName, aUIElement );
- implts_sortUIElements();
+ WriteGuard aWriteLock( m_aLock );
+ UIElement& rUIElement = LayoutManager::impl_findElement( aUIElement.m_aName );
+ if ( rUIElement.m_aName == aName )
+ {
+ rUIElement.m_aDockedData.m_nDockedArea = aUIElement.m_aDockedData.m_nDockedArea;
+ rUIElement.m_aDockedData.m_aPos = aUIElement.m_aDockedData.m_aPos;
+ }
+ aWriteLock.unlock();
- if ( aUIElement.m_bVisible )
- doLayout();
- }
+ if ( xDockWindow->isFloating() )
+ {
+ // Will call toggle floating mode which will do the rest!
+ xWindow->setVisible( sal_False );
+ xDockWindow->setFloatingMode( sal_False );
+ xWindow->setVisible( sal_True );
+ }
+ else
+ {
+ implts_writeWindowStateData( aName, aUIElement );
+ implts_sortUIElements();
- return sal_True;
+ if ( aUIElement.m_bVisible )
+ doLayout();
}
+
+ return sal_True;
}
- catch ( DisposedException& )
- {
- }
+ }
+ catch ( DisposedException& )
+ {
}
}
@@ -5000,7 +4984,8 @@ throw (RuntimeException)
}
}
- for ( sal_uInt32 i = 0; i < aToolBarNameVector.size(); i++ )
+ const sal_uInt32 nCount = aToolBarNameVector.size();
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
{
::com::sun::star::awt::Point aPoint;
aPoint.X = aPoint.Y = SAL_MAX_INT32;
@@ -5164,42 +5149,39 @@ throw (RuntimeException)
{
UIElement aUIElement;
- if ( implts_findElement( aName, aUIElement ))
+ if ( implts_findElement( aName, aUIElement ) && aUIElement.m_xUIElement.is() )
{
- if ( aUIElement.m_xUIElement.is() )
+ try
{
- try
- {
- Reference< css::awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), UNO_QUERY );
- Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY );
+ Reference< css::awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), UNO_QUERY );
+ Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY );
- if ( xWindow.is() && xDockWindow.is() )
+ if ( xWindow.is() && xDockWindow.is() )
+ {
+ if ( aUIElement.m_bFloating )
{
- if ( aUIElement.m_bFloating )
- {
- xWindow->setPosSize( aPos.X, aPos.Y, 0, 0, css::awt::PosSize::POS );
- implts_writeNewStateData( aName, xWindow );
- }
- else
- {
- WriteGuard aWriteLock( m_aLock );
- UIElement& rUIElement = LayoutManager::impl_findElement( aUIElement.m_aName );
- if ( rUIElement.m_aName == aName )
- rUIElement.m_aDockedData.m_aPos = ::Point( aPos.X, aPos.Y );
- aWriteLock.unlock();
+ xWindow->setPosSize( aPos.X, aPos.Y, 0, 0, css::awt::PosSize::POS );
+ implts_writeNewStateData( aName, xWindow );
+ }
+ else
+ {
+ WriteGuard aWriteLock( m_aLock );
+ UIElement& rUIElement = LayoutManager::impl_findElement( aUIElement.m_aName );
+ if ( rUIElement.m_aName == aName )
+ rUIElement.m_aDockedData.m_aPos = ::Point( aPos.X, aPos.Y );
+ aWriteLock.unlock();
- aUIElement.m_aDockedData.m_aPos = ::Point( aPos.X, aPos.Y );
- implts_writeWindowStateData( aName, aUIElement );
- implts_sortUIElements();
+ aUIElement.m_aDockedData.m_aPos = ::Point( aPos.X, aPos.Y );
+ implts_writeWindowStateData( aName, aUIElement );
+ implts_sortUIElements();
- if ( aUIElement.m_bVisible )
- doLayout();
- }
+ if ( aUIElement.m_bVisible )
+ doLayout();
}
}
- catch ( DisposedException& )
- {
- }
+ }
+ catch ( DisposedException& )
+ {
}
}
}
@@ -5322,10 +5304,7 @@ throw (RuntimeException)
if ( xWindow.is() )
{
Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow && pWindow->IsVisible() )
- return sal_True;
- else
- return sal_False;
+ return pWindow && pWindow->IsVisible();
}
}
}
@@ -5353,13 +5332,8 @@ throw (RuntimeException)
{
if ( pIter->m_aName == aName && pIter->m_xUIElement.is() )
{
- Reference< css::awt::XWindow > xWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY );
- if ( xWindow.is() )
- {
- Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY );
- if ( xDockWindow.is() )
- return xDockWindow->isFloating();
- }
+ Reference< css::awt::XDockableWindow > xDockWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY );
+ return xDockWindow.is() && xDockWindow->isFloating();
}
}
@@ -5376,13 +5350,8 @@ throw (RuntimeException)
{
if ( pIter->m_aName == aName && pIter->m_xUIElement.is() )
{
- Reference< css::awt::XWindow > xWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY );
- if ( xWindow.is() )
- {
- Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY );
- if ( xDockWindow.is() )
- return !xDockWindow->isFloating();
- }
+ Reference< css::awt::XDockableWindow > xDockWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY );
+ return xDockWindow.is() && !xDockWindow->isFloating();
}
}
@@ -5397,16 +5366,10 @@ throw (::com::sun::star::uno::RuntimeException)
ReadGuard aReadLock( m_aLock );
for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
- if (( pIter->m_aName == ResourceURL ) &&
- ( pIter->m_xUIElement.is() ))
+ if (( pIter->m_aName == ResourceURL ) && ( pIter->m_xUIElement.is() ))
{
- Reference< css::awt::XWindow > xWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY );
- if ( xWindow.is() )
- {
- Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY );
- if ( xDockWindow.is() )
- return xDockWindow->isLocked();
- }
+ Reference< css::awt::XDockableWindow > xDockWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY );
+ return xDockWindow.is() && !xDockWindow->isLocked();
}
}
@@ -5416,64 +5379,53 @@ throw (::com::sun::star::uno::RuntimeException)
css::awt::Size SAL_CALL LayoutManager::getElementSize( const ::rtl::OUString& aName )
throw (RuntimeException)
{
- UIElementVector::const_iterator pIter;
-
ReadGuard aReadLock( m_aLock );
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
+ UIElement aElementData;
+ if ( implts_findElement( aName,aElementData ) && aElementData.m_xUIElement.is() )
{
- if ( pIter->m_aName == aName && pIter->m_xUIElement.is() )
+ Reference< css::awt::XWindow > xWindow( aElementData.m_xUIElement->getRealInterface(), UNO_QUERY );
+ if ( xWindow.is() )
{
- Reference< css::awt::XWindow > xWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY );
- if ( xWindow.is() )
+ Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ if ( pWindow )
{
- Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow )
- {
- ::Size aSize = pWindow->GetSizePixel();
- css::awt::Size aElementSize;
- aElementSize.Width = aSize.Width();
- aElementSize.Height = aSize.Height();
- return aElementSize;
- }
- else
- break;
- }
+ ::Size aSize = pWindow->GetSizePixel();
+ css::awt::Size aElementSize;
+ aElementSize.Width = aSize.Width();
+ aElementSize.Height = aSize.Height();
+ return aElementSize;
+ } // if ( pWindow )
}
}
-
return css::awt::Size();
}
css::awt::Point SAL_CALL LayoutManager::getElementPos( const ::rtl::OUString& aName )
throw (RuntimeException)
{
- UIElementVector::const_iterator pIter;
-
ReadGuard aReadLock( m_aLock );
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
+ UIElement aElementData;
+ if ( implts_findElement( aName,aElementData ) && aElementData.m_xUIElement.is() )
{
- if ( pIter->m_aName == aName && pIter->m_xUIElement.is() )
+ Reference< css::awt::XWindow > xWindow( aElementData.m_xUIElement->getRealInterface(), UNO_QUERY );
+ Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY );
+ if ( xDockWindow.is() )
{
- Reference< css::awt::XWindow > xWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY );
- Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY );
- if ( xWindow.is() && xDockWindow.is() )
+ css::awt::Point aPos;
+ if ( aElementData.m_bFloating )
{
- css::awt::Point aPos;
- if ( pIter->m_bFloating )
- {
- css::awt::Rectangle aRect = xWindow->getPosSize();
- aPos.X = aRect.X;
- aPos.Y = aRect.Y;
- }
- else
- {
- ::Point aVirtualPos = pIter->m_aDockedData.m_aPos;
- aPos.X = aVirtualPos.X();
- aPos.Y = aVirtualPos.Y();
- }
-
- return aPos;
+ css::awt::Rectangle aRect = xWindow->getPosSize();
+ aPos.X = aRect.X;
+ aPos.Y = aRect.Y;
+ }
+ else
+ {
+ ::Point aVirtualPos = aElementData.m_aDockedData.m_aPos;
+ aPos.X = aVirtualPos.X();
+ aPos.Y = aVirtualPos.Y();
}
+
+ return aPos;
}
}
@@ -5621,7 +5573,8 @@ sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace )
implts_getDockingAreaElementInfos( (DockingArea)i, aRowColumnsWindowData );
sal_Int32 nOffset( 0 );
- for ( sal_Int32 j = 0; j < sal_Int32( aRowColumnsWindowData.size() ); j++ )
+ const sal_uInt32 nCount = aRowColumnsWindowData.size();
+ for ( sal_uInt32 j = 0; j < nCount; ++j )
{
implts_calcWindowPosSizeOnSingleRowColumn( i, nOffset, aRowColumnsWindowData[j], aContainerSize );
nOffset += aRowColumnsWindowData[j].nStaticSize;
@@ -5687,7 +5640,7 @@ void LayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockin
sal_Int32 nBottomDockingAreaSize;
sal_Int32 nContainerClientSize;
- if ( rRowColumnWindowData.aRowColumnWindows.size() == 0 )
+ if ( rRowColumnWindowData.aRowColumnWindows.empty() )
return;
if (( nDockingArea == DockingArea_DOCKINGAREA_TOP ) ||
@@ -5704,26 +5657,28 @@ void LayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockin
nDiff = nContainerClientSize - rRowColumnWindowData.nVarSize;
}
+ const sal_uInt32 nCount = rRowColumnWindowData.aRowColumnWindowSizes.size();
if (( nDiff < 0 ) && ( nRCSpace > 0 ))
{
// First we try to reduce the size of blank space before/behind docked windows
- sal_Int32 i = rRowColumnWindowData.aRowColumnWindowSizes.size()-1;
+ sal_Int32 i = nCount - 1;
while ( i >= 0 )
{
sal_Int32 nSpace = rRowColumnWindowData.aRowColumnSpace[i];
if ( nSpace >= -nDiff )
{
+
if (( nDockingArea == DockingArea_DOCKINGAREA_TOP ) ||
( nDockingArea == DockingArea_DOCKINGAREA_BOTTOM ))
{
// Try to move this and all user elements behind with the calculated difference
- for ( sal_Int32 j = i; j < sal_Int32( rRowColumnWindowData.aRowColumnWindowSizes.size() ); j++ )
+ for ( sal_uInt32 j = i; j < nCount ; j++ )
rRowColumnWindowData.aRowColumnWindowSizes[j].X += nDiff;
}
else
{
// Try to move this and all user elements behind with the calculated difference
- for ( sal_Int32 j = i; j < sal_Int32( rRowColumnWindowData.aRowColumnWindowSizes.size() ); j++ )
+ for ( sal_uInt32 j = i; j < nCount ; j++ )
rRowColumnWindowData.aRowColumnWindowSizes[j].Y += nDiff;
}
nDiff = 0;
@@ -5736,13 +5691,13 @@ void LayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockin
( nDockingArea == DockingArea_DOCKINGAREA_BOTTOM ))
{
// Try to move this and all user elements behind with the calculated difference
- for ( sal_Int32 j = i; j < sal_Int32( rRowColumnWindowData.aRowColumnWindowSizes.size() ); j++ )
+ for ( sal_uInt32 j = i; j < nCount; j++ )
rRowColumnWindowData.aRowColumnWindowSizes[j].X -= nSpace;
}
else
{
// Try to move this and all user elements behind with the calculated difference
- for ( sal_Int32 j = i; j < sal_Int32( rRowColumnWindowData.aRowColumnWindowSizes.size() ); j++ )
+ for ( sal_uInt32 j = i; j < nCount; j++ )
rRowColumnWindowData.aRowColumnWindowSizes[j].Y -= nSpace;
}
nDiff += nSpace;
@@ -5755,7 +5710,7 @@ void LayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockin
if ( nDiff < 0 )
{
// Now we have to reduce the size of certain docked windows
- sal_Int32 i = sal_Int32( rRowColumnWindowData.aRowColumnWindowSizes.size() - 1 );
+ sal_Int32 i = sal_Int32( nCount - 1 );
while ( i >= 0 )
{
css::awt::Rectangle& rWinRect = rRowColumnWindowData.aRowColumnWindowSizes[i];
@@ -5787,7 +5742,7 @@ void LayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockin
}
// Try to move this and all user elements behind with the calculated difference
- for ( sal_Int32 j = i; j < sal_Int32( rRowColumnWindowData.aRowColumnWindowSizes.size() ); j++ )
+ for ( sal_uInt32 j = i; j < nCount; j++ )
rRowColumnWindowData.aRowColumnWindowSizes[j].X += nDiff;
}
else
@@ -5805,7 +5760,7 @@ void LayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockin
}
// Try to move this and all user elements behind with the calculated difference
- for ( sal_Int32 j = i; j < sal_Int32( rRowColumnWindowData.aRowColumnWindowSizes.size() ); j++ )
+ for ( sal_uInt32 j = i; j < nCount; j++ )
rRowColumnWindowData.aRowColumnWindowSizes[j].Y += nDiff;
}
}
@@ -5831,7 +5786,7 @@ void LayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockin
nStartOffset = pDockAreaWindow->GetSizePixel().Height() - rRowColumnWindowData.nStaticSize;
vos::OGuard aGuard( Application::GetSolarMutex() );
- for ( sal_Int32 i = 0; i < sal_Int32( rRowColumnWindowData.aRowColumnWindows.size() ); i++ )
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
Reference< css::awt::XWindow > xWindow = rRowColumnWindowData.aRowColumnWindows[i];
Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
@@ -5986,12 +5941,13 @@ css::awt::Rectangle LayoutManager::implts_calcDockingAreaSizes()
}
// Sum up max heights from every row/column
- if ( aWindowVector.size() > 0 )
+ if ( !aWindowVector.empty() )
{
for ( sal_Int32 i = 0; i <= DockingArea_DOCKINGAREA_RIGHT; i++ )
{
sal_Int32 nSize( 0 );
- for ( sal_Int32 j = 0; j < sal_Int32( aRowColumnSizes[i].size() ); j++ )
+ const sal_uInt32 nCount = aRowColumnSizes[i].size();
+ for ( sal_uInt32 j = 0; j < nCount; j++ )
nSize += aRowColumnSizes[i][j];
if ( i == DockingArea_DOCKINGAREA_TOP )
@@ -7084,6 +7040,7 @@ IMPL_LINK( LayoutManager, AsyncLayoutHdl, Timer *, EMPTYARG )
void LayoutManager::implts_checkElementContainer()
{
+#ifdef DBG_UTIL
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
ReadGuard aReadLock( m_aLock );
@@ -7102,7 +7059,8 @@ void LayoutManager::implts_checkElementContainer()
::rtl::OString aName = ::rtl::OUStringToOString( pCheckIter->first, RTL_TEXTENCODING_ASCII_US );
DBG_ASSERT( "More than one element (%s) with the same name found!", aName.getStr() );
}
- }
+ } // for ( ; pCheckIter != aUIElementHash.end(); pCheckIter++ )
+#endif
}
//---------------------------------------------------------------------------------------------------------
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index e67b7570f0..902a5a970f 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -75,6 +75,7 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/awt/XWindow2.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
@@ -1829,9 +1830,8 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw
// read window state from the configuration
// and apply it on the window.
// Do nothing, if no configuration entry exists!
- css::uno::Any aWindowState = ::comphelper::ConfigurationHelper::readRelativeKey(xModuleCfg, sModule, OFFICEFACTORY_PROPNAME_WINDOWATTRIBUTES);
::rtl::OUString sWindowState ;
- aWindowState >>= sWindowState;
+ ::comphelper::ConfigurationHelper::readRelativeKey(xModuleCfg, sModule, OFFICEFACTORY_PROPNAME_WINDOWATTRIBUTES) >>= sWindowState;
if (sWindowState.getLength())
{
// SOLAR SAFE ->
diff --git a/framework/source/recording/dispatchrecorder.cxx b/framework/source/recording/dispatchrecorder.cxx
index de76f58891..9ad3f696d6 100644
--- a/framework/source/recording/dispatchrecorder.cxx
+++ b/framework/source/recording/dispatchrecorder.cxx
@@ -187,7 +187,7 @@ void SAL_CALL DispatchRecorder::endRecording() throw( css::uno::RuntimeException
/* SAFE{ */
WriteGuard aWriteLock(m_aLock);
- if ( !m_aStatements.size() )
+ if ( m_aStatements.empty() )
return ::rtl::OUString();
::rtl::OUStringBuffer aScriptBuffer;
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index 48d383ce7b..c7ef3da666 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -61,29 +61,29 @@
=================================================================================================================*/
#include <services/urltransformer.hxx>
#include <services/desktop.hxx>
-#include <services/tabwindowservice.hxx>
+//#include <services/tabwindowservice.hxx>
#include <services/frame.hxx>
#include <services/modulemanager.hxx>
-#include <dispatch/oxt_handler.hxx>
+//#include <dispatch/oxt_handler.hxx>
#include <jobs/jobexecutor.hxx>
-#include <recording/dispatchrecordersupplier.hxx>
-#include <recording/dispatchrecorder.hxx>
-#include <dispatch/mailtodispatcher.hxx>
-#include <dispatch/servicehandler.hxx>
+//#include <recording/dispatchrecordersupplier.hxx>
+//#include <recording/dispatchrecorder.hxx>
+//#include <dispatch/mailtodispatcher.hxx>
+//#include <dispatch/servicehandler.hxx>
#include <jobs/jobdispatch.hxx>
#include <services/backingcomp.hxx>
-#include <services/dispatchhelper.hxx>
+//#include <services/dispatchhelper.hxx>
#include <services/layoutmanager.hxx>
-#include <services/license.hxx>
+//#include <services/license.hxx>
#include <uifactory/uielementfactorymanager.hxx>
#include <uifactory/popupmenucontrollerfactory.hxx>
-#include <uielement/fontmenucontroller.hxx>
-#include <uielement/fontsizemenucontroller.hxx>
+//#include <uielement/fontmenucontroller.hxx>
+//#include <uielement/fontsizemenucontroller.hxx>
#include <uielement/objectmenucontroller.hxx>
-#include <uielement/headermenucontroller.hxx>
-#include <uielement/footermenucontroller.hxx>
+//#include <uielement/headermenucontroller.hxx>
+//#include <uielement/footermenucontroller.hxx>
#include <uielement/controlmenucontroller.hxx>
-#include <uielement/macrosmenucontroller.hxx>
+//#include <uielement/macrosmenucontroller.hxx>
#include <uielement/uicommanddescription.hxx>
#include <uiconfiguration/uiconfigurationmanager.hxx>
#include <uiconfiguration/moduleuicfgsupplier.hxx>
@@ -95,53 +95,54 @@
#include <uifactory/toolboxfactory.hxx>
#include <uifactory/addonstoolboxfactory.hxx>
#include "uiconfiguration/windowstateconfiguration.hxx"
-#include <uielement/toolbarsmenucontroller.hxx>
+//#include <uielement/toolbarsmenucontroller.hxx>
#include "uifactory/toolbarcontrollerfactory.hxx"
#include "uifactory/statusbarcontrollerfactory.hxx"
-#include <uielement/toolbarsmenucontroller.hxx>
#include <services/autorecovery.hxx>
#include <helper/statusindicatorfactory.hxx>
#include <uielement/recentfilesmenucontroller.hxx>
#include <uifactory/statusbarfactory.hxx>
#include <uiconfiguration/uicategorydescription.hxx>
#include <services/sessionlistener.hxx>
-#include <uielement/logoimagestatusbarcontroller.hxx>
-#include <uielement/logotextstatusbarcontroller.hxx>
-#include <uielement/newmenucontroller.hxx>
+//#include <uielement/logoimagestatusbarcontroller.hxx>
+//#include <uielement/logotextstatusbarcontroller.hxx>
+//#include <uielement/newmenucontroller.hxx>
#include <services/taskcreatorsrv.hxx>
-#include <uielement/simpletextstatusbarcontroller.hxx>
-#include <services/uriabbreviation.hxx>
-#include <dispatch/popupmenudispatcher.hxx>
+//#include <uielement/simpletextstatusbarcontroller.hxx>
+//#include <services/uriabbreviation.hxx>
+
#include <uielement/langselectionstatusbarcontroller.hxx>
-#include <uielement/langselectionmenucontroller.hxx>
+//#include <uielement/langselectionmenucontroller.hxx>
#include <uiconfiguration/imagemanager.hxx>
#include <uifactory/windowcontentfactorymanager.hxx>
+#include <services/substitutepathvars.hxx>
+#include <services/pathsettings.hxx>
COMPONENTGETIMPLEMENTATIONENVIRONMENT
COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::URLTransformer )
COMPONENTINFO( ::framework::Desktop )
COMPONENTINFO( ::framework::Frame )
- COMPONENTINFO( ::framework::Oxt_Handler )
+ //COMPONENTINFO( ::framework::Oxt_Handler )
COMPONENTINFO( ::framework::JobExecutor )
- COMPONENTINFO( ::framework::DispatchRecorderSupplier )
- COMPONENTINFO( ::framework::DispatchRecorder )
- COMPONENTINFO( ::framework::MailToDispatcher )
- COMPONENTINFO( ::framework::ServiceHandler )
+ //COMPONENTINFO( ::framework::DispatchRecorderSupplier )
+ //COMPONENTINFO( ::framework::DispatchRecorder )
+ //COMPONENTINFO( ::framework::MailToDispatcher )
+ //COMPONENTINFO( ::framework::ServiceHandler )
COMPONENTINFO( ::framework::JobDispatch )
COMPONENTINFO( ::framework::BackingComp )
- COMPONENTINFO( ::framework::DispatchHelper )
+ //COMPONENTINFO( ::framework::DispatchHelper )
COMPONENTINFO( ::framework::LayoutManager )
- COMPONENTINFO( ::framework::License )
+ //COMPONENTINFO( ::framework::License )
COMPONENTINFO( ::framework::UIElementFactoryManager )
COMPONENTINFO( ::framework::PopupMenuControllerFactory )
- COMPONENTINFO( ::framework::FontMenuController )
- COMPONENTINFO( ::framework::FontSizeMenuController )
+ //COMPONENTINFO( ::framework::FontMenuController )
+ //COMPONENTINFO( ::framework::FontSizeMenuController )
COMPONENTINFO( ::framework::ObjectMenuController )
- COMPONENTINFO( ::framework::HeaderMenuController )
- COMPONENTINFO( ::framework::FooterMenuController )
+ //COMPONENTINFO( ::framework::HeaderMenuController )
+ //COMPONENTINFO( ::framework::FooterMenuController )
COMPONENTINFO( ::framework::ControlMenuController )
- COMPONENTINFO( ::framework::MacrosMenuController )
+ //COMPONENTINFO( ::framework::MacrosMenuController )
COMPONENTINFO( ::framework::UICommandDescription )
COMPONENTINFO( ::framework::ModuleManager )
COMPONENTINFO( ::framework::UIConfigurationManager )
@@ -155,7 +156,7 @@ COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::URLTransformer
COMPONENTINFO( ::framework::AddonsToolBoxFactory )
COMPONENTINFO( ::framework::WindowStateConfiguration )
COMPONENTINFO( ::framework::ToolbarControllerFactory )
- COMPONENTINFO( ::framework::ToolbarsMenuController )
+ //COMPONENTINFO( ::framework::ToolbarsMenuController )
COMPONENTINFO( ::framework::AutoRecovery )
COMPONENTINFO( ::framework::StatusIndicatorFactory )
COMPONENTINFO( ::framework::RecentFilesMenuController )
@@ -163,43 +164,45 @@ COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::URLTransformer
COMPONENTINFO( ::framework::UICategoryDescription )
COMPONENTINFO( ::framework::StatusbarControllerFactory )
COMPONENTINFO( ::framework::SessionListener )
- COMPONENTINFO( ::framework::LogoImageStatusbarController )
- COMPONENTINFO( ::framework::LogoTextStatusbarController )
- COMPONENTINFO( ::framework::NewMenuController )
+ //COMPONENTINFO( ::framework::LogoImageStatusbarController )
+ //COMPONENTINFO( ::framework::LogoTextStatusbarController )
+ //COMPONENTINFO( ::framework::NewMenuController )
COMPONENTINFO( ::framework::TaskCreatorService )
- COMPONENTINFO( ::framework::SimpleTextStatusbarController )
- COMPONENTINFO( ::framework::UriAbbreviation )
- COMPONENTINFO( ::framework::PopupMenuDispatcher )
+ //COMPONENTINFO( ::framework::SimpleTextStatusbarController )
+ //COMPONENTINFO( ::framework::UriAbbreviation )
+ //COMPONENTINFO( ::framework::PopupMenuDispatcher )
COMPONENTINFO( ::framework::ImageManager )
COMPONENTINFO( ::framework::LangSelectionStatusbarController )
- COMPONENTINFO( ::framework::LanguageSelectionMenuController )
- COMPONENTINFO( ::framework::TabWindowService )
+ //COMPONENTINFO( ::framework::LanguageSelectionMenuController )
+ //COMPONENTINFO( ::framework::TabWindowService )
COMPONENTINFO( ::framework::WindowContentFactoryManager )
+ COMPONENTINFO( ::framework::SubstitutePathVariables )
+ COMPONENTINFO( ::framework::PathSettings )
)
COMPONENTGETFACTORY ( IFFACTORY( ::framework::URLTransformer ) else
IFFACTORY( ::framework::Desktop ) else
IFFACTORY( ::framework::Frame ) else
- IFFACTORY( ::framework::Oxt_Handler ) else
+ //IFFACTORY( ::framework::Oxt_Handler ) else
IFFACTORY( ::framework::JobExecutor ) else
- IFFACTORY( ::framework::DispatchRecorderSupplier ) else
- IFFACTORY( ::framework::DispatchRecorder ) else
- IFFACTORY( ::framework::MailToDispatcher ) else
- IFFACTORY( ::framework::ServiceHandler ) else
+ //IFFACTORY( ::framework::DispatchRecorderSupplier ) else
+ //IFFACTORY( ::framework::DispatchRecorder ) else
+ //IFFACTORY( ::framework::MailToDispatcher ) else
+ //IFFACTORY( ::framework::ServiceHandler ) else
IFFACTORY( ::framework::JobDispatch ) else
IFFACTORY( ::framework::BackingComp ) else
- IFFACTORY( ::framework::DispatchHelper ) else
+ //IFFACTORY( ::framework::DispatchHelper ) else
IFFACTORY( ::framework::LayoutManager ) else
- IFFACTORY( ::framework::License ) else
+ //IFFACTORY( ::framework::License ) else
IFFACTORY( ::framework::UIElementFactoryManager ) else
IFFACTORY( ::framework::PopupMenuControllerFactory ) else
- IFFACTORY( ::framework::FontMenuController ) else
- IFFACTORY( ::framework::FontSizeMenuController ) else
+ //IFFACTORY( ::framework::FontMenuController ) else
+ //IFFACTORY( ::framework::FontSizeMenuController ) else
IFFACTORY( ::framework::ObjectMenuController ) else
- IFFACTORY( ::framework::HeaderMenuController ) else
- IFFACTORY( ::framework::FooterMenuController ) else
+ //IFFACTORY( ::framework::HeaderMenuController ) else
+ //IFFACTORY( ::framework::FooterMenuController ) else
IFFACTORY( ::framework::ControlMenuController ) else
- IFFACTORY( ::framework::MacrosMenuController ) else
+ //IFFACTORY( ::framework::MacrosMenuController ) else
IFFACTORY( ::framework::UICommandDescription ) else
IFFACTORY( ::framework::ModuleManager ) else
IFFACTORY( ::framework::UIConfigurationManager ) else
@@ -213,7 +216,7 @@ COMPONENTGETFACTORY ( IFFACTORY( ::framework::URLTransformer ) else
IFFACTORY( ::framework::AddonsToolBoxFactory ) else
IFFACTORY( ::framework::WindowStateConfiguration ) else
IFFACTORY( ::framework::ToolbarControllerFactory ) else
- IFFACTORY( ::framework::ToolbarsMenuController ) else
+ //IFFACTORY( ::framework::ToolbarsMenuController ) else
IFFACTORY( ::framework::AutoRecovery ) else
IFFACTORY( ::framework::StatusIndicatorFactory ) else
IFFACTORY( ::framework::RecentFilesMenuController ) else
@@ -222,18 +225,19 @@ COMPONENTGETFACTORY ( IFFACTORY( ::framework::URLTransformer ) else
IFFACTORY( ::framework::SessionListener ) else
IFFACTORY( ::framework::StatusbarControllerFactory ) else
IFFACTORY( ::framework::SessionListener ) else
- IFFACTORY( ::framework::LogoImageStatusbarController ) else
- IFFACTORY( ::framework::LogoTextStatusbarController ) else
+ //IFFACTORY( ::framework::LogoImageStatusbarController ) else
+ //IFFACTORY( ::framework::LogoTextStatusbarController ) else
IFFACTORY( ::framework::TaskCreatorService ) else
- IFFACTORY( ::framework::NewMenuController ) else
- IFFACTORY( ::framework::SimpleTextStatusbarController ) else
- IFFACTORY( ::framework::UriAbbreviation ) else
- IFFACTORY( ::framework::PopupMenuDispatcher ) else
+ //IFFACTORY( ::framework::NewMenuController ) else
+ //IFFACTORY( ::framework::SimpleTextStatusbarController ) else
+ //IFFACTORY( ::framework::UriAbbreviation ) else
+ //IFFACTORY( ::framework::PopupMenuDispatcher ) else
IFFACTORY( ::framework::ImageManager ) else
- IFFACTORY( ::framework::PopupMenuDispatcher ) else
IFFACTORY( ::framework::LangSelectionStatusbarController ) else
- IFFACTORY( ::framework::LanguageSelectionMenuController ) else
+ //IFFACTORY( ::framework::LanguageSelectionMenuController ) else
IFFACTORY( ::framework::WindowContentFactoryManager ) else
- IFFACTORY( ::framework::TabWindowService )
+ //IFFACTORY( ::framework::TabWindowService ) else
+ IFFACTORY( ::framework::SubstitutePathVariables ) else
+ IFFACTORY( ::framework::PathSettings )
)
diff --git a/framework/source/register/registertemp.cxx b/framework/source/register/registertemp.cxx
index d008176f81..2297346ae5 100644
--- a/framework/source/register/registertemp.cxx
+++ b/framework/source/register/registertemp.cxx
@@ -60,17 +60,74 @@
)
=================================================================================================================*/
#include <services/mediatypedetectionhelper.hxx>
-#include <services/substitutepathvars.hxx>
-#include <services/pathsettings.hxx>
+#include <dispatch/mailtodispatcher.hxx>
+#include <dispatch/oxt_handler.hxx>
+#include <dispatch/popupmenudispatcher.hxx>
+#include <dispatch/servicehandler.hxx>
+#include <services/dispatchhelper.hxx>
+#include <recording/dispatchrecorder.hxx>
+#include <recording/dispatchrecordersupplier.hxx>
+#include <services/license.hxx>
+#include <services/uriabbreviation.hxx>
+#include <uielement/simpletextstatusbarcontroller.hxx>
+#include <uielement/logoimagestatusbarcontroller.hxx>
+#include <uielement/logotextstatusbarcontroller.hxx>
+#include <services/tabwindowservice.hxx>
+#include <uielement/fontmenucontroller.hxx>
+#include <uielement/fontsizemenucontroller.hxx>
+#include <uielement/footermenucontroller.hxx>
+#include <uielement/headermenucontroller.hxx>
+#include <uielement/langselectionmenucontroller.hxx>
+#include <uielement/macrosmenucontroller.hxx>
+#include <uielement/newmenucontroller.hxx>
+#include <uielement/toolbarsmenucontroller.hxx>
COMPONENTGETIMPLEMENTATIONENVIRONMENT
COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::MediaTypeDetectionHelper )
- COMPONENTINFO( ::framework::SubstitutePathVariables )
- COMPONENTINFO( ::framework::PathSettings )
+ COMPONENTINFO( ::framework::MailToDispatcher )
+ COMPONENTINFO( ::framework::NewMenuController )
+ COMPONENTINFO( ::framework::ToolbarsMenuController )
+ COMPONENTINFO( ::framework::MacrosMenuController )
+ COMPONENTINFO( ::framework::FontSizeMenuController )
+ COMPONENTINFO( ::framework::HeaderMenuController )
+ COMPONENTINFO( ::framework::FooterMenuController )
+ COMPONENTINFO( ::framework::FontMenuController )
+ COMPONENTINFO( ::framework::ServiceHandler )
+ COMPONENTINFO( ::framework::LogoImageStatusbarController )
+ COMPONENTINFO( ::framework::LogoTextStatusbarController )
+ COMPONENTINFO( ::framework::SimpleTextStatusbarController )
+ COMPONENTINFO( ::framework::UriAbbreviation )
+ COMPONENTINFO( ::framework::LanguageSelectionMenuController )
+ COMPONENTINFO( ::framework::PopupMenuDispatcher )
+ COMPONENTINFO( ::framework::DispatchHelper )
+ COMPONENTINFO( ::framework::TabWindowService )
+ COMPONENTINFO( ::framework::DispatchRecorder )
+ COMPONENTINFO( ::framework::DispatchRecorderSupplier )
+ COMPONENTINFO( ::framework::Oxt_Handler )
+ COMPONENTINFO( ::framework::License )
)
-COMPONENTGETFACTORY ( IFFACTORY( ::framework::MediaTypeDetectionHelper ) else
- IFFACTORY( ::framework::SubstitutePathVariables ) else
- IFFACTORY( ::framework::PathSettings )
+COMPONENTGETFACTORY ( IFFACTORY( ::framework::MediaTypeDetectionHelper )
+ IFFACTORY( ::framework::MailToDispatcher ) else
+ IFFACTORY( ::framework::ServiceHandler ) else
+ IFFACTORY( ::framework::LogoTextStatusbarController ) else
+ IFFACTORY( ::framework::LogoImageStatusbarController ) else
+ IFFACTORY( ::framework::License ) else
+ IFFACTORY( ::framework::PopupMenuDispatcher ) else
+ IFFACTORY( ::framework::DispatchHelper ) else
+ IFFACTORY( ::framework::TabWindowService ) else
+ IFFACTORY( ::framework::DispatchRecorder ) else
+ IFFACTORY( ::framework::DispatchRecorderSupplier ) else
+ IFFACTORY( ::framework::SimpleTextStatusbarController ) else
+ IFFACTORY( ::framework::ToolbarsMenuController ) else
+ IFFACTORY( ::framework::FontMenuController ) else
+ IFFACTORY( ::framework::MacrosMenuController ) else
+ IFFACTORY( ::framework::NewMenuController ) else
+ IFFACTORY( ::framework::FontSizeMenuController ) else
+ IFFACTORY( ::framework::UriAbbreviation ) else
+ IFFACTORY( ::framework::FooterMenuController ) else
+ IFFACTORY( ::framework::HeaderMenuController ) else
+ IFFACTORY( ::framework::LanguageSelectionMenuController ) else
+ IFFACTORY( ::framework::Oxt_Handler )
)
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index f6841a7e0f..ca7b94f2c5 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3180,15 +3180,13 @@ void SAL_CALL AutoRecovery::getFastPropertyValue(css::uno::Any& aValue ,
{
case AUTORECOVERY_PROPHANDLE_EXISTS_RECOVERYDATA :
{
- css::uno::Any aSessionVal = ::comphelper::ConfigurationHelper::readDirectKey(
+ sal_Bool bSessionData = sal_False;
+ ::comphelper::ConfigurationHelper::readDirectKey(
m_xSMGR,
CFG_PACKAGE_RECOVERY,
CFG_PATH_RECOVERYINFO,
CFG_ENTRY_SESSIONDATA,
- ::comphelper::ConfigurationHelper::E_READONLY);
-
- sal_Bool bSessionData = sal_False;
- aSessionVal >>= bSessionData;
+ ::comphelper::ConfigurationHelper::E_READONLY) >>= bSessionData;
sal_Bool bRecoveryData = ((sal_Bool)(m_lDocCache.size()>0));
diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx
index 0917a0cd04..64ac51daff 100644
--- a/framework/source/services/backingwindow.cxx
+++ b/framework/source/services/backingwindow.cxx
@@ -34,6 +34,7 @@
#include "backingwindow.hxx"
#include "framework.hrc"
#include "classes/fwkresid.hxx"
+#include <services.h>
#include "vcl/metric.hxx"
#include "vcl/mnemonic.hxx"
@@ -206,9 +207,7 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
maToolbox.ShowItem( nItemId_Info );
// get dispatch provider
- mxDesktop = Reference<XDesktop>( comphelper::getProcessServiceFactory()->createInstance(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ),
- UNO_QUERY );
+ mxDesktop = Reference<XDesktop>( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_DESKTOP ),UNO_QUERY );
if( mxDesktop.is() )
mxDesktopDispatchProvider = Reference< XDispatchProvider >( mxDesktop, UNO_QUERY );
@@ -720,9 +719,7 @@ IMPL_LINK( BackingWindow, ToolboxHdl, void*, EMPTYARG )
{
try
{
- Reference<lang::XMultiServiceFactory> xConfig( comphelper::getProcessServiceFactory()->createInstance(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"))),
- UNO_QUERY);
+ Reference<lang::XMultiServiceFactory> xConfig( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY);
if( xConfig.is() )
{
Sequence<Any> args(1);
@@ -732,9 +729,7 @@ IMPL_LINK( BackingWindow, ToolboxHdl, void*, EMPTYARG )
Any(rtl::OUString::createFromAscii(pNodePath)),
PropertyState_DIRECT_VALUE);
args.getArray()[0] <<= val;
- Reference<container::XNameAccess> xNameAccess(
- xConfig->createInstanceWithArguments(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")),
- args), UNO_QUERY);
+ Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY);
if( xNameAccess.is() )
{
rtl::OUString sURL;
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index ebb9eb0829..679554eabc 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -82,6 +82,7 @@
#include <com/sun/star/frame/XNotifyingDispatch.hpp>
#include <com/sun/star/frame/DispatchResultState.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/document/MacroExecMode.hpp>
#include <com/sun/star/document/UpdateDocMode.hpp>
diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx
index 29b3ff5c87..0413cbfdbc 100644
--- a/framework/source/services/dispatchhelper.cxx
+++ b/framework/source/services/dispatchhelper.cxx
@@ -63,19 +63,6 @@ namespace framework{
//_______________________________________________
// XInterface, XTypeProvider, XServiceInfo
-DEFINE_XINTERFACE_4(DispatchHelper ,
- OWeakObject ,
- DIRECT_INTERFACE(css::lang::XTypeProvider ),
- DIRECT_INTERFACE(css::lang::XServiceInfo ),
- DIRECT_INTERFACE(css::frame::XDispatchHelper ),
- DIRECT_INTERFACE(css::frame::XDispatchResultListener))
-
-DEFINE_XTYPEPROVIDER_4(DispatchHelper ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- css::frame::XDispatchHelper ,
- css::frame::XDispatchResultListener)
-
DEFINE_XSERVICEINFO_MULTISERVICE(DispatchHelper ,
::cppu::OWeakObject ,
SERVICENAME_DISPATCHHELPER ,
@@ -91,7 +78,6 @@ DEFINE_INIT_SERVICE( DispatchHelper, {} )
*/
DispatchHelper::DispatchHelper( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR )
: ThreadHelpBase( )
- , OWeakObject ( )
// Init member
, m_xSMGR (xSMGR)
{
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 6b3231b2b9..f6e55c671c 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -62,6 +62,7 @@
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/task/XJobExecutor.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/util/XCloseable.hpp>
@@ -991,10 +992,9 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Frame::findFrame( const ::rtl
sal_Int32 nCount = xContainer->getCount();
for( sal_Int32 i=0; i<nCount; ++i )
{
- css::uno::Any aItem = xContainer->getByIndex(i);
css::uno::Reference< css::frame::XFrame > xSibling;
if (
- ( !(aItem>>=xSibling) ) || // control unpacking
+ ( !(xContainer->getByIndex(i)>>=xSibling) ) || // control unpacking
( ! xSibling.is() ) || // check for valid items
( xSibling==static_cast< ::cppu::OWeakObject* >(this) ) // ignore ourself! (We are a part of this container too - but search on our children was already done.)
)
@@ -2899,11 +2899,7 @@ void Frame::implts_setIconOnWindow()
{
try
{
- css::uno::Any aID = xSet->getPropertyValue( DECLARE_ASCII("IconId") );
- if( aID.hasValue() == sal_True )
- {
- aID >>= nIcon;
- }
+ xSet->getPropertyValue( DECLARE_ASCII("IconId") )>>= nIcon;
}
catch( css::beans::UnknownPropertyException& )
{
diff --git a/framework/source/services/license.cxx b/framework/source/services/license.cxx
index c71d1a1097..0627707de0 100644
--- a/framework/source/services/license.cxx
+++ b/framework/source/services/license.cxx
@@ -318,9 +318,9 @@ css::uno::Any SAL_CALL License::execute(const css::uno::Sequence< css::beans::Na
#endif
// check if we need to show the license at all
// open org.openoffice.Setup/Office/ooLicenseAcceptDate
- ::rtl::OUString sConfigSrvc = ::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider");
+ ::rtl::OUString sConfigSrvc = SERVICENAME_CFGPROVIDER;
::rtl::OUString sAccessSrvc = ::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess");
- ::rtl::OUString sReadSrvc = ::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess");
+ ::rtl::OUString sReadSrvc = SERVICENAME_CFGREADACCESS;
// get configuration provider
Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
@@ -332,11 +332,10 @@ css::uno::Any SAL_CALL License::execute(const css::uno::Sequence< css::beans::Na
theArgs[0] <<= v;
Reference< XPropertySet > pset = Reference< XPropertySet >(
theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW);
- Any result = pset->getPropertyValue(::rtl::OUString::createFromAscii("ooLicenseAcceptDate"));
// if we find a date there, compare it to baseinstall license date
::rtl::OUString aAcceptDate;
- if (result >>= aAcceptDate)
+ if (pset->getPropertyValue(::rtl::OUString::createFromAscii("ooLicenseAcceptDate")) >>= aAcceptDate)
{
// get LicenseFileDate from base install
::rtl::OUString aLicenseURL = aLicensePath;
diff --git a/framework/source/services/mediatypedetectionhelper.cxx b/framework/source/services/mediatypedetectionhelper.cxx
index 17016865d0..b5b7cfe062 100644
--- a/framework/source/services/mediatypedetectionhelper.cxx
+++ b/framework/source/services/mediatypedetectionhelper.cxx
@@ -38,6 +38,7 @@
#include <services.h>
#include <svtools/inettype.hxx>
#include <tools/string.hxx>
+#include <rtl/logfile.hxx>
//_________________________________________________________________________________________________________________
// interface includes
@@ -72,23 +73,6 @@ MediaTypeDetectionHelper::~MediaTypeDetectionHelper()
{
}
-//*****************************************************************************************************************
-// XInterface, XTypeProvider, XServiceInfo
-//*****************************************************************************************************************
-
-DEFINE_XINTERFACE_3 ( MediaTypeDetectionHelper
- , OWeakObject
- , DIRECT_INTERFACE( lang::XTypeProvider )
- , DIRECT_INTERFACE( lang::XServiceInfo )
- , DIRECT_INTERFACE( util::XStringMapping )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( MediaTypeDetectionHelper
- , lang::XTypeProvider
- , lang::XServiceInfo
- , util::XStringMapping
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( MediaTypeDetectionHelper
, ::cppu::OWeakObject
, SERVICENAME_MEDIATYPEDETECTIONHELPER
diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx
index 1ad7cfb47e..2bb57c30ad 100644
--- a/framework/source/services/modulemanager.cxx
+++ b/framework/source/services/modulemanager.cxx
@@ -53,6 +53,7 @@
//_______________________________________________
// other includes
+#include <rtl/logfile.hxx>
namespace framework
{
@@ -194,7 +195,7 @@ void SAL_CALL ModuleManager::replaceByName(const ::rtl::OUString& sName ,
css::uno::RuntimeException )
{
::comphelper::SequenceAsHashMap lProps(aValue);
- if (lProps.size() < 1)
+ if (lProps.empty() )
{
throw css::lang::IllegalArgumentException(
::rtl::OUString::createFromAscii("No properties given to replace part of module."),
@@ -254,10 +255,8 @@ css::uno::Any SAL_CALL ModuleManager::getByName(const ::rtl::OUString& sName)
{
// get access to the element
css::uno::Reference< css::container::XNameAccess > xCFG = implts_getConfig();
- css::uno::Any aElement = xCFG->getByName(sName);
-
css::uno::Reference< css::container::XNameAccess > xModule;
- aElement >>= xModule;
+ xCFG->getByName(sName) >>= xModule;
if (!xModule.is())
{
throw css::uno::RuntimeException(
diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx
index 0f19580d16..8871fea734 100644
--- a/framework/source/services/pathsettings.cxx
+++ b/framework/source/services/pathsettings.cxx
@@ -157,6 +157,7 @@ PathSettings::PathSettings( const css::uno::Reference< css::lang::XMultiServiceF
, m_pPropHelp(0 )
, m_bIgnoreEvents(sal_False)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "PathSettings::PathSettings" );
}
//-----------------------------------------------------------------------------
@@ -170,6 +171,7 @@ PathSettings::~PathSettings()
void SAL_CALL PathSettings::changesOccurred(const css::util::ChangesEvent& aEvent)
throw (css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "PathSettings::changesOccurred" );
/*
if (m_bIgnoreEvents)
return;
@@ -206,6 +208,7 @@ void SAL_CALL PathSettings::changesOccurred(const css::util::ChangesEvent& aEven
void SAL_CALL PathSettings::disposing(const css::lang::EventObject& aSource)
throw(css::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "PathSettings::disposing" );
// SAFE ->
WriteGuard aWriteLock(m_aLock);
@@ -219,6 +222,7 @@ void SAL_CALL PathSettings::disposing(const css::lang::EventObject& aSource)
//-----------------------------------------------------------------------------
void PathSettings::impl_readAll()
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "PathSettings::impl_readAll" );
RTL_LOGFILE_CONTEXT(aLog, "framework (as96863) ::PathSettings::load config (all)");
// TODO think about me
@@ -241,6 +245,7 @@ void PathSettings::impl_readAll()
// NO substitution here ! It's done outside ...
OUStringList PathSettings::impl_readOldFormat(const ::rtl::OUString& sPath)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "PathSettings::impl_readOldFormat" );
css::uno::Reference< css::container::XNameAccess > xCfg = fa_getCfgOld();
css::uno::Any aVal = xCfg->getByName(sPath);
@@ -308,6 +313,7 @@ PathSettings::PathInfo PathSettings::impl_readNewFormat(const ::rtl::OUString& s
//-----------------------------------------------------------------------------
void PathSettings::impl_storePath(const PathSettings::PathInfo& aPath)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "PathSettings::impl_storePath" );
m_bIgnoreEvents = sal_True;
css::uno::Reference< css::container::XNameAccess > xCfgNew = fa_getCfgNew();
@@ -356,6 +362,7 @@ void PathSettings::impl_storePath(const PathSettings::PathInfo& aPath)
void PathSettings::impl_mergeOldUserPaths( PathSettings::PathInfo& rPath,
const OUStringList& lOld )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "PathSettings::impl_mergeOldUserPaths" );
OUStringList::const_iterator pIt;
for ( pIt = lOld.begin();
pIt != lOld.end() ;
@@ -654,6 +661,7 @@ void PathSettings::impl_subst(PathSettings::PathInfo& aPath ,
{
OUStringList::const_iterator pIt;
OUStringList lTemp;
+ lTemp.reserve(rPath.lInternalPaths.size() + rPath.lUserPaths.size() + 1);
for ( pIt = rPath.lInternalPaths.begin();
pIt != rPath.lInternalPaths.end() ;
@@ -857,7 +865,7 @@ void PathSettings::impl_setPathValue( sal_Int32 nID ,
if (aChangePath.bIsSinglePath)
{
LOG_ASSERT2(lList.size()>1, "PathSettings::impl_setPathValue()", "You try to set more then path value for a defined SINGLE_PATH!")
- if (lList.size()>0)
+ if ( !lList.empty() )
aChangePath.sWritePath = *(lList.begin());
else
aChangePath.sWritePath = ::rtl::OUString();
diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx
index 66bb9710d1..ee766efeee 100644
--- a/framework/source/services/substitutepathvars.cxx
+++ b/framework/source/services/substitutepathvars.cxx
@@ -295,7 +295,7 @@ void SubstitutePathVariables_Impl::GetSharePointsRules( SubstituteVariables& aSu
SubstituteRuleVector aRuleSet;
ReadSharePointRuleSetFromConfiguration( aSharePointNames[ nSharePoints ], aSharePointNodeName, aRuleSet );
- if ( aRuleSet.size() > 0 )
+ if ( !aRuleSet.empty() )
{
// We have at minimum one rule. Filter the correct rule out of the rule set
// and put into our SubstituteVariable map
@@ -409,10 +409,11 @@ sal_Bool SubstitutePathVariables_Impl::FilterRuleSet( const SubstituteRuleVector
{
sal_Bool bResult = sal_False;
- if ( aRuleSet.size() >= 1 )
+ if ( !aRuleSet.empty() )
{
sal_Int16 nPrioCurrentRule = aEnvPrioTable[ ET_UNKNOWN ];
- for ( sal_Int32 nIndex = 0; nIndex < (sal_Int32)aRuleSet.size(); nIndex++ )
+ const sal_uInt32 nCount = aRuleSet.size();
+ for ( sal_uInt32 nIndex = 0; nIndex < nCount; nIndex++ )
{
const SubstituteRule& aRule = aRuleSet[nIndex];
EnvironmentType eEnvType = aRule.aEnvType;
@@ -587,19 +588,6 @@ void SubstitutePathVariables_Impl::ReadSharePointRuleSetFromConfiguration(
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( SubstitutePathVariables ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XServiceInfo ),
- DIRECT_INTERFACE( css::util::XStringSubstitution )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( SubstitutePathVariables ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- css::util::XStringSubstitution
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( SubstitutePathVariables ,
::cppu::OWeakObject ,
SERVICENAME_SUBSTITUTEPATHVARIABLES ,
@@ -616,6 +604,7 @@ SubstitutePathVariables::SubstitutePathVariables( const Reference< XMultiService
m_aImpl( LINK( this, SubstitutePathVariables, implts_ConfigurationNotify )),
m_xServiceManager( xServiceManager )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::SubstitutePathVariables" );
int i;
SetPredefinedPathVariables( m_aPreDefVars );
@@ -674,6 +663,7 @@ SubstitutePathVariables::~SubstitutePathVariables()
rtl::OUString SAL_CALL SubstitutePathVariables::substituteVariables( const ::rtl::OUString& aText, sal_Bool bSubstRequired )
throw ( NoSuchElementException, RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::substituteVariables" );
ResetableGuard aLock( m_aLock );
return impl_substituteVariable( aText, bSubstRequired );
}
@@ -681,6 +671,7 @@ throw ( NoSuchElementException, RuntimeException )
rtl::OUString SAL_CALL SubstitutePathVariables::reSubstituteVariables( const ::rtl::OUString& aText )
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::reSubstituteVariables" );
ResetableGuard aLock( m_aLock );
return impl_reSubstituteVariables( aText );
}
@@ -688,6 +679,7 @@ throw ( RuntimeException )
rtl::OUString SAL_CALL SubstitutePathVariables::getSubstituteVariableValue( const ::rtl::OUString& aVariable )
throw ( NoSuchElementException, RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::getSubstituteVariableValue" );
ResetableGuard aLock( m_aLock );
return impl_getSubstituteVariableValue( aVariable );
}
@@ -707,6 +699,7 @@ IMPL_LINK( SubstitutePathVariables, implts_ConfigurationNotify, SubstitutePathNo
rtl::OUString SubstitutePathVariables::ConvertOSLtoUCBURL( const rtl::OUString& aOSLCompliantURL ) const
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::ConvertOSLtoUCBURL" );
String aResult;
rtl::OUString aTemp;
@@ -722,28 +715,28 @@ rtl::OUString SubstitutePathVariables::ConvertOSLtoUCBURL( const rtl::OUString&
rtl::OUString SubstitutePathVariables::GetWorkPath() const
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::GetWorkPath" );
rtl::OUString aWorkPath;
- css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(
+ ::comphelper::ConfigurationHelper::readDirectKey(
m_xServiceManager,
::rtl::OUString::createFromAscii("org.openoffice.Office.Paths"),
::rtl::OUString::createFromAscii("Paths/Work"),
::rtl::OUString::createFromAscii("WritePath"),
- ::comphelper::ConfigurationHelper::E_READONLY);
- aVal >>= aWorkPath;
+ ::comphelper::ConfigurationHelper::E_READONLY) >>= aWorkPath;
return aWorkPath;
}
rtl::OUString SubstitutePathVariables::GetWorkVariableValue() const
{
- css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::GetWorkVariableValue" );
+ ::rtl::OUString aWorkPath;
+ ::comphelper::ConfigurationHelper::readDirectKey(
m_xServiceManager,
::rtl::OUString::createFromAscii("org.openoffice.Office.Paths"),
::rtl::OUString::createFromAscii("Variables"),
::rtl::OUString::createFromAscii("Work"),
- ::comphelper::ConfigurationHelper::E_READONLY);
- ::rtl::OUString aWorkPath;
- aVal >>= aWorkPath;
-
+ ::comphelper::ConfigurationHelper::E_READONLY) >>= aWorkPath;
+
// fallback to $HOME in case platform dependend config layer does not return
// an usuable work dir value.
if (aWorkPath.getLength() < 1)
@@ -756,6 +749,7 @@ rtl::OUString SubstitutePathVariables::GetWorkVariableValue() const
rtl::OUString SubstitutePathVariables::GetHomeVariableValue() const
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::GetHomeVariableValue" );
osl::Security aSecurity;
rtl::OUString aHomePath;
@@ -765,6 +759,7 @@ rtl::OUString SubstitutePathVariables::GetHomeVariableValue() const
rtl::OUString SubstitutePathVariables::GetPathVariableValue() const
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::GetPathVariableValue" );
const int PATH_EXTEND_FACTOR = 120;
rtl::OUString aRetStr;
@@ -801,6 +796,7 @@ rtl::OUString SubstitutePathVariables::GetPathVariableValue() const
rtl::OUString SubstitutePathVariables::impl_substituteVariable( const ::rtl::OUString& rText, sal_Bool bSubstRequired )
throw ( NoSuchElementException, RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::impl_substituteVariable" );
// This is maximal recursive depth supported!
const sal_Int32 nMaxRecursiveDepth = 8;
@@ -928,7 +924,8 @@ throw ( NoSuchElementException, RuntimeException )
else
{
// Check for recursion
- for ( sal_Int32 i=0; i < (sal_Int32)aEndlessRecursiveDetector.size(); i++ )
+ const sal_uInt32 nCount = aEndlessRecursiveDetector.size();
+ for ( sal_uInt32 i=0; i < nCount; i++ )
{
if ( aEndlessRecursiveDetector[i] == aWorkText )
{
@@ -992,6 +989,7 @@ throw ( NoSuchElementException, RuntimeException )
rtl::OUString SubstitutePathVariables::impl_reSubstituteVariables( const ::rtl::OUString& rURL )
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::impl_reSubstituteVariables" );
rtl::OUString aURL;
INetURLObject aUrl( rURL );
@@ -1096,6 +1094,7 @@ throw ( RuntimeException )
::rtl::OUString SubstitutePathVariables::impl_getSubstituteVariableValue( const ::rtl::OUString& rVariable )
throw ( NoSuchElementException, RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::impl_getSubstituteVariableValue" );
rtl::OUString aVariable;
sal_Int32 nPos = rVariable.indexOf( m_aVarStart );
@@ -1148,6 +1147,7 @@ throw ( NoSuchElementException, RuntimeException )
void SubstitutePathVariables::SetPredefinedPathVariables( PredefinedPathVariables& aPreDefPathVariables )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "SubstitutePathVariables::SetPredefinedPathVariables" );
Any aAny;
::rtl::OUString aOfficePath;
::rtl::OUString aUserPath;
@@ -1204,9 +1204,8 @@ void SubstitutePathVariables::SetPredefinedPathVariables( PredefinedPathVariable
// Detect the language type of the current office
aPreDefPathVariables.m_eLanguageType = LANGUAGE_ENGLISH_US;
- Any aLocale = utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty( utl::ConfigManager::LOCALE );
rtl::OUString aLocaleStr;
- if ( aLocale >>= aLocaleStr )
+ if ( utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty( utl::ConfigManager::LOCALE ) >>= aLocaleStr )
aPreDefPathVariables.m_eLanguageType = MsLangId::convertIsoStringToLanguage( aLocaleStr );
else
{
diff --git a/framework/source/services/uriabbreviation.cxx b/framework/source/services/uriabbreviation.cxx
index ad8177f5eb..c7655f5cc5 100644
--- a/framework/source/services/uriabbreviation.cxx
+++ b/framework/source/services/uriabbreviation.cxx
@@ -55,19 +55,6 @@ namespace css = ::com::sun::star;
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( UriAbbreviation ,
- cppu::OWeakObject ,
- DIRECT_INTERFACE(css::lang::XTypeProvider ),
- DIRECT_INTERFACE(css::lang::XServiceInfo ),
- DIRECT_INTERFACE(css::util::XStringAbbreviation )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( UriAbbreviation ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- css::util::XStringAbbreviation
- )
-
DEFINE_XSERVICEINFO_MULTISERVICE_2 ( UriAbbreviation ,
::cppu::OWeakObject ,
SERVICENAME_STRINGABBREVIATION ,
diff --git a/framework/source/services/urltransformer.cxx b/framework/source/services/urltransformer.cxx
index 6d8000694d..f04827592e 100644
--- a/framework/source/services/urltransformer.cxx
+++ b/framework/source/services/urltransformer.cxx
@@ -77,21 +77,11 @@ using namespace ::com::sun::star::util ;
//*****************************************************************************************************************
// constructor
//*****************************************************************************************************************
-URLTransformer::URLTransformer( const Reference< XMultiServiceFactory >& xFactory )
- // Init baseclasses first
- // Attention:
- // Don't change order of initialization!
- // ThreadHelpBase is a struct with a mutex as member. We can't use a mutex as member, while
- // we must garant right initialization and a valid value of this! First initialize
- // baseclasses and then members. And we need the mutex for other baseclasses !!!
- : ThreadHelpBase ( &Application::GetSolarMutex() )
- , OWeakObject ( )
- // Init member
- , m_xFactory ( xFactory )
+URLTransformer::URLTransformer( const Reference< XMultiServiceFactory >& /*xFactory*/ )
{
// Safe impossible cases.
// Method not defined for all incoming parameter.
- LOG_ASSERT( xFactory.is(), "URLTransformer::URLTransformer()\nInvalid parameter detected!\n" )
+ //LOG_ASSERT( xFactory.is(), "URLTransformer::URLTransformer()\nInvalid parameter detected!\n" )
}
//*****************************************************************************************************************
@@ -105,19 +95,6 @@ URLTransformer::~URLTransformer()
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( URLTransformer ,
- OWeakObject ,
- DIRECT_INTERFACE(XTypeProvider ),
- DIRECT_INTERFACE(XServiceInfo ),
- DIRECT_INTERFACE(XURLTransformer )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( URLTransformer ,
- XTypeProvider ,
- XServiceInfo ,
- XURLTransformer
- )
-
DEFINE_XSERVICEINFO_MULTISERVICE ( URLTransformer ,
OWeakObject ,
SERVICENAME_URLTRANSFORMER ,
@@ -129,21 +106,68 @@ DEFINE_INIT_SERVICE ( URLTransformer,
}
)
+namespace
+{
+ void lcl_ParserHelper(INetURLObject& _rParser,URL& _rURL,bool _bUseIntern)
+ {
+ // Get all information about this URL.
+ _rURL.Protocol = INetURLObject::GetScheme( _rParser.GetProtocol() );
+ _rURL.User = _rParser.GetUser ( INetURLObject::DECODE_WITH_CHARSET );
+ _rURL.Password = _rParser.GetPass ( INetURLObject::DECODE_WITH_CHARSET );
+ _rURL.Server = _rParser.GetHost ( INetURLObject::DECODE_WITH_CHARSET );
+ _rURL.Port = (sal_Int16)_rParser.GetPort();
+
+ sal_Int32 nCount = _rParser.getSegmentCount( false );
+ if ( nCount > 0 )
+ {
+ // Don't add last segment as it is the name!
+ --nCount;
+
+ rtl::OUStringBuffer aPath;
+ for ( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ aPath.append( sal_Unicode( '/' ));
+ aPath.append( _rParser.getName( nIndex, false, INetURLObject::NO_DECODE ));
+ }
+
+ if ( nCount > 0 )
+ aPath.append( sal_Unicode( '/' )); // final slash!
+
+ _rURL.Path = aPath.makeStringAndClear();
+ _rURL.Name = _rParser.getName( INetURLObject::LAST_SEGMENT, false, INetURLObject::NO_DECODE );
+ }
+ else
+ {
+ _rURL.Path = _rParser.GetURLPath( INetURLObject::NO_DECODE );
+ _rURL.Name = _rParser.GetName ( );
+ }
+
+ _rURL.Arguments = _rParser.GetParam ( INetURLObject::NO_DECODE );
+ _rURL.Mark = _rParser.GetMark ( INetURLObject::DECODE_WITH_CHARSET );
+
+ // INetURLObject supports only an intelligent method of parsing URL's. So write
+ // back Complete to have a valid encoded URL in all cases!
+ _rURL.Complete = _rParser.GetMainURL( INetURLObject::NO_DECODE );
+ if ( _bUseIntern )
+ _rURL.Complete = _rURL.Complete.intern();
+
+ _rParser.SetMark ( ::rtl::OUString() );
+ _rParser.SetParam( ::rtl::OUString() );
+
+ _rURL.Main = _rParser.GetMainURL( INetURLObject::NO_DECODE );
+ }
+}
//*****************************************************************************************************************
// XURLTransformer
//*****************************************************************************************************************
sal_Bool SAL_CALL URLTransformer::parseStrict( URL& aURL ) throw( RuntimeException )
{
- // Ready for multithreading
- ResetableGuard aGuard( m_aLock );
-
// Safe impossible cases.
if (( &aURL == NULL ) ||
( aURL.Complete.getLength() < 1 ) )
{
return sal_False;
}
-
// Try to extract the protocol
sal_Int32 nURLIndex = aURL.Complete.indexOf( sal_Unicode( ':' ));
::rtl::OUString aProtocol;
@@ -165,50 +189,7 @@ sal_Bool SAL_CALL URLTransformer::parseStrict( URL& aURL ) throw( RuntimeExcepti
}
else if ( !aParser.HasError() )
{
- aURL.Protocol = INetURLObject::GetScheme( aParser.GetProtocol() );
- aURL.User = aParser.GetUser ( INetURLObject::DECODE_WITH_CHARSET );
- aURL.Password = aParser.GetPass ( INetURLObject::DECODE_WITH_CHARSET );
- aURL.Server = aParser.GetHost ( INetURLObject::DECODE_WITH_CHARSET );
- aURL.Port = (sal_Int16)aParser.GetPort();
-
- sal_Int32 nCount = aParser.getSegmentCount( false );
- if ( nCount > 0 )
- {
- // Don't add last segment as it is the name!
- --nCount;
-
- rtl::OUStringBuffer aPath;
- for ( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
- {
- aPath.append( sal_Unicode( '/' ));
- aPath.append( aParser.getName( nIndex, false, INetURLObject::NO_DECODE ));
- }
-
- if ( nCount > 0 )
- aPath.append( sal_Unicode( '/' )); // final slash!
-
- aURL.Path = aPath.makeStringAndClear();
- aURL.Name = aParser.getName( INetURLObject::LAST_SEGMENT, false, INetURLObject::NO_DECODE );
- }
- else
- {
- aURL.Path = aParser.GetURLPath( INetURLObject::NO_DECODE );
- aURL.Name = aParser.GetName ( );
- }
-
- aURL.Arguments = aParser.GetParam ( INetURLObject::NO_DECODE );
- aURL.Mark = aParser.GetMark ( INetURLObject::DECODE_WITH_CHARSET );
-
- // INetURLObject supports only an intelligent method of parsing URL's. So write
- // back Complete to have a valid encoded URL in all cases!
- aURL.Complete = aParser.GetMainURL( INetURLObject::NO_DECODE );
- aURL.Complete = aURL.Complete.intern();
-
- aParser.SetMark ( ::rtl::OUString() );
- aParser.SetParam( ::rtl::OUString() );
-
- aURL.Main = aParser.GetMainURL( INetURLObject::NO_DECODE );
-
+ lcl_ParserHelper(aParser,aURL,false);
// Return "URL is parsed".
return sal_True;
}
@@ -235,8 +216,6 @@ sal_Bool SAL_CALL URLTransformer::parseStrict( URL& aURL ) throw( RuntimeExcepti
sal_Bool SAL_CALL URLTransformer::parseSmart( URL& aURL ,
const ::rtl::OUString& sSmartProtocol ) throw( RuntimeException )
{
- // Ready for multithreading
- ResetableGuard aGuard( m_aLock );
// Safe impossible cases.
if (( &aURL == NULL ) ||
( aURL.Complete.getLength() < 1 ) )
@@ -251,48 +230,7 @@ sal_Bool SAL_CALL URLTransformer::parseSmart( URL& aURL ,
bool bOk = aParser.SetSmartURL( aURL.Complete );
if ( bOk )
{
- // Get all information about this URL.
- aURL.Protocol = INetURLObject::GetScheme( aParser.GetProtocol() );
- aURL.User = aParser.GetUser ( INetURLObject::DECODE_WITH_CHARSET );
- aURL.Password = aParser.GetPass ( INetURLObject::DECODE_WITH_CHARSET );
- aURL.Server = aParser.GetHost ( INetURLObject::DECODE_WITH_CHARSET );
- aURL.Port = (sal_Int16)aParser.GetPort();
-
- sal_Int32 nCount = aParser.getSegmentCount( false );
- if ( nCount > 0 )
- {
- // Don't add last segment as it is the name!
- --nCount;
-
- rtl::OUStringBuffer aPath;
- for ( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
- {
- aPath.append( sal_Unicode( '/' ));
- aPath.append( aParser.getName( nIndex, false, INetURLObject::NO_DECODE ));
- }
-
- if ( nCount > 0 )
- aPath.append( sal_Unicode( '/' )); // final slash!
-
- aURL.Path = aPath.makeStringAndClear();
- aURL.Name = aParser.getName( INetURLObject::LAST_SEGMENT, false, INetURLObject::NO_DECODE );
- }
- else
- {
- aURL.Path = aParser.GetURLPath( INetURLObject::NO_DECODE );
- aURL.Name = aParser.GetName ( );
- }
-
- aURL.Arguments = aParser.GetParam ( INetURLObject::NO_DECODE );
- aURL.Mark = aParser.GetMark ( INetURLObject::DECODE_WITH_CHARSET );
-
- aURL.Complete = aParser.GetMainURL( INetURLObject::NO_DECODE );
-
- aParser.SetMark ( ::rtl::OUString() );
- aParser.SetParam( ::rtl::OUString() );
-
- aURL.Main = aParser.GetMainURL( INetURLObject::NO_DECODE );
-
+ lcl_ParserHelper(aParser,aURL,true);
// Return "URL is parsed".
return sal_True;
}
@@ -333,9 +271,6 @@ sal_Bool SAL_CALL URLTransformer::parseSmart( URL& aURL ,
//*****************************************************************************************************************
sal_Bool SAL_CALL URLTransformer::assemble( URL& aURL ) throw( RuntimeException )
{
- // Ready for multithreading
- ResetableGuard aGuard( m_aLock );
-
// Safe impossible cases.
if ( &aURL == NULL )
return sal_False ;
@@ -400,9 +335,6 @@ sal_Bool SAL_CALL URLTransformer::assemble( URL& aURL ) throw( RuntimeException
::rtl::OUString SAL_CALL URLTransformer::getPresentation( const URL& aURL ,
sal_Bool bWithPassword ) throw( RuntimeException )
{
- // Ready for multithreading
- ResetableGuard aGuard( m_aLock );
-
// Safe impossible cases.
if (( &aURL == NULL ) ||
( aURL.Complete.getLength() < 1 ) ||
diff --git a/framework/source/tabwin/tabwindow.cxx b/framework/source/tabwin/tabwindow.cxx
index 5a3431bd49..72d7b4a1c5 100644
--- a/framework/source/tabwin/tabwindow.cxx
+++ b/framework/source/tabwin/tabwindow.cxx
@@ -45,7 +45,7 @@
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/WindowDescriptor.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
-
+#include <com/sun/star/lang/DisposedException.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
diff --git a/framework/source/tabwin/tabwinfactory.cxx b/framework/source/tabwin/tabwinfactory.cxx
index 6bf4eafd4b..bde6ef7524 100644
--- a/framework/source/tabwin/tabwinfactory.cxx
+++ b/framework/source/tabwin/tabwinfactory.cxx
@@ -70,19 +70,6 @@ namespace framework
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( TabWinFactory ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XServiceInfo ),
- DIRECT_INTERFACE( css::lang::XSingleComponentFactory )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( TabWinFactory ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- css::lang::XSingleComponentFactory
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( TabWinFactory ,
::cppu::OWeakObject ,
SERVICENAME_TABWINFACTORY ,
diff --git a/framework/source/threadhelp/transactionmanager.cxx b/framework/source/threadhelp/transactionmanager.cxx
index 3b1519fa22..17b06afa67 100644
--- a/framework/source/threadhelp/transactionmanager.cxx
+++ b/framework/source/threadhelp/transactionmanager.cxx
@@ -43,7 +43,7 @@
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
-
+#include <com/sun/star/lang/DisposedException.hpp>
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
diff --git a/framework/source/uiconfiguration/graphicnameaccess.cxx b/framework/source/uiconfiguration/graphicnameaccess.cxx
index aee1b9e0a9..658d18df01 100644
--- a/framework/source/uiconfiguration/graphicnameaccess.cxx
+++ b/framework/source/uiconfiguration/graphicnameaccess.cxx
@@ -103,7 +103,7 @@ throw(::com::sun::star::uno::RuntimeException)
sal_Bool SAL_CALL GraphicNameAccess::hasElements()
throw( uno::RuntimeException )
{
- return ( m_aNameToElementMap.size() > 0 );
+ return ( !m_aNameToElementMap.empty() );
}
uno::Type SAL_CALL GraphicNameAccess::getElementType()
diff --git a/framework/source/uiconfiguration/imagemanager.cxx b/framework/source/uiconfiguration/imagemanager.cxx
index 06af65cf52..18eb67dea3 100644
--- a/framework/source/uiconfiguration/imagemanager.cxx
+++ b/framework/source/uiconfiguration/imagemanager.cxx
@@ -35,6 +35,7 @@
#include <xml/imagesconfiguration.hxx>
#include <uiconfiguration/graphicnameaccess.hxx>
#include <services.h>
+#include "imagemanagerimpl.hxx"
#include "properties.h"
@@ -62,6 +63,7 @@
#include <unotools/ucbstreamhelper.hxx>
#include <vcl/pngread.hxx>
#include <vcl/pngwrite.hxx>
+#include <rtl/logfile.hxx>
//_________________________________________________________________________________________________________________
// namespaces
@@ -90,55 +92,14 @@ const sal_Int32 IMAGE_SIZE_LARGE = 26;
const sal_Int16 MAX_IMAGETYPE_VALUE = ::com::sun::star::ui::ImageType::COLOR_HIGHCONTRAST|
::com::sun::star::ui::ImageType::SIZE_LARGE;
-static const char IMAGE_FOLDER[] = "images";
-static const char BITMAPS_FOLDER[] = "Bitmaps";
-static const char IMAGE_EXTENSION[] = ".png";
-
-static const char* IMAGELIST_XML_FILE[] =
-{
- "sc_imagelist.xml",
- "lc_imagelist.xml",
- "sch_imagelist.xml",
- "lch_imagelist.xml"
-};
-
-static const char* BITMAP_FILE_NAMES[] =
-{
- "sc_userimages.png",
- "lc_userimages.png",
- "sch_userimages.png",
- "lch_userimages.png"
-};
-
namespace framework
{
-static char ModuleImageList[] = "private:resource/images/moduleimages";
-
typedef GraphicNameAccess CmdToXGraphicNameAccess;
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_6 ( ImageManager ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XComponent ),
- DIRECT_INTERFACE( css::lang::XInitialization ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XImageManager ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfiguration ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationPersistence )
- )
-
-DEFINE_XTYPEPROVIDER_6 ( ImageManager ,
- css::lang::XTypeProvider ,
- css::lang::XComponent ,
- css::lang::XInitialization ,
- ::com::sun::star::ui::XImageManager ,
- ::com::sun::star::ui::XUIConfiguration ,
- ::com::sun::star::ui::XUIConfigurationPersistence
- )
-
DEFINE_XSERVICEINFO_MULTISERVICE ( ImageManager ,
::cppu::OWeakObject ,
SERVICENAME_IMAGEMANAGER ,
@@ -147,471 +108,69 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( ImageManager ,
DEFINE_INIT_SERVICE ( ImageManager, {} )
-static sal_Bool implts_checkAndScaleGraphic( uno::Reference< XGraphic >& rOutGraphic, const uno::Reference< XGraphic >& rInGraphic, sal_Int16 nImageType )
-{
- static Size aNormSize( IMAGE_SIZE_NORMAL, IMAGE_SIZE_NORMAL );
- static Size aLargeSize( IMAGE_SIZE_LARGE, IMAGE_SIZE_LARGE );
-
- if ( !rInGraphic.is() )
- {
- rOutGraphic = Image().GetXGraphic();
- return sal_False;
- }
-
- // Check size and scale it
- Image aImage( rInGraphic );
- Size aSize = aImage.GetSizePixel();
- bool bMustScale( false );
-
- if (( nImageType == ImageType_Color_Large ) ||
- ( nImageType == ImageType_HC_Large ))
- bMustScale = ( aSize != aLargeSize );
- else
- bMustScale = ( aSize != aNormSize );
-
- if ( bMustScale )
- {
- BitmapEx aBitmap = aImage.GetBitmapEx();
- aBitmap.Scale( aNormSize );
- aImage = Image( aBitmap );
- rOutGraphic = aImage.GetXGraphic();
- }
- else
- rOutGraphic = rInGraphic;
- return sal_True;
-}
-
-static sal_Int16 implts_convertImageTypeToIndex( sal_Int16 nImageType )
-{
- sal_Int16 nIndex( 0 );
- if ( nImageType & ::com::sun::star::ui::ImageType::SIZE_LARGE )
- nIndex += 1;
- if ( nImageType & ::com::sun::star::ui::ImageType::COLOR_HIGHCONTRAST )
- nIndex += 2;
- return nIndex;
-}
-
-ImageList* ImageManager::implts_getUserImageList( ImageType nImageType )
-{
- ResetableGuard aGuard( m_aLock );
- if ( !m_pUserImageList[nImageType] )
- implts_loadUserImages( nImageType, m_xUserImageStorage, m_xUserBitmapsStorage );
-
- return m_pUserImageList[nImageType];
-}
-
-void ImageManager::implts_initialize()
-{
- // Initialize the top-level structures with the storage data
- if ( m_xUserConfigStorage.is() )
- {
- long nModes = m_bReadOnly ? ElementModes::READ : ElementModes::READWRITE;
-
- try
- {
- m_xUserImageStorage = m_xUserConfigStorage->openStorageElement( OUString::createFromAscii( IMAGE_FOLDER ),
- nModes );
- if ( m_xUserImageStorage.is() )
- {
- m_xUserBitmapsStorage = m_xUserImageStorage->openStorageElement( OUString::createFromAscii( BITMAPS_FOLDER ),
- nModes );
- }
- }
- catch ( com::sun::star::container::NoSuchElementException& )
- {
- }
- catch ( ::com::sun::star::embed::InvalidStorageException& )
- {
- }
- catch ( ::com::sun::star::lang::IllegalArgumentException& )
- {
- }
- catch ( ::com::sun::star::io::IOException& )
- {
- }
- catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
- {
- }
- }
-}
-
-sal_Bool ImageManager::implts_loadUserImages(
- ImageType nImageType,
- const uno::Reference< XStorage >& xUserImageStorage,
- const uno::Reference< XStorage >& xUserBitmapsStorage )
-{
- ResetableGuard aGuard( m_aLock );
-
- if ( xUserImageStorage.is() && xUserBitmapsStorage.is() )
- {
- try
- {
- uno::Reference< XStream > xStream = xUserImageStorage->openStreamElement( rtl::OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ),
- ElementModes::READ );
- uno::Reference< XInputStream > xInputStream = xStream->getInputStream();
-
- ImageListsDescriptor aUserImageListInfo;
- ImagesConfiguration::LoadImages( m_xServiceManager,
- xInputStream,
- aUserImageListInfo );
- if (( aUserImageListInfo.pImageList != 0 ) &&
- ( aUserImageListInfo.pImageList->Count() > 0 ))
- {
- ImageListItemDescriptor* pList = aUserImageListInfo.pImageList->GetObject(0);
- sal_Int32 nCount = pList->pImageItemList->Count();
-
- std::vector< OUString > aUserImagesVector;
- for ( USHORT i=0; i < nCount; i++ )
- {
- const ImageItemDescriptor* pItem = pList->pImageItemList->GetObject(i);
- aUserImagesVector.push_back( pItem->aCommandURL );
- }
-
- uno::Reference< XStream > xBitmapStream = xUserBitmapsStorage->openStreamElement(
- rtl::OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ),
- ElementModes::READ );
-
- if ( xBitmapStream.is() )
- {
- SvStream* pSvStream( 0 );
- BitmapEx aUserBitmap;
- {
- pSvStream = utl::UcbStreamHelper::CreateStream( xBitmapStream );
- vcl::PNGReader aPngReader( *pSvStream );
- aUserBitmap = aPngReader.Read();
- }
- delete pSvStream;
-
- // Delete old image list and create a new one from the read bitmap
- delete m_pUserImageList[nImageType];
- m_pUserImageList[nImageType] = new ImageList();
- m_pUserImageList[nImageType]->InsertFromHorizontalStrip
- ( aUserBitmap, aUserImagesVector );
- return sal_True;
- }
- }
- }
- catch ( com::sun::star::container::NoSuchElementException& )
- {
- }
- catch ( ::com::sun::star::embed::InvalidStorageException& )
- {
- }
- catch ( ::com::sun::star::lang::IllegalArgumentException& )
- {
- }
- catch ( ::com::sun::star::io::IOException& )
- {
- }
- catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
- {
- }
- }
-
- // Destroy old image list - create a new empty one
- delete m_pUserImageList[nImageType];
- m_pUserImageList[nImageType] = new ImageList;
-
- return sal_True;
-}
-
-sal_Bool ImageManager::implts_storeUserImages(
- ImageType nImageType,
- const uno::Reference< XStorage >& xUserImageStorage,
- const uno::Reference< XStorage >& xUserBitmapsStorage )
-{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bModified )
- {
- ImageList* pImageList = implts_getUserImageList( nImageType );
- if ( pImageList->GetImageCount() > 0 )
- {
- ImageListsDescriptor aUserImageListInfo;
- aUserImageListInfo.pImageList = new ImageListDescriptor;
-
- ImageListItemDescriptor* pList = new ImageListItemDescriptor;
- aUserImageListInfo.pImageList->Insert( pList, 0 );
-
- pList->pImageItemList = new ImageItemListDescriptor;
- for ( USHORT i=0; i < pImageList->GetImageCount(); i++ )
- {
- ImageItemDescriptor* pItem = new ::framework::ImageItemDescriptor;
-
- pItem->nIndex = i;
- pItem->aCommandURL = pImageList->GetImageName( i );
- pList->pImageItemList->Insert( pItem, pList->pImageItemList->Count() );
- }
-
- pList->aURL = String::CreateFromAscii("Bitmaps/");
- pList->aURL += String::CreateFromAscii( BITMAP_FILE_NAMES[nImageType] );
-
- uno::Reference< XTransactedObject > xTransaction;
- uno::Reference< XOutputStream > xOutputStream;
- uno::Reference< XStream > xStream = xUserImageStorage->openStreamElement( rtl::OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ),
- ElementModes::WRITE|ElementModes::TRUNCATE );
- if ( xStream.is() )
- {
- uno::Reference< XStream > xBitmapStream =
- xUserBitmapsStorage->openStreamElement( rtl::OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ),
- ElementModes::WRITE|ElementModes::TRUNCATE );
- if ( xBitmapStream.is() )
- {
- SvStream* pSvStream = utl::UcbStreamHelper::CreateStream( xBitmapStream );
- {
- vcl::PNGWriter aPngWriter( pImageList->GetAsHorizontalStrip() );
- aPngWriter.Write( *pSvStream );
- }
- delete pSvStream;
-
- // Commit user bitmaps storage
- xTransaction = uno::Reference< XTransactedObject >( xUserBitmapsStorage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
- }
-
- xOutputStream = xStream->getOutputStream();
- if ( xOutputStream.is() )
- ImagesConfiguration::StoreImages( m_xServiceManager, xOutputStream, aUserImageListInfo );
-
- // Commit user image storage
- xTransaction = uno::Reference< XTransactedObject >( xUserImageStorage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
- }
-
- return sal_True;
- }
- else
- {
- // Remove the streams from the storage, if we have no data. We have to catch
- // the NoSuchElementException as it can be possible that there is no stream at all!
- try
- {
- xUserImageStorage->removeElement( rtl::OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ));
- }
- catch ( ::com::sun::star::container::NoSuchElementException& )
- {
- }
-
- try
- {
- xUserBitmapsStorage->removeElement( rtl::OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ));
- }
- catch ( ::com::sun::star::container::NoSuchElementException& )
- {
- }
-
- uno::Reference< XTransactedObject > xTransaction;
-
- // Commit user image storage
- xTransaction = uno::Reference< XTransactedObject >( xUserImageStorage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
-
- // Commit user bitmaps storage
- xTransaction = uno::Reference< XTransactedObject >( xUserBitmapsStorage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
-
- return sal_True;
- }
- }
-
- return sal_False;
-}
-
ImageManager::ImageManager( uno::Reference< XMultiServiceFactory > xServiceManager ) :
ThreadHelpBase( &Application::GetSolarMutex() )
- , m_xUserConfigStorage( 0 )
- , m_xUserImageStorage( 0 )
- , m_xUserBitmapsStorage( 0 )
- , m_bReadOnly( true )
- , m_bInitialized( false )
- , m_bModified( false )
- , m_bConfigRead( false )
- , m_bDisposed( false )
- , m_aXMLPostfix( RTL_CONSTASCII_USTRINGPARAM( ".xml" ))
- , m_aResourceString( RTL_CONSTASCII_USTRINGPARAM( ModuleImageList ))
- , m_xServiceManager( xServiceManager )
- , m_aListenerContainer( m_aLock.getShareableOslMutex() )
+ , m_pImpl( new ImageManagerImpl(xServiceManager,static_cast< OWeakObject* >(this),false) )
{
- for ( sal_Int32 n=0; n < ImageType_COUNT; n++ )
- {
- m_pUserImageList[n] = 0;
- m_bUserImageListModified[n] = false;
- }
}
ImageManager::~ImageManager()
{
- ResetableGuard aGuard( m_aLock );
- for ( sal_Int32 n = 0; n < ImageType_COUNT; n++ )
- {
- delete m_pUserImageList[n];
- m_pUserImageList[n] = 0;
- }
+ m_pImpl->clear();
}
// XComponent
void SAL_CALL ImageManager::dispose() throw (::com::sun::star::uno::RuntimeException)
{
- uno::Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
-
- css::lang::EventObject aEvent( xThis );
- m_aListenerContainer.disposeAndClear( aEvent );
-
- {
- ResetableGuard aGuard( m_aLock );
- m_xUserConfigStorage.clear();
- m_xUserImageStorage.clear();
- m_bConfigRead = false;
- m_bModified = false;
- m_bDisposed = true;
- }
+ m_pImpl->dispose();
}
void SAL_CALL ImageManager::addEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- {
- ResetableGuard aGuard( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
- }
-
- m_aListenerContainer.addInterface( ::getCppuType( ( const uno::Reference< XEventListener >* ) NULL ), xListener );
+ m_pImpl->addEventListener(xListener);
}
void SAL_CALL ImageManager::removeEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- m_aListenerContainer.removeInterface( ::getCppuType( ( const uno::Reference< XEventListener >* ) NULL ), xListener );
+ m_pImpl->removeEventListener(xListener);
}
// Non-UNO methods
void ImageManager::setStorage( const uno::Reference< XStorage >& Storage )
throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aLock( m_aLock );
+ ResetableGuard aLock( m_pImpl->m_aLock );
- m_xUserConfigStorage = Storage;
- implts_initialize();
+ m_pImpl->m_xUserConfigStorage = Storage;
+ m_pImpl->implts_initialize();
}
// XInitialization
void SAL_CALL ImageManager::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
{
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bInitialized )
- {
- for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
- {
- PropertyValue aPropValue;
- if ( aArguments[n] >>= aPropValue )
- {
- if ( aPropValue.Name.equalsAscii( "UserConfigStorage" ))
- {
- aPropValue.Value >>= m_xUserConfigStorage;
- }
- else if ( aPropValue.Name.equalsAscii( "ModuleIdentifier" ))
- {
- aPropValue.Value >>= m_aModuleIdentifier;
- }
- }
- }
-
- if ( m_xUserConfigStorage.is() )
- {
- uno::Reference< XPropertySet > xPropSet( m_xUserConfigStorage, UNO_QUERY );
- if ( xPropSet.is() )
- {
- long nOpenMode = 0;
- Any a = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" )));
- if ( a >>= nOpenMode )
- m_bReadOnly = !( nOpenMode & ElementModes::WRITE );
- }
- }
-
- implts_initialize();
-
- m_bInitialized = true;
- }
+ m_pImpl->initialize(aArguments);
}
// XImageManager
void SAL_CALL ImageManager::reset()
throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aLock( m_aLock );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- std::vector< OUString > aUserImageNames;
-
- for ( sal_Int32 i = 0; i < ImageType_COUNT; i++ )
- {
- aUserImageNames.clear();
- ImageList* pImageList = implts_getUserImageList( ImageType(i));
- pImageList->GetImageNames( aUserImageNames );
-
- Sequence< rtl::OUString > aRemoveList( aUserImageNames.size() );
- for ( sal_uInt32 j = 0; j < aUserImageNames.size(); j++ )
- aRemoveList[j] = aUserImageNames[j];
-
- // Remove images
- removeImages( sal_Int16( i ), aRemoveList );
- m_bUserImageListModified[i] = true;
- }
-
- m_bModified = sal_True;
+ m_pImpl->reset();
}
Sequence< ::rtl::OUString > SAL_CALL ImageManager::getAllImageNames( ::sal_Int16 nImageType )
throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aLock( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- sal_uInt32 i( 0 );
- sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
- ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
-
- std::vector< OUString > aUserImageNames;
- pImageList->GetImageNames( aUserImageNames );
-
- Sequence< OUString > aImageNameSeq( aUserImageNames.size() );
- for ( i = 0; i < aUserImageNames.size(); i++ )
- aImageNameSeq[i] = aUserImageNames[i];
-
- return aImageNameSeq;
+ return m_pImpl->getAllImageNames( nImageType );
}
::sal_Bool SAL_CALL ImageManager::hasImage( ::sal_Int16 nImageType, const ::rtl::OUString& aCommandURL )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aLock( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- if (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE ))
- throw IllegalArgumentException();
-
- sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
- ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
- if ( pImageList )
- return ( pImageList->GetImagePos( aCommandURL ) != IMAGELIST_IMAGE_NOTFOUND );
-
- return sal_False;
+ return m_pImpl->hasImage(nImageType,aCommandURL);
}
Sequence< uno::Reference< XGraphic > > SAL_CALL ImageManager::getImages(
@@ -619,28 +178,7 @@ Sequence< uno::Reference< XGraphic > > SAL_CALL ImageManager::getImages(
const Sequence< ::rtl::OUString >& aCommandURLSequence )
throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
{
- ResetableGuard aLock( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- if (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE ))
- throw IllegalArgumentException();
-
- Sequence< uno::Reference< XGraphic > > aGraphSeq( aCommandURLSequence.getLength() );
-
- const rtl::OUString* aStrArray = aCommandURLSequence.getConstArray();
- sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
- ImageList* pUserImageList = implts_getUserImageList( ImageType( nIndex ));
-
- for ( sal_Int32 n = 0; n < aCommandURLSequence.getLength(); n++ )
- {
- Image aImage = pUserImageList->GetImage( aStrArray[n] );
- aGraphSeq[n] = aImage.GetXGraphic();
- }
-
- return aGraphSeq;
+ return m_pImpl->getImages(nImageType,aCommandURLSequence);
}
void SAL_CALL ImageManager::replaceImages(
@@ -651,84 +189,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- CmdToXGraphicNameAccess* pInsertedImages( 0 );
- CmdToXGraphicNameAccess* pReplacedImages( 0 );
-
- {
- ResetableGuard aLock( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- if (( aCommandURLSequence.getLength() != aGraphicsSequence.getLength() ) ||
- (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE )))
- throw IllegalArgumentException();
-
- if ( m_bReadOnly )
- throw IllegalAccessException();
-
- sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
- ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
-
- uno::Reference< XGraphic > xGraphic;
- for ( sal_Int32 i = 0; i < aCommandURLSequence.getLength(); i++ )
- {
- // Check size and scale. If we don't have any graphics ignore it
- if ( !implts_checkAndScaleGraphic( xGraphic, aGraphicsSequence[i], nIndex ))
- continue;
-
- USHORT nPos = pImageList->GetImagePos( aCommandURLSequence[i] );
- if ( nPos == IMAGELIST_IMAGE_NOTFOUND )
- {
- pImageList->AddImage( aCommandURLSequence[i], xGraphic );
- if ( !pInsertedImages )
- pInsertedImages = new CmdToXGraphicNameAccess();
- pInsertedImages->addElement( aCommandURLSequence[i], xGraphic );
- }
- else
- {
- pImageList->ReplaceImage( aCommandURLSequence[i], xGraphic );
- if ( !pReplacedImages )
- pReplacedImages = new CmdToXGraphicNameAccess();
- pReplacedImages->addElement( aCommandURLSequence[i], xGraphic );
- }
- }
-
- if (( pInsertedImages != 0 ) || ( pReplacedImages != 0 ))
- {
- m_bModified = sal_True;
- m_bUserImageListModified[nIndex] = true;
- }
- }
-
- // Notify listeners
- uno::Reference< XImageManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- uno::Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- if ( pInsertedImages != 0 )
- {
- ConfigurationEvent aInsertEvent;
- aInsertEvent.aInfo = uno::makeAny( nImageType );
- aInsertEvent.Accessor = uno::makeAny( xThis );
- aInsertEvent.Source = xIfac;
- aInsertEvent.ResourceURL = m_aResourceString;
- aInsertEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pInsertedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aInsertEvent, NotifyOp_Insert );
- }
- if ( pReplacedImages != 0 )
- {
- ConfigurationEvent aReplaceEvent;
- aReplaceEvent.aInfo = uno::makeAny( nImageType );
- aReplaceEvent.Accessor = uno::makeAny( xThis );
- aReplaceEvent.Source = xIfac;
- aReplaceEvent.ResourceURL = m_aResourceString;
- aReplaceEvent.ReplacedElement = Any();
- aReplaceEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pReplacedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aReplaceEvent, NotifyOp_Replace );
- }
+ m_pImpl->replaceImages(nImageType,aCommandURLSequence,aGraphicsSequence);
}
void SAL_CALL ImageManager::removeImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
@@ -736,62 +197,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- CmdToXGraphicNameAccess* pRemovedImages( 0 );
-
- {
- ResetableGuard aLock( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- if (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE ))
- throw IllegalArgumentException();
-
- if ( m_bReadOnly )
- throw IllegalAccessException();
-
- sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
- ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
- uno::Reference< XGraphic > xEmptyGraphic( Image().GetXGraphic() );
-
- for ( sal_Int32 i = 0; i < aCommandURLSequence.getLength(); i++ )
- {
- USHORT nPos = pImageList->GetImagePos( aCommandURLSequence[i] );
- if ( nPos != IMAGELIST_IMAGE_NOTFOUND )
- {
- Image aImage = pImageList->GetImage( nPos );
- USHORT nId = pImageList->GetImageId( nPos );
- pImageList->RemoveImage( nId );
-
- if ( !pRemovedImages )
- pRemovedImages = new CmdToXGraphicNameAccess();
- pRemovedImages->addElement( aCommandURLSequence[i], xEmptyGraphic );
- }
- }
-
- if ( pRemovedImages != 0 )
- {
- m_bModified = sal_True;
- m_bUserImageListModified[nIndex] = true;
- }
- }
-
- // Notify listeners
- uno::Reference< XImageManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- uno::Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- if ( pRemovedImages != 0 )
- {
- ConfigurationEvent aRemoveEvent;
- aRemoveEvent.aInfo = uno::makeAny( nImageType );
- aRemoveEvent.Accessor = uno::makeAny( xThis );
- aRemoveEvent.Source = xIfac;
- aRemoveEvent.ResourceURL = m_aResourceString;
- aRemoveEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pRemovedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aRemoveEvent, NotifyOp_Remove );
- }
+ m_pImpl->removeImages(nImageType,aCommandURLSequence);
}
void SAL_CALL ImageManager::insertImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
@@ -800,105 +206,21 @@ throw ( ::com::sun::star::container::ElementExistException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- CmdToXGraphicNameAccess* pInsertedImages( 0 );
- CmdToXGraphicNameAccess* pReplacedImages( 0 );
-
- {
- ResetableGuard aLock( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- if (( aCommandURLSequence.getLength() != aGraphicSequence.getLength() ) ||
- (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE )))
- throw IllegalArgumentException();
-
- if ( m_bReadOnly )
- throw IllegalAccessException();
-
- sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
- ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
-
- uno::Reference< XGraphic > xGraphic;
- for ( sal_Int32 i = 0; i < aCommandURLSequence.getLength(); i++ )
- {
- if ( !implts_checkAndScaleGraphic( xGraphic, aGraphicSequence[i], nIndex ))
- continue;
-
- USHORT nPos = pImageList->GetImagePos( aCommandURLSequence[i] );
- if ( nPos == IMAGELIST_IMAGE_NOTFOUND )
- {
- pImageList->AddImage( aCommandURLSequence[i], xGraphic );
- if ( !pInsertedImages )
- pInsertedImages = new CmdToXGraphicNameAccess();
- pInsertedImages->addElement( aCommandURLSequence[i], xGraphic );
- }
- else
- {
- pImageList->ReplaceImage( aCommandURLSequence[i], xGraphic );
- if ( !pReplacedImages )
- pReplacedImages = new CmdToXGraphicNameAccess();
- pReplacedImages->addElement( aCommandURLSequence[i], xGraphic );
- }
- }
-
- if (( pInsertedImages != 0 ) || ( pReplacedImages != 0 ))
- {
- m_bModified = sal_True;
- m_bUserImageListModified[nIndex] = true;
- }
- }
-
- // Notify listeners
- uno::Reference< XImageManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- uno::Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- if ( pInsertedImages != 0 )
- {
- ConfigurationEvent aInsertEvent;
- aInsertEvent.aInfo = uno::makeAny( nImageType );
- aInsertEvent.Accessor = uno::makeAny( xThis );
- aInsertEvent.Source = xIfac;
- aInsertEvent.ResourceURL = m_aResourceString;
- aInsertEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pInsertedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aInsertEvent, NotifyOp_Insert );
- }
- if ( pReplacedImages != 0 )
- {
- ConfigurationEvent aReplaceEvent;
- aReplaceEvent.aInfo = uno::makeAny( nImageType );
- aReplaceEvent.Accessor = uno::makeAny( xThis );
- aReplaceEvent.Source = xIfac;
- aReplaceEvent.ResourceURL = m_aResourceString;
- aReplaceEvent.ReplacedElement = Any();
- aReplaceEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pReplacedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aReplaceEvent, NotifyOp_Replace );
- }
+ m_pImpl->insertImages(nImageType,aCommandURLSequence,aGraphicSequence);
}
// XUIConfiguration
void SAL_CALL ImageManager::addConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
throw (::com::sun::star::uno::RuntimeException)
{
- {
- ResetableGuard aGuard( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
- }
-
- m_aListenerContainer.addInterface( ::getCppuType( ( const uno::Reference< XUIConfigurationListener >* ) NULL ), xListener );
+ m_pImpl->addConfigurationListener(xListener);
}
void SAL_CALL ImageManager::removeConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
throw (::com::sun::star::uno::RuntimeException)
{
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- m_aListenerContainer.removeInterface( ::getCppuType( ( const uno::Reference< XUIConfigurationListener >* ) NULL ), xListener );
+ m_pImpl->removeConfigurationListener(xListener);
}
// XUIConfigurationPersistence
@@ -906,228 +228,30 @@ void SAL_CALL ImageManager::reload()
throw ( ::com::sun::star::uno::Exception,
::com::sun::star::uno::RuntimeException )
{
- ResetableGuard aGuard( m_aLock );
-
- uno::Reference< uno::XInterface > xRefThis( static_cast< OWeakObject* >( this ));
-
- if ( m_bDisposed )
- throw DisposedException();
-
- CommandMap aOldUserCmdImageSet;
- std::vector< rtl::OUString > aNewUserCmdImageSet;
-
- if ( m_bModified )
- {
- uno::Reference< XImageManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- uno::Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- for ( sal_Int16 i = 0; i < sal_Int16( ImageType_COUNT ); i++ )
- {
- if ( !m_bDisposed && m_bUserImageListModified[i] )
- {
- std::vector< rtl::OUString > aOldUserCmdImageVector;
- ImageList* pImageList = implts_getUserImageList( (ImageType)i );
- pImageList->GetImageNames( aOldUserCmdImageVector );
-
- // Fill hash map to speed up search afterwards
- sal_uInt32 j( 0 );
- for ( j = 0; j < aOldUserCmdImageVector.size(); j++ )
- aOldUserCmdImageSet.insert( CommandMap::value_type( aOldUserCmdImageVector[j], false ));
-
- // Attention: This can make the old image list pointer invalid!
- implts_loadUserImages( (ImageType)i, m_xUserImageStorage, m_xUserBitmapsStorage );
- pImageList = implts_getUserImageList( (ImageType)i );
- pImageList->GetImageNames( aNewUserCmdImageSet );
-
- CmdToXGraphicNameAccess* pInsertedImages( 0 );
- CmdToXGraphicNameAccess* pReplacedImages( 0 );
- CmdToXGraphicNameAccess* pRemovedImages( 0 );
-
- for ( j = 0; j < aNewUserCmdImageSet.size(); j++ )
- {
- CommandMap::iterator pIter = aOldUserCmdImageSet.find( aNewUserCmdImageSet[j] );
- if ( pIter != aOldUserCmdImageSet.end() )
- {
- pIter->second = true; // mark entry as replaced
- if ( !pReplacedImages )
- pReplacedImages = new CmdToXGraphicNameAccess();
- pReplacedImages->addElement( aNewUserCmdImageSet[j],
- pImageList->GetImage( aNewUserCmdImageSet[j] ).GetXGraphic() );
- }
- else
- {
- if ( !pInsertedImages )
- pInsertedImages = new CmdToXGraphicNameAccess();
- pInsertedImages->addElement( aNewUserCmdImageSet[j],
- pImageList->GetImage( aNewUserCmdImageSet[j] ).GetXGraphic() );
- }
- }
-
- // Search map for unmarked entries => they have been removed from the user list
- // through this reload operation.
- uno::Reference< XGraphic > xEmptyGraphic( Image().GetXGraphic() );
- CommandMap::const_iterator pIter = aOldUserCmdImageSet.begin();
- while ( pIter != aOldUserCmdImageSet.end() )
- {
- if ( !pIter->second )
- {
- // No image in the user image list => remove user image
- if ( !pRemovedImages )
- pRemovedImages = new CmdToXGraphicNameAccess();
- pRemovedImages->addElement( pIter->first, xEmptyGraphic );
- }
- ++pIter;
- }
-
- aGuard.unlock();
-
- // Now notify our listeners. Unlock mutex to prevent deadlocks
- if ( pInsertedImages != 0 )
- {
- ConfigurationEvent aInsertEvent;
- aInsertEvent.aInfo = uno::makeAny( i );
- aInsertEvent.Accessor = uno::makeAny( xThis );
- aInsertEvent.Source = xIfac;
- aInsertEvent.ResourceURL = m_aResourceString;
- aInsertEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pInsertedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aInsertEvent, NotifyOp_Insert );
- }
- if ( pReplacedImages != 0 )
- {
- ConfigurationEvent aReplaceEvent;
- aReplaceEvent.aInfo = uno::makeAny( i );
- aReplaceEvent.Accessor = uno::makeAny( xThis );
- aReplaceEvent.Source = xIfac;
- aReplaceEvent.ResourceURL = m_aResourceString;
- aReplaceEvent.ReplacedElement = Any();
- aReplaceEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pReplacedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aReplaceEvent, NotifyOp_Replace );
- }
- if ( pRemovedImages != 0 )
- {
- ConfigurationEvent aRemoveEvent;
- aRemoveEvent.aInfo = uno::makeAny( i );
- aRemoveEvent.Accessor = uno::makeAny( xThis );
- aRemoveEvent.Source = xIfac;
- aRemoveEvent.ResourceURL = m_aResourceString;
- aRemoveEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pRemovedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aRemoveEvent, NotifyOp_Remove );
- }
-
- aGuard.lock();
- }
- }
- }
+ m_pImpl->reload();
}
void SAL_CALL ImageManager::store()
throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_bModified )
- {
- sal_Bool bWritten( sal_False );
- for ( sal_Int32 i = 0; i < ImageType_COUNT; i++ )
- {
- sal_Bool bSuccess = implts_storeUserImages( ImageType(i), m_xUserImageStorage, m_xUserBitmapsStorage );
- if ( bSuccess )
- bWritten = sal_True;
- m_bUserImageListModified[i] = false;
- }
-
- if ( bWritten &&
- m_xUserConfigStorage.is())
- {
- uno::Reference< XTransactedObject > xUserConfigStorageCommit( m_xUserConfigStorage, UNO_QUERY );
- if ( xUserConfigStorageCommit.is() )
- xUserConfigStorageCommit->commit();
- }
-
- m_bModified = sal_False;
- }
+ m_pImpl->store();
}
void SAL_CALL ImageManager::storeToStorage( const uno::Reference< XStorage >& Storage )
throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_bModified && Storage.is() )
- {
- long nModes = ElementModes::READWRITE;
-
- uno::Reference< XStorage > xUserImageStorage = Storage->openStorageElement( OUString::createFromAscii( IMAGE_FOLDER ),
- nModes );
- if ( xUserImageStorage.is() )
- {
- uno::Reference< XStorage > xUserBitmapsStorage = xUserImageStorage->openStorageElement( OUString::createFromAscii( BITMAPS_FOLDER ),
- nModes );
- for ( sal_Int32 i = 0; i < ImageType_COUNT; i++ )
- {
- implts_getUserImageList( (ImageType)i );
- implts_storeUserImages( (ImageType)i, xUserImageStorage, xUserBitmapsStorage );
- }
-
- uno::Reference< XTransactedObject > xTransaction( Storage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
- }
- }
+ m_pImpl->storeToStorage(Storage);
}
sal_Bool SAL_CALL ImageManager::isModified()
throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
- return m_bModified;
+ return m_pImpl->isModified();
}
sal_Bool SAL_CALL ImageManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
- return m_bReadOnly;
-}
-
-void ImageManager::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp )
-{
- ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer(
- ::getCppuType( ( const css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >*) NULL ) );
- if ( pContainer != NULL )
- {
- ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
- while ( pIterator.hasMoreElements() )
- {
- try
- {
- switch ( eOp )
- {
- case NotifyOp_Replace:
- ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementReplaced( aEvent );
- break;
- case NotifyOp_Insert:
- ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementInserted( aEvent );
- break;
- case NotifyOp_Remove:
- ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementRemoved( aEvent );
- break;
- }
- }
- catch( css::uno::RuntimeException& )
- {
- pIterator.remove();
- }
- }
- }
+ return m_pImpl->isReadOnly();
}
} // namespace framework
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
new file mode 100755
index 0000000000..2ba2e105d3
--- /dev/null
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -0,0 +1,1466 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ImageManagerImpl.cxx,v $
+ * $Revision: 1.16.82.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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_framework.hxx"
+#include <imagemanagerimpl.hxx>
+#include <threadhelp/resetableguard.hxx>
+#include <xml/imagesconfiguration.hxx>
+#include <uiconfiguration/graphicnameaccess.hxx>
+#include <services.h>
+
+#include "properties.h"
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+#include <com/sun/star/ui/UIElementType.hpp>
+#include <com/sun/star/ui/ConfigurationEvent.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/ui/ImageType.hpp>
+
+//_________________________________________________________________________________________________________________
+// other includes
+//_________________________________________________________________________________________________________________
+
+#include <vcl/svapp.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <osl/mutex.hxx>
+#include <comphelper/sequence.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/pngread.hxx>
+#include <vcl/pngwrite.hxx>
+#include <rtl/logfile.hxx>
+#include "svtools/miscopt.hxx"
+
+//_________________________________________________________________________________________________________________
+// namespaces
+//_________________________________________________________________________________________________________________
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::graphic::XGraphic;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::embed;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::ui;
+using namespace ::cppu;
+
+// Image sizes for our toolbars/menus
+const sal_Int32 IMAGE_SIZE_NORMAL = 16;
+const sal_Int32 IMAGE_SIZE_LARGE = 26;
+const sal_Int16 MAX_IMAGETYPE_VALUE = ::com::sun::star::ui::ImageType::COLOR_HIGHCONTRAST|
+ ::com::sun::star::ui::ImageType::SIZE_LARGE;
+
+static const char IMAGE_FOLDER[] = "images";
+static const char BITMAPS_FOLDER[] = "Bitmaps";
+static const char IMAGE_EXTENSION[] = ".png";
+
+static const char* IMAGELIST_XML_FILE[] =
+{
+ "sc_imagelist.xml",
+ "lc_imagelist.xml",
+ "sch_imagelist.xml",
+ "lch_imagelist.xml"
+};
+
+static const char* BITMAP_FILE_NAMES[] =
+{
+ "sc_userimages.png",
+ "lc_userimages.png",
+ "sch_userimages.png",
+ "lch_userimages.png"
+};
+
+namespace framework
+{
+ static char ModuleImageList[] = "private:resource/images/moduleimages";
+ static osl::Mutex* pImageListWrapperMutex = 0;
+ static GlobalImageList* pGlobalImageList = 0;
+ static const char* ImageType_Prefixes[ImageType_COUNT] =
+ {
+ "res/commandimagelist/sc_",
+ "res/commandimagelist/lc_",
+ "res/commandimagelist/sch_",
+ "res/commandimagelist/lch_"
+ };
+
+typedef GraphicNameAccess CmdToXGraphicNameAccess;
+
+static osl::Mutex& getGlobalImageListMutex()
+{
+ if ( pImageListWrapperMutex == 0 )
+ {
+ osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
+ if ( pImageListWrapperMutex == 0 )
+ pImageListWrapperMutex = new osl::Mutex;
+ }
+
+ return *pImageListWrapperMutex;
+}
+
+static GlobalImageList* getGlobalImageList( const uno::Reference< XMultiServiceFactory >& rServiceManager )
+{
+ osl::MutexGuard guard( getGlobalImageListMutex() );
+
+ if ( pGlobalImageList == 0 )
+ pGlobalImageList = new GlobalImageList( rServiceManager );
+
+ return pGlobalImageList;
+}
+
+static rtl::OUString getCanonicalName( const rtl::OUString& rFileName )
+{
+ bool bRemoveSlash( true );
+ sal_Int32 nLength = rFileName.getLength();
+ const sal_Unicode* pString = rFileName.getStr();
+
+ rtl::OUStringBuffer aBuf( nLength );
+ for ( sal_Int32 i = 0; i < nLength; i++ )
+ {
+ const sal_Unicode c = pString[i];
+ switch ( c )
+ {
+ // map forbidden characters to escape
+ case '/' : if ( !bRemoveSlash )
+ aBuf.appendAscii( "%2f" );
+ break;
+ case '\\': aBuf.appendAscii( "%5c" ); bRemoveSlash = false; break;
+ case ':' : aBuf.appendAscii( "%3a" ); bRemoveSlash = false; break;
+ case '*' : aBuf.appendAscii( "%2a" ); bRemoveSlash = false; break;
+ case '?' : aBuf.appendAscii( "%3f" ); bRemoveSlash = false; break;
+ case '<' : aBuf.appendAscii( "%3c" ); bRemoveSlash = false; break;
+ case '>' : aBuf.appendAscii( "%3e" ); bRemoveSlash = false; break;
+ case '|' : aBuf.appendAscii( "%7c" ); bRemoveSlash = false; break;
+ default: aBuf.append( c ); bRemoveSlash = false;
+ }
+ }
+ return aBuf.makeStringAndClear();
+}
+
+//_________________________________________________________________________________________________________________
+
+CmdImageList::CmdImageList( const uno::Reference< XMultiServiceFactory >& rServiceManager, const rtl::OUString& aModuleIdentifier ) :
+ m_bVectorInit( sal_False ),
+ m_aModuleIdentifier( aModuleIdentifier ),
+ m_xServiceManager( rServiceManager ),
+ m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() )
+{
+ for ( sal_Int32 n=0; n < ImageType_COUNT; n++ )
+ m_pImageList[n] = 0;
+}
+
+CmdImageList::~CmdImageList()
+{
+ for ( sal_Int32 n=0; n < ImageType_COUNT; n++ )
+ delete m_pImageList[n];
+}
+
+void CmdImageList::impl_fillCommandToImageNameMap()
+{
+ RTL_LOGFILE_CONTEXT( aLog, "framework: CmdImageList::impl_fillCommandToImageNameMap" );
+
+ if ( !m_bVectorInit )
+ {
+ const rtl::OUString aCommandImageList( RTL_CONSTASCII_USTRINGPARAM( UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST ));
+ Sequence< OUString > aCmdImageSeq;
+ uno::Reference< XNameAccess > xCmdDesc( m_xServiceManager->createInstance(
+ SERVICENAME_UICOMMANDDESCRIPTION ),
+ UNO_QUERY );
+
+ if ( m_aModuleIdentifier.getLength() > 0 )
+ {
+ // If we have a module identifier - use to retrieve the command image name list from it.
+ // Otherwise we will use the global command image list
+ try
+ {
+ xCmdDesc->getByName( m_aModuleIdentifier ) >>= xCmdDesc;
+ if ( xCmdDesc.is() )
+ xCmdDesc->getByName( aCommandImageList ) >>= aCmdImageSeq;
+ }
+ catch ( NoSuchElementException& )
+ {
+ // Module unknown we will work with an empty command image list!
+ return;
+ }
+ }
+
+ if ( xCmdDesc.is() )
+ {
+ try
+ {
+ xCmdDesc->getByName( aCommandImageList ) >>= aCmdImageSeq;
+ }
+ catch ( NoSuchElementException& )
+ {
+ }
+ catch ( WrappedTargetException& )
+ {
+ }
+ }
+
+ // We have to map commands which uses special characters like '/',':','?','\','<'.'>','|'
+ String aExt = String::CreateFromAscii( IMAGE_EXTENSION );
+ m_aImageCommandNameVector.resize(aCmdImageSeq.getLength() );
+ m_aImageNameVector.resize( aCmdImageSeq.getLength() );
+
+ ::std::copy( aCmdImageSeq.getConstArray(),
+ aCmdImageSeq.getConstArray()+aCmdImageSeq.getLength(),
+ m_aImageCommandNameVector.begin() );
+
+ // Create a image name vector that must be provided to the vcl imagelist. We also need
+ // a command to image name map to speed up access time for image retrieval.
+ OUString aUNOString( RTL_CONSTASCII_USTRINGPARAM( ".uno:" ));
+ String aEmptyString;
+ const sal_uInt32 nCount = m_aImageCommandNameVector.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ OUString aCommandName( m_aImageCommandNameVector[i] );
+ String aImageName;
+
+ if ( aCommandName.indexOf( aUNOString ) != 0 )
+ {
+ INetURLObject aUrlObject( aCommandName, INetURLObject::ENCODE_ALL );
+ aImageName = aUrlObject.GetURLPath();
+ aImageName = getCanonicalName( aImageName ); // convert to valid filename
+ }
+ else
+ {
+ // just remove the schema
+ if ( aCommandName.getLength() > 5 )
+ aImageName = aCommandName.copy( 5 );
+ else
+ aImageName = aEmptyString;
+
+ // Search for query part.
+ sal_Int32 nIndex = aImageName.Search( '?' );
+ if ( nIndex != STRING_NOTFOUND )
+ aImageName = getCanonicalName( aImageName ); // convert to valid filename
+ }
+ // Image names are not case-dependent. Always use lower case characters to
+ // reflect this.
+ aImageName += aExt;
+ aImageName.ToLowerAscii();
+
+ m_aImageNameVector[i] = aImageName;
+ m_aCommandToImageNameMap.insert( CommandToImageNameMap::value_type( aCommandName, aImageName ));
+ }
+
+ m_bVectorInit = sal_True;
+ }
+}
+
+ImageList* CmdImageList::impl_getImageList( sal_Int16 nImageType )
+{
+ SvtMiscOptions aMiscOptions;
+
+ sal_Int16 nSymbolsStyle = aMiscOptions.GetCurrentSymbolsStyle();
+ if ( nSymbolsStyle != m_nSymbolsStyle )
+ {
+ m_nSymbolsStyle = nSymbolsStyle;
+ for ( sal_Int32 n=0; n < ImageType_COUNT; n++ )
+ delete m_pImageList[n], m_pImageList[n] = NULL;
+ }
+
+ if ( !m_pImageList[nImageType] )
+ {
+ m_pImageList[nImageType] = new ImageList( m_aImageNameVector,
+ OUString::createFromAscii( ImageType_Prefixes[nImageType] ) );
+ }
+
+ return m_pImageList[nImageType];
+}
+
+std::vector< ::rtl::OUString >& CmdImageList::impl_getImageNameVector()
+{
+ return m_aImageNameVector;
+}
+
+std::vector< rtl::OUString >& CmdImageList::impl_getImageCommandNameVector()
+{
+ return m_aImageCommandNameVector;
+}
+
+Image CmdImageList::getImageFromCommandURL( sal_Int16 nImageType, const rtl::OUString& rCommandURL )
+{
+ impl_fillCommandToImageNameMap();
+ CommandToImageNameMap::const_iterator pIter = m_aCommandToImageNameMap.find( rCommandURL );
+ if ( pIter != m_aCommandToImageNameMap.end() )
+ {
+ ImageList* pImageList = impl_getImageList( nImageType );
+ return pImageList->GetImage( pIter->second );
+ }
+
+ return Image();
+}
+
+bool CmdImageList::hasImage( sal_Int16 /*nImageType*/, const rtl::OUString& rCommandURL )
+{
+ impl_fillCommandToImageNameMap();
+ CommandToImageNameMap::const_iterator pIter = m_aCommandToImageNameMap.find( rCommandURL );
+ if ( pIter != m_aCommandToImageNameMap.end() )
+ return true;
+ else
+ return false;
+}
+
+::std::vector< rtl::OUString >& CmdImageList::getImageNames()
+{
+ return impl_getImageNameVector();
+}
+
+::std::vector< rtl::OUString >& CmdImageList::getImageCommandNames()
+{
+ return impl_getImageCommandNameVector();
+}
+
+//_________________________________________________________________________________________________________________
+
+GlobalImageList::GlobalImageList( const uno::Reference< XMultiServiceFactory >& rServiceManager ) :
+ CmdImageList( rServiceManager, rtl::OUString() ),
+ m_nRefCount( 0 )
+{
+}
+
+GlobalImageList::~GlobalImageList()
+{
+}
+
+Image GlobalImageList::getImageFromCommandURL( sal_Int16 nImageType, const rtl::OUString& rCommandURL )
+{
+ osl::MutexGuard guard( getGlobalImageListMutex() );
+ return CmdImageList::getImageFromCommandURL( nImageType, rCommandURL );
+}
+
+bool GlobalImageList::hasImage( sal_Int16 nImageType, const rtl::OUString& rCommandURL )
+{
+ osl::MutexGuard guard( getGlobalImageListMutex() );
+ return CmdImageList::hasImage( nImageType, rCommandURL );
+}
+
+::std::vector< rtl::OUString >& GlobalImageList::getImageNames()
+{
+ osl::MutexGuard guard( getGlobalImageListMutex() );
+ return impl_getImageNameVector();
+}
+
+::std::vector< rtl::OUString >& GlobalImageList::getImageCommandNames()
+{
+ osl::MutexGuard guard( getGlobalImageListMutex() );
+ return impl_getImageCommandNameVector();
+}
+
+oslInterlockedCount GlobalImageList::acquire()
+{
+ osl_incrementInterlockedCount( &m_nRefCount );
+ return m_nRefCount;
+}
+
+oslInterlockedCount GlobalImageList::release()
+{
+ osl::MutexGuard guard( getGlobalImageListMutex() );
+
+ if ( !osl_decrementInterlockedCount( &m_nRefCount ))
+ {
+ oslInterlockedCount nCount( m_nRefCount );
+ // remove global pointer as we destroy the object now
+ pGlobalImageList = 0;
+ delete this;
+ return nCount;
+ }
+
+ return m_nRefCount;
+}
+
+static sal_Bool implts_checkAndScaleGraphic( uno::Reference< XGraphic >& rOutGraphic, const uno::Reference< XGraphic >& rInGraphic, sal_Int16 nImageType )
+{
+ static Size aNormSize( IMAGE_SIZE_NORMAL, IMAGE_SIZE_NORMAL );
+ static Size aLargeSize( IMAGE_SIZE_LARGE, IMAGE_SIZE_LARGE );
+
+ if ( !rInGraphic.is() )
+ {
+ rOutGraphic = Image().GetXGraphic();
+ return sal_False;
+ }
+
+ // Check size and scale it
+ Image aImage( rInGraphic );
+ Size aSize = aImage.GetSizePixel();
+ bool bMustScale( false );
+
+ if (( nImageType == ImageType_Color_Large ) ||
+ ( nImageType == ImageType_HC_Large ))
+ bMustScale = ( aSize != aLargeSize );
+ else
+ bMustScale = ( aSize != aNormSize );
+
+ if ( bMustScale )
+ {
+ BitmapEx aBitmap = aImage.GetBitmapEx();
+ aBitmap.Scale( aNormSize );
+ aImage = Image( aBitmap );
+ rOutGraphic = aImage.GetXGraphic();
+ }
+ else
+ rOutGraphic = rInGraphic;
+ return sal_True;
+}
+
+static sal_Int16 implts_convertImageTypeToIndex( sal_Int16 nImageType )
+{
+ sal_Int16 nIndex( 0 );
+ if ( nImageType & ::com::sun::star::ui::ImageType::SIZE_LARGE )
+ nIndex += 1;
+ if ( nImageType & ::com::sun::star::ui::ImageType::COLOR_HIGHCONTRAST )
+ nIndex += 2;
+ return nIndex;
+}
+
+ImageList* ImageManagerImpl::implts_getUserImageList( ImageType nImageType )
+{
+ ResetableGuard aGuard( m_aLock );
+ if ( !m_pUserImageList[nImageType] )
+ implts_loadUserImages( nImageType, m_xUserImageStorage, m_xUserBitmapsStorage );
+
+ return m_pUserImageList[nImageType];
+}
+
+void ImageManagerImpl::implts_initialize()
+{
+ // Initialize the top-level structures with the storage data
+ if ( m_xUserConfigStorage.is() )
+ {
+ long nModes = m_bReadOnly ? ElementModes::READ : ElementModes::READWRITE;
+
+ try
+ {
+ m_xUserImageStorage = m_xUserConfigStorage->openStorageElement( OUString::createFromAscii( IMAGE_FOLDER ),
+ nModes );
+ if ( m_xUserImageStorage.is() )
+ {
+ m_xUserBitmapsStorage = m_xUserImageStorage->openStorageElement( OUString::createFromAscii( BITMAPS_FOLDER ),
+ nModes );
+ }
+ }
+ catch ( com::sun::star::container::NoSuchElementException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::InvalidStorageException& )
+ {
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( ::com::sun::star::io::IOException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
+ {
+ }
+ }
+}
+
+sal_Bool ImageManagerImpl::implts_loadUserImages(
+ ImageType nImageType,
+ const uno::Reference< XStorage >& xUserImageStorage,
+ const uno::Reference< XStorage >& xUserBitmapsStorage )
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( xUserImageStorage.is() && xUserBitmapsStorage.is() )
+ {
+ try
+ {
+ uno::Reference< XStream > xStream = xUserImageStorage->openStreamElement( rtl::OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ),
+ ElementModes::READ );
+ uno::Reference< XInputStream > xInputStream = xStream->getInputStream();
+
+ ImageListsDescriptor aUserImageListInfo;
+ ImagesConfiguration::LoadImages( m_xServiceManager,
+ xInputStream,
+ aUserImageListInfo );
+ if (( aUserImageListInfo.pImageList != 0 ) &&
+ ( aUserImageListInfo.pImageList->Count() > 0 ))
+ {
+ ImageListItemDescriptor* pList = aUserImageListInfo.pImageList->GetObject(0);
+ sal_Int32 nCount = pList->pImageItemList->Count();
+ std::vector< OUString > aUserImagesVector;
+ aUserImagesVector.reserve(nCount);
+ for ( USHORT i=0; i < nCount; i++ )
+ {
+ const ImageItemDescriptor* pItem = pList->pImageItemList->GetObject(i);
+ aUserImagesVector.push_back( pItem->aCommandURL );
+ }
+
+ uno::Reference< XStream > xBitmapStream = xUserBitmapsStorage->openStreamElement(
+ rtl::OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ),
+ ElementModes::READ );
+
+ if ( xBitmapStream.is() )
+ {
+ SvStream* pSvStream( 0 );
+ BitmapEx aUserBitmap;
+ {
+ pSvStream = utl::UcbStreamHelper::CreateStream( xBitmapStream );
+ vcl::PNGReader aPngReader( *pSvStream );
+ aUserBitmap = aPngReader.Read();
+ }
+ delete pSvStream;
+
+ // Delete old image list and create a new one from the read bitmap
+ delete m_pUserImageList[nImageType];
+ m_pUserImageList[nImageType] = new ImageList();
+ m_pUserImageList[nImageType]->InsertFromHorizontalStrip
+ ( aUserBitmap, aUserImagesVector );
+ return sal_True;
+ }
+ }
+ }
+ catch ( com::sun::star::container::NoSuchElementException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::InvalidStorageException& )
+ {
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( ::com::sun::star::io::IOException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
+ {
+ }
+ }
+
+ // Destroy old image list - create a new empty one
+ delete m_pUserImageList[nImageType];
+ m_pUserImageList[nImageType] = new ImageList;
+
+ return sal_True;
+}
+
+sal_Bool ImageManagerImpl::implts_storeUserImages(
+ ImageType nImageType,
+ const uno::Reference< XStorage >& xUserImageStorage,
+ const uno::Reference< XStorage >& xUserBitmapsStorage )
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bModified )
+ {
+ ImageList* pImageList = implts_getUserImageList( nImageType );
+ if ( pImageList->GetImageCount() > 0 )
+ {
+ ImageListsDescriptor aUserImageListInfo;
+ aUserImageListInfo.pImageList = new ImageListDescriptor;
+
+ ImageListItemDescriptor* pList = new ImageListItemDescriptor;
+ aUserImageListInfo.pImageList->Insert( pList, 0 );
+
+ pList->pImageItemList = new ImageItemListDescriptor;
+ for ( USHORT i=0; i < pImageList->GetImageCount(); i++ )
+ {
+ ImageItemDescriptor* pItem = new ::framework::ImageItemDescriptor;
+
+ pItem->nIndex = i;
+ pItem->aCommandURL = pImageList->GetImageName( i );
+ pList->pImageItemList->Insert( pItem, pList->pImageItemList->Count() );
+ }
+
+ pList->aURL = String::CreateFromAscii("Bitmaps/");
+ pList->aURL += String::CreateFromAscii( BITMAP_FILE_NAMES[nImageType] );
+
+ uno::Reference< XTransactedObject > xTransaction;
+ uno::Reference< XOutputStream > xOutputStream;
+ uno::Reference< XStream > xStream = xUserImageStorage->openStreamElement( rtl::OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ),
+ ElementModes::WRITE|ElementModes::TRUNCATE );
+ if ( xStream.is() )
+ {
+ uno::Reference< XStream > xBitmapStream =
+ xUserBitmapsStorage->openStreamElement( rtl::OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ),
+ ElementModes::WRITE|ElementModes::TRUNCATE );
+ if ( xBitmapStream.is() )
+ {
+ SvStream* pSvStream = utl::UcbStreamHelper::CreateStream( xBitmapStream );
+ {
+ vcl::PNGWriter aPngWriter( pImageList->GetAsHorizontalStrip() );
+ aPngWriter.Write( *pSvStream );
+ }
+ delete pSvStream;
+
+ // Commit user bitmaps storage
+ xTransaction = uno::Reference< XTransactedObject >( xUserBitmapsStorage, UNO_QUERY );
+ if ( xTransaction.is() )
+ xTransaction->commit();
+ }
+
+ xOutputStream = xStream->getOutputStream();
+ if ( xOutputStream.is() )
+ ImagesConfiguration::StoreImages( m_xServiceManager, xOutputStream, aUserImageListInfo );
+
+ // Commit user image storage
+ xTransaction = uno::Reference< XTransactedObject >( xUserImageStorage, UNO_QUERY );
+ if ( xTransaction.is() )
+ xTransaction->commit();
+ }
+
+ return sal_True;
+ }
+ else
+ {
+ // Remove the streams from the storage, if we have no data. We have to catch
+ // the NoSuchElementException as it can be possible that there is no stream at all!
+ try
+ {
+ xUserImageStorage->removeElement( rtl::OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ));
+ }
+ catch ( ::com::sun::star::container::NoSuchElementException& )
+ {
+ }
+
+ try
+ {
+ xUserBitmapsStorage->removeElement( rtl::OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ));
+ }
+ catch ( ::com::sun::star::container::NoSuchElementException& )
+ {
+ }
+
+ uno::Reference< XTransactedObject > xTransaction;
+
+ // Commit user image storage
+ xTransaction = uno::Reference< XTransactedObject >( xUserImageStorage, UNO_QUERY );
+ if ( xTransaction.is() )
+ xTransaction->commit();
+
+ // Commit user bitmaps storage
+ xTransaction = uno::Reference< XTransactedObject >( xUserBitmapsStorage, UNO_QUERY );
+ if ( xTransaction.is() )
+ xTransaction->commit();
+
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+const rtl::Reference< GlobalImageList >& ImageManagerImpl::implts_getGlobalImageList()
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( !m_pGlobalImageList.is() )
+ m_pGlobalImageList = getGlobalImageList( m_xServiceManager );
+ return m_pGlobalImageList;
+}
+
+CmdImageList* ImageManagerImpl::implts_getDefaultImageList()
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( !m_pDefaultImageList )
+ m_pDefaultImageList = new CmdImageList( m_xServiceManager, m_aModuleIdentifier );
+
+ return m_pDefaultImageList;
+}
+
+ImageManagerImpl::ImageManagerImpl( const uno::Reference< XMultiServiceFactory >& xServiceManager,const uno::Reference< XInterface >& _xOwner,bool _bUseGlobal ) :
+ ThreadHelpBase( &Application::GetSolarMutex() )
+ , m_xServiceManager( xServiceManager )
+ , m_xOwner(_xOwner)
+ , m_pDefaultImageList( 0 )
+ , m_aXMLPostfix( RTL_CONSTASCII_USTRINGPARAM( ".xml" ))
+ , m_aResourceString( RTL_CONSTASCII_USTRINGPARAM( ModuleImageList ))
+ , m_aListenerContainer( m_aLock.getShareableOslMutex() )
+ , m_bUseGlobal(_bUseGlobal)
+ , m_bReadOnly( true )
+ , m_bInitialized( false )
+ , m_bModified( false )
+ , m_bConfigRead( false )
+ , m_bDisposed( false )
+{
+ for ( sal_Int32 n=0; n < ImageType_COUNT; n++ )
+ {
+ m_pUserImageList[n] = 0;
+ m_bUserImageListModified[n] = false;
+ }
+}
+
+ImageManagerImpl::~ImageManagerImpl()
+{
+ clear();
+}
+
+void ImageManagerImpl::dispose()
+{
+ css::lang::EventObject aEvent( m_xOwner );
+ m_aListenerContainer.disposeAndClear( aEvent );
+
+ {
+ ResetableGuard aGuard( m_aLock );
+ m_xUserConfigStorage.clear();
+ m_xUserImageStorage.clear();
+ m_xUserRootCommit.clear();
+ m_bConfigRead = false;
+ m_bModified = false;
+ m_bDisposed = true;
+
+ // delete user and default image list on dispose
+ for ( sal_Int32 n=0; n < ImageType_COUNT; n++ )
+ {
+ delete m_pUserImageList[n];
+ m_pUserImageList[n] = 0;
+ }
+ delete m_pDefaultImageList;
+ m_pDefaultImageList = 0;
+ }
+
+}
+void ImageManagerImpl::addEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
+{
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+ }
+
+ m_aListenerContainer.addInterface( ::getCppuType( ( const uno::Reference< XEventListener >* ) NULL ), xListener );
+}
+
+void ImageManagerImpl::removeEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
+{
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ m_aListenerContainer.removeInterface( ::getCppuType( ( const uno::Reference< XEventListener >* ) NULL ), xListener );
+}
+
+// XInitialization
+void ImageManagerImpl::initialize( const Sequence< Any >& aArguments )
+{
+ ResetableGuard aLock( m_aLock );
+
+ if ( !m_bInitialized )
+ {
+ for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
+ {
+ PropertyValue aPropValue;
+ if ( aArguments[n] >>= aPropValue )
+ {
+ if ( aPropValue.Name.equalsAscii( "UserConfigStorage" ))
+ {
+ aPropValue.Value >>= m_xUserConfigStorage;
+ }
+ else if ( aPropValue.Name.equalsAscii( "ModuleIdentifier" ))
+ {
+ aPropValue.Value >>= m_aModuleIdentifier;
+ }
+ else if ( aPropValue.Name.equalsAscii( "UserRootCommit" ))
+ {
+ aPropValue.Value >>= m_xUserRootCommit;
+ }
+ }
+ }
+
+ if ( m_xUserConfigStorage.is() )
+ {
+ uno::Reference< XPropertySet > xPropSet( m_xUserConfigStorage, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ long nOpenMode = 0;
+ if ( xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" ))) >>= nOpenMode )
+ m_bReadOnly = !( nOpenMode & ElementModes::WRITE );
+ }
+ }
+
+ implts_initialize();
+
+ m_bInitialized = true;
+ }
+}
+
+// XImageManagerImpl
+void ImageManagerImpl::reset()
+throw (::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aLock( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ std::vector< OUString > aUserImageNames;
+
+ for ( sal_Int32 i = 0; i < ImageType_COUNT; i++ )
+ {
+ aUserImageNames.clear();
+ ImageList* pImageList = implts_getUserImageList( ImageType(i));
+ pImageList->GetImageNames( aUserImageNames );
+
+ Sequence< rtl::OUString > aRemoveList( aUserImageNames.size() );
+ const sal_uInt32 nCount = aUserImageNames.size();
+ for ( sal_uInt32 j = 0; j < nCount; j++ )
+ aRemoveList[j] = aUserImageNames[j];
+
+ // Remove images
+ removeImages( sal_Int16( i ), aRemoveList );
+ m_bUserImageListModified[i] = true;
+ }
+
+ m_bModified = sal_True;
+}
+
+Sequence< ::rtl::OUString > ImageManagerImpl::getAllImageNames( ::sal_Int16 nImageType )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aLock( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ ImageNameMap aImageCmdNameMap;
+
+ sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
+
+ sal_uInt32 i( 0 );
+ if ( m_bUseGlobal )
+ {
+ rtl::Reference< GlobalImageList > rGlobalImageList = implts_getGlobalImageList();
+
+ const std::vector< OUString >& rGlobalImageNameVector = rGlobalImageList->getImageCommandNames();
+ const sal_uInt32 nGlobalCount = rGlobalImageNameVector.size();
+ for ( i = 0; i < nGlobalCount; i++ )
+ aImageCmdNameMap.insert( ImageNameMap::value_type( rGlobalImageNameVector[i], sal_True ));
+
+ const std::vector< OUString >& rModuleImageNameVector = implts_getDefaultImageList()->getImageCommandNames();
+ const sal_uInt32 nModuleCount = rModuleImageNameVector.size();
+ for ( i = 0; i < nModuleCount; i++ )
+ aImageCmdNameMap.insert( ImageNameMap::value_type( rModuleImageNameVector[i], sal_True ));
+ }
+
+ ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
+ std::vector< OUString > rUserImageNames;
+ pImageList->GetImageNames( rUserImageNames );
+ const sal_uInt32 nUserCount = rUserImageNames.size();
+ for ( i = 0; i < nUserCount; i++ )
+ aImageCmdNameMap.insert( ImageNameMap::value_type( rUserImageNames[i], sal_True ));
+
+ Sequence< OUString > aImageNameSeq( aImageCmdNameMap.size() );
+ ImageNameMap::const_iterator pIter;
+ i = 0;
+ for ( pIter = aImageCmdNameMap.begin(); pIter != aImageCmdNameMap.end(); pIter++ )
+ aImageNameSeq[i++] = pIter->first;
+
+ return aImageNameSeq;
+}
+
+::sal_Bool ImageManagerImpl::hasImage( ::sal_Int16 nImageType, const ::rtl::OUString& aCommandURL )
+throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aLock( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE ))
+ throw IllegalArgumentException();
+
+ sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
+ if ( m_bUseGlobal && implts_getGlobalImageList()->hasImage( nIndex, aCommandURL ))
+ return sal_True;
+ else
+ {
+ if ( m_bUseGlobal && implts_getDefaultImageList()->hasImage( nIndex, aCommandURL ))
+ return sal_True;
+ else
+ {
+ // User layer
+ ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
+ if ( pImageList )
+ return ( pImageList->GetImagePos( aCommandURL ) != IMAGELIST_IMAGE_NOTFOUND );
+ }
+ }
+
+ return sal_False;
+}
+
+Sequence< uno::Reference< XGraphic > > ImageManagerImpl::getImages(
+ ::sal_Int16 nImageType,
+ const Sequence< ::rtl::OUString >& aCommandURLSequence )
+throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
+{
+ ResetableGuard aLock( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE ))
+ throw IllegalArgumentException();
+
+ Sequence< uno::Reference< XGraphic > > aGraphSeq( aCommandURLSequence.getLength() );
+
+ const rtl::OUString* aStrArray = aCommandURLSequence.getConstArray();
+
+ sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
+ rtl::Reference< GlobalImageList > rGlobalImageList;
+ CmdImageList* pDefaultImageList = NULL;
+ if ( m_bUseGlobal )
+ {
+ rGlobalImageList = implts_getGlobalImageList();
+ pDefaultImageList = implts_getDefaultImageList();
+ }
+ ImageList* pUserImageList = implts_getUserImageList( ImageType( nIndex ));
+
+ // We have to search our image list in the following order:
+ // 1. user image list (read/write)
+ // 2. module image list (read)
+ // 3. global image list (read)
+ for ( sal_Int32 n = 0; n < aCommandURLSequence.getLength(); n++ )
+ {
+ Image aImage = pUserImageList->GetImage( aStrArray[n] );
+ if ( !aImage && m_bUseGlobal )
+ {
+ aImage = pDefaultImageList->getImageFromCommandURL( nIndex, aStrArray[n] );
+ if ( !aImage )
+ aImage = rGlobalImageList->getImageFromCommandURL( nIndex, aStrArray[n] );
+ }
+
+ aGraphSeq[n] = aImage.GetXGraphic();
+ }
+
+ return aGraphSeq;
+}
+
+void ImageManagerImpl::replaceImages(
+ ::sal_Int16 nImageType,
+ const Sequence< ::rtl::OUString >& aCommandURLSequence,
+ const Sequence< uno::Reference< XGraphic > >& aGraphicsSequence )
+throw ( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::IllegalAccessException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ CmdToXGraphicNameAccess* pInsertedImages( 0 );
+ CmdToXGraphicNameAccess* pReplacedImages( 0 );
+
+ {
+ ResetableGuard aLock( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if (( aCommandURLSequence.getLength() != aGraphicsSequence.getLength() ) ||
+ (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE )))
+ throw IllegalArgumentException();
+
+ if ( m_bReadOnly )
+ throw IllegalAccessException();
+
+ sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
+ ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
+
+ uno::Reference< XGraphic > xGraphic;
+ for ( sal_Int32 i = 0; i < aCommandURLSequence.getLength(); i++ )
+ {
+ // Check size and scale. If we don't have any graphics ignore it
+ if ( !implts_checkAndScaleGraphic( xGraphic, aGraphicsSequence[i], nIndex ))
+ continue;
+
+ USHORT nPos = pImageList->GetImagePos( aCommandURLSequence[i] );
+ if ( nPos == IMAGELIST_IMAGE_NOTFOUND )
+ {
+ pImageList->AddImage( aCommandURLSequence[i], xGraphic );
+ if ( !pInsertedImages )
+ pInsertedImages = new CmdToXGraphicNameAccess();
+ pInsertedImages->addElement( aCommandURLSequence[i], xGraphic );
+ }
+ else
+ {
+ pImageList->ReplaceImage( aCommandURLSequence[i], xGraphic );
+ if ( !pReplacedImages )
+ pReplacedImages = new CmdToXGraphicNameAccess();
+ pReplacedImages->addElement( aCommandURLSequence[i], xGraphic );
+ }
+ }
+
+ if (( pInsertedImages != 0 ) || ( pReplacedImages != 0 ))
+ {
+ m_bModified = sal_True;
+ m_bUserImageListModified[nIndex] = true;
+ }
+ }
+
+ // Notify listeners
+ if ( pInsertedImages != 0 )
+ {
+ ConfigurationEvent aInsertEvent;
+ aInsertEvent.aInfo <<= nImageType;
+ aInsertEvent.Accessor <<= m_xOwner;
+ aInsertEvent.Source = m_xOwner;
+ aInsertEvent.ResourceURL = m_aResourceString;
+ aInsertEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
+ static_cast< OWeakObject *>( pInsertedImages ), UNO_QUERY ));
+ implts_notifyContainerListener( aInsertEvent, NotifyOp_Insert );
+ }
+ if ( pReplacedImages != 0 )
+ {
+ ConfigurationEvent aReplaceEvent;
+ aReplaceEvent.aInfo <<= nImageType;
+ aReplaceEvent.Accessor <<= m_xOwner;
+ aReplaceEvent.Source = m_xOwner;
+ aReplaceEvent.ResourceURL = m_aResourceString;
+ aReplaceEvent.ReplacedElement = Any();
+ aReplaceEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
+ static_cast< OWeakObject *>( pReplacedImages ), UNO_QUERY ));
+ implts_notifyContainerListener( aReplaceEvent, NotifyOp_Replace );
+ }
+}
+
+void ImageManagerImpl::removeImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
+throw ( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::IllegalAccessException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ CmdToXGraphicNameAccess* pRemovedImages( 0 );
+ CmdToXGraphicNameAccess* pReplacedImages( 0 );
+
+ {
+ ResetableGuard aLock( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE ))
+ throw IllegalArgumentException();
+
+ if ( m_bReadOnly )
+ throw IllegalAccessException();
+
+ sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
+ rtl::Reference< GlobalImageList > rGlobalImageList;
+ CmdImageList* pDefaultImageList = NULL;
+ if ( m_bUseGlobal )
+ {
+ rGlobalImageList = implts_getGlobalImageList();
+ pDefaultImageList = implts_getDefaultImageList();
+ }
+ ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
+ uno::Reference< XGraphic > xEmptyGraphic( Image().GetXGraphic() );
+
+ for ( sal_Int32 i = 0; i < aCommandURLSequence.getLength(); i++ )
+ {
+ USHORT nPos = pImageList->GetImagePos( aCommandURLSequence[i] );
+ if ( nPos != IMAGELIST_IMAGE_NOTFOUND )
+ {
+ Image aImage = pImageList->GetImage( nPos );
+ USHORT nId = pImageList->GetImageId( nPos );
+ pImageList->RemoveImage( nId );
+
+ if ( m_bUseGlobal )
+ {
+ // Check, if we have a image in our module/global image list. If we find one =>
+ // this is a replace instead of a remove operation!
+ Image aNewImage = pDefaultImageList->getImageFromCommandURL( nIndex, aCommandURLSequence[i] );
+ if ( !aNewImage )
+ aNewImage = rGlobalImageList->getImageFromCommandURL( nIndex, aCommandURLSequence[i] );
+ if ( !aNewImage )
+ {
+ if ( !pRemovedImages )
+ pRemovedImages = new CmdToXGraphicNameAccess();
+ pRemovedImages->addElement( aCommandURLSequence[i], xEmptyGraphic );
+ }
+ else
+ {
+ if ( !pReplacedImages )
+ pReplacedImages = new CmdToXGraphicNameAccess();
+ pReplacedImages->addElement( aCommandURLSequence[i], aNewImage.GetXGraphic() );
+ }
+ } // if ( m_bUseGlobal )
+ else
+ {
+ if ( !pRemovedImages )
+ pRemovedImages = new CmdToXGraphicNameAccess();
+ pRemovedImages->addElement( aCommandURLSequence[i], xEmptyGraphic );
+ }
+ }
+ }
+
+ if (( pReplacedImages != 0 ) || ( pRemovedImages != 0 ))
+ {
+ m_bModified = sal_True;
+ m_bUserImageListModified[nIndex] = true;
+ }
+ }
+
+ // Notify listeners
+ if ( pRemovedImages != 0 )
+ {
+ ConfigurationEvent aRemoveEvent;
+ aRemoveEvent.aInfo = uno::makeAny( nImageType );
+ aRemoveEvent.Accessor = uno::makeAny( m_xOwner );
+ aRemoveEvent.Source = m_xOwner;
+ aRemoveEvent.ResourceURL = m_aResourceString;
+ aRemoveEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
+ static_cast< OWeakObject *>( pRemovedImages ), UNO_QUERY ));
+ implts_notifyContainerListener( aRemoveEvent, NotifyOp_Remove );
+ }
+ if ( pReplacedImages != 0 )
+ {
+ ConfigurationEvent aReplaceEvent;
+ aReplaceEvent.aInfo = uno::makeAny( nImageType );
+ aReplaceEvent.Accessor = uno::makeAny( m_xOwner );
+ aReplaceEvent.Source = m_xOwner;
+ aReplaceEvent.ResourceURL = m_aResourceString;
+ aReplaceEvent.ReplacedElement = Any();
+ aReplaceEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
+ static_cast< OWeakObject *>( pReplacedImages ), UNO_QUERY ));
+ implts_notifyContainerListener( aReplaceEvent, NotifyOp_Replace );
+ }
+}
+
+void ImageManagerImpl::insertImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
+throw ( ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::IllegalAccessException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ replaceImages(nImageType,aCommandURLSequence,aGraphicSequence);
+}
+
+
+// XUIConfigurationPersistence
+void ImageManagerImpl::reload()
+throw ( ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException )
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ CommandMap aOldUserCmdImageSet;
+ std::vector< rtl::OUString > aNewUserCmdImageSet;
+
+ if ( m_bModified )
+ {
+ for ( sal_Int16 i = 0; i < sal_Int16( ImageType_COUNT ); i++ )
+ {
+ if ( !m_bDisposed && m_bUserImageListModified[i] )
+ {
+ std::vector< rtl::OUString > aOldUserCmdImageVector;
+ ImageList* pImageList = implts_getUserImageList( (ImageType)i );
+ pImageList->GetImageNames( aOldUserCmdImageVector );
+
+ // Fill hash map to speed up search afterwards
+ sal_uInt32 j( 0 );
+ const sal_uInt32 nOldCount = aOldUserCmdImageVector.size();
+ for ( j = 0; j < nOldCount; j++ )
+ aOldUserCmdImageSet.insert( CommandMap::value_type( aOldUserCmdImageVector[j], false ));
+
+ // Attention: This can make the old image list pointer invalid!
+ implts_loadUserImages( (ImageType)i, m_xUserImageStorage, m_xUserBitmapsStorage );
+ pImageList = implts_getUserImageList( (ImageType)i );
+ pImageList->GetImageNames( aNewUserCmdImageSet );
+
+ CmdToXGraphicNameAccess* pInsertedImages( 0 );
+ CmdToXGraphicNameAccess* pReplacedImages( 0 );
+ CmdToXGraphicNameAccess* pRemovedImages( 0 );
+
+ const sal_uInt32 nNewCount = aNewUserCmdImageSet.size();
+ for ( j = 0; j < nNewCount; j++ )
+ {
+ CommandMap::iterator pIter = aOldUserCmdImageSet.find( aNewUserCmdImageSet[j] );
+ if ( pIter != aOldUserCmdImageSet.end() )
+ {
+ pIter->second = true; // mark entry as replaced
+ if ( !pReplacedImages )
+ pReplacedImages = new CmdToXGraphicNameAccess();
+ pReplacedImages->addElement( aNewUserCmdImageSet[j],
+ pImageList->GetImage( aNewUserCmdImageSet[j] ).GetXGraphic() );
+ }
+ else
+ {
+ if ( !pInsertedImages )
+ pInsertedImages = new CmdToXGraphicNameAccess();
+ pInsertedImages->addElement( aNewUserCmdImageSet[j],
+ pImageList->GetImage( aNewUserCmdImageSet[j] ).GetXGraphic() );
+ }
+ }
+
+ // Search map for unmarked entries => they have been removed from the user list
+ // through this reload operation.
+ // We have to search the module and global image list!
+ rtl::Reference< GlobalImageList > rGlobalImageList;
+ CmdImageList* pDefaultImageList = NULL;
+ if ( m_bUseGlobal )
+ {
+ rGlobalImageList = implts_getGlobalImageList();
+ pDefaultImageList = implts_getDefaultImageList();
+ }
+ uno::Reference< XGraphic > xEmptyGraphic( Image().GetXGraphic() );
+ CommandMap::const_iterator pIter = aOldUserCmdImageSet.begin();
+ while ( pIter != aOldUserCmdImageSet.end() )
+ {
+ if ( !pIter->second )
+ {
+ if ( m_bUseGlobal )
+ {
+ Image aImage = pDefaultImageList->getImageFromCommandURL( i, pIter->first );
+ if ( !aImage )
+ aImage = rGlobalImageList->getImageFromCommandURL( i, pIter->first );
+
+ if ( !aImage )
+ {
+ // No image in the module/global image list => remove user image
+ if ( !pRemovedImages )
+ pRemovedImages = new CmdToXGraphicNameAccess();
+ pRemovedImages->addElement( pIter->first, xEmptyGraphic );
+ }
+ else
+ {
+ // Image has been found in the module/global image list => replace user image
+ if ( !pReplacedImages )
+ pReplacedImages = new CmdToXGraphicNameAccess();
+ pReplacedImages->addElement( pIter->first, aImage.GetXGraphic() );
+ }
+ } // if ( m_bUseGlobal )
+ else
+ {
+ // No image in the user image list => remove user image
+ if ( !pRemovedImages )
+ pRemovedImages = new CmdToXGraphicNameAccess();
+ pRemovedImages->addElement( pIter->first, xEmptyGraphic );
+ }
+ }
+ ++pIter;
+ }
+
+ aGuard.unlock();
+
+ // Now notify our listeners. Unlock mutex to prevent deadlocks
+ if ( pInsertedImages != 0 )
+ {
+ ConfigurationEvent aInsertEvent;
+ aInsertEvent.aInfo = uno::makeAny( i );
+ aInsertEvent.Accessor = uno::makeAny( m_xOwner );
+ aInsertEvent.Source = m_xOwner;
+ aInsertEvent.ResourceURL = m_aResourceString;
+ aInsertEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
+ static_cast< OWeakObject *>( pInsertedImages ), UNO_QUERY ));
+ implts_notifyContainerListener( aInsertEvent, NotifyOp_Insert );
+ }
+ if ( pReplacedImages != 0 )
+ {
+ ConfigurationEvent aReplaceEvent;
+ aReplaceEvent.aInfo = uno::makeAny( i );
+ aReplaceEvent.Accessor = uno::makeAny( m_xOwner );
+ aReplaceEvent.Source = m_xOwner;
+ aReplaceEvent.ResourceURL = m_aResourceString;
+ aReplaceEvent.ReplacedElement = Any();
+ aReplaceEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
+ static_cast< OWeakObject *>( pReplacedImages ), UNO_QUERY ));
+ implts_notifyContainerListener( aReplaceEvent, NotifyOp_Replace );
+ }
+ if ( pRemovedImages != 0 )
+ {
+ ConfigurationEvent aRemoveEvent;
+ aRemoveEvent.aInfo = uno::makeAny( i );
+ aRemoveEvent.Accessor = uno::makeAny( m_xOwner );
+ aRemoveEvent.Source = m_xOwner;
+ aRemoveEvent.ResourceURL = m_aResourceString;
+ aRemoveEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
+ static_cast< OWeakObject *>( pRemovedImages ), UNO_QUERY ));
+ implts_notifyContainerListener( aRemoveEvent, NotifyOp_Remove );
+ }
+
+ aGuard.lock();
+ }
+ }
+ }
+}
+
+void ImageManagerImpl::store()
+throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_bModified )
+ {
+ sal_Bool bWritten( sal_False );
+ for ( sal_Int32 i = 0; i < ImageType_COUNT; i++ )
+ {
+ sal_Bool bSuccess = implts_storeUserImages( ImageType(i), m_xUserImageStorage, m_xUserBitmapsStorage );
+ if ( bSuccess )
+ bWritten = sal_True;
+ m_bUserImageListModified[i] = false;
+ }
+
+ if ( bWritten &&
+ m_xUserConfigStorage.is() )
+ {
+ uno::Reference< XTransactedObject > xUserConfigStorageCommit( m_xUserConfigStorage, UNO_QUERY );
+ if ( xUserConfigStorageCommit.is() )
+ xUserConfigStorageCommit->commit();
+ if ( m_xUserRootCommit.is() )
+ m_xUserRootCommit->commit();
+ }
+
+ m_bModified = sal_False;
+ }
+}
+
+void ImageManagerImpl::storeToStorage( const uno::Reference< XStorage >& Storage )
+throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_bModified && Storage.is() )
+ {
+ long nModes = ElementModes::READWRITE;
+
+ uno::Reference< XStorage > xUserImageStorage = Storage->openStorageElement( OUString::createFromAscii( IMAGE_FOLDER ),
+ nModes );
+ if ( xUserImageStorage.is() )
+ {
+ uno::Reference< XStorage > xUserBitmapsStorage = xUserImageStorage->openStorageElement( OUString::createFromAscii( BITMAPS_FOLDER ),
+ nModes );
+ for ( sal_Int32 i = 0; i < ImageType_COUNT; i++ )
+ {
+ implts_getUserImageList( (ImageType)i );
+ implts_storeUserImages( (ImageType)i, xUserImageStorage, xUserBitmapsStorage );
+ }
+
+ uno::Reference< XTransactedObject > xTransaction( Storage, UNO_QUERY );
+ if ( xTransaction.is() )
+ xTransaction->commit();
+ }
+ }
+}
+
+sal_Bool ImageManagerImpl::isModified()
+throw (::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+ return m_bModified;
+}
+
+sal_Bool ImageManagerImpl::isReadOnly() throw (::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+ return m_bReadOnly;
+}
+// XUIConfiguration
+void ImageManagerImpl::addConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+ }
+
+ m_aListenerContainer.addInterface( ::getCppuType( ( const uno::Reference< XUIConfigurationListener >* ) NULL ), xListener );
+}
+
+void ImageManagerImpl::removeConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ m_aListenerContainer.removeInterface( ::getCppuType( ( const uno::Reference< XUIConfigurationListener >* ) NULL ), xListener );
+}
+
+
+void ImageManagerImpl::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp )
+{
+ ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer(
+ ::getCppuType( ( const css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >*) NULL ) );
+ if ( pContainer != NULL )
+ {
+ ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
+ while ( pIterator.hasMoreElements() )
+ {
+ try
+ {
+ switch ( eOp )
+ {
+ case NotifyOp_Replace:
+ ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementReplaced( aEvent );
+ break;
+ case NotifyOp_Insert:
+ ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementInserted( aEvent );
+ break;
+ case NotifyOp_Remove:
+ ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementRemoved( aEvent );
+ break;
+ }
+ }
+ catch( css::uno::RuntimeException& )
+ {
+ pIterator.remove();
+ }
+ }
+ }
+}
+void ImageManagerImpl::clear()
+{
+ ResetableGuard aGuard( m_aLock );
+ for ( sal_Int32 n = 0; n < ImageType_COUNT; n++ )
+ {
+ delete m_pUserImageList[n];
+ m_pUserImageList[n] = 0;
+ }
+}
+} // namespace framework
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.hxx b/framework/source/uiconfiguration/imagemanagerimpl.hxx
new file mode 100755
index 0000000000..e5201e9a9b
--- /dev/null
+++ b/framework/source/uiconfiguration/imagemanagerimpl.hxx
@@ -0,0 +1,225 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: imagemanager.hxx,v $
+ * $Revision: 1.7.82.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 __FRAMEWORK_UICONFIGURATION_IMAGEMANAGERIMPL_HXX_
+#define __FRAMEWORK_UICONFIGURATION_IMAGEMANAGERIMPL_HXX_
+
+
+/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
+ with solaris headers ...
+*/
+#include <vector>
+#include <list>
+#include <hash_map>
+
+//_________________________________________________________________________________________________________________
+// my own includes
+//_________________________________________________________________________________________________________________
+#include <threadhelp/threadhelpbase.hxx>
+#include <macros/generic.hxx>
+#include <macros/xinterface.hxx>
+#include <macros/xtypeprovider.hxx>
+#include <macros/xserviceinfo.hxx>
+#include <stdtypes.h>
+#include <uiconfiguration/imagetype.hxx>
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
+#include <com/sun/star/ui/XUIConfigurationStorage.hpp>
+#include <com/sun/star/ui/XUIConfiguration.hpp>
+#include <com/sun/star/ui/XImageManager.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/ui/ConfigurationEvent.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/ui/XImageManager.hpp>
+
+//_________________________________________________________________________________________________________________
+// other includes
+//_________________________________________________________________________________________________________________
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <rtl/ustring.hxx>
+
+#include <vcl/image.hxx>
+#include <tools/color.hxx>
+#include <rtl/ref.hxx>
+
+#include <vector>
+
+namespace framework
+{
+ class CmdImageList
+ {
+ public:
+ CmdImageList( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
+ const ::rtl::OUString& aModuleIdentifier );
+ virtual ~CmdImageList();
+
+ virtual Image getImageFromCommandURL( sal_Int16 nImageType, const rtl::OUString& rCommandURL );
+ virtual bool hasImage( sal_Int16 nImageType, const rtl::OUString& rCommandURL );
+ virtual ::std::vector< rtl::OUString >& getImageNames();
+ virtual ::std::vector< rtl::OUString >& getImageCommandNames();
+
+ protected:
+ void impl_fillCommandToImageNameMap();
+ ImageList* impl_getImageList( sal_Int16 nImageType );
+ std::vector< ::rtl::OUString >& impl_getImageNameVector();
+ std::vector< ::rtl::OUString >& impl_getImageCommandNameVector();
+
+ private:
+ sal_Bool m_bVectorInit;
+ rtl::OUString m_aModuleIdentifier;
+ ImageList* m_pImageList[ImageType_COUNT];
+ CommandToImageNameMap m_aCommandToImageNameMap;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::std::vector< rtl::OUString > m_aImageNameVector;
+ ::std::vector< rtl::OUString > m_aImageCommandNameVector;
+ sal_Int16 m_nSymbolsStyle;
+ };
+
+ class GlobalImageList : public CmdImageList, public rtl::IReference
+ {
+ public:
+ GlobalImageList( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
+ virtual ~GlobalImageList();
+
+ virtual Image getImageFromCommandURL( sal_Int16 nImageType, const rtl::OUString& rCommandURL );
+ virtual bool hasImage( sal_Int16 nImageType, const rtl::OUString& rCommandURL );
+ virtual ::std::vector< rtl::OUString >& getImageNames();
+ virtual ::std::vector< rtl::OUString >& getImageCommandNames();
+
+ // ÍReference
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+ private:
+ oslInterlockedCount m_nRefCount;
+ };
+
+ class ImageManagerImpl : public ThreadHelpBase // Struct for right initalization of mutex member! Must be first of baseclasses.
+ {
+ public:
+
+ ImageManagerImpl(const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager
+ ,const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& _xOwner
+ ,bool _bUseGlobal);
+ ~ImageManagerImpl();
+
+ void dispose();
+ void initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
+ void addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ void removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XImageManager
+ void reset() throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > getAllImageNames( ::sal_Int16 nImageType ) throw (::com::sun::star::uno::RuntimeException);
+ ::sal_Bool hasImage( ::sal_Int16 nImageType, const ::rtl::OUString& aCommandURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > getImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ void replaceImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& aGraphicsSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
+ void removeImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aResourceURLSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
+ void insertImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& aGraphicSequence ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
+
+ // XUIConfiguration
+ void addConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ void removeConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XUIConfigurationPersistence
+ void reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ void store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ void storeToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ sal_Bool isModified() throw (::com::sun::star::uno::RuntimeException);
+ sal_Bool isReadOnly() throw (::com::sun::star::uno::RuntimeException);
+
+ void clear();
+
+ typedef std::hash_map< rtl::OUString,
+ sal_Bool,
+ OUStringHashCode,
+ ::std::equal_to< ::rtl::OUString > > ImageNameMap;
+
+ enum Layer
+ {
+ LAYER_DEFAULT,
+ LAYER_USERDEFINED,
+ LAYER_COUNT
+ };
+
+ enum NotifyOp
+ {
+ NotifyOp_Remove,
+ NotifyOp_Insert,
+ NotifyOp_Replace
+ };
+
+ typedef ::std::vector< ::com::sun::star::ui::ConfigurationEvent > ConfigEventNotifyContainer;
+
+ // private methods
+ void implts_initialize();
+ void implts_notifyContainerListener( const ::com::sun::star::ui::ConfigurationEvent& aEvent, NotifyOp eOp );
+ ImageList* implts_getUserImageList( ImageType nImageType );
+ sal_Bool implts_loadUserImages( ImageType nImageType,
+ const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xUserImageStorage,
+ const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xUserBitmapsStorage );
+ sal_Bool implts_storeUserImages( ImageType nImageType,
+ const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xUserImageStorage,
+ const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xUserBitmapsStorage );
+ const rtl::Reference< GlobalImageList >& implts_getGlobalImageList();
+ CmdImageList* implts_getDefaultImageList();
+
+
+ com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserConfigStorage;
+ com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserImageStorage;
+ com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserBitmapsStorage;
+ com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject > m_xUserRootCommit;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xOwner;
+ rtl::Reference< GlobalImageList > m_pGlobalImageList;
+ CmdImageList* m_pDefaultImageList;
+ rtl::OUString m_aXMLPostfix;
+ rtl::OUString m_aModuleIdentifier;
+ rtl::OUString m_aResourceString;
+ ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
+ ImageList* m_pUserImageList[ImageType_COUNT];
+ bool m_bUserImageListModified[ImageType_COUNT];
+ bool m_bUseGlobal;
+ bool m_bReadOnly;
+ bool m_bInitialized;
+ bool m_bModified;
+ bool m_bConfigRead;
+ bool m_bDisposed;
+ };
+}
+
+#endif // __FRAMEWORK_UICONFIGURATION_IMAGEMANAGERIMPL_HXX_
diff --git a/framework/source/uiconfiguration/makefile.mk b/framework/source/uiconfiguration/makefile.mk
index a78ecaca4d..c7d6eb435d 100644
--- a/framework/source/uiconfiguration/makefile.mk
+++ b/framework/source/uiconfiguration/makefile.mk
@@ -43,11 +43,13 @@ ENABLE_EXCEPTIONS= TRUE
SLOFILES= \
$(SLO)$/uiconfigurationmanager.obj \
+ $(SLO)$/uiconfigurationmanagerimpl.obj \
$(SLO)$/moduleuiconfigurationmanager.obj \
$(SLO)$/moduleuicfgsupplier.obj \
$(SLO)$/windowstateconfiguration.obj \
$(SLO)$/moduleimagemanager.obj \
$(SLO)$/imagemanager.obj \
+ $(SLO)$/imagemanagerimpl.obj \
$(SLO)$/graphicnameaccess.obj \
$(SLO)$/uicategorydescription.obj \
$(SLO)$/globalsettings.obj
diff --git a/framework/source/uiconfiguration/moduleimagemanager.cxx b/framework/source/uiconfiguration/moduleimagemanager.cxx
index 632dbbba38..2273c1d641 100644
--- a/framework/source/uiconfiguration/moduleimagemanager.cxx
+++ b/framework/source/uiconfiguration/moduleimagemanager.cxx
@@ -36,6 +36,7 @@
#include <xml/imagesconfiguration.hxx>
#include <uiconfiguration/graphicnameaccess.hxx>
#include <services.h>
+#include "imagemanagerimpl.hxx"
#include "properties.h"
@@ -67,7 +68,7 @@
#include <unotools/ucbstreamhelper.hxx>
#include <vcl/pngread.hxx>
#include <vcl/pngwrite.hxx>
-#include "svtools/miscopt.hxx"
+#include <rtl/logfile.hxx>
//_________________________________________________________________________________________________________________
// namespaces
@@ -90,668 +91,12 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::ui;
-// Image sizes for our toolbars/menus
-const sal_Int32 IMAGE_SIZE_NORMAL = 16;
-const sal_Int32 IMAGE_SIZE_LARGE = 26;
-const sal_Int16 MAX_IMAGETYPE_VALUE = ::com::sun::star::ui::ImageType::COLOR_HIGHCONTRAST|
- ::com::sun::star::ui::ImageType::SIZE_LARGE;
-
-static const char IMAGE_FOLDER[] = "images";
-static const char BITMAPS_FOLDER[] = "Bitmaps";
-static const char IMAGE_EXTENSION[] = ".png";
-
-static const char* IMAGELIST_XML_FILE[] =
-{
- "sc_imagelist.xml",
- "lc_imagelist.xml",
- "sch_imagelist.xml",
- "lch_imagelist.xml"
-};
-
-static const char* BITMAP_FILE_NAMES[] =
-{
- "sc_userimages.png",
- "lc_userimages.png",
- "sch_userimages.png",
- "lch_userimages.png"
-};
-
namespace framework
{
-
-static osl::Mutex* pImageListWrapperMutex = 0;
-static GlobalImageList* pGlobalImageList = 0;
-static const char* ImageType_Prefixes[ImageType_COUNT] =
-{
- "res/commandimagelist/sc_",
- "res/commandimagelist/lc_",
- "res/commandimagelist/sch_",
- "res/commandimagelist/lch_"
-};
-static char ModuleImageList[] = "private:resource/images/moduleimages";
-
-typedef GraphicNameAccess CmdToXGraphicNameAccess;
-
-static osl::Mutex& getGlobalImageListMutex()
-{
- if ( pImageListWrapperMutex == 0 )
- {
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
- if ( pImageListWrapperMutex == 0 )
- pImageListWrapperMutex = new osl::Mutex;
- }
-
- return *pImageListWrapperMutex;
-}
-
-static GlobalImageList* getGlobalImageList( const uno::Reference< XMultiServiceFactory >& rServiceManager )
-{
- osl::MutexGuard guard( getGlobalImageListMutex() );
-
- if ( pGlobalImageList == 0 )
- pGlobalImageList = new GlobalImageList( rServiceManager );
-
- return pGlobalImageList;
-}
-
-static rtl::OUString getCanonicalName( const rtl::OUString& rFileName )
-{
- bool bRemoveSlash( true );
- sal_Int32 nLength = rFileName.getLength();
- const sal_Unicode* pString = rFileName.getStr();
-
- rtl::OUStringBuffer aBuf( nLength );
- for ( sal_Int32 i = 0; i < nLength; i++ )
- {
- const sal_Unicode c = pString[i];
- switch ( c )
- {
- // map forbidden characters to escape
- case '/' : if ( !bRemoveSlash )
- aBuf.appendAscii( "%2f" );
- break;
- case '\\': aBuf.appendAscii( "%5c" ); bRemoveSlash = false; break;
- case ':' : aBuf.appendAscii( "%3a" ); bRemoveSlash = false; break;
- case '*' : aBuf.appendAscii( "%2a" ); bRemoveSlash = false; break;
- case '?' : aBuf.appendAscii( "%3f" ); bRemoveSlash = false; break;
- case '<' : aBuf.appendAscii( "%3c" ); bRemoveSlash = false; break;
- case '>' : aBuf.appendAscii( "%3e" ); bRemoveSlash = false; break;
- case '|' : aBuf.appendAscii( "%7c" ); bRemoveSlash = false; break;
- default: aBuf.append( c ); bRemoveSlash = false;
- }
- }
- return aBuf.makeStringAndClear();
-}
-
-//_________________________________________________________________________________________________________________
-
-CmdImageList::CmdImageList( const uno::Reference< XMultiServiceFactory >& rServiceManager, const rtl::OUString& aModuleIdentifier ) :
- m_bVectorInit( sal_False ),
- m_aModuleIdentifier( aModuleIdentifier ),
- m_xServiceManager( rServiceManager ),
- m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() )
-{
- for ( sal_Int32 n=0; n < ImageType_COUNT; n++ )
- m_pImageList[n] = 0;
-}
-
-CmdImageList::~CmdImageList()
-{
- for ( sal_Int32 n=0; n < ImageType_COUNT; n++ )
- delete m_pImageList[n];
-}
-
-void CmdImageList::impl_fillCommandToImageNameMap()
-{
- RTL_LOGFILE_CONTEXT( aLog, "framework: CmdImageList::impl_fillCommandToImageNameMap" );
-
- if ( !m_bVectorInit )
- {
- const rtl::OUString aCommandImageList( RTL_CONSTASCII_USTRINGPARAM( UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST ));
- Sequence< OUString > aCmdImageSeq;
- uno::Reference< XNameAccess > xCmdDesc( m_xServiceManager->createInstance(
- SERVICENAME_UICOMMANDDESCRIPTION ),
- UNO_QUERY );
-
- if ( m_aModuleIdentifier.getLength() > 0 )
- {
- // If we have a module identifier - use to retrieve the command image name list from it.
- // Otherwise we will use the global command image list
- try
- {
- xCmdDesc->getByName( m_aModuleIdentifier ) >>= xCmdDesc;
- if ( xCmdDesc.is() )
- xCmdDesc->getByName( aCommandImageList ) >>= aCmdImageSeq;
- }
- catch ( NoSuchElementException& )
- {
- // Module unknown we will work with an empty command image list!
- return;
- }
- }
-
- if ( xCmdDesc.is() )
- {
- try
- {
- xCmdDesc->getByName( aCommandImageList ) >>= aCmdImageSeq;
- }
- catch ( NoSuchElementException& )
- {
- }
- catch ( WrappedTargetException& )
- {
- }
- }
-
- // We have to map commands which uses special characters like '/',':','?','\','<'.'>','|'
- String aExt = String::CreateFromAscii( IMAGE_EXTENSION );
- m_aImageCommandNameVector.resize(aCmdImageSeq.getLength() );
- m_aImageNameVector.resize( aCmdImageSeq.getLength() );
-
- ::std::copy( aCmdImageSeq.getConstArray(),
- aCmdImageSeq.getConstArray()+aCmdImageSeq.getLength(),
- m_aImageCommandNameVector.begin() );
-
- // Create a image name vector that must be provided to the vcl imagelist. We also need
- // a command to image name map to speed up access time for image retrieval.
- OUString aUNOString( RTL_CONSTASCII_USTRINGPARAM( ".uno:" ));
- String aEmptyString;
- for ( sal_uInt32 i = 0; i < m_aImageCommandNameVector.size(); i++ )
- {
- OUString aCommandName( m_aImageCommandNameVector[i] );
- String aImageName;
-
- if ( aCommandName.indexOf( aUNOString ) != 0 )
- {
- INetURLObject aUrlObject( aCommandName, INetURLObject::ENCODE_ALL );
- aImageName = aUrlObject.GetURLPath();
- aImageName = getCanonicalName( aImageName ); // convert to valid filename
- }
- else
- {
- // just remove the schema
- if ( aCommandName.getLength() > 5 )
- aImageName = aCommandName.copy( 5 );
- else
- aImageName = aEmptyString;
-
- // Search for query part.
- sal_Int32 nIndex = aImageName.Search( '?' );
- if ( nIndex != STRING_NOTFOUND )
- aImageName = getCanonicalName( aImageName ); // convert to valid filename
- }
- // Image names are not case-dependent. Always use lower case characters to
- // reflect this.
- aImageName += aExt;
- aImageName.ToLowerAscii();
-
- m_aImageNameVector[i] = aImageName;
- m_aCommandToImageNameMap.insert( CommandToImageNameMap::value_type( aCommandName, aImageName ));
- }
-
- m_bVectorInit = sal_True;
- }
-}
-
-ImageList* CmdImageList::impl_getImageList( sal_Int16 nImageType )
-{
- SvtMiscOptions aMiscOptions;
-
- sal_Int16 nSymbolsStyle = aMiscOptions.GetCurrentSymbolsStyle();
- if ( nSymbolsStyle != m_nSymbolsStyle )
- {
- m_nSymbolsStyle = nSymbolsStyle;
- for ( sal_Int32 n=0; n < ImageType_COUNT; n++ )
- delete m_pImageList[n], m_pImageList[n] = NULL;
- }
-
- if ( !m_pImageList[nImageType] )
- {
- m_pImageList[nImageType] = new ImageList( m_aImageNameVector,
- OUString::createFromAscii( ImageType_Prefixes[nImageType] ) );
- }
-
- return m_pImageList[nImageType];
-}
-
-std::vector< ::rtl::OUString >& CmdImageList::impl_getImageNameVector()
-{
- return m_aImageNameVector;
-}
-
-std::vector< rtl::OUString >& CmdImageList::impl_getImageCommandNameVector()
-{
- return m_aImageCommandNameVector;
-}
-
-Image CmdImageList::getImageFromCommandURL( sal_Int16 nImageType, const rtl::OUString& rCommandURL )
-{
- impl_fillCommandToImageNameMap();
- CommandToImageNameMap::const_iterator pIter = m_aCommandToImageNameMap.find( rCommandURL );
- if ( pIter != m_aCommandToImageNameMap.end() )
- {
- ImageList* pImageList = impl_getImageList( nImageType );
- return pImageList->GetImage( pIter->second );
- }
-
- return Image();
-}
-
-bool CmdImageList::hasImage( sal_Int16 /*nImageType*/, const rtl::OUString& rCommandURL )
-{
- impl_fillCommandToImageNameMap();
- CommandToImageNameMap::const_iterator pIter = m_aCommandToImageNameMap.find( rCommandURL );
- if ( pIter != m_aCommandToImageNameMap.end() )
- return true;
- else
- return false;
-}
-
-::std::vector< rtl::OUString >& CmdImageList::getImageNames()
-{
- return impl_getImageNameVector();
-}
-
-::std::vector< rtl::OUString >& CmdImageList::getImageCommandNames()
-{
- return impl_getImageCommandNameVector();
-}
-
-//_________________________________________________________________________________________________________________
-
-GlobalImageList::GlobalImageList( const uno::Reference< XMultiServiceFactory >& rServiceManager ) :
- CmdImageList( rServiceManager, rtl::OUString() ),
- m_nRefCount( 0 )
-{
-}
-
-GlobalImageList::~GlobalImageList()
-{
-}
-
-Image GlobalImageList::getImageFromCommandURL( sal_Int16 nImageType, const rtl::OUString& rCommandURL )
-{
- osl::MutexGuard guard( getGlobalImageListMutex() );
- return CmdImageList::getImageFromCommandURL( nImageType, rCommandURL );
-}
-
-bool GlobalImageList::hasImage( sal_Int16 nImageType, const rtl::OUString& rCommandURL )
-{
- osl::MutexGuard guard( getGlobalImageListMutex() );
- return CmdImageList::hasImage( nImageType, rCommandURL );
-}
-
-::std::vector< rtl::OUString >& GlobalImageList::getImageNames()
-{
- osl::MutexGuard guard( getGlobalImageListMutex() );
- return impl_getImageNameVector();
-}
-
-::std::vector< rtl::OUString >& GlobalImageList::getImageCommandNames()
-{
- osl::MutexGuard guard( getGlobalImageListMutex() );
- return impl_getImageCommandNameVector();
-}
-
-oslInterlockedCount GlobalImageList::acquire()
-{
- osl_incrementInterlockedCount( &m_nRefCount );
- return m_nRefCount;
-}
-
-oslInterlockedCount GlobalImageList::release()
-{
- osl::MutexGuard guard( getGlobalImageListMutex() );
-
- if ( !osl_decrementInterlockedCount( &m_nRefCount ))
- {
- oslInterlockedCount nCount( m_nRefCount );
- // remove global pointer as we destroy the object now
- pGlobalImageList = 0;
- delete this;
- return nCount;
- }
-
- return m_nRefCount;
-}
-
-//*****************************************************************************************************************
-// XInterface, XTypeProvider, XServiceInfo
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_6 ( ModuleImageManager ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XComponent ),
- DIRECT_INTERFACE( css::lang::XInitialization ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XImageManager ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfiguration ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationPersistence )
- )
-
-DEFINE_XTYPEPROVIDER_6 ( ModuleImageManager ,
- css::lang::XTypeProvider ,
- css::lang::XComponent ,
- css::lang::XInitialization ,
- ::com::sun::star::ui::XImageManager ,
- ::com::sun::star::ui::XUIConfiguration ,
- ::com::sun::star::ui::XUIConfigurationPersistence
- )
-
-static sal_Bool implts_checkAndScaleGraphic( uno::Reference< XGraphic >& rOutGraphic, const uno::Reference< XGraphic >& rInGraphic, sal_Int16 nImageType )
-{
- static Size aNormSize( IMAGE_SIZE_NORMAL, IMAGE_SIZE_NORMAL );
- static Size aLargeSize( IMAGE_SIZE_LARGE, IMAGE_SIZE_LARGE );
-
- if ( !rInGraphic.is() )
- {
- rOutGraphic = Image().GetXGraphic();
- return sal_False;
- }
-
- // Check size and scale it
- Image aImage( rInGraphic );
- Size aSize = aImage.GetSizePixel();
- bool bMustScale( false );
-
- if (( nImageType == ImageType_Color_Large ) ||
- ( nImageType == ImageType_HC_Large ))
- bMustScale = ( aSize != aLargeSize );
- else
- bMustScale = ( aSize != aNormSize );
-
- if ( bMustScale )
- {
- BitmapEx aBitmap = aImage.GetBitmapEx();
- aBitmap.Scale( aNormSize );
- aImage = Image( aBitmap );
- rOutGraphic = aImage.GetXGraphic();
- }
- else
- rOutGraphic = rInGraphic;
- return sal_True;
-}
-
-static sal_Int16 implts_convertImageTypeToIndex( sal_Int16 nImageType )
-{
- sal_Int16 nIndex( 0 );
- if ( nImageType & ::com::sun::star::ui::ImageType::SIZE_LARGE )
- nIndex += 1;
- if ( nImageType & ::com::sun::star::ui::ImageType::COLOR_HIGHCONTRAST )
- nIndex += 2;
- return nIndex;
-}
-
-const rtl::Reference< GlobalImageList >& ModuleImageManager::implts_getGlobalImageList()
-{
- ResetableGuard aGuard( m_aLock );
-
- if ( !m_pGlobalImageList.is() )
- m_pGlobalImageList = getGlobalImageList( m_xServiceManager );
- return m_pGlobalImageList;
-}
-
-CmdImageList* ModuleImageManager::implts_getDefaultImageList()
-{
- ResetableGuard aGuard( m_aLock );
-
- if ( !m_pDefaultImageList )
- m_pDefaultImageList = new CmdImageList( m_xServiceManager, m_aModuleIdentifier );
-
- return m_pDefaultImageList;
-}
-
-ImageList* ModuleImageManager::implts_getUserImageList( ImageType nImageType )
-{
- ResetableGuard aGuard( m_aLock );
- if ( !m_pUserImageList[nImageType] )
- implts_loadUserImages( nImageType, m_xUserImageStorage, m_xUserBitmapsStorage );
-
- return m_pUserImageList[nImageType];
-}
-
-void ModuleImageManager::implts_initialize()
-{
- // Initialize the top-level structures with the storage data
- if ( m_xUserConfigStorage.is() )
- {
- long nModes = m_bReadOnly ? ElementModes::READ : ElementModes::READWRITE;
-
- try
- {
- m_xUserImageStorage = m_xUserConfigStorage->openStorageElement( OUString::createFromAscii( IMAGE_FOLDER ),
- nModes );
- if ( m_xUserImageStorage.is() )
- {
- m_xUserBitmapsStorage = m_xUserImageStorage->openStorageElement( OUString::createFromAscii( BITMAPS_FOLDER ),
- nModes );
- }
- }
- catch ( com::sun::star::container::NoSuchElementException& )
- {
- }
- catch ( ::com::sun::star::embed::InvalidStorageException& )
- {
- }
- catch ( ::com::sun::star::lang::IllegalArgumentException& )
- {
- }
- catch ( ::com::sun::star::io::IOException& )
- {
- }
- catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
- {
- }
- }
-}
-
-sal_Bool ModuleImageManager::implts_loadUserImages(
- ImageType nImageType,
- const uno::Reference< XStorage >& xUserImageStorage,
- const uno::Reference< XStorage >& xUserBitmapsStorage )
-{
- ResetableGuard aGuard( m_aLock );
-
- if ( xUserImageStorage.is() && xUserBitmapsStorage.is() )
- {
- try
- {
- uno::Reference< XStream > xStream = xUserImageStorage->openStreamElement( rtl::OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ),
- ElementModes::READ );
- uno::Reference< XInputStream > xInputStream = xStream->getInputStream();
-
- ImageListsDescriptor aUserImageListInfo;
- ImagesConfiguration::LoadImages( m_xServiceManager,
- xInputStream,
- aUserImageListInfo );
- if (( aUserImageListInfo.pImageList != 0 ) &&
- ( aUserImageListInfo.pImageList->Count() > 0 ))
- {
- ImageListItemDescriptor* pList = aUserImageListInfo.pImageList->GetObject(0);
- sal_Int32 nCount = pList->pImageItemList->Count();
-
- std::vector< OUString > aUserImagesVector;
- for ( USHORT i=0; i < nCount; i++ )
- {
- const ImageItemDescriptor* pItem = pList->pImageItemList->GetObject(i);
- aUserImagesVector.push_back( pItem->aCommandURL );
- }
-
- uno::Reference< XStream > xBitmapStream = xUserBitmapsStorage->openStreamElement(
- rtl::OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ),
- ElementModes::READ );
-
- if ( xBitmapStream.is() )
- {
- SvStream* pSvStream( 0 );
- BitmapEx aUserBitmap;
- {
- pSvStream = utl::UcbStreamHelper::CreateStream( xBitmapStream );
- vcl::PNGReader aPngReader( *pSvStream );
- aUserBitmap = aPngReader.Read();
- }
- delete pSvStream;
-
- // Delete old image list and create a new one from the read bitmap
- delete m_pUserImageList[nImageType];
- m_pUserImageList[nImageType] = new ImageList();
- m_pUserImageList[nImageType]->InsertFromHorizontalStrip
- ( aUserBitmap, aUserImagesVector );
- return sal_True;
- }
- }
- }
- catch ( com::sun::star::container::NoSuchElementException& )
- {
- }
- catch ( ::com::sun::star::embed::InvalidStorageException& )
- {
- }
- catch ( ::com::sun::star::lang::IllegalArgumentException& )
- {
- }
- catch ( ::com::sun::star::io::IOException& )
- {
- }
- catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
- {
- }
- }
-
- // Destroy old image list - create a new empty one
- delete m_pUserImageList[nImageType];
- m_pUserImageList[nImageType] = new ImageList;
-
- return sal_True;
-}
-
-sal_Bool ModuleImageManager::implts_storeUserImages(
- ImageType nImageType,
- const uno::Reference< XStorage >& xUserImageStorage,
- const uno::Reference< XStorage >& xUserBitmapsStorage )
-{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bModified )
- {
- ImageList* pImageList = implts_getUserImageList( nImageType );
- if ( pImageList->GetImageCount() > 0 )
- {
- ImageListsDescriptor aUserImageListInfo;
- aUserImageListInfo.pImageList = new ImageListDescriptor;
-
- ImageListItemDescriptor* pList = new ImageListItemDescriptor;
- aUserImageListInfo.pImageList->Insert( pList, 0 );
-
- pList->pImageItemList = new ImageItemListDescriptor;
- for ( USHORT i=0; i < pImageList->GetImageCount(); i++ )
- {
- ImageItemDescriptor* pItem = new ::framework::ImageItemDescriptor;
-
- pItem->nIndex = i;
- pItem->aCommandURL = pImageList->GetImageName( i );
- pList->pImageItemList->Insert( pItem, pList->pImageItemList->Count() );
- }
-
- pList->aURL = String::CreateFromAscii("Bitmaps/");
- pList->aURL += String::CreateFromAscii( BITMAP_FILE_NAMES[nImageType] );
-
- uno::Reference< XTransactedObject > xTransaction;
- uno::Reference< XOutputStream > xOutputStream;
- uno::Reference< XStream > xStream = xUserImageStorage->openStreamElement( rtl::OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ),
- ElementModes::WRITE|ElementModes::TRUNCATE );
- if ( xStream.is() )
- {
- uno::Reference< XStream > xBitmapStream =
- xUserBitmapsStorage->openStreamElement( rtl::OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ),
- ElementModes::WRITE|ElementModes::TRUNCATE );
- if ( xBitmapStream.is() )
- {
- SvStream* pSvStream = utl::UcbStreamHelper::CreateStream( xBitmapStream );
- {
- vcl::PNGWriter aPngWriter( pImageList->GetAsHorizontalStrip() );
- aPngWriter.Write( *pSvStream );
- }
- delete pSvStream;
-
- // Commit user bitmaps storage
- xTransaction = uno::Reference< XTransactedObject >( xUserBitmapsStorage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
- }
-
- xOutputStream = xStream->getOutputStream();
- if ( xOutputStream.is() )
- ImagesConfiguration::StoreImages( m_xServiceManager, xOutputStream, aUserImageListInfo );
-
- // Commit user image storage
- xTransaction = uno::Reference< XTransactedObject >( xUserImageStorage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
- }
-
- return sal_True;
- }
- else
- {
- // Remove the streams from the storage, if we have no data. We have to catch
- // the NoSuchElementException as it can be possible that there is no stream at all!
- try
- {
- xUserImageStorage->removeElement( rtl::OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ));
- }
- catch ( ::com::sun::star::container::NoSuchElementException& )
- {
- }
-
- try
- {
- xUserBitmapsStorage->removeElement( rtl::OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ));
- }
- catch ( ::com::sun::star::container::NoSuchElementException& )
- {
- }
-
- uno::Reference< XTransactedObject > xTransaction;
-
- // Commit user image storage
- xTransaction = uno::Reference< XTransactedObject >( xUserImageStorage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
-
- // Commit user bitmaps storage
- xTransaction = uno::Reference< XTransactedObject >( xUserBitmapsStorage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
-
- return sal_True;
- }
- }
-
- return sal_False;
-}
-
ModuleImageManager::ModuleImageManager( uno::Reference< XMultiServiceFactory > xServiceManager ) :
ThreadHelpBase( &Application::GetSolarMutex() )
- , m_xUserConfigStorage( 0 )
- , m_xUserImageStorage( 0 )
- , m_xUserBitmapsStorage( 0 )
- , m_bReadOnly( true )
- , m_bInitialized( false )
- , m_bModified( false )
- , m_bConfigRead( false )
- , m_bDisposed( false )
- , m_aXMLPostfix( RTL_CONSTASCII_USTRINGPARAM( ".xml" ))
- , m_aResourceString( RTL_CONSTASCII_USTRINGPARAM( ModuleImageList ))
- , m_xServiceManager( xServiceManager )
- , m_aListenerContainer( m_aLock.getShareableOslMutex() )
- , m_pDefaultImageList( 0 )
+ , m_pImpl( new ImageManagerImpl(xServiceManager,static_cast< OWeakObject* >(this),true) )
{
- for ( sal_Int32 n=0; n < ImageType_COUNT; n++ )
- {
- m_pUserImageList[n] = 0;
- m_bUserImageListModified[n] = false;
- }
}
ModuleImageManager::~ModuleImageManager()
@@ -761,192 +106,43 @@ ModuleImageManager::~ModuleImageManager()
// XComponent
void SAL_CALL ModuleImageManager::dispose() throw (::com::sun::star::uno::RuntimeException)
{
- uno::Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
-
- css::lang::EventObject aEvent( xThis );
- m_aListenerContainer.disposeAndClear( aEvent );
-
- {
- ResetableGuard aGuard( m_aLock );
- m_xUserConfigStorage.clear();
- m_xUserImageStorage.clear();
- m_xUserRootCommit.clear();
- m_bConfigRead = false;
- m_bModified = false;
- m_bDisposed = true;
-
- // delete user and default image list on dispose
- for ( sal_Int32 n=0; n < ImageType_COUNT; n++ )
- {
- delete m_pUserImageList[n];
- m_pUserImageList[n] = 0;
- }
- delete m_pDefaultImageList;
- m_pDefaultImageList = 0;
- }
+ m_pImpl->dispose();
}
void SAL_CALL ModuleImageManager::addEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- {
- ResetableGuard aGuard( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
- }
-
- m_aListenerContainer.addInterface( ::getCppuType( ( const uno::Reference< XEventListener >* ) NULL ), xListener );
+ m_pImpl->addEventListener(xListener);
}
void SAL_CALL ModuleImageManager::removeEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- m_aListenerContainer.removeInterface( ::getCppuType( ( const uno::Reference< XEventListener >* ) NULL ), xListener );
+ m_pImpl->removeEventListener(xListener);
}
// XInitialization
void SAL_CALL ModuleImageManager::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
{
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bInitialized )
- {
- for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
- {
- PropertyValue aPropValue;
- if ( aArguments[n] >>= aPropValue )
- {
- if ( aPropValue.Name.equalsAscii( "UserConfigStorage" ))
- {
- aPropValue.Value >>= m_xUserConfigStorage;
- }
- else if ( aPropValue.Name.equalsAscii( "ModuleIdentifier" ))
- {
- aPropValue.Value >>= m_aModuleIdentifier;
- }
- else if ( aPropValue.Name.equalsAscii( "UserRootCommit" ))
- {
- aPropValue.Value >>= m_xUserRootCommit;
- }
- }
- }
-
- if ( m_xUserConfigStorage.is() )
- {
- uno::Reference< XPropertySet > xPropSet( m_xUserConfigStorage, UNO_QUERY );
- if ( xPropSet.is() )
- {
- long nOpenMode = 0;
- Any a = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" )));
- if ( a >>= nOpenMode )
- m_bReadOnly = !( nOpenMode & ElementModes::WRITE );
- }
- }
-
- implts_initialize();
-
- m_bInitialized = true;
- }
+ m_pImpl->initialize(aArguments);
}
// XImageManager
void SAL_CALL ModuleImageManager::reset()
throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aLock( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- std::vector< OUString > aUserImageNames;
-
- for ( sal_Int32 i = 0; i < ImageType_COUNT; i++ )
- {
- aUserImageNames.clear();
- ImageList* pImageList = implts_getUserImageList( ImageType(i));
- pImageList->GetImageNames( aUserImageNames );
-
- Sequence< rtl::OUString > aRemoveList( aUserImageNames.size() );
- for ( sal_uInt32 j = 0; j < aUserImageNames.size(); j++ )
- aRemoveList[j] = aUserImageNames[j];
-
- // Remove images
- removeImages( sal_Int16( i ), aRemoveList );
- m_bUserImageListModified[i] = true;
- }
-
- m_bModified = sal_True;
+ m_pImpl->reset();
}
Sequence< ::rtl::OUString > SAL_CALL ModuleImageManager::getAllImageNames( ::sal_Int16 nImageType )
throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aLock( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- ImageNameMap aImageCmdNameMap;
-
- sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
- rtl::Reference< GlobalImageList > rGlobalImageList = implts_getGlobalImageList();
-
- sal_uInt32 i( 0 );
- const std::vector< OUString >& rGlobalImageNameVector = rGlobalImageList->getImageCommandNames();
- for ( i = 0; i < rGlobalImageNameVector.size(); i++ )
- aImageCmdNameMap.insert( ImageNameMap::value_type( rGlobalImageNameVector[i], sal_True ));
-
- const std::vector< OUString >& rModuleImageNameVector = implts_getDefaultImageList()->getImageCommandNames();
- for ( i = 0; i < rModuleImageNameVector.size(); i++ )
- aImageCmdNameMap.insert( ImageNameMap::value_type( rModuleImageNameVector[i], sal_True ));
-
- ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
- std::vector< OUString > rUserImageNames;
- pImageList->GetImageNames( rUserImageNames );
- for ( i = 0; i < rUserImageNames.size(); i++ )
- aImageCmdNameMap.insert( ImageNameMap::value_type( rUserImageNames[i], sal_True ));
-
- Sequence< OUString > aImageNameSeq( aImageCmdNameMap.size() );
- ImageNameMap::const_iterator pIter;
- i = 0;
- for ( pIter = aImageCmdNameMap.begin(); pIter != aImageCmdNameMap.end(); pIter++ )
- aImageNameSeq[i++] = pIter->first;
-
- return aImageNameSeq;
+ return m_pImpl->getAllImageNames( nImageType );
}
::sal_Bool SAL_CALL ModuleImageManager::hasImage( ::sal_Int16 nImageType, const ::rtl::OUString& aCommandURL )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aLock( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- if (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE ))
- throw IllegalArgumentException();
-
- sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
- if ( implts_getGlobalImageList()->hasImage( nIndex, aCommandURL ))
- return sal_True;
- else
- {
- if ( implts_getDefaultImageList()->hasImage( nIndex, aCommandURL ))
- return sal_True;
- else
- {
- // User layer
- ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
- if ( pImageList )
- return ( pImageList->GetImagePos( aCommandURL ) != IMAGELIST_IMAGE_NOTFOUND );
- }
- }
-
- return sal_False;
+ return m_pImpl->hasImage(nImageType,aCommandURL);
}
Sequence< uno::Reference< XGraphic > > SAL_CALL ModuleImageManager::getImages(
@@ -955,43 +151,7 @@ Sequence< uno::Reference< XGraphic > > SAL_CALL ModuleImageManager::getImages(
throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
{
RTL_LOGFILE_CONTEXT( aLog, "framework: ModuleImageManager::getImages" );
-
- ResetableGuard aLock( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- if (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE ))
- throw IllegalArgumentException();
-
- Sequence< uno::Reference< XGraphic > > aGraphSeq( aCommandURLSequence.getLength() );
-
- const rtl::OUString* aStrArray = aCommandURLSequence.getConstArray();
-
- sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
- rtl::Reference< GlobalImageList > rGlobalImageList = implts_getGlobalImageList();
- CmdImageList* pDefaultImageList = implts_getDefaultImageList();
- ImageList* pUserImageList = implts_getUserImageList( ImageType( nIndex ));
-
- // We have to search our image list in the following order:
- // 1. user image list (read/write)
- // 2. module image list (read)
- // 3. global image list (read)
- for ( sal_Int32 n = 0; n < aCommandURLSequence.getLength(); n++ )
- {
- Image aImage = pUserImageList->GetImage( aStrArray[n] );
- if ( !aImage )
- {
- aImage = pDefaultImageList->getImageFromCommandURL( nIndex, aStrArray[n] );
- if ( !aImage )
- aImage = rGlobalImageList->getImageFromCommandURL( nIndex, aStrArray[n] );
- }
-
- aGraphSeq[n] = aImage.GetXGraphic();
- }
-
- return aGraphSeq;
+ return m_pImpl->getImages(nImageType,aCommandURLSequence);
}
void SAL_CALL ModuleImageManager::replaceImages(
@@ -1002,84 +162,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- CmdToXGraphicNameAccess* pInsertedImages( 0 );
- CmdToXGraphicNameAccess* pReplacedImages( 0 );
-
- {
- ResetableGuard aLock( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- if (( aCommandURLSequence.getLength() != aGraphicsSequence.getLength() ) ||
- (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE )))
- throw IllegalArgumentException();
-
- if ( m_bReadOnly )
- throw IllegalAccessException();
-
- sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
- ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
-
- uno::Reference< XGraphic > xGraphic;
- for ( sal_Int32 i = 0; i < aCommandURLSequence.getLength(); i++ )
- {
- // Check size and scale. If we don't have any graphics ignore it
- if ( !implts_checkAndScaleGraphic( xGraphic, aGraphicsSequence[i], nIndex ))
- continue;
-
- USHORT nPos = pImageList->GetImagePos( aCommandURLSequence[i] );
- if ( nPos == IMAGELIST_IMAGE_NOTFOUND )
- {
- pImageList->AddImage( aCommandURLSequence[i], xGraphic );
- if ( !pInsertedImages )
- pInsertedImages = new CmdToXGraphicNameAccess();
- pInsertedImages->addElement( aCommandURLSequence[i], xGraphic );
- }
- else
- {
- pImageList->ReplaceImage( aCommandURLSequence[i], xGraphic );
- if ( !pReplacedImages )
- pReplacedImages = new CmdToXGraphicNameAccess();
- pReplacedImages->addElement( aCommandURLSequence[i], xGraphic );
- }
- }
-
- if (( pInsertedImages != 0 ) || ( pReplacedImages != 0 ))
- {
- m_bModified = sal_True;
- m_bUserImageListModified[nIndex] = true;
- }
- }
-
- // Notify listeners
- uno::Reference< XImageManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- uno::Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- if ( pInsertedImages != 0 )
- {
- ConfigurationEvent aInsertEvent;
- aInsertEvent.aInfo = uno::makeAny( nImageType );
- aInsertEvent.Accessor = uno::makeAny( xThis );
- aInsertEvent.Source = xIfac;
- aInsertEvent.ResourceURL = m_aResourceString;
- aInsertEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pInsertedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aInsertEvent, NotifyOp_Insert );
- }
- if ( pReplacedImages != 0 )
- {
- ConfigurationEvent aReplaceEvent;
- aReplaceEvent.aInfo = uno::makeAny( nImageType );
- aReplaceEvent.Accessor = uno::makeAny( xThis );
- aReplaceEvent.Source = xIfac;
- aReplaceEvent.ResourceURL = m_aResourceString;
- aReplaceEvent.ReplacedElement = Any();
- aReplaceEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pReplacedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aReplaceEvent, NotifyOp_Replace );
- }
+ m_pImpl->replaceImages(nImageType,aCommandURLSequence,aGraphicsSequence);
}
void SAL_CALL ModuleImageManager::removeImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
@@ -1087,91 +170,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- CmdToXGraphicNameAccess* pRemovedImages( 0 );
- CmdToXGraphicNameAccess* pReplacedImages( 0 );
-
- {
- ResetableGuard aLock( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- if (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE ))
- throw IllegalArgumentException();
-
- if ( m_bReadOnly )
- throw IllegalAccessException();
-
- sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
- rtl::Reference< GlobalImageList > rGlobalImageList = implts_getGlobalImageList();
- CmdImageList* pDefaultImageList = implts_getDefaultImageList();
- ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
- uno::Reference< XGraphic > xEmptyGraphic( Image().GetXGraphic() );
-
- for ( sal_Int32 i = 0; i < aCommandURLSequence.getLength(); i++ )
- {
- USHORT nPos = pImageList->GetImagePos( aCommandURLSequence[i] );
- if ( nPos != IMAGELIST_IMAGE_NOTFOUND )
- {
- Image aImage = pImageList->GetImage( nPos );
- USHORT nId = pImageList->GetImageId( nPos );
- pImageList->RemoveImage( nId );
-
- // Check, if we have a image in our module/global image list. If we find one =>
- // this is a replace instead of a remove operation!
- Image aNewImage = pDefaultImageList->getImageFromCommandURL( nIndex, aCommandURLSequence[i] );
- if ( !aNewImage )
- aNewImage = rGlobalImageList->getImageFromCommandURL( nIndex, aCommandURLSequence[i] );
- if ( !aNewImage )
- {
- if ( !pRemovedImages )
- pRemovedImages = new CmdToXGraphicNameAccess();
- pRemovedImages->addElement( aCommandURLSequence[i], xEmptyGraphic );
- }
- else
- {
- if ( !pReplacedImages )
- pReplacedImages = new CmdToXGraphicNameAccess();
- pReplacedImages->addElement( aCommandURLSequence[i], aNewImage.GetXGraphic() );
- }
- }
- }
-
- if (( pReplacedImages != 0 ) || ( pRemovedImages != 0 ))
- {
- m_bModified = sal_True;
- m_bUserImageListModified[nIndex] = true;
- }
- }
-
- // Notify listeners
- uno::Reference< XImageManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- uno::Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- if ( pRemovedImages != 0 )
- {
- ConfigurationEvent aRemoveEvent;
- aRemoveEvent.aInfo = uno::makeAny( nImageType );
- aRemoveEvent.Accessor = uno::makeAny( xThis );
- aRemoveEvent.Source = xIfac;
- aRemoveEvent.ResourceURL = m_aResourceString;
- aRemoveEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pRemovedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aRemoveEvent, NotifyOp_Remove );
- }
- if ( pReplacedImages != 0 )
- {
- ConfigurationEvent aReplaceEvent;
- aReplaceEvent.aInfo = uno::makeAny( nImageType );
- aReplaceEvent.Accessor = uno::makeAny( xThis );
- aReplaceEvent.Source = xIfac;
- aReplaceEvent.ResourceURL = m_aResourceString;
- aReplaceEvent.ReplacedElement = Any();
- aReplaceEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pReplacedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aReplaceEvent, NotifyOp_Replace );
- }
+ m_pImpl->removeImages(nImageType,aCommandURLSequence);
}
void SAL_CALL ModuleImageManager::insertImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
@@ -1180,105 +179,20 @@ throw ( ::com::sun::star::container::ElementExistException,
::com::sun::star::lang::IllegalAccessException,
::com::sun::star::uno::RuntimeException)
{
- CmdToXGraphicNameAccess* pInsertedImages( 0 );
- CmdToXGraphicNameAccess* pReplacedImages( 0 );
-
- {
- ResetableGuard aLock( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- if (( aCommandURLSequence.getLength() != aGraphicSequence.getLength() ) ||
- (( nImageType < 0 ) || ( nImageType > MAX_IMAGETYPE_VALUE )))
- throw IllegalArgumentException();
-
- if ( m_bReadOnly )
- throw IllegalAccessException();
-
- sal_Int16 nIndex = implts_convertImageTypeToIndex( nImageType );
- ImageList* pImageList = implts_getUserImageList( ImageType( nIndex ));
-
- uno::Reference< XGraphic > xGraphic;
- for ( sal_Int32 i = 0; i < aCommandURLSequence.getLength(); i++ )
- {
- if ( !implts_checkAndScaleGraphic( xGraphic, aGraphicSequence[i], nIndex ))
- continue;
-
- USHORT nPos = pImageList->GetImagePos( aCommandURLSequence[i] );
- if ( nPos == IMAGELIST_IMAGE_NOTFOUND )
- {
- pImageList->AddImage( aCommandURLSequence[i], xGraphic );
- if ( !pInsertedImages )
- pInsertedImages = new CmdToXGraphicNameAccess();
- pInsertedImages->addElement( aCommandURLSequence[i], xGraphic );
- }
- else
- {
- pImageList->ReplaceImage( aCommandURLSequence[i], xGraphic );
- if ( !pReplacedImages )
- pReplacedImages = new CmdToXGraphicNameAccess();
- pReplacedImages->addElement( aCommandURLSequence[i], xGraphic );
- }
- }
-
- if (( pInsertedImages != 0 ) || ( pReplacedImages != 0 ))
- {
- m_bModified = sal_True;
- m_bUserImageListModified[nIndex] = true;
- }
- }
-
- // Notify listeners
- uno::Reference< XImageManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- uno::Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- if ( pInsertedImages != 0 )
- {
- ConfigurationEvent aInsertEvent;
- aInsertEvent.aInfo = uno::makeAny( nImageType );
- aInsertEvent.Accessor = uno::makeAny( xThis );
- aInsertEvent.Source = xIfac;
- aInsertEvent.ResourceURL = m_aResourceString;
- aInsertEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pInsertedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aInsertEvent, NotifyOp_Insert );
- }
- if ( pReplacedImages != 0 )
- {
- ConfigurationEvent aReplaceEvent;
- aReplaceEvent.aInfo = uno::makeAny( nImageType );
- aReplaceEvent.Accessor = uno::makeAny( xThis );
- aReplaceEvent.Source = xIfac;
- aReplaceEvent.ResourceURL = m_aResourceString;
- aReplaceEvent.ReplacedElement = Any();
- aReplaceEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pReplacedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aReplaceEvent, NotifyOp_Replace );
- }
+ m_pImpl->insertImages(nImageType,aCommandURLSequence,aGraphicSequence);
}
// XUIConfiguration
void SAL_CALL ModuleImageManager::addConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
throw (::com::sun::star::uno::RuntimeException)
{
- {
- ResetableGuard aGuard( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
- }
-
- m_aListenerContainer.addInterface( ::getCppuType( ( const uno::Reference< XUIConfigurationListener >* ) NULL ), xListener );
+ m_pImpl->addConfigurationListener(xListener);
}
void SAL_CALL ModuleImageManager::removeConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
throw (::com::sun::star::uno::RuntimeException)
{
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- m_aListenerContainer.removeInterface( ::getCppuType( ( const uno::Reference< XUIConfigurationListener >* ) NULL ), xListener );
+ m_pImpl->removeConfigurationListener(xListener);
}
// XUIConfigurationPersistence
@@ -1286,248 +200,30 @@ void SAL_CALL ModuleImageManager::reload()
throw ( ::com::sun::star::uno::Exception,
::com::sun::star::uno::RuntimeException )
{
- ResetableGuard aGuard( m_aLock );
-
- uno::Reference< uno::XInterface > xRefThis( static_cast< OWeakObject* >( this ));
-
- if ( m_bDisposed )
- throw DisposedException();
-
- CommandMap aOldUserCmdImageSet;
- std::vector< rtl::OUString > aNewUserCmdImageSet;
-
- if ( m_bModified )
- {
- uno::Reference< XImageManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- uno::Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- for ( sal_Int16 i = 0; i < sal_Int16( ImageType_COUNT ); i++ )
- {
- if ( !m_bDisposed && m_bUserImageListModified[i] )
- {
- std::vector< rtl::OUString > aOldUserCmdImageVector;
- ImageList* pImageList = implts_getUserImageList( (ImageType)i );
- pImageList->GetImageNames( aOldUserCmdImageVector );
-
- // Fill hash map to speed up search afterwards
- sal_uInt32 j( 0 );
- for ( j = 0; j < aOldUserCmdImageVector.size(); j++ )
- aOldUserCmdImageSet.insert( CommandMap::value_type( aOldUserCmdImageVector[j], false ));
-
- // Attention: This can make the old image list pointer invalid!
- implts_loadUserImages( (ImageType)i, m_xUserImageStorage, m_xUserBitmapsStorage );
- pImageList = implts_getUserImageList( (ImageType)i );
- pImageList->GetImageNames( aNewUserCmdImageSet );
-
- CmdToXGraphicNameAccess* pInsertedImages( 0 );
- CmdToXGraphicNameAccess* pReplacedImages( 0 );
- CmdToXGraphicNameAccess* pRemovedImages( 0 );
-
- for ( j = 0; j < aNewUserCmdImageSet.size(); j++ )
- {
- CommandMap::iterator pIter = aOldUserCmdImageSet.find( aNewUserCmdImageSet[j] );
- if ( pIter != aOldUserCmdImageSet.end() )
- {
- pIter->second = true; // mark entry as replaced
- if ( !pReplacedImages )
- pReplacedImages = new CmdToXGraphicNameAccess();
- pReplacedImages->addElement( aNewUserCmdImageSet[j],
- pImageList->GetImage( aNewUserCmdImageSet[j] ).GetXGraphic() );
- }
- else
- {
- if ( !pInsertedImages )
- pInsertedImages = new CmdToXGraphicNameAccess();
- pInsertedImages->addElement( aNewUserCmdImageSet[j],
- pImageList->GetImage( aNewUserCmdImageSet[j] ).GetXGraphic() );
- }
- }
-
- // Search map for unmarked entries => they have been removed from the user list
- // through this reload operation.
- // We have to search the module and global image list!
- rtl::Reference< GlobalImageList > rGlobalImageList = implts_getGlobalImageList();
- CmdImageList* pDefaultImageList = implts_getDefaultImageList();
- uno::Reference< XGraphic > xEmptyGraphic( Image().GetXGraphic() );
- CommandMap::const_iterator pIter = aOldUserCmdImageSet.begin();
- while ( pIter != aOldUserCmdImageSet.end() )
- {
- if ( !pIter->second )
- {
- Image aImage = pDefaultImageList->getImageFromCommandURL( i, pIter->first );
- if ( !aImage )
- aImage = rGlobalImageList->getImageFromCommandURL( i, pIter->first );
-
- if ( !aImage )
- {
- // No image in the module/global image list => remove user image
- if ( !pRemovedImages )
- pRemovedImages = new CmdToXGraphicNameAccess();
- pRemovedImages->addElement( pIter->first, xEmptyGraphic );
- }
- else
- {
- // Image has been found in the module/global image list => replace user image
- if ( !pReplacedImages )
- pReplacedImages = new CmdToXGraphicNameAccess();
- pReplacedImages->addElement( pIter->first, aImage.GetXGraphic() );
- }
- }
- ++pIter;
- }
-
- aGuard.unlock();
-
- // Now notify our listeners. Unlock mutex to prevent deadlocks
- if ( pInsertedImages != 0 )
- {
- ConfigurationEvent aInsertEvent;
- aInsertEvent.aInfo = uno::makeAny( i );
- aInsertEvent.Accessor = uno::makeAny( xThis );
- aInsertEvent.Source = xIfac;
- aInsertEvent.ResourceURL = m_aResourceString;
- aInsertEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pInsertedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aInsertEvent, NotifyOp_Insert );
- }
- if ( pReplacedImages != 0 )
- {
- ConfigurationEvent aReplaceEvent;
- aReplaceEvent.aInfo = uno::makeAny( i );
- aReplaceEvent.Accessor = uno::makeAny( xThis );
- aReplaceEvent.Source = xIfac;
- aReplaceEvent.ResourceURL = m_aResourceString;
- aReplaceEvent.ReplacedElement = Any();
- aReplaceEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pReplacedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aReplaceEvent, NotifyOp_Replace );
- }
- if ( pRemovedImages != 0 )
- {
- ConfigurationEvent aRemoveEvent;
- aRemoveEvent.aInfo = uno::makeAny( i );
- aRemoveEvent.Accessor = uno::makeAny( xThis );
- aRemoveEvent.Source = xIfac;
- aRemoveEvent.ResourceURL = m_aResourceString;
- aRemoveEvent.Element = uno::makeAny( uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pRemovedImages ), UNO_QUERY ));
- implts_notifyContainerListener( aRemoveEvent, NotifyOp_Remove );
- }
-
- aGuard.lock();
- }
- }
- }
+ m_pImpl->reload();
}
void SAL_CALL ModuleImageManager::store()
throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_bModified )
- {
- sal_Bool bWritten( sal_False );
- for ( sal_Int32 i = 0; i < ImageType_COUNT; i++ )
- {
- sal_Bool bSuccess = implts_storeUserImages( ImageType(i), m_xUserImageStorage, m_xUserBitmapsStorage );
- if ( bSuccess )
- bWritten = sal_True;
- m_bUserImageListModified[i] = false;
- }
-
- if ( bWritten &&
- m_xUserConfigStorage.is() &&
- m_xUserRootCommit.is() )
- {
- uno::Reference< XTransactedObject > xUserConfigStorageCommit( m_xUserConfigStorage, UNO_QUERY );
- if ( xUserConfigStorageCommit.is() )
- xUserConfigStorageCommit->commit();
- m_xUserRootCommit->commit();
- }
-
- m_bModified = sal_False;
- }
+ m_pImpl->store();
}
void SAL_CALL ModuleImageManager::storeToStorage( const uno::Reference< XStorage >& Storage )
throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_bModified && Storage.is() )
- {
- long nModes = ElementModes::READWRITE;
-
- uno::Reference< XStorage > xUserImageStorage = Storage->openStorageElement( OUString::createFromAscii( IMAGE_FOLDER ),
- nModes );
- if ( xUserImageStorage.is() )
- {
- uno::Reference< XStorage > xUserBitmapsStorage = xUserImageStorage->openStorageElement( OUString::createFromAscii( BITMAPS_FOLDER ),
- nModes );
- for ( sal_Int32 i = 0; i < ImageType_COUNT; i++ )
- {
- implts_getUserImageList( (ImageType)i );
- implts_storeUserImages( (ImageType)i, xUserImageStorage, xUserBitmapsStorage );
- }
-
- uno::Reference< XTransactedObject > xTransaction( Storage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
- }
- }
+ m_pImpl->storeToStorage(Storage);
}
sal_Bool SAL_CALL ModuleImageManager::isModified()
throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
- return m_bModified;
+ return m_pImpl->isModified();
}
sal_Bool SAL_CALL ModuleImageManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- return m_bReadOnly;
-}
-
-void ModuleImageManager::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp )
-{
- ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer(
- ::getCppuType( ( const css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >*) NULL ) );
- if ( pContainer != NULL )
- {
- ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
- while ( pIterator.hasMoreElements() )
- {
- try
- {
- switch ( eOp )
- {
- case NotifyOp_Replace:
- ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementReplaced( aEvent );
- break;
- case NotifyOp_Insert:
- ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementInserted( aEvent );
- break;
- case NotifyOp_Remove:
- ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementRemoved( aEvent );
- break;
- }
- }
- catch( css::uno::RuntimeException& )
- {
- pIterator.remove();
- }
- }
- }
+ return m_pImpl->isReadOnly();
}
} // namespace framework
diff --git a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
index 43d4fcfc80..8123813718 100644
--- a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
+++ b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
@@ -50,7 +50,7 @@
// other includes
//_________________________________________________________________________________________________________________
#include <rtl/logfile.hxx>
-
+#include <cppuhelper/implbase1.hxx>
#include <vcl/svapp.hxx>
using namespace com::sun::star::uno;
@@ -65,15 +65,10 @@ using namespace ::com::sun::star::frame;
namespace framework
{
-class RootStorageWrapper : public com::sun::star::lang::XTypeProvider ,
- public com::sun::star::embed::XTransactedObject ,
- public ::cppu::OWeakObject
+class RootStorageWrapper : public ::cppu::WeakImplHelper1< com::sun::star::embed::XTransactedObject >
{
public:
// XInterface, XTypeProvider
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
RootStorageWrapper( const Reference< XTransactedObject >& xRootCommit ) : m_xRootCommit( xRootCommit ) {}
virtual ~RootStorageWrapper() {}
@@ -92,17 +87,6 @@ class RootStorageWrapper : public com::sun::star::lang::XTypeProvider ,
Reference< XTransactedObject > m_xRootCommit;
};
-DEFINE_XINTERFACE_2 ( RootStorageWrapper ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( com::sun::star::embed::XTransactedObject )
- )
-
-DEFINE_XTYPEPROVIDER_2 ( RootStorageWrapper ,
- css::lang::XTypeProvider ,
- css::embed::XTransactedObject
- )
-
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
@@ -133,6 +117,7 @@ DEFINE_INIT_SERVICE ( ModuleUIConfigurationManagerSupplier
/*TODO_AS
void ModuleUIConfigurationManagerSupplier::impl_initStorages()
{
+RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::impl_initStorages" );
if ( !m_bInit )
{
RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ModuleUIConfigurationManagerSupplier::impl_initStorages" );
@@ -232,6 +217,7 @@ ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier( cons
, m_xServiceManager( xServiceManager )
, m_aListenerContainer( m_aLock.getShareableOslMutex() )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier" );
// Retrieve known modules and insert them into our hash_map to speed-up access time.
Reference< XNameAccess > xNameAccess( m_xModuleMgr, UNO_QUERY );
const Sequence< ::rtl::OUString > aNameSeq = xNameAccess->getElementNames();
@@ -273,6 +259,7 @@ ModuleUIConfigurationManagerSupplier::~ModuleUIConfigurationManagerSupplier()
void SAL_CALL ModuleUIConfigurationManagerSupplier::dispose()
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::dispose" );
Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
css::lang::EventObject aEvent( xThis );
@@ -287,6 +274,7 @@ throw ( RuntimeException )
void SAL_CALL ModuleUIConfigurationManagerSupplier::addEventListener( const Reference< XEventListener >& xListener )
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::addEventListener" );
{
ResetableGuard aGuard( m_aLock );
@@ -301,6 +289,7 @@ throw ( RuntimeException )
void SAL_CALL ModuleUIConfigurationManagerSupplier::removeEventListener( const Reference< XEventListener >& xListener )
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::removeEventListener" );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
}
@@ -309,6 +298,7 @@ throw ( RuntimeException )
Reference< XUIConfigurationManager > SAL_CALL ModuleUIConfigurationManagerSupplier::getUIConfigurationManager( const ::rtl::OUString& ModuleIdentifier )
throw ( NoSuchElementException, RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::getUIConfigurationManager" );
ResetableGuard aGuard( m_aLock );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -318,30 +308,6 @@ throw ( NoSuchElementException, RuntimeException)
ModuleToModuleCfgMgr::iterator pIter = m_aModuleToModuleUICfgMgrMap.find( ModuleIdentifier );
if ( pIter == m_aModuleToModuleUICfgMgrMap.end() )
throw NoSuchElementException();
-
- ::rtl::OUString sShort;
- try
- {
- Sequence< PropertyValue > lProps;
- Reference< XNameAccess > xCont(m_xModuleMgr, UNO_QUERY);
- xCont->getByName(ModuleIdentifier) >>= lProps;
- for (sal_Int32 i=0; i<lProps.getLength(); ++i)
- {
- if (lProps[i].Name.equalsAscii("ooSetupFactoryShortName"))
- {
- lProps[i].Value >>= sShort;
- break;
- }
- }
- }
- catch( Exception& )
- {
- sShort = ::rtl::OUString();
- }
-
- if (!sShort.getLength())
- throw NoSuchElementException();
-
//TODO_AS impl_initStorages();
// Create instance on demand
@@ -394,6 +360,28 @@ throw ( NoSuchElementException, RuntimeException)
aArg.Value <<= m_xUserRootCommit;
aArgs[3] <<= aArg;
*/
+ ::rtl::OUString sShort;
+ try
+ {
+ Sequence< PropertyValue > lProps;
+ Reference< XNameAccess > xCont(m_xModuleMgr, UNO_QUERY);
+ xCont->getByName(ModuleIdentifier) >>= lProps;
+ for (sal_Int32 i=0; i<lProps.getLength(); ++i)
+ {
+ if (lProps[i].Name.equalsAscii("ooSetupFactoryShortName"))
+ {
+ lProps[i].Value >>= sShort;
+ break;
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ sShort = ::rtl::OUString();
+ }
+
+ if (!sShort.getLength())
+ throw NoSuchElementException();
PropertyValue aArg;
Sequence< Any > aArgs( 2 );
aArg.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleShortName" ));
@@ -403,9 +391,7 @@ throw ( NoSuchElementException, RuntimeException)
aArg.Value <<= ModuleIdentifier;
aArgs[1] <<= aArg;
- pIter->second = Reference< XUIConfigurationManager >( m_xServiceManager->createInstanceWithArguments(
- SERVICENAME_MODULEUICONFIGURATIONMANAGER, aArgs ),
- UNO_QUERY );
+ pIter->second.set( m_xServiceManager->createInstanceWithArguments(SERVICENAME_MODULEUICONFIGURATIONMANAGER, aArgs ),UNO_QUERY );
}
return pIter->second;
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 7d2bf4fd54..5f478f2902 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -38,6 +38,7 @@
#include <uielement/uielementtypenames.hxx>
#include <xml/menuconfiguration.hxx>
#include <xml/toolboxconfiguration.hxx>
+#include <uiconfigurationmanagerimpl.hxx>
#ifndef __FRAMEWORK_XML_STATUSBARCONFIGURATION_HXX_
#include <xml/statusbarconfiguration.hxx>
@@ -113,1292 +114,127 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( ModuleUIConfigurationManager
DEFINE_INIT_SERVICE ( ModuleUIConfigurationManager, {} )
-// important: The order and position of the elements must match the constant
-// definition of "::com::sun::star::ui::UIElementType"
-static const char* UIELEMENTTYPENAMES[] =
+ModuleUIConfigurationManager::ModuleUIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager )
+: m_pImpl( new UIConfigurationManagerImpl(xServiceManager,static_cast< OWeakObject* >(this),true) )
{
- "", // Dummy value for unknown!
- UIELEMENTTYPE_MENUBAR_NAME,
- UIELEMENTTYPE_POPUPMENU_NAME,
- UIELEMENTTYPE_TOOLBAR_NAME,
- UIELEMENTTYPE_STATUSBAR_NAME,
- UIELEMENTTYPE_FLOATINGWINDOW_NAME,
- UIELEMENTTYPE_PROGRESSBAR_NAME
-};
-
-static const char RESOURCEURL_PREFIX[] = "private:resource/";
-static const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17;
-static const char RESOURCEURL_CUSTOM_ELEMENT[] = "custom_";
-
-static sal_Int16 RetrieveTypeFromResourceURL( const rtl::OUString& aResourceURL )
-{
-
- if (( aResourceURL.indexOf( OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
- ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
- {
- OUString aTmpStr = aResourceURL.copy( RESOURCEURL_PREFIX_SIZE );
- sal_Int32 nIndex = aTmpStr.indexOf( '/' );
- if (( nIndex > 0 ) && ( aTmpStr.getLength() > nIndex ))
- {
- OUString aTypeStr( aTmpStr.copy( 0, nIndex ));
- for ( int i = 0; i < UIElementType::COUNT; i++ )
- {
- if ( aTypeStr.equalsAscii( UIELEMENTTYPENAMES[i] ))
- return sal_Int16( i );
- }
- }
- }
-
- return UIElementType::UNKNOWN;
-}
-
-static OUString RetrieveNameFromResourceURL( const rtl::OUString& aResourceURL )
-{
- if (( aResourceURL.indexOf( OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
- ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
- {
- sal_Int32 nIndex = aResourceURL.lastIndexOf( '/' );
- if (( nIndex > 0 ) && (( nIndex+1 ) < aResourceURL.getLength()))
- return aResourceURL.copy( nIndex+1 );
- }
-
- return OUString();
-}
-
-void ModuleUIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType )
-{
- // preload list of element types on demand
- impl_preloadUIElementTypeList( LAYER_USERDEFINED, nElementType );
- impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType );
-
- UIElementDataHashMap& rUserElements = m_aUIElements[LAYER_USERDEFINED][nElementType].aElementsHashMap;
- UIElementDataHashMap::const_iterator pUserIter = rUserElements.begin();
-
- OUString aCustomUrlPrefix( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_CUSTOM_ELEMENT ));
- while ( pUserIter != rUserElements.end() )
- {
- sal_Int32 nIndex = pUserIter->second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE );
- if ( nIndex > RESOURCEURL_PREFIX_SIZE )
- {
- // Performance: Retrieve user interface name only for custom user interface elements.
- // It's only used by them!
- UIElementData* pDataSettings = impl_findUIElementData( pUserIter->second.aResourceURL, nElementType );
- if ( pDataSettings )
- {
- // Retrieve user interface name from XPropertySet interface
- rtl::OUString aUIName;
- Reference< XPropertySet > xPropSet( pDataSettings->xSettings, UNO_QUERY );
- if ( xPropSet.is() )
- {
- Any a = xPropSet->getPropertyValue( m_aPropUIName );
- a >>= aUIName;
- }
-
- UIElementInfo aInfo( pUserIter->second.aResourceURL, aUIName );
- aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo ));
- }
- }
- else
- {
- // The user interface name for standard user interface elements is stored in the WindowState.xcu file
- UIElementInfo aInfo( pUserIter->second.aResourceURL, OUString() );
- aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo ));
- }
- ++pUserIter;
- }
-
- UIElementDataHashMap& rDefaultElements = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap;
- UIElementDataHashMap::const_iterator pDefIter = rDefaultElements.begin();
-
- while ( pDefIter != rDefaultElements.end() )
- {
- UIElementInfoHashMap::const_iterator pIterInfo = aUIElementInfoCollection.find( pDefIter->second.aResourceURL );
- if ( pIterInfo == aUIElementInfoCollection.end() )
- {
- sal_Int32 nIndex = pDefIter->second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE );
- if ( nIndex > RESOURCEURL_PREFIX_SIZE )
- {
- // Performance: Retrieve user interface name only for custom user interface elements.
- // It's only used by them!
- UIElementData* pDataSettings = impl_findUIElementData( pDefIter->second.aResourceURL, nElementType );
- if ( pDataSettings )
- {
- // Retrieve user interface name from XPropertySet interface
- rtl::OUString aUIName;
- Reference< XPropertySet > xPropSet( pDataSettings->xSettings, UNO_QUERY );
- if ( xPropSet.is() )
- {
- Any a = xPropSet->getPropertyValue( m_aPropUIName );
- a >>= aUIName;
- }
-
- UIElementInfo aInfo( pDefIter->second.aResourceURL, aUIName );
- aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pDefIter->second.aResourceURL, aInfo ));
- }
- }
- else
- {
- // The user interface name for standard user interface elements is stored in the WindowState.xcu file
- UIElementInfo aInfo( pDefIter->second.aResourceURL, OUString() );
- aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pDefIter->second.aResourceURL, aInfo ));
- }
- }
-
- ++pDefIter;
- }
-}
-
-void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer, sal_Int16 nElementType )
-{
- UIElementType& rElementTypeData = m_aUIElements[eLayer][nElementType];
-
- if ( !rElementTypeData.bLoaded )
- {
- Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage;
- if ( xElementTypeStorage.is() )
- {
- rtl::OUStringBuffer aBuf( RESOURCEURL_PREFIX_SIZE );
- aBuf.appendAscii( RESOURCEURL_PREFIX );
- aBuf.appendAscii( UIELEMENTTYPENAMES[ nElementType ] );
- aBuf.appendAscii( "/" );
- OUString aResURLPrefix( aBuf.makeStringAndClear() );
-
- UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap;
- Reference< XNameAccess > xNameAccess( xElementTypeStorage, UNO_QUERY );
- Sequence< OUString > aUIElementNames = xNameAccess->getElementNames();
- for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ )
- {
- UIElementData aUIElementData;
-
- // Resource name must be without ".xml"
- sal_Int32 nIndex = aUIElementNames[n].lastIndexOf( '.' );
- if (( nIndex > 0 ) && ( nIndex < aUIElementNames[n].getLength() ))
- {
- OUString aExtension( aUIElementNames[n].copy( nIndex+1 ));
- OUString aUIElementName( aUIElementNames[n].copy( 0, nIndex ));
-
- if (( aUIElementName.getLength() > 0 ) &&
- ( aExtension.equalsIgnoreAsciiCaseAsciiL( "xml", 3 )))
- {
- aUIElementData.aResourceURL = aResURLPrefix + aUIElementName;
- aUIElementData.aName = aUIElementNames[n];
-
- if ( eLayer == LAYER_USERDEFINED )
- {
- aUIElementData.bModified = false;
- aUIElementData.bDefault = false;
- aUIElementData.bDefaultNode = false;
- }
-
- // Create hash_map entries for all user interface elements inside the storage. We don't load the
- // settings to speed up the process.
- rHashMap.insert( UIElementDataHashMap::value_type( aUIElementData.aResourceURL, aUIElementData ));
- }
- }
- }
- }
- }
-
- rElementTypeData.bLoaded = true;
-}
-
-void ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, Layer eLayer, UIElementData& aUIElementData )
-{
- UIElementType& rElementTypeData = m_aUIElements[eLayer][nElementType];
-
- Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage;
- if ( xElementTypeStorage.is() && aUIElementData.aName.getLength() )
- {
- try
- {
- Reference< XStream > xStream = xElementTypeStorage->openStreamElement( aUIElementData.aName, ElementModes::READ );
- Reference< XInputStream > xInputStream = xStream->getInputStream();
-
- if ( xInputStream.is() )
- {
- switch ( nElementType )
- {
- case ::com::sun::star::ui::UIElementType::UNKNOWN:
- break;
-
- case ::com::sun::star::ui::UIElementType::MENUBAR:
- {
- try
- {
- MenuConfiguration aMenuCfg( m_xServiceManager );
- Reference< XIndexAccess > xContainer( aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream ));
- RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xContainer );
- if ( pRootItemContainer )
- aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
- else
- aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( xContainer, sal_True ) ), UNO_QUERY );
- return;
- }
- catch ( ::com::sun::star::lang::WrappedTargetException& )
- {
- }
- }
- break;
-
- case ::com::sun::star::ui::UIElementType::POPUPMENU:
- {
- break;
- }
-
- case ::com::sun::star::ui::UIElementType::TOOLBAR:
- {
- try
- {
- Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
- ToolBoxConfiguration::LoadToolBox( m_xServiceManager, xInputStream, xIndexContainer );
- RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
- aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
- return;
- }
- catch ( ::com::sun::star::lang::WrappedTargetException& )
- {
- }
-
- break;
- }
-
- case ::com::sun::star::ui::UIElementType::STATUSBAR:
- {
- try
- {
- Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
- StatusBarConfiguration::LoadStatusBar( m_xServiceManager, xInputStream, xIndexContainer );
- RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
- aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
- return;
- }
- catch ( ::com::sun::star::lang::WrappedTargetException& )
- {
- }
-
- break;
- }
-
- case ::com::sun::star::ui::UIElementType::FLOATINGWINDOW:
- {
- break;
- }
- }
- }
- }
- catch ( ::com::sun::star::embed::InvalidStorageException& )
- {
- }
- catch ( ::com::sun::star::lang::IllegalArgumentException& )
- {
- }
- catch ( ::com::sun::star::io::IOException& )
- {
- }
- catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
- {
- }
- }
-
- // At least we provide an empty settings container!
- aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer() ), UNO_QUERY );
-}
-
-ModuleUIConfigurationManager::UIElementData* ModuleUIConfigurationManager::impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad )
-{
- // preload list of element types on demand
- impl_preloadUIElementTypeList( LAYER_USERDEFINED, nElementType );
- impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType );
-
- // first try to look into our user-defined vector/hash_map combination
- UIElementDataHashMap& rUserHashMap = m_aUIElements[LAYER_USERDEFINED][nElementType].aElementsHashMap;
- UIElementDataHashMap::iterator pIter = rUserHashMap.find( aResourceURL );
- if ( pIter != rUserHashMap.end() )
- {
- // Default data settings data must be retrieved from the default layer!
- if ( !pIter->second.bDefault )
- {
- if ( !pIter->second.xSettings.is() && bLoad )
- impl_requestUIElementData( nElementType, LAYER_USERDEFINED, pIter->second );
- return &(pIter->second);
- }
- }
-
- // Not successfull, we have to look into our default vector/hash_map combination
- UIElementDataHashMap& rDefaultHashMap = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap;
- pIter = rDefaultHashMap.find( aResourceURL );
- if ( pIter != rDefaultHashMap.end() )
- {
- if ( !pIter->second.xSettings.is() && bLoad )
- impl_requestUIElementData( nElementType, LAYER_DEFAULT, pIter->second );
- return &(pIter->second);
- }
-
- // Nothing has been found!
- return NULL;
-}
-
-void ModuleUIConfigurationManager::impl_storeElementTypeData( Reference< XStorage > xStorage, UIElementType& rElementType, bool bResetModifyState )
-{
- UIElementDataHashMap& rHashMap = rElementType.aElementsHashMap;
- UIElementDataHashMap::iterator pIter = rHashMap.begin();
-
- while ( pIter != rHashMap.end() )
- {
- UIElementData& rElement = pIter->second;
- if ( rElement.bModified )
- {
- if ( rElement.bDefault )
- {
- xStorage->removeElement( rElement.aName );
- rElement.bModified = sal_False; // mark as not modified
- }
- else
- {
- Reference< XStream > xStream( xStorage->openStreamElement( rElement.aName, ElementModes::WRITE|ElementModes::TRUNCATE ), UNO_QUERY );
- Reference< XOutputStream > xOutputStream( xStream->getOutputStream() );
-
- if ( xOutputStream.is() )
- {
- switch( rElementType.nElementType )
- {
- case ::com::sun::star::ui::UIElementType::MENUBAR:
- {
- try
- {
- MenuConfiguration aMenuCfg( m_xServiceManager );
- aMenuCfg.StoreMenuBarConfigurationToXML( rElement.xSettings, xOutputStream );
- }
- catch ( ::com::sun::star::lang::WrappedTargetException& )
- {
- }
- }
- break;
-
- case ::com::sun::star::ui::UIElementType::TOOLBAR:
- {
- try
- {
- ToolBoxConfiguration::StoreToolBox( m_xServiceManager, xOutputStream, rElement.xSettings );
- }
- catch ( ::com::sun::star::lang::WrappedTargetException& )
- {
- }
- }
- break;
-
- case ::com::sun::star::ui::UIElementType::STATUSBAR:
- {
- try
- {
- StatusBarConfiguration::StoreStatusBar( m_xServiceManager, xOutputStream, rElement.xSettings );
- }
- catch ( ::com::sun::star::lang::WrappedTargetException& )
- {
- }
- }
- break;
-
- default:
- break;
- }
- }
-
- // mark as not modified if we store to our own storage
- if ( bResetModifyState )
- rElement.bModified = sal_False;
- }
- }
-
- ++pIter;
- }
-
- // commit element type storage
- Reference< XTransactedObject > xTransactedObject( xStorage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
-
- // mark UIElementType as not modified if we store to our own storage
- if ( bResetModifyState )
- rElementType.bModified = sal_False;
-}
-
-// This is only allowed to be called on the LAYER_USER_DEFINED!
-void ModuleUIConfigurationManager::impl_resetElementTypeData(
- UIElementType& rUserElementType,
- UIElementType& rDefaultElementType,
- ConfigEventNotifyContainer& rRemoveNotifyContainer,
- ConfigEventNotifyContainer& rReplaceNotifyContainer )
-{
- UIElementDataHashMap& rHashMap = rUserElementType.aElementsHashMap;
- UIElementDataHashMap::iterator pIter = rHashMap.begin();
-
- Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- Reference< XInterface > xIfac( xThis, UNO_QUERY );
- Reference< XNameAccess > xDefaultNameAccess( rDefaultElementType.xStorage, UNO_QUERY );
- sal_Int16 nType = rUserElementType.nElementType;
-
- // Make copies of the event structures to be thread-safe. We have to unlock our mutex before calling
- // our listeners!
- while ( pIter != rHashMap.end() )
- {
- UIElementData& rElement = pIter->second;
- if ( !rElement.bDefault )
- {
- if ( xDefaultNameAccess->hasByName( rElement.aName ))
- {
- // Replace settings with data from default layer
- Reference< XIndexAccess > xOldSettings( rElement.xSettings );
- impl_requestUIElementData( nType, LAYER_DEFAULT, rElement );
-
- ConfigurationEvent aReplaceEvent;
- aReplaceEvent.ResourceURL = rElement.aResourceURL;
- aReplaceEvent.Accessor <<= xThis;
- aReplaceEvent.Source = xIfac;
- aReplaceEvent.ReplacedElement <<= xOldSettings;
- aReplaceEvent.Element <<= rElement.xSettings;
-
- rReplaceNotifyContainer.push_back( aReplaceEvent );
-
- // Mark element as default and not modified. That means "not active"
- // in the user layer anymore.
- rElement.bModified = false;
- rElement.bDefault = true;
- }
- else
- {
- // Remove user-defined settings from user layer
- ConfigurationEvent aEvent;
- aEvent.ResourceURL = rElement.aResourceURL;
- aEvent.Accessor <<= xThis;
- aEvent.Source = xIfac;
- aEvent.Element <<= rElement.xSettings;
-
- rRemoveNotifyContainer.push_back( aEvent );
-
- // Mark element as default and not modified. That means "not active"
- // in the user layer anymore.
- rElement.bModified = false;
- rElement.bDefault = true;
- }
- }
-
- ++pIter;
- }
-
- // Remove all settings from our user interface elements
- rHashMap.clear();
-}
-
-void ModuleUIConfigurationManager::impl_reloadElementTypeData(
- UIElementType& rUserElementType,
- UIElementType& rDefaultElementType,
- ConfigEventNotifyContainer& rRemoveNotifyContainer,
- ConfigEventNotifyContainer& rReplaceNotifyContainer )
-{
- UIElementDataHashMap& rHashMap = rUserElementType.aElementsHashMap;
- UIElementDataHashMap::iterator pIter = rHashMap.begin();
- Reference< XStorage > xUserStorage( rUserElementType.xStorage );
- Reference< XStorage > xDefaultStorage( rDefaultElementType.xStorage );
- Reference< XNameAccess > xUserNameAccess( rUserElementType.xStorage, UNO_QUERY );
- Reference< XNameAccess > xDefaultNameAccess( rDefaultElementType.xStorage, UNO_QUERY );
-
- Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- Reference< XInterface > xIfac( xThis, UNO_QUERY );
- sal_Int16 nType = rUserElementType.nElementType;
-
- while ( pIter != rHashMap.end() )
- {
- UIElementData& rElement = pIter->second;
- if ( rElement.bModified )
- {
- if ( xUserNameAccess->hasByName( rElement.aName ))
- {
- // Replace settings with data from user layer
- Reference< XIndexAccess > xOldSettings( rElement.xSettings );
-
- impl_requestUIElementData( nType, LAYER_USERDEFINED, rElement );
-
- ConfigurationEvent aReplaceEvent;
-
- aReplaceEvent.ResourceURL = rElement.aResourceURL;
- aReplaceEvent.Accessor <<= xThis;
- aReplaceEvent.Source = xIfac;
- aReplaceEvent.ReplacedElement <<= xOldSettings;
- aReplaceEvent.Element <<= rElement.xSettings;
- rReplaceNotifyContainer.push_back( aReplaceEvent );
-
- rElement.bModified = false;
- }
- else if ( xDefaultNameAccess->hasByName( rElement.aName ))
- {
- // Replace settings with data from default layer
- Reference< XIndexAccess > xOldSettings( rElement.xSettings );
-
- impl_requestUIElementData( nType, LAYER_DEFAULT, rElement );
-
- ConfigurationEvent aReplaceEvent;
-
- aReplaceEvent.ResourceURL = rElement.aResourceURL;
- aReplaceEvent.Accessor <<= xThis;
- aReplaceEvent.Source = xIfac;
- aReplaceEvent.ReplacedElement <<= xOldSettings;
- aReplaceEvent.Element <<= rElement.xSettings;
- rReplaceNotifyContainer.push_back( aReplaceEvent );
-
- // Mark element as default and not modified. That means "not active"
- // in the user layer anymore.
- rElement.bModified = false;
- rElement.bDefault = true;
- }
- else
- {
- // Element settings are not in any storage => remove
- ConfigurationEvent aRemoveEvent;
-
- aRemoveEvent.ResourceURL = rElement.aResourceURL;
- aRemoveEvent.Accessor <<= xThis;
- aRemoveEvent.Source = xIfac;
- aRemoveEvent.Element <<= rElement.xSettings;
-
- rRemoveNotifyContainer.push_back( aRemoveEvent );
-
- // Mark element as default and not modified. That means "not active"
- // in the user layer anymore.
- rElement.bModified = false;
- rElement.bDefault = true;
- }
- }
- ++pIter;
- }
-
- rUserElementType.bModified = sal_False;
-}
-
-void ModuleUIConfigurationManager::impl_Initialize()
-{
- // Initialize the top-level structures with the storage data
- if ( m_xUserConfigStorage.is() )
- {
- // Try to access our module sub folder
- for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT;
- i++ )
- {
- Reference< XStorage > xElementTypeStorage;
- try
- {
- if ( m_pStorageHandler[i] )
- xElementTypeStorage = m_pStorageHandler[i]->getWorkingStorageUser();
- }
- catch ( com::sun::star::container::NoSuchElementException& )
- {
- }
- catch ( ::com::sun::star::embed::InvalidStorageException& )
- {
- }
- catch ( ::com::sun::star::lang::IllegalArgumentException& )
- {
- }
- catch ( ::com::sun::star::io::IOException& )
- {
- }
- catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
- {
- }
-
- m_aUIElements[LAYER_USERDEFINED][i].nElementType = i;
- m_aUIElements[LAYER_USERDEFINED][i].bModified = false;
- m_aUIElements[LAYER_USERDEFINED][i].xStorage = xElementTypeStorage;
- m_aUIElements[LAYER_USERDEFINED][i].bDefaultLayer = false;
- }
- }
-
- if ( m_xDefaultConfigStorage.is() )
- {
- Reference< XNameAccess > xNameAccess( m_xDefaultConfigStorage, UNO_QUERY_THROW );
-
- // Try to access our module sub folder
- for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT;
- i++ )
- {
- Reference< XStorage > xElementTypeStorage;
- try
- {
- Any a = xNameAccess->getByName( OUString::createFromAscii( UIELEMENTTYPENAMES[i] ));
- a >>= xElementTypeStorage;
- }
- catch ( com::sun::star::container::NoSuchElementException& )
- {
- }
-
- m_aUIElements[LAYER_DEFAULT][i].nElementType = i;
- m_aUIElements[LAYER_DEFAULT][i].bModified = false;
- m_aUIElements[LAYER_DEFAULT][i].xStorage = xElementTypeStorage;
- m_aUIElements[LAYER_DEFAULT][i].bDefaultLayer = true;
- }
- }
-}
-
-ModuleUIConfigurationManager::ModuleUIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ) :
- ThreadHelpBase( &Application::GetSolarMutex() )
- , m_xDefaultConfigStorage( 0 )
- , m_xUserConfigStorage( 0 )
- , m_bReadOnly( true )
- , m_bInitialized( false )
- , m_bModified( false )
- , m_bConfigRead( false )
- , m_bDisposed( false )
- , m_aXMLPostfix( RTL_CONSTASCII_USTRINGPARAM( ".xml" ))
- , m_aPropUIName( RTL_CONSTASCII_USTRINGPARAM( "UIName" ))
- , m_aPropResourceURL( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" ))
- , m_xServiceManager( xServiceManager )
- , m_aListenerContainer( m_aLock.getShareableOslMutex() )
-{
- for ( int i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- m_pStorageHandler[i] = 0;
-
- // Make sure we have a default initialized entry for every layer and user interface element type!
- // The following code depends on this!
- m_aUIElements[LAYER_DEFAULT].resize( ::com::sun::star::ui::UIElementType::COUNT );
- m_aUIElements[LAYER_USERDEFINED].resize( ::com::sun::star::ui::UIElementType::COUNT );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::ModuleUIConfigurationManager" );
}
ModuleUIConfigurationManager::~ModuleUIConfigurationManager()
{
- for ( int i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- delete m_pStorageHandler[i];
}
// XComponent
void SAL_CALL ModuleUIConfigurationManager::dispose() throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
-
- css::lang::EventObject aEvent( xThis );
- m_aListenerContainer.disposeAndClear( aEvent );
-
- {
- ResetableGuard aGuard( m_aLock );
- try
- {
- if ( m_xModuleImageManager.is() )
- m_xModuleImageManager->dispose();
- }
- catch ( Exception& )
- {
- }
-
- m_xModuleImageManager.clear();
- m_aUIElements[LAYER_USERDEFINED].clear();
- m_aUIElements[LAYER_DEFAULT].clear();
- m_xDefaultConfigStorage.clear();
- m_xUserConfigStorage.clear();
- m_xUserRootCommit.clear();
- m_bConfigRead = false;
- m_bModified = false;
- m_bDisposed = true;
- }
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::dispose" );
+ m_pImpl->dispose();
}
void SAL_CALL ModuleUIConfigurationManager::addEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- {
- ResetableGuard aGuard( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
- }
-
- m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::addEventListener" );
+ m_pImpl->addEventListener(xListener);
}
void SAL_CALL ModuleUIConfigurationManager::removeEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::removeEventListener" );
+ m_pImpl->removeEventListener(xListener);
}
// XInitialization
void SAL_CALL ModuleUIConfigurationManager::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
{
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bInitialized )
- {
- ::comphelper::SequenceAsHashMap lArgs(aArguments);
- m_aModuleIdentifier = lArgs.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("ModuleIdentifier"), ::rtl::OUString());
- m_aModuleShortName = lArgs.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("ModuleShortName"), ::rtl::OUString());
-
- for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- {
- rtl::OUString aResourceType;
- if ( i == ::com::sun::star::ui::UIElementType::MENUBAR )
- aResourceType = PresetHandler::RESOURCETYPE_MENUBAR();
- else if ( i == ::com::sun::star::ui::UIElementType::TOOLBAR )
- aResourceType = PresetHandler::RESOURCETYPE_TOOLBAR();
- else if ( i == ::com::sun::star::ui::UIElementType::STATUSBAR )
- aResourceType = PresetHandler::RESOURCETYPE_STATUSBAR();
-
- if ( aResourceType.getLength() > 0 )
- {
- m_pStorageHandler[i] = new PresetHandler( m_xServiceManager );
- m_pStorageHandler[i]->connectToResource( PresetHandler::E_MODULES,
- aResourceType, // this path wont be used later ... seee next lines!
- m_aModuleShortName,
- css::uno::Reference< css::embed::XStorage >()); // no document root used here!
- }
- }
-
- // initialize root storages for all resource types
- m_xUserRootCommit = css::uno::Reference< css::embed::XTransactedObject >(
- m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getOrCreateRootStorageUser(), css::uno::UNO_QUERY); // can be empty
- m_xDefaultConfigStorage = m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getParentStorageShare(
- m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getWorkingStorageShare());
- m_xUserConfigStorage = m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getParentStorageUser(
- m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getWorkingStorageUser());
-
- if ( m_xUserConfigStorage.is() )
- {
- Reference< XPropertySet > xPropSet( m_xUserConfigStorage, UNO_QUERY );
- if ( xPropSet.is() )
- {
- long nOpenMode = 0;
- Any a = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" )));
- if ( a >>= nOpenMode )
- m_bReadOnly = !( nOpenMode & ElementModes::WRITE );
- }
- }
-
- impl_Initialize();
-
- m_bInitialized = true;
- }
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::initialize" );
+ m_pImpl->initialize(aArguments);
}
// XUIConfiguration
void SAL_CALL ModuleUIConfigurationManager::addConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- {
- ResetableGuard aGuard( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
- }
-
- m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::addConfigurationListener" );
+ m_pImpl->addConfigurationListener(xListener);
}
void SAL_CALL ModuleUIConfigurationManager::removeConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::removeConfigurationListener" );
+ m_pImpl->removeConfigurationListener(xListener);
}
// XUIConfigurationManager
void SAL_CALL ModuleUIConfigurationManager::reset() throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- bool bResetStorage( false );
-
- if ( !isReadOnly() )
- {
- // Remove all elements from our user-defined storage!
- try
- {
- for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- {
- UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
- Reference< XStorage > xSubStorage( rElementType.xStorage, UNO_QUERY );
-
- if ( xSubStorage.is() )
- {
- bool bCommitSubStorage( false );
- Reference< XNameAccess > xSubStorageNameAccess( xSubStorage, UNO_QUERY );
- Sequence< OUString > aUIElementStreamNames = xSubStorageNameAccess->getElementNames();
- for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ )
- {
- xSubStorage->removeElement( aUIElementStreamNames[j] );
- bCommitSubStorage = true;
- }
-
- if ( bCommitSubStorage )
- {
- Reference< XTransactedObject > xTransactedObject( xSubStorage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
- m_pStorageHandler[i]->commitUserChanges();
- }
- }
- }
-
- bResetStorage = true;
-
- // remove settings from user defined layer and notify listener about removed settings data!
- ConfigEventNotifyContainer aRemoveEventNotifyContainer;
- ConfigEventNotifyContainer aReplaceEventNotifyContainer;
- for ( sal_Int16 j = 1; j < ::com::sun::star::ui::UIElementType::COUNT; j++ )
- {
- try
- {
- UIElementType& rUserElementType = m_aUIElements[LAYER_USERDEFINED][j];
- UIElementType& rDefaultElementType = m_aUIElements[LAYER_DEFAULT][j];
-
- impl_resetElementTypeData( rUserElementType, rDefaultElementType, aRemoveEventNotifyContainer, aReplaceEventNotifyContainer );
- rUserElementType.bModified = sal_False;
- }
- catch ( Exception& )
- {
- throw IOException();
- }
- }
-
- m_bModified = sal_False;
-
- // Unlock mutex before notify our listeners
- aGuard.unlock();
-
- // Notify our listeners
- sal_uInt32 k = 0;
- for ( k = 0; k < aRemoveEventNotifyContainer.size(); k++ )
- implts_notifyContainerListener( aRemoveEventNotifyContainer[k], NotifyOp_Remove );
- for ( k = 0; k < aReplaceEventNotifyContainer.size(); k++ )
- implts_notifyContainerListener( aReplaceEventNotifyContainer[k], NotifyOp_Replace );
- }
- catch ( ::com::sun::star::lang::IllegalArgumentException& )
- {
- }
- catch ( ::com::sun::star::container::NoSuchElementException& )
- {
- }
- catch ( ::com::sun::star::embed::InvalidStorageException& )
- {
- }
- catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
- {
- }
- }
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::reset" );
+ m_pImpl->reset();
}
Sequence< Sequence< PropertyValue > > SAL_CALL ModuleUIConfigurationManager::getUIElementsInfo( sal_Int16 ElementType )
throw ( IllegalArgumentException, RuntimeException )
{
- if (( ElementType < 0 ) || ( ElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
-
- ResetableGuard aGuard( m_aLock );
- if ( m_bDisposed )
- throw DisposedException();
-
- Sequence< Sequence< PropertyValue > > aElementInfoSeq;
- UIElementInfoHashMap aUIElementInfoCollection;
-
- if ( ElementType == ::com::sun::star::ui::UIElementType::UNKNOWN )
- {
- for ( sal_Int16 i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, sal_Int16( i ) );
- }
- else
- impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, ElementType );
-
- Sequence< PropertyValue > aUIElementInfo( 2 );
- aUIElementInfo[0].Name = m_aPropResourceURL;
- aUIElementInfo[1].Name = m_aPropUIName;
-
- aElementInfoSeq.realloc( aUIElementInfoCollection.size() );
- UIElementInfoHashMap::const_iterator pIter = aUIElementInfoCollection.begin();
-
- sal_Int32 n = 0;
- while ( pIter != aUIElementInfoCollection.end() )
- {
- aUIElementInfo[0].Value <<= pIter->second.aResourceURL;
- aUIElementInfo[1].Value <<= pIter->second.aUIName;
- aElementInfoSeq[n++] = aUIElementInfo;
- ++pIter;
- }
-
- return aElementInfoSeq;
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getUIElementsInfo" );
+ return m_pImpl->getUIElementsInfo(ElementType);
}
Reference< XIndexContainer > SAL_CALL ModuleUIConfigurationManager::createSettings() throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::createSettings" );
// Creates an empty item container which can be filled from outside
- return Reference< XIndexContainer >( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
+ return m_pImpl->createSettings();
}
sal_Bool SAL_CALL ModuleUIConfigurationManager::hasSettings( const ::rtl::OUString& ResourceURL )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
-
- if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
- ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
- else
- {
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
- if ( pDataSettings )
- return sal_True;
- }
-
- return sal_False;
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::hasSettings" );
+ return m_pImpl->hasSettings(ResourceURL);
}
Reference< XIndexAccess > SAL_CALL ModuleUIConfigurationManager::getSettings( const ::rtl::OUString& ResourceURL, sal_Bool bWriteable )
throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
-
- if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
- ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
- else
- {
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
- if ( pDataSettings )
- {
- // Create a copy of our data if someone wants to change the data.
- if ( bWriteable )
- return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( pDataSettings->xSettings ) ), UNO_QUERY );
- else
- return pDataSettings->xSettings;
- }
- }
-
- throw NoSuchElementException();
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getSettings" );
+ return m_pImpl->getSettings(ResourceURL,bWriteable);
}
void SAL_CALL ModuleUIConfigurationManager::replaceSettings( const ::rtl::OUString& ResourceURL, const Reference< ::com::sun::star::container::XIndexAccess >& aNewData )
throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException)
{
- sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
-
- if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
- ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
- else if ( m_bReadOnly )
- throw IllegalAccessException();
- else
- {
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
- if ( pDataSettings )
- {
- if ( !pDataSettings->bDefaultNode )
- {
- // we have a settings entry in our user-defined layer - replace
- Reference< XIndexAccess > xOldSettings = pDataSettings->xSettings;
-
- // Create a copy of the data if the container is not const
- Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
- if ( xReplace.is() )
- pDataSettings->xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
- else
- pDataSettings->xSettings = aNewData;
- pDataSettings->bDefault = false;
- pDataSettings->bModified = true;
- m_bModified = true;
-
- // Modify type container
- UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType];
- rElementType.bModified = true;
-
- Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
-
- // Create event to notify listener about replaced element settings
- ConfigurationEvent aEvent;
- Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- aEvent.ResourceURL = ResourceURL;
- aEvent.Accessor <<= xThis;
- aEvent.Source = xIfac;
- aEvent.ReplacedElement <<= xOldSettings;
- aEvent.Element <<= pDataSettings->xSettings;
-
- aGuard.unlock();
-
- implts_notifyContainerListener( aEvent, NotifyOp_Replace );
- }
- else
- {
- // we have no settings in our user-defined layer - insert
- UIElementData aUIElementData;
-
- aUIElementData.bDefault = false;
- aUIElementData.bDefaultNode = false;
- aUIElementData.bModified = true;
-
- // Create a copy of the data if the container is not const
- Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
- if ( xReplace.is() )
- aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
- else
- aUIElementData.xSettings = aNewData;
- aUIElementData.aName = RetrieveNameFromResourceURL( ResourceURL ) + m_aXMLPostfix;
- aUIElementData.aResourceURL = ResourceURL;
- m_bModified = true;
-
- // Modify type container
- UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType];
- rElementType.bModified = true;
-
- UIElementDataHashMap& rElements = rElementType.aElementsHashMap;
-
- // Check our user element settings hash map as it can already contain settings that have been set to default!
- // If no node can be found, we have to insert it.
- UIElementDataHashMap::iterator pIter = rElements.find( ResourceURL );
- if ( pIter != rElements.end() )
- pIter->second = aUIElementData;
- else
- rElements.insert( UIElementDataHashMap::value_type( ResourceURL, aUIElementData ));
-
- Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- // Create event to notify listener about replaced element settings
- ConfigurationEvent aEvent;
-
- aEvent.ResourceURL = ResourceURL;
- aEvent.Accessor <<= xThis;
- aEvent.Source = xIfac;
- aEvent.ReplacedElement <<= pDataSettings->xSettings;
- aEvent.Element <<= aUIElementData.xSettings;
-
- aGuard.unlock();
-
- implts_notifyContainerListener( aEvent, NotifyOp_Replace );
- }
- }
- else
- throw NoSuchElementException();
- }
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::replaceSettings" );
+ return m_pImpl->replaceSettings(ResourceURL,aNewData);
}
void SAL_CALL ModuleUIConfigurationManager::removeSettings( const ::rtl::OUString& ResourceURL )
throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException, RuntimeException)
{
- sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
-
- if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
- ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
- else if ( m_bReadOnly )
- throw IllegalAccessException();
- else
- {
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
- if ( pDataSettings )
- {
- // If element settings are default, we don't need to change anything!
- if ( pDataSettings->bDefault )
- return;
- else
- {
- Reference< XIndexAccess > xRemovedSettings = pDataSettings->xSettings;
- pDataSettings->bDefault = true;
-
- // check if this is a default layer node
- if ( !pDataSettings->bDefaultNode )
- pDataSettings->bModified = true; // we have to remove this node from the user layer!
- pDataSettings->xSettings.clear();
- m_bModified = true; // user layer must be written
-
- // Modify type container
- UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType];
- rElementType.bModified = true;
-
- Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- // Check if we have settings in the default layer which replaces the user-defined one!
- UIElementData* pDefaultDataSettings = impl_findUIElementData( ResourceURL, nElementType );
- if ( pDefaultDataSettings )
- {
- // Create event to notify listener about replaced element settings
- ConfigurationEvent aEvent;
-
- aEvent.ResourceURL = ResourceURL;
- aEvent.Accessor <<= xThis;
- aEvent.Source = xIfac;
- aEvent.Element <<= xRemovedSettings;
- aEvent.ReplacedElement <<= pDefaultDataSettings->xSettings;
-
- aGuard.unlock();
-
- implts_notifyContainerListener( aEvent, NotifyOp_Replace );
- }
- else
- {
- // Create event to notify listener about removed element settings
- ConfigurationEvent aEvent;
-
- aEvent.ResourceURL = ResourceURL;
- aEvent.Accessor <<= xThis;
- aEvent.Source = xIfac;
- aEvent.Element <<= xRemovedSettings;
-
- aGuard.unlock();
-
- implts_notifyContainerListener( aEvent, NotifyOp_Remove );
- }
- }
- }
- else
- throw NoSuchElementException();
- }
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::removeSettings" );
+ m_pImpl->removeSettings(ResourceURL);
}
void SAL_CALL ModuleUIConfigurationManager::insertSettings( const ::rtl::OUString& NewResourceURL, const Reference< XIndexAccess >& aNewData )
throw ( ElementExistException, IllegalArgumentException, IllegalAccessException, RuntimeException )
{
- sal_Int16 nElementType = RetrieveTypeFromResourceURL( NewResourceURL );
-
- if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
- ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
- else if ( m_bReadOnly )
- throw IllegalAccessException();
- else
- {
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- UIElementData* pDataSettings = impl_findUIElementData( NewResourceURL, nElementType );
- if ( !pDataSettings )
- {
- UIElementData aUIElementData;
-
- aUIElementData.bDefault = false;
- aUIElementData.bDefaultNode = false;
- aUIElementData.bModified = true;
-
- // Create a copy of the data if the container is not const
- Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
- if ( xReplace.is() )
- aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
- else
- aUIElementData.xSettings = aNewData;
- aUIElementData.aName = RetrieveNameFromResourceURL( NewResourceURL ) + m_aXMLPostfix;
- aUIElementData.aResourceURL = NewResourceURL;
- m_bModified = true;
-
- UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType];
- rElementType.bModified = true;
-
- UIElementDataHashMap& rElements = rElementType.aElementsHashMap;
- rElements.insert( UIElementDataHashMap::value_type( NewResourceURL, aUIElementData ));
-
- Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings );
- Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- // Create event to notify listener about removed element settings
- ConfigurationEvent aEvent;
-
- aEvent.ResourceURL = NewResourceURL;
- aEvent.Accessor <<= xThis;
- aEvent.Source = xIfac;
- aEvent.Element <<= xInsertSettings;
-
- aGuard.unlock();
-
- implts_notifyContainerListener( aEvent, NotifyOp_Insert );
- }
- else
- throw ElementExistException();
- }
+ m_pImpl->insertSettings(NewResourceURL,aNewData);
}
Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getImageManager() throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( !m_xModuleImageManager.is() )
- {
- m_xModuleImageManager = Reference< XComponent >( static_cast< cppu::OWeakObject *>( new ModuleImageManager( m_xServiceManager )),
- UNO_QUERY );
- Reference< XInitialization > xInit( m_xModuleImageManager, UNO_QUERY );
-
- Sequence< Any > aPropSeq( 3 );
- PropertyValue aPropValue;
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfigStorage" ));
- aPropValue.Value = makeAny( m_xUserConfigStorage );
- aPropSeq[0] = makeAny( aPropValue );
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" ));
- aPropValue.Value = makeAny( m_aModuleIdentifier );
- aPropSeq[1] = makeAny( aPropValue );
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserRootCommit" ));
- aPropValue.Value = makeAny( m_xUserRootCommit );
- aPropSeq[2] = makeAny( aPropValue );
-
- xInit->initialize( aPropSeq );
- }
-
- return Reference< XInterface >( m_xModuleImageManager, UNO_QUERY );
-
-// return Reference< XInterface >();
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getImageManager" );
+ return m_pImpl->getImageManager();
}
Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
- Reference< XMultiServiceFactory > xSMGR = m_xServiceManager;
- ::rtl::OUString aModule = /*m_aModuleShortName*/m_aModuleIdentifier;
- aGuard.unlock();
-
- Reference< XInterface > xManager = xSMGR->createInstance(SERVICENAME_MODULEACCELERATORCONFIGURATION);
- Reference< XInitialization > xInit (xManager, UNO_QUERY_THROW);
-
- PropertyValue aProp;
- aProp.Name = ::rtl::OUString::createFromAscii("ModuleIdentifier");
- aProp.Value <<= aModule;
-
- Sequence< Any > lArgs(1);
- lArgs[0] <<= aProp;
-
- xInit->initialize(lArgs);
-
- return xManager;
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getShortCutManager" );
+ return m_pImpl->getShortCutManager();
}
Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getEventsManager() throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getEventsManager" );
return Reference< XInterface >();
}
@@ -1406,210 +242,46 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getEventsManager(
sal_Bool SAL_CALL ModuleUIConfigurationManager::isDefaultSettings( const ::rtl::OUString& ResourceURL )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
-
- if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
- ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
- else
- {
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
- if ( pDataSettings && pDataSettings->bDefaultNode )
- return sal_True;
- }
-
- return sal_False;
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::isDefaultSettings" );
+ return m_pImpl->isDefaultSettings(ResourceURL);
}
Reference< XIndexAccess > SAL_CALL ModuleUIConfigurationManager::getDefaultSettings( const ::rtl::OUString& ResourceURL )
throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
-
- if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
- ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
- else
- {
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- // preload list of element types on demand
- impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType );
-
- // Look into our default vector/hash_map combination
- UIElementDataHashMap& rDefaultHashMap = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap;
- UIElementDataHashMap::iterator pIter = rDefaultHashMap.find( ResourceURL );
- if ( pIter != rDefaultHashMap.end() )
- {
- if ( !pIter->second.xSettings.is() )
- impl_requestUIElementData( nElementType, LAYER_DEFAULT, pIter->second );
- return pIter->second.xSettings;
- }
- }
-
- // Nothing has been found!
- throw NoSuchElementException();
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getDefaultSettings" );
+ return m_pImpl->getDefaultSettings(ResourceURL);
}
// XUIConfigurationPersistence
void SAL_CALL ModuleUIConfigurationManager::reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly )
- {
- // Try to access our module sub folder
- ConfigEventNotifyContainer aRemoveNotifyContainer;
- ConfigEventNotifyContainer aReplaceNotifyContainer;
- for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- {
- try
- {
- UIElementType& rUserElementType = m_aUIElements[LAYER_USERDEFINED][i];
- UIElementType& rDefaultElementType = m_aUIElements[LAYER_DEFAULT][i];
-
- if ( rUserElementType.bModified )
- impl_reloadElementTypeData( rUserElementType, rDefaultElementType, aRemoveNotifyContainer, aReplaceNotifyContainer );
- }
- catch ( Exception& )
- {
- throw IOException();
- }
- }
-
- m_bModified = sal_False;
-
- // Unlock mutex before notify our listeners
- aGuard.unlock();
-
- // Notify our listeners
- for ( sal_uInt32 j = 0; j < aRemoveNotifyContainer.size(); j++ )
- implts_notifyContainerListener( aRemoveNotifyContainer[j], NotifyOp_Remove );
- for ( sal_uInt32 k = 0; k < aReplaceNotifyContainer.size(); k++ )
- implts_notifyContainerListener( aReplaceNotifyContainer[k], NotifyOp_Replace );
- }
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::reload" );
+ m_pImpl->reload();
}
void SAL_CALL ModuleUIConfigurationManager::store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly )
- {
- // Try to access our module sub folder
- for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- {
- try
- {
- UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
- Reference< XStorage > xStorage( rElementType.xStorage, UNO_QUERY );
-
- if ( rElementType.bModified && xStorage.is() )
- {
- impl_storeElementTypeData( xStorage, rElementType );
- m_pStorageHandler[i]->commitUserChanges();
- }
- }
- catch ( Exception& )
- {
- throw IOException();
- }
- }
-
- m_bModified = false;
- }
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::store" );
+ m_pImpl->store();
}
void SAL_CALL ModuleUIConfigurationManager::storeToStorage( const Reference< XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly )
- {
- // Try to access our module sub folder
- for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- {
- try
- {
- Reference< XStorage > xElementTypeStorage( Storage->openStorageElement(
- OUString::createFromAscii( UIELEMENTTYPENAMES[i] ), ElementModes::READWRITE ));
- UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
-
- if ( rElementType.bModified && xElementTypeStorage.is() )
- impl_storeElementTypeData( xElementTypeStorage, rElementType, false ); // store data to storage, but don't reset modify flag!
- }
- catch ( Exception& )
- {
- throw IOException();
- }
- }
-
- Reference< XTransactedObject > xTransactedObject( Storage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
- }
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::storeToStorage" );
+ m_pImpl->storeToStorage(Storage);
}
sal_Bool SAL_CALL ModuleUIConfigurationManager::isModified() throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- return m_bModified;
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::isModified" );
+ return m_pImpl->isModified();
}
sal_Bool SAL_CALL ModuleUIConfigurationManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- return m_bReadOnly;
-}
-
-void ModuleUIConfigurationManager::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp )
-{
- ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >*) NULL ) );
- if ( pContainer != NULL )
- {
- ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
- while ( pIterator.hasMoreElements() )
- {
- try
- {
- switch ( eOp )
- {
- case NotifyOp_Replace:
- ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementReplaced( aEvent );
- break;
- case NotifyOp_Insert:
- ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementInserted( aEvent );
- break;
- case NotifyOp_Remove:
- ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementRemoved( aEvent );
- break;
- }
- }
- catch( css::uno::RuntimeException& )
- {
- pIterator.remove();
- }
- }
- }
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::isReadOnly" );
+ return m_pImpl->isReadOnly();
}
} // namespace framework
diff --git a/framework/source/uiconfiguration/uicategorydescription.cxx b/framework/source/uiconfiguration/uicategorydescription.cxx
index d87163dc11..739130ae4c 100644
--- a/framework/source/uiconfiguration/uicategorydescription.cxx
+++ b/framework/source/uiconfiguration/uicategorydescription.cxx
@@ -56,7 +56,7 @@
// includes of other projects
//_________________________________________________________________________________________________________________
#include <rtl/ustrbuf.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <unotools/configmgr.hxx>
#include <tools/string.hxx>
@@ -101,23 +101,14 @@ namespace framework
// Configuration access class for PopupMenuControllerFactory implementation
//*****************************************************************************************************************
-class ConfigurationAccess_UICategory : // interfaces
- public XTypeProvider ,
- public XNameAccess ,
- public XContainerListener ,
- // baseclasses
- // Order is neccessary for right initialization!
+class ConfigurationAccess_UICategory : // Order is neccessary for right initialization!
private ThreadHelpBase ,
- public ::cppu::OWeakObject
+ public ::cppu::WeakImplHelper2<XNameAccess,XContainerListener>
{
public:
ConfigurationAccess_UICategory( const ::rtl::OUString& aModuleName, const Reference< XNameAccess >& xGenericUICommands, const Reference< XMultiServiceFactory >& rServiceManager );
virtual ~ConfigurationAccess_UICategory();
- // XInterface, XTypeProvider
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
// XNameAccess
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);
@@ -171,22 +162,6 @@ class ConfigurationAccess_UICategory : // interfaces
//*****************************************************************************************************************
// XInterface, XTypeProvider
//*****************************************************************************************************************
-DEFINE_XINTERFACE_5 ( ConfigurationAccess_UICategory ,
- OWeakObject ,
- DIRECT_INTERFACE ( css::container::XNameAccess ),
- DIRECT_INTERFACE ( css::container::XContainerListener ),
- DIRECT_INTERFACE ( css::lang::XTypeProvider ),
- DERIVED_INTERFACE( css::container::XElementAccess, css::container::XNameAccess ),
- DERIVED_INTERFACE( css::lang::XEventListener, XContainerListener )
- )
-
-DEFINE_XTYPEPROVIDER_5 ( ConfigurationAccess_UICategory ,
- css::container::XNameAccess ,
- css::container::XElementAccess ,
- css::container::XContainerListener ,
- css::lang::XTypeProvider ,
- css::lang::XEventListener
- )
ConfigurationAccess_UICategory::ConfigurationAccess_UICategory( const rtl::OUString& aModuleName, const Reference< XNameAccess >& rGenericUICategories, const Reference< XMultiServiceFactory >& rServiceManager ) :
ThreadHelpBase(),
@@ -197,14 +172,12 @@ ConfigurationAccess_UICategory::ConfigurationAccess_UICategory( const rtl::OUStr
m_bConfigAccessInitialized( sal_False ),
m_bCacheFilled( sal_False )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::ConfigurationAccess_UICategory" );
// Create configuration hierachical access name
m_aConfigCategoryAccess += aModuleName;
m_aConfigCategoryAccess += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CONFIGURATION_CATEGORY_ELEMENT_ACCESS ));
- m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- UNO_QUERY );
+ m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY );
}
ConfigurationAccess_UICategory::~ConfigurationAccess_UICategory()
@@ -220,6 +193,7 @@ ConfigurationAccess_UICategory::~ConfigurationAccess_UICategory()
Any SAL_CALL ConfigurationAccess_UICategory::getByName( const ::rtl::OUString& rId )
throw ( NoSuchElementException, WrappedTargetException, RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::getByName" );
ResetableGuard aLock( m_aLock );
if ( !m_bConfigAccessInitialized )
{
@@ -240,42 +214,42 @@ throw ( NoSuchElementException, WrappedTargetException, RuntimeException)
Sequence< ::rtl::OUString > SAL_CALL ConfigurationAccess_UICategory::getElementNames()
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::getElementNames" );
return getAllIds();
}
sal_Bool SAL_CALL ConfigurationAccess_UICategory::hasByName( const ::rtl::OUString& rId )
throw (::com::sun::star::uno::RuntimeException)
{
- Any a = getByName( rId );
- if ( a != Any() )
- return sal_True;
- else
- return sal_False;
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::hasByName" );
+ return getByName( rId ).hasValue();
}
// XElementAccess
Type SAL_CALL ConfigurationAccess_UICategory::getElementType()
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::getElementType" );
return( ::getCppuType( (const rtl::OUString*)NULL ) );
}
sal_Bool SAL_CALL ConfigurationAccess_UICategory::hasElements()
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::hasElements" );
// There must be global categories!
return sal_True;
}
sal_Bool ConfigurationAccess_UICategory::fillCache()
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::fillCache" );
RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ConfigurationAccess_UICategory::fillCache" );
if ( m_bCacheFilled )
return sal_True;
sal_Int32 i( 0 );
- Any a;
rtl::OUString aUIName;
Sequence< ::rtl::OUString > aNameSeq = m_xConfigAccess->getElementNames();
@@ -283,12 +257,10 @@ sal_Bool ConfigurationAccess_UICategory::fillCache()
{
try
{
- Reference< XNameAccess > xNameAccess;
- a = m_xConfigAccess->getByName( aNameSeq[i] );
- if ( a >>= xNameAccess )
+ Reference< XNameAccess > xNameAccess(m_xConfigAccess->getByName( aNameSeq[i] ),UNO_QUERY);
+ if ( xNameAccess.is() )
{
- a = xNameAccess->getByName( m_aPropUIName );
- a >>= aUIName;
+ xNameAccess->getByName( m_aPropUIName ) >>= aUIName;
m_aIdCache.insert( IdToInfoCache::value_type( aNameSeq[i], aUIName ));
}
@@ -308,6 +280,7 @@ sal_Bool ConfigurationAccess_UICategory::fillCache()
Any ConfigurationAccess_UICategory::getUINameFromID( const rtl::OUString& rId )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::getUINameFromID" );
Any a;
try
@@ -343,6 +316,7 @@ Any ConfigurationAccess_UICategory::getUINameFromID( const rtl::OUString& rId )
Any ConfigurationAccess_UICategory::getUINameFromCache( const rtl::OUString& rId )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::getUINameFromCache" );
Any a;
IdToInfoCache::const_iterator pIter = m_aIdCache.find( rId );
@@ -354,6 +328,7 @@ Any ConfigurationAccess_UICategory::getUINameFromCache( const rtl::OUString& rId
Sequence< rtl::OUString > ConfigurationAccess_UICategory::getAllIds()
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::getAllIds" );
// SAFE
ResetableGuard aLock( m_aLock );
@@ -402,20 +377,17 @@ Sequence< rtl::OUString > ConfigurationAccess_UICategory::getAllIds()
sal_Bool ConfigurationAccess_UICategory::initializeConfigAccess()
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::initializeConfigAccess" );
Sequence< Any > aArgs( 1 );
PropertyValue aPropValue;
try
{
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
- aPropValue.Value = makeAny( m_aConfigCategoryAccess );
+ aPropValue.Value <<= m_aConfigCategoryAccess;
aArgs[0] <<= aPropValue;
- m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- UNO_QUERY );
+ m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,aArgs ),UNO_QUERY );
if ( m_xConfigAccess.is() )
{
// Add as container listener
@@ -439,19 +411,23 @@ sal_Bool ConfigurationAccess_UICategory::initializeConfigAccess()
// container.XContainerListener
void SAL_CALL ConfigurationAccess_UICategory::elementInserted( const ContainerEvent& ) throw(RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::elementInserted" );
}
void SAL_CALL ConfigurationAccess_UICategory::elementRemoved ( const ContainerEvent& ) throw(RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::elementRemoved " );
}
void SAL_CALL ConfigurationAccess_UICategory::elementReplaced( const ContainerEvent& ) throw(RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::elementReplaced" );
}
// lang.XEventListener
void SAL_CALL ConfigurationAccess_UICategory::disposing( const EventObject& aEvent ) throw(RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_UICategory::disposing" );
// SAFE
// remove our reference to the config access
ResetableGuard aLock( m_aLock );
@@ -465,21 +441,6 @@ void SAL_CALL ConfigurationAccess_UICategory::disposing( const EventObject& aEve
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_4 ( UICategoryDescription ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XServiceInfo ),
- DIRECT_INTERFACE( css::container::XNameAccess ),
- DERIVED_INTERFACE( css::container::XElementAccess, css::container::XNameAccess )
- )
-
-DEFINE_XTYPEPROVIDER_4 ( UICategoryDescription ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- css::container::XNameAccess ,
- css::container::XElementAccess
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UICategoryDescription ,
::cppu::OWeakObject ,
SERVICENAME_UICATEGORYDESCRIPTION ,
@@ -489,139 +450,29 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UICategoryDescription ,
DEFINE_INIT_SERVICE ( UICategoryDescription, {} )
UICategoryDescription::UICategoryDescription( const Reference< XMultiServiceFactory >& xServiceManager ) :
- ThreadHelpBase(),
- m_xServiceManager( xServiceManager )
+ UICommandDescription(xServiceManager,true)
{
Reference< XNameAccess > xEmpty;
- rtl::OUString aGenericCategories( ::rtl::OUString::createFromAscii( "GenericCategories" ));
- m_xGenericCategories = new ConfigurationAccess_UICategory( aGenericCategories, xEmpty, xServiceManager );
-
- m_xModuleManager = Reference< XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ),
- UNO_QUERY );
- Reference< XNameAccess > xNameAccess( m_xModuleManager, UNO_QUERY_THROW );
- Sequence< rtl::OUString > aElementNames = xNameAccess->getElementNames();
- Sequence< PropertyValue > aSeq;
- ::rtl::OUString aModuleIdentifier;
+ rtl::OUString aGenericCategories( RTL_CONSTASCII_USTRINGPARAM( "GenericCategories" ));
+ m_xGenericUICommands = new ConfigurationAccess_UICategory( aGenericCategories, xEmpty, xServiceManager );
// insert generic categories mappings
- m_aModuleToCategoryFileMap.insert( ModuleToCategoryFileMap::value_type(
+ m_aModuleToCommandFileMap.insert( ModuleToCommandFileMap::value_type(
rtl::OUString::createFromAscii( GENERIC_MODULE_NAME ), aGenericCategories ));
- CategoryHashMap::iterator pCatIter = m_aCategoryHashMap.find( aGenericCategories );
- if ( pCatIter != m_aCategoryHashMap.end() )
- pCatIter->second = m_xGenericCategories;
-
- for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ )
- {
- aModuleIdentifier = aElementNames[i];
- Any a = xNameAccess->getByName( aModuleIdentifier );
- if ( a >>= aSeq )
- {
- ::rtl::OUString aCmdCategoryStr;
- for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ )
- {
- if ( aSeq[y].Name.equalsAscii("ooSetupFactoryCmdCategoryConfigRef") )
- {
- aSeq[y].Value >>= aCmdCategoryStr;
- break;
- }
- }
-
- // Create first mapping module identifier ==> category file
- m_aModuleToCategoryFileMap.insert(
- ModuleToCategoryFileMap::value_type( aModuleIdentifier, aCmdCategoryStr ));
+ UICommandsHashMap::iterator pCatIter = m_aUICommandsHashMap.find( aGenericCategories );
+ if ( pCatIter != m_aUICommandsHashMap.end() )
+ pCatIter->second = m_xGenericUICommands;
- // Create second mapping category file ==> category instance
- CategoryHashMap::iterator pIter = m_aCategoryHashMap.find( aCmdCategoryStr );
- if ( pIter == m_aCategoryHashMap.end() )
- m_aCategoryHashMap.insert( CategoryHashMap::value_type( aCmdCategoryStr, xEmpty ));
- }
- }
+ impl_fillElements("ooSetupFactoryCmdCategoryConfigRef");
}
UICategoryDescription::~UICategoryDescription()
{
- ResetableGuard aLock( m_aLock );
- m_aModuleToCategoryFileMap.clear();
- m_aCategoryHashMap.clear();
- m_xGenericCategories.clear();
}
-
-Any SAL_CALL UICategoryDescription::getByName( const ::rtl::OUString& aName )
-throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+Reference< XNameAccess > UICategoryDescription::impl_createConfigAccess(const ::rtl::OUString& _sName)
{
- Any a;
-
- ResetableGuard aLock( m_aLock );
-
- ModuleToCategoryFileMap::const_iterator pM2CIter = m_aModuleToCategoryFileMap.find( aName );
- if ( pM2CIter != m_aModuleToCategoryFileMap.end() )
- {
- ::rtl::OUString aCommandFile( pM2CIter->second );
- CategoryHashMap::iterator pIter = m_aCategoryHashMap.find( aCommandFile );
- if ( pIter != m_aCategoryHashMap.end() )
- {
- if ( pIter->second.is() )
- a <<= pIter->second;
- else
- {
- Reference< XNameAccess > xUICategory;
- ConfigurationAccess_UICategory* pUICategory = new ConfigurationAccess_UICategory( aCommandFile,
- m_xGenericCategories,
- m_xServiceManager );
- xUICategory = Reference< XNameAccess >( static_cast< cppu::OWeakObject* >( pUICategory ),UNO_QUERY );
- pIter->second = xUICategory;
- a <<= xUICategory;
- }
- }
- }
- else
- {
- throw NoSuchElementException();
- }
-
- return a;
-}
-
-Sequence< ::rtl::OUString > SAL_CALL UICategoryDescription::getElementNames()
-throw (::com::sun::star::uno::RuntimeException)
-{
- ResetableGuard aLock( m_aLock );
-
- Sequence< rtl::OUString > aSeq( m_aModuleToCategoryFileMap.size() );
-
- sal_Int32 n = 0;
- ModuleToCategoryFileMap::const_iterator pIter = m_aModuleToCategoryFileMap.begin();
- while ( pIter != m_aModuleToCategoryFileMap.end() )
- {
- aSeq[n] = pIter->first;
- ++pIter;
- }
-
- return aSeq;
-}
-
-sal_Bool SAL_CALL UICategoryDescription::hasByName( const ::rtl::OUString& aName )
-throw (::com::sun::star::uno::RuntimeException)
-{
- ResetableGuard aLock( m_aLock );
-
- ModuleToCategoryFileMap::const_iterator pIter = m_aModuleToCategoryFileMap.find( aName );
- return ( pIter != m_aModuleToCategoryFileMap.end() );
-}
-
-// XElementAccess
-Type SAL_CALL UICategoryDescription::getElementType()
-throw (::com::sun::star::uno::RuntimeException)
-{
- return( ::getCppuType( (const Reference< XNameAccess >*)NULL ) );
-}
-
-sal_Bool SAL_CALL UICategoryDescription::hasElements()
-throw (::com::sun::star::uno::RuntimeException)
-{
- // generic UI commands are always available!
- return sal_True;
+ return new ConfigurationAccess_UICategory( _sName,m_xGenericUICommands,m_xServiceManager );
}
} // namespace framework
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index 35b35c339e..a46120ab41 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -38,6 +38,7 @@
#include <uielement/uielementtypenames.hxx>
#include <xml/menuconfiguration.hxx>
#include <xml/toolboxconfiguration.hxx>
+#include <uiconfigurationmanagerimpl.hxx>
#ifndef __FRAMEWORK_XML_STATUSBARCONFIGURATION_HXX_
#include <xml/statusbarconfiguration.hxx>
@@ -110,511 +111,9 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( UIConfigurationManager
DEFINE_INIT_SERVICE ( UIConfigurationManager, {} )
-
-// important: The order and position of the elements must match the constant
-// definition of "::com::sun::star::ui::UIElementType"
-static const char* UIELEMENTTYPENAMES[] =
-{
- "", // Dummy value for unknown!
- UIELEMENTTYPE_MENUBAR_NAME,
- UIELEMENTTYPE_POPUPMENU_NAME,
- UIELEMENTTYPE_TOOLBAR_NAME,
- UIELEMENTTYPE_STATUSBAR_NAME,
- UIELEMENTTYPE_FLOATINGWINDOW_NAME,
- UIELEMENTTYPE_PROGRESSBAR_NAME
-};
-
-static const char RESOURCEURL_PREFIX[] = "private:resource/";
-static const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17;
-
-static sal_Int16 RetrieveTypeFromResourceURL( const rtl::OUString& aResourceURL )
-{
-
- if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
- ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
- {
- rtl::OUString aTmpStr = aResourceURL.copy( RESOURCEURL_PREFIX_SIZE );
- sal_Int32 nIndex = aTmpStr.indexOf( '/' );
- if (( nIndex > 0 ) && ( aTmpStr.getLength() > nIndex ))
- {
- rtl::OUString aTypeStr( aTmpStr.copy( 0, nIndex ));
- for ( int i = 0; i < UIElementType::COUNT; i++ )
- {
- if ( aTypeStr.equalsAscii( UIELEMENTTYPENAMES[i] ))
- return sal_Int16( i );
- }
- }
- }
-
- return UIElementType::UNKNOWN;
-}
-
-static rtl::OUString RetrieveNameFromResourceURL( const rtl::OUString& aResourceURL )
+UIConfigurationManager::UIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager )
+: m_pImpl( new UIConfigurationManagerImpl(xServiceManager,static_cast< OWeakObject* >(this),false) )
{
- if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
- ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
- {
- sal_Int32 nIndex = aResourceURL.lastIndexOf( '/' );
- if (( nIndex > 0 ) && (( nIndex+1 ) < aResourceURL.getLength()))
- return aResourceURL.copy( nIndex+1 );
- }
-
- return rtl::OUString();
-}
-
-void UIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType )
-{
- // preload list of element types on demand
- impl_preloadUIElementTypeList( nElementType );
-
- UIElementDataHashMap& rUserElements = m_aUIElements[nElementType].aElementsHashMap;
- UIElementDataHashMap::const_iterator pUserIter = rUserElements.begin();
-
- while ( pUserIter != rUserElements.end() )
- {
- UIElementData* pDataSettings = impl_findUIElementData( pUserIter->second.aResourceURL, nElementType );
- if ( pDataSettings && !pDataSettings->bDefault )
- {
- // Retrieve user interface name from XPropertySet interface
- rtl::OUString aUIName;
- Reference< XPropertySet > xPropSet( pDataSettings->xSettings, UNO_QUERY );
- if ( xPropSet.is() )
- {
- Any a = xPropSet->getPropertyValue( m_aPropUIName );
- a >>= aUIName;
- }
-
- UIElementInfo aInfo( pUserIter->second.aResourceURL, aUIName );
- aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo ));
- }
- ++pUserIter;
- }
-}
-
-void UIConfigurationManager::impl_preloadUIElementTypeList( sal_Int16 nElementType )
-{
- UIElementType& rElementTypeData = m_aUIElements[nElementType];
-
- if ( !rElementTypeData.bLoaded )
- {
- Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage;
- if ( xElementTypeStorage.is() )
- {
- rtl::OUStringBuffer aBuf( RESOURCEURL_PREFIX_SIZE );
- aBuf.appendAscii( RESOURCEURL_PREFIX );
- aBuf.appendAscii( UIELEMENTTYPENAMES[ nElementType ] );
- aBuf.appendAscii( "/" );
- rtl::OUString aResURLPrefix( aBuf.makeStringAndClear() );
-
- UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap;
- Reference< XNameAccess > xNameAccess( xElementTypeStorage, UNO_QUERY );
- Sequence< rtl::OUString > aUIElementNames = xNameAccess->getElementNames();
- for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ )
- {
- UIElementData aUIElementData;
-
- // Resource name must be without ".xml"
- sal_Int32 nIndex = aUIElementNames[n].lastIndexOf( '.' );
- if (( nIndex > 0 ) && ( nIndex < aUIElementNames[n].getLength() ))
- {
- rtl::OUString aExtension( aUIElementNames[n].copy( nIndex+1 ));
- rtl::OUString aUIElementName( aUIElementNames[n].copy( 0, nIndex ));
-
- if (( aUIElementName.getLength() > 0 ) &&
- ( aExtension.equalsIgnoreAsciiCaseAsciiL( "xml", 3 )))
- {
- aUIElementData.aResourceURL = aResURLPrefix + aUIElementName;
- aUIElementData.aName = aUIElementNames[n];
- aUIElementData.bModified = false;
- aUIElementData.bDefault = false;
-
- // Create hash_map entries for all user interface elements inside the storage. We don't load the
- // settings to speed up the process.
- rHashMap.insert( UIElementDataHashMap::value_type( aUIElementData.aResourceURL, aUIElementData ));
- }
- }
- }
- }
- }
-
- rElementTypeData.bLoaded = true;
-}
-
-void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, UIElementData& aUIElementData )
-{
- UIElementType& rElementTypeData = m_aUIElements[nElementType];
-
- Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage;
- if ( xElementTypeStorage.is() && aUIElementData.aName.getLength() )
- {
- try
- {
- Reference< XStream > xStream = xElementTypeStorage->openStreamElement( aUIElementData.aName, ElementModes::READ );
- Reference< XInputStream > xInputStream = xStream->getInputStream();
-
- if ( xInputStream.is() )
- {
- switch ( nElementType )
- {
- case ::com::sun::star::ui::UIElementType::UNKNOWN:
- break;
-
- case ::com::sun::star::ui::UIElementType::MENUBAR:
- {
- try
- {
- MenuConfiguration aMenuCfg( m_xServiceManager );
- Reference< XIndexAccess > xContainer( aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream ));
- RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xContainer );
- if ( pRootItemContainer )
- aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
- else
- aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( xContainer, sal_True ) ), UNO_QUERY );
- return;
- }
- catch ( ::com::sun::star::lang::WrappedTargetException& )
- {
- }
- }
- break;
-
- case ::com::sun::star::ui::UIElementType::POPUPMENU:
- {
- break;
- }
-
- case ::com::sun::star::ui::UIElementType::TOOLBAR:
- {
- try
- {
- Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
- ToolBoxConfiguration::LoadToolBox( m_xServiceManager, xInputStream, xIndexContainer );
- RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
- aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
- return;
- }
- catch ( ::com::sun::star::lang::WrappedTargetException& )
- {
- }
-
- break;
- }
-
- case ::com::sun::star::ui::UIElementType::STATUSBAR:
- {
- try
- {
- Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
- StatusBarConfiguration::LoadStatusBar( m_xServiceManager, xInputStream, xIndexContainer );
- RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
- aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
- return;
- }
- catch ( ::com::sun::star::lang::WrappedTargetException& )
- {
- }
-
- break;
- }
-
- case ::com::sun::star::ui::UIElementType::FLOATINGWINDOW:
- {
- break;
- }
- }
- }
- }
- catch ( ::com::sun::star::embed::InvalidStorageException& )
- {
- }
- catch ( ::com::sun::star::lang::IllegalArgumentException& )
- {
- }
- catch ( ::com::sun::star::io::IOException& )
- {
- }
- catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
- {
- }
- }
-
- // At least we provide an empty settings container!
- aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer()), UNO_QUERY );
-}
-
-UIConfigurationManager::UIElementData* UIConfigurationManager::impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad )
-{
- // preload list of element types on demand
- impl_preloadUIElementTypeList( nElementType );
-
- // try to look into our document vector/hash_map combination
- UIElementDataHashMap& rUserHashMap = m_aUIElements[nElementType].aElementsHashMap;
- UIElementDataHashMap::iterator pIter = rUserHashMap.find( aResourceURL );
- if ( pIter != rUserHashMap.end() )
- {
- // Default data settings data means removed!
- if ( pIter->second.bDefault )
- return &(pIter->second);
- else
- {
- if ( !pIter->second.xSettings.is() && bLoad )
- impl_requestUIElementData( nElementType, pIter->second );
- return &(pIter->second);
- }
- }
-
- // Nothing has been found!
- return NULL;
-}
-
-void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage >& xStorage, UIElementType& rElementType, bool bResetModifyState )
-{
- UIElementDataHashMap& rHashMap = rElementType.aElementsHashMap;
- UIElementDataHashMap::iterator pIter = rHashMap.begin();
-
- while ( pIter != rHashMap.end() )
- {
- UIElementData& rElement = pIter->second;
- if ( rElement.bModified )
- {
- if ( rElement.bDefault )
- {
- xStorage->removeElement( rElement.aName );
- rElement.bModified = sal_False; // mark as not modified
- }
- else
- {
- Reference< XStream > xStream( xStorage->openStreamElement( rElement.aName, ElementModes::WRITE|ElementModes::TRUNCATE ), UNO_QUERY );
- Reference< XOutputStream > xOutputStream( xStream->getOutputStream() );
-
- if ( xOutputStream.is() )
- {
- switch( rElementType.nElementType )
- {
- case ::com::sun::star::ui::UIElementType::MENUBAR:
- {
- try
- {
- MenuConfiguration aMenuCfg( m_xServiceManager );
- aMenuCfg.StoreMenuBarConfigurationToXML( rElement.xSettings, xOutputStream );
- }
- catch ( ::com::sun::star::lang::WrappedTargetException& )
- {
- }
- }
- break;
-
- case ::com::sun::star::ui::UIElementType::TOOLBAR:
- {
- try
- {
- ToolBoxConfiguration::StoreToolBox( m_xServiceManager, xOutputStream, rElement.xSettings );
- }
- catch ( ::com::sun::star::lang::WrappedTargetException& )
- {
- }
- }
- break;
-
- case ::com::sun::star::ui::UIElementType::STATUSBAR:
- {
- try
- {
- StatusBarConfiguration::StoreStatusBar( m_xServiceManager, xOutputStream, rElement.xSettings );
- }
- catch ( ::com::sun::star::lang::WrappedTargetException& )
- {
- }
- }
- break;
-
- default:
- break;
- }
- }
-
- // mark as not modified if we store to our own storage
- if ( bResetModifyState )
- rElement.bModified = sal_False;
- }
- }
-
- ++pIter;
- }
-
- // commit element type storage
- Reference< XTransactedObject > xTransactedObject( xStorage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
-
- // mark UIElementType as not modified if we store to our own storage
- if ( bResetModifyState )
- rElementType.bModified = sal_False;
-}
-
-void UIConfigurationManager::impl_resetElementTypeData(
- UIElementType& rDocElementType,
- ConfigEventNotifyContainer& rRemoveNotifyContainer )
-{
- UIElementDataHashMap& rHashMap = rDocElementType.aElementsHashMap;
- UIElementDataHashMap::iterator pIter = rHashMap.begin();
-
- Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- // Make copies of the event structures to be thread-safe. We have to unlock our mutex before calling
- // our listeners!
- while ( pIter != rHashMap.end() )
- {
- UIElementData& rElement = pIter->second;
- if ( !rElement.bDefault )
- {
- // Remove user-defined settings from document
- ConfigurationEvent aEvent;
- aEvent.ResourceURL = rElement.aResourceURL;
- aEvent.Accessor <<= xThis;
- aEvent.Source = xIfac;
- aEvent.Element <<= rElement.xSettings;
-
- rRemoveNotifyContainer.push_back( aEvent );
-
- // Mark element as default.
- rElement.bModified = false;
- rElement.bDefault = true;
- }
- else
- rElement.bModified = false;
-
- ++pIter;
- }
-
- // Remove all settings from our user interface elements
- rHashMap.clear();
-}
-
-void UIConfigurationManager::impl_reloadElementTypeData(
- UIElementType& rDocElementType,
- ConfigEventNotifyContainer& rRemoveNotifyContainer,
- ConfigEventNotifyContainer& rReplaceNotifyContainer )
-{
- UIElementDataHashMap& rHashMap = rDocElementType.aElementsHashMap;
- UIElementDataHashMap::iterator pIter = rHashMap.begin();
- Reference< XStorage > xElementStorage( rDocElementType.xStorage );
- Reference< XNameAccess > xElementNameAccess( xElementStorage, UNO_QUERY );
-
- Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- Reference< XInterface > xIfac( xThis, UNO_QUERY );
- sal_Int16 nType = rDocElementType.nElementType;
-
- while ( pIter != rHashMap.end() )
- {
- UIElementData& rElement = pIter->second;
- if ( rElement.bModified )
- {
- if ( xElementNameAccess->hasByName( rElement.aName ))
- {
- // Replace settings with data from user layer
- Reference< XIndexAccess > xOldSettings( rElement.xSettings );
-
- impl_requestUIElementData( nType, rElement );
-
- ConfigurationEvent aReplaceEvent;
-
- aReplaceEvent.ResourceURL = rElement.aResourceURL;
- aReplaceEvent.Accessor <<= xThis;
- aReplaceEvent.Source = xIfac;
- aReplaceEvent.ReplacedElement <<= xOldSettings;
- aReplaceEvent.Element <<= rElement.xSettings;
- rReplaceNotifyContainer.push_back( aReplaceEvent );
-
- rElement.bModified = false;
- }
- else
- {
- // Element settings are not in any storage => remove
- ConfigurationEvent aRemoveEvent;
-
- aRemoveEvent.ResourceURL = rElement.aResourceURL;
- aRemoveEvent.Accessor <<= xThis;
- aRemoveEvent.Source = xIfac;
- aRemoveEvent.Element <<= rElement.xSettings;
-
- rRemoveNotifyContainer.push_back( aRemoveEvent );
-
- // Mark element as default and not modified. That means "not active" in the document anymore
- rElement.bModified = false;
- rElement.bDefault = true;
- }
- }
- ++pIter;
- }
-
- rDocElementType.bModified = sal_False;
-}
-
-void UIConfigurationManager::impl_Initialize()
-{
- // Initialize the top-level structures with the storage data
- if ( m_xDocConfigStorage.is() )
- {
- long nModes = m_bReadOnly ? ElementModes::READ : ElementModes::READWRITE;
-
- // Try to access our module sub folder
- for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT;
- i++ )
- {
- Reference< XStorage > xElementTypeStorage;
- try
- {
- xElementTypeStorage = m_xDocConfigStorage->openStorageElement( rtl::OUString::createFromAscii( UIELEMENTTYPENAMES[i] ), nModes );
- }
- catch ( com::sun::star::container::NoSuchElementException& )
- {
- }
- catch ( ::com::sun::star::embed::InvalidStorageException& )
- {
- }
- catch ( ::com::sun::star::lang::IllegalArgumentException& )
- {
- }
- catch ( ::com::sun::star::io::IOException& )
- {
- }
- catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
- {
- }
-
- m_aUIElements[i].nElementType = i;
- m_aUIElements[i].bModified = false;
- m_aUIElements[i].xStorage = xElementTypeStorage;
- m_aUIElements[i].bDefaultLayer = false;
- }
- }
- else
- {
- // We have no storage, just initialize ui element types with empty storage!
- for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- m_aUIElements[i].xStorage = m_xDocConfigStorage;
- }
-}
-
-UIConfigurationManager::UIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ) :
- ThreadHelpBase( &Application::GetSolarMutex() )
- , m_xDocConfigStorage( 0 )
- , m_bReadOnly( true )
- , m_bInitialized( false )
- , m_bModified( false )
- , m_bConfigRead( false )
- , m_bDisposed( false )
- , m_aXMLPostfix( RTL_CONSTASCII_USTRINGPARAM( ".xml" ))
- , m_aPropUIName( RTL_CONSTASCII_USTRINGPARAM( "UIName" ))
- , m_aPropResourceURL( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" ))
- , m_xServiceManager( xServiceManager )
- , m_aListenerContainer( m_aLock.getShareableOslMutex() )
-{
- // Make sure we have a default initialized entry for every layer and user interface element type!
- // The following code depends on this!
- m_aUIElements.resize( ::com::sun::star::ui::UIElementType::COUNT );
}
UIConfigurationManager::~UIConfigurationManager()
@@ -624,507 +123,86 @@ UIConfigurationManager::~UIConfigurationManager()
// XComponent
void SAL_CALL UIConfigurationManager::dispose() throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
-
- css::lang::EventObject aEvent( xThis );
- m_aListenerContainer.disposeAndClear( aEvent );
-
- {
- ResetableGuard aGuard( m_aLock );
- try
- {
- if ( m_xImageManager.is() )
- m_xImageManager->dispose();
- }
- catch ( Exception& )
- {
- }
-
- m_xImageManager.clear();
- m_aUIElements.clear();
- m_xDocConfigStorage.clear();
- m_bConfigRead = false;
- m_bModified = false;
- m_bDisposed = true;
- }
+ m_pImpl->dispose();
}
void SAL_CALL UIConfigurationManager::addEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- {
- ResetableGuard aGuard( m_aLock );
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
- }
-
- m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
+ m_pImpl->addEventListener(xListener);
}
void SAL_CALL UIConfigurationManager::removeEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
+ m_pImpl->removeEventListener(xListener);
}
// XUIConfigurationManager
void SAL_CALL UIConfigurationManager::addConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- {
- ResetableGuard aGuard( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
- }
-
- m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener );
+ m_pImpl->addConfigurationListener(xListener);
}
void SAL_CALL UIConfigurationManager::removeConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener );
+ m_pImpl->removeConfigurationListener(xListener);
}
void SAL_CALL UIConfigurationManager::reset() throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( isReadOnly() )
- return;
-
- bool bResetStorage( false );
- if ( m_xDocConfigStorage.is() )
- {
- try
- {
- // Remove all elements from our user-defined storage!
- bool bCommit( false );
- for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- {
- UIElementType& rElementType = m_aUIElements[i];
- Reference< XStorage > xSubStorage( rElementType.xStorage, UNO_QUERY );
-
- if ( xSubStorage.is() )
- {
- bool bCommitSubStorage( false );
- Reference< XNameAccess > xSubStorageNameAccess( xSubStorage, UNO_QUERY );
- Sequence< rtl::OUString > aUIElementStreamNames = xSubStorageNameAccess->getElementNames();
- for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ )
- {
- xSubStorage->removeElement( aUIElementStreamNames[j] );
- bCommitSubStorage = true;
- bCommit = true;
- }
-
- if ( bCommitSubStorage )
- {
- Reference< XTransactedObject > xTransactedObject( xSubStorage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
- }
- }
- }
-
- // Commit changes
- if ( bCommit )
- {
- Reference< XTransactedObject > xTransactedObject( m_xDocConfigStorage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
- }
- bResetStorage = true;
-
- // remove settings from user defined layer and notify listener about removed settings data!
- // Try to access our module sub folder
- ConfigEventNotifyContainer aRemoveEventNotifyContainer;
- for ( sal_Int16 j = 1; j < ::com::sun::star::ui::UIElementType::COUNT; j++ )
- {
- UIElementType& rDocElementType = m_aUIElements[j];
-
- impl_resetElementTypeData( rDocElementType, aRemoveEventNotifyContainer );
- rDocElementType.bModified = sal_False;
- }
-
- m_bModified = sal_False;
-
- // Unlock mutex before notify our listeners
- aGuard.unlock();
-
- // Notify our listeners
- for ( sal_uInt32 k = 0; k < aRemoveEventNotifyContainer.size(); k++ )
- implts_notifyContainerListener( aRemoveEventNotifyContainer[k], NotifyOp_Remove );
- }
- catch ( ::com::sun::star::lang::IllegalArgumentException& )
- {
- }
- catch ( ::com::sun::star::container::NoSuchElementException& )
- {
- }
- catch ( ::com::sun::star::embed::InvalidStorageException& )
- {
- }
- catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
- {
- }
- }
+ m_pImpl->reset();
}
Sequence< Sequence< PropertyValue > > SAL_CALL UIConfigurationManager::getUIElementsInfo( sal_Int16 ElementType )
throw ( IllegalArgumentException, RuntimeException )
{
- if (( ElementType < 0 ) || ( ElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
-
- ResetableGuard aGuard( m_aLock );
- if ( m_bDisposed )
- throw DisposedException();
-
- Sequence< Sequence< PropertyValue > > aElementInfoSeq;
- UIElementInfoHashMap aUIElementInfoCollection;
-
- if ( ElementType == ::com::sun::star::ui::UIElementType::UNKNOWN )
- {
- for ( sal_Int16 i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, sal_Int16( i ) );
- }
- else
- impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, ElementType );
-
- Sequence< PropertyValue > aUIElementInfo( 2 );
- aUIElementInfo[0].Name = m_aPropResourceURL;
- aUIElementInfo[1].Name = m_aPropUIName;
-
- aElementInfoSeq.realloc( aUIElementInfoCollection.size() );
- UIElementInfoHashMap::const_iterator pIter = aUIElementInfoCollection.begin();
-
- sal_Int32 n = 0;
- while ( pIter != aUIElementInfoCollection.end() )
- {
- aUIElementInfo[0].Value <<= pIter->second.aResourceURL;
- aUIElementInfo[1].Value <<= pIter->second.aUIName;
- aElementInfoSeq[n++] = aUIElementInfo;
- ++pIter;
- }
-
- return aElementInfoSeq;
+ return m_pImpl->getUIElementsInfo(ElementType);
}
Reference< XIndexContainer > SAL_CALL UIConfigurationManager::createSettings() throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- // Creates an empty item container which can be filled from outside
- return Reference< XIndexContainer >( static_cast< OWeakObject * >( new RootItemContainer()), UNO_QUERY );
+ return m_pImpl->createSettings();
}
sal_Bool SAL_CALL UIConfigurationManager::hasSettings( const ::rtl::OUString& ResourceURL )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
-
- if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
- ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
- else
- {
- UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
- if ( pDataSettings && !pDataSettings->bDefault )
- return sal_True;
- }
-
- return sal_False;
+ return m_pImpl->hasSettings(ResourceURL);
}
Reference< XIndexAccess > SAL_CALL UIConfigurationManager::getSettings( const ::rtl::OUString& ResourceURL, sal_Bool bWriteable )
throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
-
- if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
- ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
- else
- {
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
- if ( pDataSettings && !pDataSettings->bDefault )
- {
- // Create a copy of our data if someone wants to change the data.
- if ( bWriteable )
- return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( pDataSettings->xSettings ) ), UNO_QUERY );
- else
- return pDataSettings->xSettings;
- }
- }
-
- throw NoSuchElementException();
+ return m_pImpl->getSettings(ResourceURL,bWriteable);
}
void SAL_CALL UIConfigurationManager::replaceSettings( const ::rtl::OUString& ResourceURL, const Reference< ::com::sun::star::container::XIndexAccess >& aNewData )
throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException)
{
- sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
-
- if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
- ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
- else if ( m_bReadOnly )
- throw IllegalAccessException();
- else
- {
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
- if ( pDataSettings && !pDataSettings->bDefault )
- {
- // we have a settings entry in our user-defined layer - replace
- Reference< XIndexAccess > xOldSettings = pDataSettings->xSettings;
-
- // Create a copy of the data if the container is not const
- Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
- if ( xReplace.is() )
- pDataSettings->xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
- else
- pDataSettings->xSettings = aNewData;
-
- pDataSettings->bDefault = false;
- pDataSettings->bModified = true;
- m_bModified = true;
-
- // Modify type container
- UIElementType& rElementType = m_aUIElements[nElementType];
- rElementType.bModified = true;
-
- Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
-
- // Create event to notify listener about replaced element settings
- ConfigurationEvent aEvent;
- Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- aEvent.ResourceURL = ResourceURL;
- aEvent.Accessor <<= xThis;
- aEvent.Source = xIfac;
- aEvent.ReplacedElement <<= xOldSettings;
- aEvent.Element <<= pDataSettings->xSettings;
-
- aGuard.unlock();
-
- implts_notifyContainerListener( aEvent, NotifyOp_Replace );
- }
- else
- throw NoSuchElementException();
- }
+ return m_pImpl->replaceSettings(ResourceURL,aNewData);
}
void SAL_CALL UIConfigurationManager::removeSettings( const ::rtl::OUString& ResourceURL )
throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException, RuntimeException)
{
- sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
-
- if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
- ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
- else if ( m_bReadOnly )
- throw IllegalAccessException();
- else
- {
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
- if ( pDataSettings )
- {
- // If element settings are default, we don't need to change anything!
- if ( pDataSettings->bDefault )
- return;
- else
- {
- Reference< XIndexAccess > xRemovedSettings = pDataSettings->xSettings;
- pDataSettings->bDefault = true;
-
- // check if this is a default layer node
- pDataSettings->bModified = true; // we have to remove this node from the user layer!
- pDataSettings->xSettings.clear();
- m_bModified = true; // user layer must be written
-
- // Modify type container
- UIElementType& rElementType = m_aUIElements[nElementType];
- rElementType.bModified = true;
-
- Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- // Create event to notify listener about removed element settings
- ConfigurationEvent aEvent;
-
- aEvent.ResourceURL = ResourceURL;
- aEvent.Accessor <<= xThis;
- aEvent.Source = xIfac;
- aEvent.Element <<= xRemovedSettings;
-
- aGuard.unlock();
-
- implts_notifyContainerListener( aEvent, NotifyOp_Remove );
- }
- }
- else
- throw NoSuchElementException();
- }
+ m_pImpl->removeSettings(ResourceURL);
}
void SAL_CALL UIConfigurationManager::insertSettings( const ::rtl::OUString& NewResourceURL, const Reference< XIndexAccess >& aNewData )
throw ( ElementExistException, IllegalArgumentException, IllegalAccessException, RuntimeException )
{
- sal_Int16 nElementType = RetrieveTypeFromResourceURL( NewResourceURL );
-
- if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
- ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
- throw IllegalArgumentException();
- else if ( m_bReadOnly )
- throw IllegalAccessException();
- else
- {
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- bool bInsertData( false );
- UIElementData aUIElementData;
- UIElementData* pDataSettings = impl_findUIElementData( NewResourceURL, nElementType );
-
- if ( pDataSettings && !pDataSettings->bDefault )
- throw ElementExistException();
-
- if ( !pDataSettings )
- {
- pDataSettings = &aUIElementData;
- bInsertData = true;
- }
-
- {
- pDataSettings->bDefault = false;
- pDataSettings->bModified = true;
-
- // Create a copy of the data if the container is not const
- Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
- if ( xReplace.is() )
- pDataSettings->xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
- else
- pDataSettings->xSettings = aNewData;
-
- m_bModified = true;
-
- UIElementType& rElementType = m_aUIElements[nElementType];
- rElementType.bModified = true;
-
- if ( bInsertData )
- {
- pDataSettings->aName = RetrieveNameFromResourceURL( NewResourceURL ) + m_aXMLPostfix;
- pDataSettings->aResourceURL = NewResourceURL;
-
- UIElementDataHashMap& rElements = rElementType.aElementsHashMap;
- rElements.insert( UIElementDataHashMap::value_type( NewResourceURL, *pDataSettings ));
- }
-
- Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings );
- Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- Reference< XInterface > xIfac( xThis, UNO_QUERY );
-
- // Create event to notify listener about removed element settings
- ConfigurationEvent aEvent;
-
- aEvent.ResourceURL = NewResourceURL;
- aEvent.Accessor <<= xThis;
- aEvent.Source = xIfac;
- aEvent.Element <<= xInsertSettings;
-
- aGuard.unlock();
-
- implts_notifyContainerListener( aEvent, NotifyOp_Insert );
- }
- }
+ m_pImpl->insertSettings(NewResourceURL,aNewData);
}
Reference< XInterface > SAL_CALL UIConfigurationManager::getImageManager() throw (::com::sun::star::uno::RuntimeException)
{
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( !m_xImageManager.is() )
- {
- m_xImageManager = Reference< XComponent >( static_cast< cppu::OWeakObject *>( new ImageManager( m_xServiceManager )),
- UNO_QUERY );
- Reference< XInitialization > xInit( m_xImageManager, UNO_QUERY );
-
- Sequence< Any > aPropSeq( 2 );
- PropertyValue aPropValue;
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfigStorage" ));
- aPropValue.Value = makeAny( m_xDocConfigStorage );
- aPropSeq[0] = makeAny( aPropValue );
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" ));
- aPropValue.Value = makeAny( m_aModuleIdentifier );
- aPropSeq[1] = makeAny( aPropValue );
-
- xInit->initialize( aPropSeq );
- }
-
- return Reference< XInterface >( m_xImageManager, UNO_QUERY );
+ return m_pImpl->getImageManager();
}
Reference< XInterface > SAL_CALL UIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException)
{
- // SAFE ->
- ResetableGuard aGuard( m_aLock );
-
- if (m_xAccConfig.is())
- return m_xAccConfig;
-
- Reference< XMultiServiceFactory > xSMGR = m_xServiceManager;
- Reference< XStorage > xDocumentRoot = m_xDocConfigStorage;
-
- aGuard.unlock();
- // <- SAFE
-
- Reference< XInterface > xAccConfig = xSMGR->createInstance(SERVICENAME_DOCUMENTACCELERATORCONFIGURATION);
- Reference< XInitialization > xInit (xAccConfig, UNO_QUERY_THROW);
-
- PropertyValue aProp;
- aProp.Name = ::rtl::OUString::createFromAscii("DocumentRoot");
- aProp.Value <<= xDocumentRoot;
-
- Sequence< Any > lArgs(1);
- lArgs[0] <<= aProp;
-
- xInit->initialize(lArgs);
-
- // SAFE ->
- aGuard.lock();
- m_xAccConfig = xAccConfig;
- aGuard.unlock();
- // <- SAFE
-
- return xAccConfig;
+ return m_pImpl->getShortCutManager();
}
Reference< XInterface > SAL_CALL UIConfigurationManager::getEventsManager() throw (::com::sun::star::uno::RuntimeException)
@@ -1135,223 +213,38 @@ Reference< XInterface > SAL_CALL UIConfigurationManager::getEventsManager() thro
// XUIConfigurationStorage
void SAL_CALL UIConfigurationManager::setStorage( const Reference< XStorage >& Storage ) throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xDocConfigStorage.is() )
- {
- try
- {
- // Dispose old storage to be sure that it will be closed
- Reference< XComponent > xComponent( m_xDocConfigStorage, UNO_QUERY );
- if ( xComponent.is() )
- xComponent->dispose();
- }
- catch ( Exception& )
- {
- }
- }
-
- // We store the new storage. Be careful it could be an empty reference!
- m_xDocConfigStorage = Storage;
- m_bReadOnly = sal_True;
-
- Reference< XUIConfigurationStorage > xAccUpdate(m_xAccConfig, UNO_QUERY);
- if ( xAccUpdate.is() )
- xAccUpdate->setStorage( m_xDocConfigStorage );
-
- if ( m_xImageManager.is() )
- {
- ImageManager* pImageManager = (ImageManager*)m_xImageManager.get();
- if ( pImageManager )
- pImageManager->setStorage( m_xDocConfigStorage );
- }
-
- if ( m_xDocConfigStorage.is() )
- {
- Reference< XPropertySet > xPropSet( m_xDocConfigStorage, UNO_QUERY );
- if ( xPropSet.is() )
- {
- try
- {
- long nOpenMode = 0;
- Any a = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" )));
- if ( a >>= nOpenMode )
- m_bReadOnly = !( nOpenMode & ElementModes::WRITE );
- }
- catch ( com::sun::star::beans::UnknownPropertyException& )
- {
- }
- catch ( com::sun::star::lang::WrappedTargetException& )
- {
- }
- }
- }
-
- impl_Initialize();
+ m_pImpl->setStorage(Storage);
}
sal_Bool SAL_CALL UIConfigurationManager::hasStorage() throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- return ( m_xDocConfigStorage.is() );
+ return m_pImpl->hasStorage();
}
// XUIConfigurationPersistence
void SAL_CALL UIConfigurationManager::reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly )
- {
- // Try to access our module sub folder
- ConfigEventNotifyContainer aRemoveNotifyContainer;
- ConfigEventNotifyContainer aReplaceNotifyContainer;
- for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- {
- try
- {
- UIElementType& rDocElementType = m_aUIElements[i];
- if ( rDocElementType.bModified )
- impl_reloadElementTypeData( rDocElementType, aRemoveNotifyContainer, aReplaceNotifyContainer );
- }
- catch ( Exception& )
- {
- throw IOException();
- }
- }
-
- m_bModified = sal_False;
-
- // Unlock mutex before notify our listeners
- aGuard.unlock();
-
- // Notify our listeners
- for ( sal_uInt32 j = 0; j < aRemoveNotifyContainer.size(); j++ )
- implts_notifyContainerListener( aRemoveNotifyContainer[j], NotifyOp_Remove );
- for ( sal_uInt32 k = 0; k < aReplaceNotifyContainer.size(); k++ )
- implts_notifyContainerListener( aReplaceNotifyContainer[k], NotifyOp_Replace );
- }
+ m_pImpl->reload();
}
void SAL_CALL UIConfigurationManager::store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly )
- {
- // Try to access our module sub folder
- for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- {
- try
- {
- UIElementType& rElementType = m_aUIElements[i];
- Reference< XStorage > xStorage( rElementType.xStorage, UNO_QUERY );
-
- if ( rElementType.bModified && xStorage.is() )
- impl_storeElementTypeData( xStorage, rElementType );
- }
- catch ( Exception& )
- {
- throw IOException();
- }
- }
-
- m_bModified = false;
- Reference< XTransactedObject > xTransactedObject( m_xDocConfigStorage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
- }
+ m_pImpl->store();
}
void SAL_CALL UIConfigurationManager::storeToStorage( const Reference< XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly )
- {
- // Try to access our module sub folder
- for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
- {
- try
- {
- Reference< XStorage > xElementTypeStorage( Storage->openStorageElement(
- rtl::OUString::createFromAscii( UIELEMENTTYPENAMES[i] ), ElementModes::READWRITE ));
- UIElementType& rElementType = m_aUIElements[i];
-
- if ( rElementType.bModified && xElementTypeStorage.is() )
- impl_storeElementTypeData( xElementTypeStorage, rElementType, false ); // store data to storage, but don't reset modify flag!
- }
- catch ( Exception& )
- {
- throw IOException();
- }
- }
-
- Reference< XTransactedObject > xTransactedObject( Storage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
- }
+ m_pImpl->storeToStorage(Storage);
}
sal_Bool SAL_CALL UIConfigurationManager::isModified() throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- return m_bModified;
+ return m_pImpl->isModified();
}
sal_Bool SAL_CALL UIConfigurationManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- return m_bReadOnly;
-}
-
-void UIConfigurationManager::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp )
-{
- ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >*) NULL ) );
- if ( pContainer != NULL )
- {
- ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
- while ( pIterator.hasMoreElements() )
- {
- try
- {
- switch ( eOp )
- {
- case NotifyOp_Replace:
- ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementReplaced( aEvent );
- break;
- case NotifyOp_Insert:
- ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementInserted( aEvent );
- break;
- case NotifyOp_Remove:
- ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementRemoved( aEvent );
- break;
- }
- }
- catch( css::uno::RuntimeException& )
- {
- pIterator.remove();
- }
- }
- }
+ return m_pImpl->isReadOnly();
}
} // namespace framework
diff --git a/framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx b/framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx
new file mode 100755
index 0000000000..35676b6976
--- /dev/null
+++ b/framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx
@@ -0,0 +1,1713 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: UIConfigurationManagerImpl.cxx,v $
+ * $Revision: 1.19.208.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_framework.hxx"
+#include <uiconfigurationmanagerimpl.hxx>
+#include <threadhelp/resetableguard.hxx>
+#include <services.h>
+#include <uielement/constitemcontainer.hxx>
+#include <uielement/rootitemcontainer.hxx>
+#include <uielement/uielementtypenames.hxx>
+#include <xml/menuconfiguration.hxx>
+#include <xml/toolboxconfiguration.hxx>
+#include <uiconfiguration/imagemanager.hxx>
+
+#ifndef __FRAMEWORK_XML_STATUSBARCONFIGURATION_HXX_
+#include <xml/statusbarconfiguration.hxx>
+#endif
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+#include <com/sun/star/ui/UIElementType.hpp>
+#include <com/sun/star/ui/ConfigurationEvent.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/io/XStream.hpp>
+
+//_________________________________________________________________________________________________________________
+// other includes
+//_________________________________________________________________________________________________________________
+
+#include <vcl/svapp.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <boost/bind.hpp>
+
+//_________________________________________________________________________________________________________________
+// namespaces
+//_________________________________________________________________________________________________________________
+
+using rtl::OUString;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::io;
+using namespace com::sun::star::embed;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans;
+using namespace ::com::sun::star::ui;
+using namespace ::cppu;
+
+namespace framework
+{
+
+
+// important: The order and position of the elements must match the constant
+// definition of "::com::sun::star::ui::UIElementType"
+static const char* UIELEMENTTYPENAMES[] =
+{
+ "", // Dummy value for unknown!
+ UIELEMENTTYPE_MENUBAR_NAME,
+ UIELEMENTTYPE_POPUPMENU_NAME,
+ UIELEMENTTYPE_TOOLBAR_NAME,
+ UIELEMENTTYPE_STATUSBAR_NAME,
+ UIELEMENTTYPE_FLOATINGWINDOW_NAME,
+ UIELEMENTTYPE_PROGRESSBAR_NAME
+};
+
+static const char RESOURCEURL_PREFIX[] = "private:resource/";
+static const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17;
+static const char RESOURCEURL_CUSTOM_ELEMENT[] = "custom_";
+
+static sal_Int16 RetrieveTypeFromResourceURL( const rtl::OUString& aResourceURL )
+{
+
+ if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
+ ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
+ {
+ rtl::OUString aTmpStr = aResourceURL.copy( RESOURCEURL_PREFIX_SIZE );
+ sal_Int32 nIndex = aTmpStr.indexOf( '/' );
+ if (( nIndex > 0 ) && ( aTmpStr.getLength() > nIndex ))
+ {
+ rtl::OUString aTypeStr( aTmpStr.copy( 0, nIndex ));
+ for ( int i = 0; i < UIElementType::COUNT; i++ )
+ {
+ if ( aTypeStr.equalsAscii( UIELEMENTTYPENAMES[i] ))
+ return sal_Int16( i );
+ }
+ }
+ }
+
+ return UIElementType::UNKNOWN;
+}
+
+static rtl::OUString RetrieveNameFromResourceURL( const rtl::OUString& aResourceURL )
+{
+ if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
+ ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
+ {
+ sal_Int32 nIndex = aResourceURL.lastIndexOf( '/' );
+ if (( nIndex > 0 ) && (( nIndex+1 ) < aResourceURL.getLength()))
+ return aResourceURL.copy( nIndex+1 );
+ }
+
+ return rtl::OUString();
+}
+
+void UIConfigurationManagerImpl::impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType )
+{
+ // preload list of element types on demand
+ impl_preloadUIElementTypeList( LAYER_USERDEFINED, nElementType );
+ if ( m_bUseDefault )
+ impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType );
+
+ UIElementDataHashMap& rUserElements = m_aUIElements[LAYER_USERDEFINED][nElementType].aElementsHashMap;
+ UIElementDataHashMap::const_iterator pUserIter = rUserElements.begin();
+
+ rtl::OUString aCustomUrlPrefix( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_CUSTOM_ELEMENT ));
+ while ( pUserIter != rUserElements.end() )
+ {
+ sal_Int32 nIndex = pUserIter->second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE );
+ if ( !m_bUseDefault && nIndex > RESOURCEURL_PREFIX_SIZE )
+ {
+ // Performance: Retrieve user interface name only for custom user interface elements.
+ // It's only used by them!
+ UIElementData* pDataSettings = impl_findUIElementData( pUserIter->second.aResourceURL, nElementType );
+ if ( pDataSettings && ( !m_bUseDefault || !pDataSettings->bDefault) )
+ {
+ // Retrieve user interface name from XPropertySet interface
+ rtl::OUString aUIName;
+ Reference< XPropertySet > xPropSet( pDataSettings->xSettings, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ xPropSet->getPropertyValue( m_aPropUIName ) >>= aUIName;
+ }
+
+ UIElementInfo aInfo( pUserIter->second.aResourceURL, aUIName );
+ aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo ));
+ }
+ }
+ else
+ {
+ // The user interface name for standard user interface elements is stored in the WindowState.xcu file
+ UIElementInfo aInfo( pUserIter->second.aResourceURL, rtl::OUString() );
+ aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo ));
+ }
+ ++pUserIter;
+ }
+
+ if ( m_bUseDefault )
+ {
+ UIElementDataHashMap& rDefaultElements = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap;
+ UIElementDataHashMap::const_iterator pDefIter = rDefaultElements.begin();
+
+ while ( pDefIter != rDefaultElements.end() )
+ {
+ UIElementInfoHashMap::const_iterator pIterInfo = aUIElementInfoCollection.find( pDefIter->second.aResourceURL );
+ if ( pIterInfo == aUIElementInfoCollection.end() )
+ {
+ sal_Int32 nIndex = pDefIter->second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE );
+ if ( nIndex > RESOURCEURL_PREFIX_SIZE )
+ {
+ // Performance: Retrieve user interface name only for custom user interface elements.
+ // It's only used by them!
+ UIElementData* pDataSettings = impl_findUIElementData( pDefIter->second.aResourceURL, nElementType );
+ if ( pDataSettings )
+ {
+ // Retrieve user interface name from XPropertySet interface
+ rtl::OUString aUIName;
+ Reference< XPropertySet > xPropSet( pDataSettings->xSettings, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ xPropSet->getPropertyValue( m_aPropUIName ) >>= aUIName;
+ }
+
+ UIElementInfo aInfo( pDefIter->second.aResourceURL, aUIName );
+ aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pDefIter->second.aResourceURL, aInfo ));
+ }
+ }
+ else
+ {
+ // The user interface name for standard user interface elements is stored in the WindowState.xcu file
+ UIElementInfo aInfo( pDefIter->second.aResourceURL, rtl::OUString() );
+ aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pDefIter->second.aResourceURL, aInfo ));
+ }
+ }
+
+ ++pDefIter;
+ } // while ( pDefIter != rDefaultElements.end() )
+ }
+}
+
+void UIConfigurationManagerImpl::impl_preloadUIElementTypeList( Layer eLayer, sal_Int16 nElementType )
+{
+ UIElementType& rElementTypeData = m_aUIElements[eLayer][nElementType];
+
+ if ( !rElementTypeData.bLoaded )
+ {
+ Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage;
+ if ( xElementTypeStorage.is() )
+ {
+ rtl::OUStringBuffer aBuf( RESOURCEURL_PREFIX_SIZE );
+ aBuf.appendAscii( RESOURCEURL_PREFIX );
+ aBuf.appendAscii( UIELEMENTTYPENAMES[ nElementType ] );
+ aBuf.appendAscii( "/" );
+ rtl::OUString aResURLPrefix( aBuf.makeStringAndClear() );
+
+ UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap;
+ Reference< XNameAccess > xNameAccess( xElementTypeStorage, UNO_QUERY );
+ Sequence< rtl::OUString > aUIElementNames = xNameAccess->getElementNames();
+ for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ )
+ {
+ UIElementData aUIElementData;
+
+ // Resource name must be without ".xml"
+ sal_Int32 nIndex = aUIElementNames[n].lastIndexOf( '.' );
+ if (( nIndex > 0 ) && ( nIndex < aUIElementNames[n].getLength() ))
+ {
+ rtl::OUString aExtension( aUIElementNames[n].copy( nIndex+1 ));
+ rtl::OUString aUIElementName( aUIElementNames[n].copy( 0, nIndex ));
+
+ if (( aUIElementName.getLength() > 0 ) &&
+ ( aExtension.equalsIgnoreAsciiCaseAsciiL( "xml", 3 )))
+ {
+ aUIElementData.aResourceURL = aResURLPrefix + aUIElementName;
+ aUIElementData.aName = aUIElementNames[n];
+
+ if ( eLayer == LAYER_USERDEFINED )
+ {
+ aUIElementData.bModified = false;
+ aUIElementData.bDefault = false;
+ aUIElementData.bDefaultNode = false;
+ }
+
+ // Create hash_map entries for all user interface elements inside the storage. We don't load the
+ // settings to speed up the process.
+ rHashMap.insert( UIElementDataHashMap::value_type( aUIElementData.aResourceURL, aUIElementData ));
+ }
+ }
+ }
+ }
+ }
+
+ rElementTypeData.bLoaded = true;
+}
+
+void UIConfigurationManagerImpl::impl_requestUIElementData( sal_Int16 nElementType, Layer eLayer, UIElementData& aUIElementData )
+{
+ UIElementType& rElementTypeData = m_aUIElements[eLayer][nElementType];
+
+ Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage;
+ if ( xElementTypeStorage.is() && aUIElementData.aName.getLength() )
+ {
+ try
+ {
+ Reference< XStream > xStream = xElementTypeStorage->openStreamElement( aUIElementData.aName, ElementModes::READ );
+ Reference< XInputStream > xInputStream = xStream->getInputStream();
+
+ if ( xInputStream.is() )
+ {
+ switch ( nElementType )
+ {
+ case ::com::sun::star::ui::UIElementType::UNKNOWN:
+ break;
+
+ case ::com::sun::star::ui::UIElementType::MENUBAR:
+ {
+ try
+ {
+ MenuConfiguration aMenuCfg( m_xServiceManager );
+ Reference< XIndexAccess > xContainer( aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream ));
+ RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xContainer );
+ if ( pRootItemContainer )
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
+ else
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( xContainer, sal_True ) ), UNO_QUERY );
+ return;
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ break;
+
+ case ::com::sun::star::ui::UIElementType::POPUPMENU:
+ {
+ break;
+ }
+
+ case ::com::sun::star::ui::UIElementType::TOOLBAR:
+ {
+ try
+ {
+ Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
+ ToolBoxConfiguration::LoadToolBox( m_xServiceManager, xInputStream, xIndexContainer );
+ RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
+ return;
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+
+ break;
+ }
+
+ case ::com::sun::star::ui::UIElementType::STATUSBAR:
+ {
+ try
+ {
+ Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
+ StatusBarConfiguration::LoadStatusBar( m_xServiceManager, xInputStream, xIndexContainer );
+ RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
+ return;
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+
+ break;
+ }
+
+ case ::com::sun::star::ui::UIElementType::FLOATINGWINDOW:
+ {
+ break;
+ }
+ }
+ }
+ }
+ catch ( ::com::sun::star::embed::InvalidStorageException& )
+ {
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( ::com::sun::star::io::IOException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
+ {
+ }
+ }
+
+ // At least we provide an empty settings container!
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer() ), UNO_QUERY );
+}
+
+UIConfigurationManagerImpl::UIElementData* UIConfigurationManagerImpl::impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad )
+{
+ // preload list of element types on demand
+ impl_preloadUIElementTypeList( LAYER_USERDEFINED, nElementType );
+ if ( m_bUseDefault )
+ impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType );
+
+ // first try to look into our user-defined vector/hash_map combination
+ UIElementDataHashMap& rUserHashMap = m_aUIElements[LAYER_USERDEFINED][nElementType].aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rUserHashMap.find( aResourceURL );
+ if ( pIter != rUserHashMap.end() )
+ {
+ // Default data settings data must be retrieved from the default layer!
+ if ( !pIter->second.bDefault )
+ {
+ if ( !pIter->second.xSettings.is() && bLoad )
+ impl_requestUIElementData( nElementType, LAYER_USERDEFINED, pIter->second );
+ return &(pIter->second);
+ }
+ }
+
+ if ( m_bUseDefault )
+ {
+ // Not successfull, we have to look into our default vector/hash_map combination
+ UIElementDataHashMap& rDefaultHashMap = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap;
+ pIter = rDefaultHashMap.find( aResourceURL );
+ if ( pIter != rDefaultHashMap.end() )
+ {
+ if ( !pIter->second.xSettings.is() && bLoad )
+ impl_requestUIElementData( nElementType, LAYER_DEFAULT, pIter->second );
+ return &(pIter->second);
+ } // if ( pIter != rDefaultHashMap.end() )
+ }
+
+ // Nothing has been found!
+ return NULL;
+}
+
+void UIConfigurationManagerImpl::impl_storeElementTypeData( Reference< XStorage > xStorage, UIElementType& rElementType, bool bResetModifyState )
+{
+ UIElementDataHashMap& rHashMap = rElementType.aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rHashMap.begin();
+
+ while ( pIter != rHashMap.end() )
+ {
+ UIElementData& rElement = pIter->second;
+ if ( rElement.bModified )
+ {
+ if ( rElement.bDefault )
+ {
+ xStorage->removeElement( rElement.aName );
+ rElement.bModified = sal_False; // mark as not modified
+ }
+ else
+ {
+ Reference< XStream > xStream( xStorage->openStreamElement( rElement.aName, ElementModes::WRITE|ElementModes::TRUNCATE ), UNO_QUERY );
+ Reference< XOutputStream > xOutputStream( xStream->getOutputStream() );
+
+ if ( xOutputStream.is() )
+ {
+ switch( rElementType.nElementType )
+ {
+ case ::com::sun::star::ui::UIElementType::MENUBAR:
+ {
+ try
+ {
+ MenuConfiguration aMenuCfg( m_xServiceManager );
+ aMenuCfg.StoreMenuBarConfigurationToXML( rElement.xSettings, xOutputStream );
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ break;
+
+ case ::com::sun::star::ui::UIElementType::TOOLBAR:
+ {
+ try
+ {
+ ToolBoxConfiguration::StoreToolBox( m_xServiceManager, xOutputStream, rElement.xSettings );
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ break;
+
+ case ::com::sun::star::ui::UIElementType::STATUSBAR:
+ {
+ try
+ {
+ StatusBarConfiguration::StoreStatusBar( m_xServiceManager, xOutputStream, rElement.xSettings );
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ // mark as not modified if we store to our own storage
+ if ( bResetModifyState )
+ rElement.bModified = sal_False;
+ }
+ }
+
+ ++pIter;
+ }
+
+ // commit element type storage
+ Reference< XTransactedObject > xTransactedObject( xStorage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
+
+ // mark UIElementType as not modified if we store to our own storage
+ if ( bResetModifyState )
+ rElementType.bModified = sal_False;
+}
+
+// This is only allowed to be called on the LAYER_USER_DEFINED!
+void UIConfigurationManagerImpl::impl_resetElementTypeData(
+ UIElementType& rUserElementType,
+ UIElementType& rDefaultElementType,
+ ConfigEventNotifyContainer& rRemoveNotifyContainer,
+ ConfigEventNotifyContainer& rReplaceNotifyContainer )
+{
+ UIElementDataHashMap& rHashMap = rUserElementType.aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rHashMap.begin();
+
+ Reference< XUIConfigurationManager > xThis( m_xOwner, UNO_QUERY );
+ Reference< XNameAccess > xDefaultNameAccess( rDefaultElementType.xStorage, UNO_QUERY );
+ sal_Int16 nType = rUserElementType.nElementType;
+
+ // Make copies of the event structures to be thread-safe. We have to unlock our mutex before calling
+ // our listeners!
+ while ( pIter != rHashMap.end() )
+ {
+ UIElementData& rElement = pIter->second;
+ if ( !rElement.bDefault )
+ {
+ if ( m_bUseDefault && xDefaultNameAccess->hasByName( rElement.aName ))
+ {
+ // Replace settings with data from default layer
+ Reference< XIndexAccess > xOldSettings( rElement.xSettings );
+ impl_requestUIElementData( nType, LAYER_DEFAULT, rElement );
+
+ ConfigurationEvent aReplaceEvent;
+ aReplaceEvent.ResourceURL = rElement.aResourceURL;
+ aReplaceEvent.Accessor <<= xThis;
+ aReplaceEvent.Source = m_xOwner;
+ aReplaceEvent.ReplacedElement <<= xOldSettings;
+ aReplaceEvent.Element <<= rElement.xSettings;
+
+ rReplaceNotifyContainer.push_back( aReplaceEvent );
+
+ // Mark element as default and not modified. That means "not active"
+ // in the user layer anymore.
+ rElement.bModified = false;
+ rElement.bDefault = true;
+ }
+ else
+ {
+ // Remove user-defined settings from user layer
+ ConfigurationEvent aEvent;
+ aEvent.ResourceURL = rElement.aResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = m_xOwner;
+ aEvent.Element <<= rElement.xSettings;
+
+ rRemoveNotifyContainer.push_back( aEvent );
+
+ // Mark element as default and not modified. That means "not active"
+ // in the user layer anymore.
+ rElement.bModified = false;
+ rElement.bDefault = true;
+ }
+ } // if ( !rElement.bDefault )
+ else
+ rElement.bModified = false;
+
+ ++pIter;
+ }
+
+ // Remove all settings from our user interface elements
+ rHashMap.clear();
+}
+
+void UIConfigurationManagerImpl::impl_reloadElementTypeData(
+ UIElementType& rUserElementType,
+ UIElementType& rDefaultElementType,
+ ConfigEventNotifyContainer& rRemoveNotifyContainer,
+ ConfigEventNotifyContainer& rReplaceNotifyContainer )
+{
+ UIElementDataHashMap& rHashMap = rUserElementType.aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rHashMap.begin();
+ Reference< XStorage > xUserStorage( rUserElementType.xStorage );
+ Reference< XStorage > xDefaultStorage( rDefaultElementType.xStorage );
+ Reference< XNameAccess > xUserNameAccess( rUserElementType.xStorage, UNO_QUERY );
+ Reference< XNameAccess > xDefaultNameAccess( rDefaultElementType.xStorage, UNO_QUERY );
+
+ Reference< XUIConfigurationManager > xThis( m_xOwner, UNO_QUERY );
+ sal_Int16 nType = rUserElementType.nElementType;
+
+ while ( pIter != rHashMap.end() )
+ {
+ UIElementData& rElement = pIter->second;
+ if ( rElement.bModified )
+ {
+ if ( xUserNameAccess->hasByName( rElement.aName ))
+ {
+ // Replace settings with data from user layer
+ Reference< XIndexAccess > xOldSettings( rElement.xSettings );
+
+ impl_requestUIElementData( nType, LAYER_USERDEFINED, rElement );
+
+ ConfigurationEvent aReplaceEvent;
+
+ aReplaceEvent.ResourceURL = rElement.aResourceURL;
+ aReplaceEvent.Accessor <<= xThis;
+ aReplaceEvent.Source = m_xOwner;
+ aReplaceEvent.ReplacedElement <<= xOldSettings;
+ aReplaceEvent.Element <<= rElement.xSettings;
+ rReplaceNotifyContainer.push_back( aReplaceEvent );
+
+ rElement.bModified = false;
+ }
+ else if ( m_bUseDefault && xDefaultNameAccess->hasByName( rElement.aName ))
+ {
+ // Replace settings with data from default layer
+ Reference< XIndexAccess > xOldSettings( rElement.xSettings );
+
+ impl_requestUIElementData( nType, LAYER_DEFAULT, rElement );
+
+ ConfigurationEvent aReplaceEvent;
+
+ aReplaceEvent.ResourceURL = rElement.aResourceURL;
+ aReplaceEvent.Accessor <<= xThis;
+ aReplaceEvent.Source = m_xOwner;
+ aReplaceEvent.ReplacedElement <<= xOldSettings;
+ aReplaceEvent.Element <<= rElement.xSettings;
+ rReplaceNotifyContainer.push_back( aReplaceEvent );
+
+ // Mark element as default and not modified. That means "not active"
+ // in the user layer anymore.
+ rElement.bModified = false;
+ rElement.bDefault = true;
+ }
+ else
+ {
+ // Element settings are not in any storage => remove
+ ConfigurationEvent aRemoveEvent;
+
+ aRemoveEvent.ResourceURL = rElement.aResourceURL;
+ aRemoveEvent.Accessor <<= xThis;
+ aRemoveEvent.Source = m_xOwner;
+ aRemoveEvent.Element <<= rElement.xSettings;
+
+ rRemoveNotifyContainer.push_back( aRemoveEvent );
+
+ // Mark element as default and not modified. That means "not active"
+ // in the user layer anymore.
+ rElement.bModified = false;
+ rElement.bDefault = true;
+ }
+ }
+ ++pIter;
+ }
+
+ rUserElementType.bModified = sal_False;
+}
+
+void UIConfigurationManagerImpl::impl_Initialize()
+{
+ // Initialize the top-level structures with the storage data
+ if ( m_xUserConfigStorage.is() )
+ {
+ // Try to access our module sub folder
+ for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT;
+ i++ )
+ {
+ Reference< XStorage > xElementTypeStorage;
+ try
+ {
+ if ( m_pStorageHandler[i] )
+ xElementTypeStorage = m_pStorageHandler[i]->getWorkingStorageUser();
+ }
+ catch ( com::sun::star::container::NoSuchElementException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::InvalidStorageException& )
+ {
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( ::com::sun::star::io::IOException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
+ {
+ }
+
+ m_aUIElements[LAYER_USERDEFINED][i].nElementType = i;
+ m_aUIElements[LAYER_USERDEFINED][i].bModified = false;
+ m_aUIElements[LAYER_USERDEFINED][i].xStorage = xElementTypeStorage;
+ m_aUIElements[LAYER_USERDEFINED][i].bDefaultLayer = false;
+ }
+ } // if ( m_xUserConfigStorage.is() )
+ else if ( !m_bUseDefault )
+ {
+ // We have no storage, just initialize ui element types with empty storage!
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ m_aUIElements[LAYER_USERDEFINED][i].xStorage.clear();
+ }
+
+ if ( m_bUseDefault && m_xUserConfigStorage.is() )
+ {
+ Reference< XNameAccess > xNameAccess( m_xDefaultConfigStorage, UNO_QUERY_THROW );
+
+ // Try to access our module sub folder
+ for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT;
+ i++ )
+ {
+ Reference< XStorage > xElementTypeStorage;
+ try
+ {
+ xNameAccess->getByName( rtl::OUString::createFromAscii( UIELEMENTTYPENAMES[i] )) >>= xElementTypeStorage;
+ }
+ catch ( com::sun::star::container::NoSuchElementException& )
+ {
+ }
+
+ m_aUIElements[LAYER_DEFAULT][i].nElementType = i;
+ m_aUIElements[LAYER_DEFAULT][i].bModified = false;
+ m_aUIElements[LAYER_DEFAULT][i].xStorage = xElementTypeStorage;
+ m_aUIElements[LAYER_DEFAULT][i].bDefaultLayer = true;
+ }
+ }
+}
+
+UIConfigurationManagerImpl::UIConfigurationManagerImpl( const Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager
+ ,const Reference< XInterface >& _xOwner
+ , bool _bUseDefault) :
+ ThreadHelpBase( &Application::GetSolarMutex() )
+ , m_xOwner( _xOwner )
+ , m_bUseDefault(_bUseDefault)
+ , m_bReadOnly( true )
+ , m_bInitialized( false )
+ , m_bModified( false )
+ , m_bConfigRead( false )
+ , m_bDisposed( false )
+ , m_aXMLPostfix( RTL_CONSTASCII_USTRINGPARAM( ".xml" ))
+ , m_aPropUIName( RTL_CONSTASCII_USTRINGPARAM( "UIName" ))
+ , m_aPropResourceURL( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" ))
+ , m_xServiceManager( xServiceManager )
+ , m_aListenerContainer( m_aLock.getShareableOslMutex() )
+{
+ for ( int i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ m_pStorageHandler[i] = 0;
+
+ // Make sure we have a default initialized entry for every layer and user interface element type!
+ // The following code depends on this!
+ m_aUIElements[LAYER_DEFAULT].resize( ::com::sun::star::ui::UIElementType::COUNT );
+ m_aUIElements[LAYER_USERDEFINED].resize( ::com::sun::star::ui::UIElementType::COUNT );
+}
+
+UIConfigurationManagerImpl::~UIConfigurationManagerImpl()
+{
+ for ( int i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ delete m_pStorageHandler[i];
+}
+
+// XComponent
+void UIConfigurationManagerImpl::dispose() throw (::com::sun::star::uno::RuntimeException)
+{
+ css::lang::EventObject aEvent( m_xOwner );
+ m_aListenerContainer.disposeAndClear( aEvent );
+
+ {
+ ResetableGuard aGuard( m_aLock );
+ try
+ {
+ if ( m_xModuleImageManager.is() )
+ m_xModuleImageManager->dispose();
+ }
+ catch ( Exception& )
+ {
+ }
+
+ m_xModuleImageManager.clear();
+ m_aUIElements[LAYER_USERDEFINED].clear();
+ m_aUIElements[LAYER_DEFAULT].clear();
+ m_xDefaultConfigStorage.clear();
+ m_xUserConfigStorage.clear();
+ m_xUserRootCommit.clear();
+ m_bConfigRead = false;
+ m_bModified = false;
+ m_bDisposed = true;
+ }
+}
+
+void UIConfigurationManagerImpl::addEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
+{
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+ }
+
+ m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
+}
+
+void UIConfigurationManagerImpl::removeEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
+{
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
+}
+
+// XInitialization
+void UIConfigurationManagerImpl::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
+{
+ ResetableGuard aLock( m_aLock );
+
+ if ( !m_bInitialized )
+ {
+ ::comphelper::SequenceAsHashMap lArgs(aArguments);
+ m_aModuleIdentifier = lArgs.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("ModuleIdentifier"), ::rtl::OUString());
+ m_aModuleShortName = lArgs.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("ModuleShortName"), ::rtl::OUString());
+
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ rtl::OUString aResourceType;
+ if ( i == ::com::sun::star::ui::UIElementType::MENUBAR )
+ aResourceType = PresetHandler::RESOURCETYPE_MENUBAR();
+ else if ( i == ::com::sun::star::ui::UIElementType::TOOLBAR )
+ aResourceType = PresetHandler::RESOURCETYPE_TOOLBAR();
+ else if ( i == ::com::sun::star::ui::UIElementType::STATUSBAR )
+ aResourceType = PresetHandler::RESOURCETYPE_STATUSBAR();
+
+ if ( aResourceType.getLength() > 0 )
+ {
+ m_pStorageHandler[i] = new PresetHandler( m_xServiceManager );
+ m_pStorageHandler[i]->connectToResource( PresetHandler::E_MODULES,
+ aResourceType, // this path wont be used later ... seee next lines!
+ m_aModuleShortName,
+ css::uno::Reference< css::embed::XStorage >()); // no document root used here!
+ }
+ }
+
+ // initialize root storages for all resource types
+ m_xUserRootCommit = css::uno::Reference< css::embed::XTransactedObject >(
+ m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getOrCreateRootStorageUser(), css::uno::UNO_QUERY); // can be empty
+ m_xDefaultConfigStorage = m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getParentStorageShare(
+ m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getWorkingStorageShare());
+ m_xUserConfigStorage = m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getParentStorageUser(
+ m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getWorkingStorageUser());
+
+ if ( m_xUserConfigStorage.is() )
+ {
+ Reference< XPropertySet > xPropSet( m_xUserConfigStorage, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ long nOpenMode = 0;
+ if ( xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" ))) >>= nOpenMode )
+ m_bReadOnly = !( nOpenMode & ElementModes::WRITE );
+ }
+ }
+
+ impl_Initialize();
+
+ m_bInitialized = true;
+ }
+}
+
+// XUIConfiguration
+void UIConfigurationManagerImpl::addConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
+{
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+ }
+
+ m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener );
+}
+
+void UIConfigurationManagerImpl::removeConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
+{
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener );
+}
+
+
+// XUIConfigurationManager
+void UIConfigurationManagerImpl::reset() throw (::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ bool bResetStorage( false );
+
+ if ( !isReadOnly() )
+ {
+ // Remove all elements from our user-defined storage!
+ try
+ {
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
+ Reference< XStorage > xSubStorage( rElementType.xStorage, UNO_QUERY );
+
+ if ( xSubStorage.is() )
+ {
+ bool bCommitSubStorage( false );
+ Reference< XNameAccess > xSubStorageNameAccess( xSubStorage, UNO_QUERY );
+ Sequence< rtl::OUString > aUIElementStreamNames = xSubStorageNameAccess->getElementNames();
+ for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ )
+ {
+ xSubStorage->removeElement( aUIElementStreamNames[j] );
+ bCommitSubStorage = true;
+ }
+
+ if ( bCommitSubStorage )
+ {
+ Reference< XTransactedObject > xTransactedObject( xSubStorage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
+ m_pStorageHandler[i]->commitUserChanges();
+ }
+ }
+ }
+
+ bResetStorage = true;
+
+ // remove settings from user defined layer and notify listener about removed settings data!
+ ConfigEventNotifyContainer aRemoveEventNotifyContainer;
+ ConfigEventNotifyContainer aReplaceEventNotifyContainer;
+ for ( sal_Int16 j = 1; j < ::com::sun::star::ui::UIElementType::COUNT; j++ )
+ {
+ try
+ {
+ UIElementType& rUserElementType = m_aUIElements[LAYER_USERDEFINED][j];
+ UIElementType& rDefaultElementType = m_aUIElements[LAYER_DEFAULT][j];
+
+ impl_resetElementTypeData( rUserElementType, rDefaultElementType, aRemoveEventNotifyContainer, aReplaceEventNotifyContainer );
+ rUserElementType.bModified = sal_False;
+ }
+ catch ( Exception& )
+ {
+ throw IOException();
+ }
+ }
+
+ m_bModified = sal_False;
+
+ // Unlock mutex before notify our listeners
+ aGuard.unlock();
+
+ // Notify our listeners
+ ::std::for_each(aRemoveEventNotifyContainer.begin(),aRemoveEventNotifyContainer.end(),::boost::bind(&UIConfigurationManagerImpl::implts_notifyContainerListener,this,_1,NotifyOp_Remove));
+ ::std::for_each(aReplaceEventNotifyContainer.begin(),aReplaceEventNotifyContainer.end(),::boost::bind(&UIConfigurationManagerImpl::implts_notifyContainerListener,this,_1,NotifyOp_Replace));
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( ::com::sun::star::container::NoSuchElementException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::InvalidStorageException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
+ {
+ }
+ }
+}
+
+Sequence< Sequence< PropertyValue > > UIConfigurationManagerImpl::getUIElementsInfo( sal_Int16 ElementType )
+throw ( IllegalArgumentException, RuntimeException )
+{
+ if (( ElementType < 0 ) || ( ElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+
+ ResetableGuard aGuard( m_aLock );
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ Sequence< Sequence< PropertyValue > > aElementInfoSeq;
+ UIElementInfoHashMap aUIElementInfoCollection;
+
+ if ( ElementType == ::com::sun::star::ui::UIElementType::UNKNOWN )
+ {
+ for ( sal_Int16 i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, sal_Int16( i ) );
+ }
+ else
+ impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, ElementType );
+
+ Sequence< PropertyValue > aUIElementInfo( 2 );
+ aUIElementInfo[0].Name = m_aPropResourceURL;
+ aUIElementInfo[1].Name = m_aPropUIName;
+
+ aElementInfoSeq.realloc( aUIElementInfoCollection.size() );
+ UIElementInfoHashMap::const_iterator pIter = aUIElementInfoCollection.begin();
+
+ sal_Int32 n = 0;
+ while ( pIter != aUIElementInfoCollection.end() )
+ {
+ aUIElementInfo[0].Value <<= pIter->second.aResourceURL;
+ aUIElementInfo[1].Value <<= pIter->second.aUIName;
+ aElementInfoSeq[n++] = aUIElementInfo;
+ ++pIter;
+ }
+
+ return aElementInfoSeq;
+}
+
+Reference< XIndexContainer > UIConfigurationManagerImpl::createSettings() throw (::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ // Creates an empty item container which can be filled from outside
+ return Reference< XIndexContainer >( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
+}
+
+sal_Bool UIConfigurationManagerImpl::hasSettings( const ::rtl::OUString& ResourceURL )
+throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
+ if ( pDataSettings && ( m_bUseDefault || !pDataSettings->bDefault) )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+Reference< XIndexAccess > UIConfigurationManagerImpl::getSettings( const ::rtl::OUString& ResourceURL, sal_Bool bWriteable )
+throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
+ if ( pDataSettings && ( m_bUseDefault || !pDataSettings->bDefault) )
+ {
+ // Create a copy of our data if someone wants to change the data.
+ if ( bWriteable )
+ return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( pDataSettings->xSettings ) ), UNO_QUERY );
+ else
+ return pDataSettings->xSettings;
+ }
+ }
+
+ throw NoSuchElementException();
+}
+
+void UIConfigurationManagerImpl::replaceSettings( const ::rtl::OUString& ResourceURL, const Reference< ::com::sun::star::container::XIndexAccess >& aNewData )
+throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else if ( m_bReadOnly )
+ throw IllegalAccessException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
+ if ( pDataSettings && ( m_bUseDefault || !pDataSettings->bDefault) )
+ {
+ if ( !m_bUseDefault || !pDataSettings->bDefaultNode )
+ {
+ // we have a settings entry in our user-defined layer - replace
+ Reference< XIndexAccess > xOldSettings = pDataSettings->xSettings;
+
+ // Create a copy of the data if the container is not const
+ Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
+ if ( xReplace.is() )
+ pDataSettings->xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
+ else
+ pDataSettings->xSettings = aNewData;
+ pDataSettings->bDefault = false;
+ pDataSettings->bModified = true;
+ m_bModified = true;
+
+ // Modify type container
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType];
+ rElementType.bModified = true;
+
+ Reference< XUIConfigurationManager > xThis( m_xOwner, UNO_QUERY );
+
+ // Create event to notify listener about replaced element settings
+ ConfigurationEvent aEvent;
+
+ aEvent.ResourceURL = ResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = m_xOwner;
+ aEvent.ReplacedElement <<= xOldSettings;
+ aEvent.Element <<= pDataSettings->xSettings;
+
+ aGuard.unlock();
+
+ implts_notifyContainerListener( aEvent, NotifyOp_Replace );
+ }
+ else
+ {
+ // we have no settings in our user-defined layer - insert
+ UIElementData aUIElementData;
+
+ aUIElementData.bDefault = false;
+ aUIElementData.bDefaultNode = false;
+ aUIElementData.bModified = true;
+
+ // Create a copy of the data if the container is not const
+ Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
+ if ( xReplace.is() )
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
+ else
+ aUIElementData.xSettings = aNewData;
+ aUIElementData.aName = RetrieveNameFromResourceURL( ResourceURL ) + m_aXMLPostfix;
+ aUIElementData.aResourceURL = ResourceURL;
+ m_bModified = true;
+
+ // Modify type container
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType];
+ rElementType.bModified = true;
+
+ UIElementDataHashMap& rElements = rElementType.aElementsHashMap;
+
+ // Check our user element settings hash map as it can already contain settings that have been set to default!
+ // If no node can be found, we have to insert it.
+ UIElementDataHashMap::iterator pIter = rElements.find( ResourceURL );
+ if ( pIter != rElements.end() )
+ pIter->second = aUIElementData;
+ else
+ rElements.insert( UIElementDataHashMap::value_type( ResourceURL, aUIElementData ));
+
+ Reference< XUIConfigurationManager > xThis( m_xOwner, UNO_QUERY );
+
+ // Create event to notify listener about replaced element settings
+ ConfigurationEvent aEvent;
+
+ aEvent.ResourceURL = ResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = m_xOwner;
+ aEvent.ReplacedElement <<= pDataSettings->xSettings;
+ aEvent.Element <<= aUIElementData.xSettings;
+
+ aGuard.unlock();
+
+ implts_notifyContainerListener( aEvent, NotifyOp_Replace );
+ }
+ }
+ else
+ throw NoSuchElementException();
+ }
+}
+
+void UIConfigurationManagerImpl::removeSettings( const ::rtl::OUString& ResourceURL )
+throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException, RuntimeException)
+{
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else if ( m_bReadOnly )
+ throw IllegalAccessException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
+ if ( pDataSettings )
+ {
+ // If element settings are default, we don't need to change anything!
+ if ( pDataSettings->bDefault )
+ return;
+ else
+ {
+ Reference< XIndexAccess > xRemovedSettings = pDataSettings->xSettings;
+ pDataSettings->bDefault = true;
+
+ // check if this is a default layer node
+ if ( !m_bUseDefault || !pDataSettings->bDefaultNode )
+ pDataSettings->bModified = true; // we have to remove this node from the user layer!
+ pDataSettings->xSettings.clear();
+ m_bModified = true; // user layer must be written
+
+ // Modify type container
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType];
+ rElementType.bModified = true;
+
+ Reference< XUIConfigurationManager > xThis( m_xOwner, UNO_QUERY );
+ // Check if we have settings in the default layer which replaces the user-defined one!
+ UIElementData* pDefaultDataSettings = m_bUseDefault ? impl_findUIElementData( ResourceURL, nElementType ) : NULL;
+ if ( pDefaultDataSettings )
+ {
+ // Create event to notify listener about replaced element settings
+ ConfigurationEvent aEvent;
+
+ aEvent.ResourceURL = ResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = m_xOwner;
+ aEvent.Element <<= xRemovedSettings;
+ aEvent.ReplacedElement <<= pDefaultDataSettings->xSettings;
+
+ aGuard.unlock();
+
+ implts_notifyContainerListener( aEvent, NotifyOp_Replace );
+ }
+ else
+ {
+ // Create event to notify listener about removed element settings
+ ConfigurationEvent aEvent;
+
+ aEvent.ResourceURL = ResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = m_xOwner;
+ aEvent.Element <<= xRemovedSettings;
+
+ aGuard.unlock();
+
+ implts_notifyContainerListener( aEvent, NotifyOp_Remove );
+ }
+ }
+ }
+ else
+ throw NoSuchElementException();
+ }
+}
+
+void UIConfigurationManagerImpl::insertSettings( const ::rtl::OUString& NewResourceURL, const Reference< XIndexAccess >& aNewData )
+throw ( ElementExistException, IllegalArgumentException, IllegalAccessException, RuntimeException )
+{
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( NewResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else if ( m_bReadOnly )
+ throw IllegalAccessException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ bool bInsertData( m_bUseDefault );
+ UIElementData aUIElementData;
+ UIElementData* pDataSettings = impl_findUIElementData( NewResourceURL, nElementType );
+ if ( !m_bUseDefault )
+ {
+ if ( pDataSettings && !pDataSettings->bDefault )
+ throw ElementExistException();
+ if ( !pDataSettings )
+ {
+ pDataSettings = &aUIElementData;
+ bInsertData = true;
+ }
+ }
+ if ( !pDataSettings )
+ {
+ aUIElementData.bDefault = false;
+ if ( !m_bUseDefault )
+ aUIElementData.bDefaultNode = false;
+ aUIElementData.bModified = true;
+
+ // Create a copy of the data if the container is not const
+ Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
+ if ( xReplace.is() )
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
+ else
+ aUIElementData.xSettings = aNewData;
+
+ m_bModified = true;
+
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType];
+ rElementType.bModified = true;
+
+ if ( bInsertData )
+ {
+ aUIElementData.aName = RetrieveNameFromResourceURL( NewResourceURL ) + m_aXMLPostfix;
+ aUIElementData.aResourceURL = NewResourceURL;
+ UIElementDataHashMap& rElements = rElementType.aElementsHashMap;
+ rElements.insert( UIElementDataHashMap::value_type( NewResourceURL, aUIElementData ));
+ }
+
+ Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings );
+ Reference< XUIConfigurationManager > xThis( m_xOwner, UNO_QUERY );
+
+ // Create event to notify listener about removed element settings
+ ConfigurationEvent aEvent;
+
+ aEvent.ResourceURL = NewResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = m_xOwner;
+ aEvent.Element <<= xInsertSettings;
+
+ aGuard.unlock();
+
+ implts_notifyContainerListener( aEvent, NotifyOp_Insert );
+ }
+ else
+ throw ElementExistException();
+ }
+}
+
+Reference< XInterface > UIConfigurationManagerImpl::getImageManager() throw (::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( !m_xModuleImageManager.is() )
+ {
+ if ( m_bUseDefault )
+ m_xModuleImageManager = Reference< XComponent >( static_cast< cppu::OWeakObject *>( new ModuleImageManager( m_xServiceManager )),
+ UNO_QUERY );
+ else
+ m_xModuleImageManager = Reference< XComponent >( static_cast< cppu::OWeakObject *>( new ImageManager( m_xServiceManager )),
+ UNO_QUERY );
+ Reference< XInitialization > xInit( m_xModuleImageManager, UNO_QUERY );
+
+ Sequence< Any > aPropSeq( m_bUseDefault ? 3 : 2 );
+ PropertyValue aPropValue;
+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfigStorage" ));
+ aPropValue.Value <<= m_xUserConfigStorage;
+ aPropSeq[0] <<= aPropValue;
+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" ));
+ aPropValue.Value <<= m_aModuleIdentifier;
+ aPropSeq[1] <<= aPropValue;
+ if ( m_bUseDefault )
+ {
+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserRootCommit" ));
+ aPropValue.Value <<= m_xUserRootCommit;
+ aPropSeq[2] <<= aPropValue;
+ }
+
+ xInit->initialize( aPropSeq );
+ }
+
+ return Reference< XInterface >( m_xModuleImageManager, UNO_QUERY );
+
+// return Reference< XInterface >();
+}
+
+Reference< XInterface > UIConfigurationManagerImpl::getShortCutManager() throw (::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+ if ( !m_bUseDefault && m_xAccConfig.is())
+ return m_xAccConfig;
+
+ Reference< XMultiServiceFactory > xSMGR = m_xServiceManager;
+ ::rtl::OUString aModule = m_aModuleIdentifier;
+ Reference< XStorage > xDocumentRoot = m_xUserConfigStorage;
+ aGuard.unlock();
+ Reference< XInterface > xManager = xSMGR->createInstance(m_bUseDefault ? SERVICENAME_MODULEACCELERATORCONFIGURATION : SERVICENAME_DOCUMENTACCELERATORCONFIGURATION );
+ Reference< XInitialization > xInit (xManager, UNO_QUERY_THROW);
+
+ PropertyValue aProp;
+ Sequence< Any > lArgs(1);
+ if ( m_bUseDefault )
+ {
+ aProp.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleIdentifier"));
+ aProp.Value <<= aModule;
+ } // if ( m_bUseDefault )
+ else
+ {
+ aProp.Name = ::rtl::OUString::createFromAscii("DocumentRoot");
+ aProp.Value <<= xDocumentRoot;
+ }
+ lArgs[0] <<= aProp;
+ xInit->initialize(lArgs);
+
+ if ( !m_bUseDefault )
+ {
+ // SAFE ->
+ aGuard.lock();
+ m_xAccConfig = xManager;
+ aGuard.unlock();
+ // <- SAFE
+ }
+
+ return xManager;
+}
+
+Reference< XInterface > UIConfigurationManagerImpl::getEventsManager() throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XInterface >();
+}
+// XUIConfigurationStorage
+void UIConfigurationManagerImpl::setStorage( const Reference< XStorage >& Storage ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_xUserConfigStorage.is() )
+ {
+ try
+ {
+ // Dispose old storage to be sure that it will be closed
+ Reference< XComponent > xComponent( m_xUserConfigStorage, UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+
+ // We store the new storage. Be careful it could be an empty reference!
+ m_xUserConfigStorage = Storage;
+ m_bReadOnly = sal_True;
+
+ Reference< XUIConfigurationStorage > xAccUpdate(m_xAccConfig, UNO_QUERY);
+ if ( xAccUpdate.is() )
+ xAccUpdate->setStorage( m_xUserConfigStorage );
+
+ if ( m_xModuleImageManager.is() )
+ {
+ ImageManager* pImageManager = (ImageManager*)m_xModuleImageManager.get();
+ if ( pImageManager )
+ pImageManager->setStorage( m_xUserConfigStorage );
+ }
+
+ if ( m_xUserConfigStorage.is() )
+ {
+ ::rtl::OUString sEmpty;
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ rtl::OUString aResourceType;
+ if ( i == ::com::sun::star::ui::UIElementType::MENUBAR )
+ aResourceType = PresetHandler::RESOURCETYPE_MENUBAR();
+ else if ( i == ::com::sun::star::ui::UIElementType::TOOLBAR )
+ aResourceType = PresetHandler::RESOURCETYPE_TOOLBAR();
+ else if ( i == ::com::sun::star::ui::UIElementType::STATUSBAR )
+ aResourceType = PresetHandler::RESOURCETYPE_STATUSBAR();
+
+ //if ( aResourceType.getLength() > 0 )
+ {
+ m_pStorageHandler[i] = new PresetHandler( m_xServiceManager );
+ m_pStorageHandler[i]->connectToResource( PresetHandler::E_DOCUMENT,
+ rtl::OUString::createFromAscii( UIELEMENTTYPENAMES[i] ), // this path wont be used later ... seee next lines!
+ sEmpty,
+ m_xUserConfigStorage);
+ }
+ }
+ Reference< XPropertySet > xPropSet( m_xUserConfigStorage, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ try
+ {
+ long nOpenMode = 0;
+ if ( xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" ))) >>= nOpenMode )
+ m_bReadOnly = !( nOpenMode & ElementModes::WRITE );
+ }
+ catch ( com::sun::star::beans::UnknownPropertyException& )
+ {
+ }
+ catch ( com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ }
+
+ impl_Initialize();
+}
+// -----------------------------------------------------------------------------
+sal_Bool UIConfigurationManagerImpl::hasStorage() throw (::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ return ( m_xUserConfigStorage.is() );
+}
+
+// XUIConfigurationManagerImpl
+sal_Bool UIConfigurationManagerImpl::isDefaultSettings( const ::rtl::OUString& ResourceURL )
+throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
+ if ( pDataSettings && pDataSettings->bDefaultNode )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+Reference< XIndexAccess > UIConfigurationManagerImpl::getDefaultSettings( const ::rtl::OUString& ResourceURL )
+throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ // preload list of element types on demand
+ impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType );
+
+ // Look into our default vector/hash_map combination
+ UIElementDataHashMap& rDefaultHashMap = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rDefaultHashMap.find( ResourceURL );
+ if ( pIter != rDefaultHashMap.end() )
+ {
+ if ( !pIter->second.xSettings.is() )
+ impl_requestUIElementData( nElementType, LAYER_DEFAULT, pIter->second );
+ return pIter->second.xSettings;
+ }
+ }
+
+ // Nothing has been found!
+ throw NoSuchElementException();
+}
+
+// XUIConfigurationPersistence
+void UIConfigurationManagerImpl::reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly )
+ {
+ // Try to access our module sub folder
+ ConfigEventNotifyContainer aRemoveNotifyContainer;
+ ConfigEventNotifyContainer aReplaceNotifyContainer;
+ for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ try
+ {
+ UIElementType& rUserElementType = m_aUIElements[LAYER_USERDEFINED][i];
+ UIElementType& rDefaultElementType = m_aUIElements[LAYER_DEFAULT][i];
+
+ if ( rUserElementType.bModified )
+ impl_reloadElementTypeData( rUserElementType, rDefaultElementType, aRemoveNotifyContainer, aReplaceNotifyContainer );
+ }
+ catch ( Exception& )
+ {
+ throw IOException();
+ }
+ }
+
+ m_bModified = sal_False;
+
+ // Unlock mutex before notify our listeners
+ aGuard.unlock();
+
+ // Notify our listeners
+ ::std::for_each(aRemoveNotifyContainer.begin(),aRemoveNotifyContainer.end(),::boost::bind(&UIConfigurationManagerImpl::implts_notifyContainerListener,this,_1,NotifyOp_Remove));
+ ::std::for_each(aReplaceNotifyContainer.begin(),aReplaceNotifyContainer.end(),::boost::bind(&UIConfigurationManagerImpl::implts_notifyContainerListener,this,_1,NotifyOp_Replace));
+ }
+}
+
+void UIConfigurationManagerImpl::store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly )
+ {
+ // Try to access our module sub folder
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ try
+ {
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
+ Reference< XStorage > xStorage( rElementType.xStorage, UNO_QUERY );
+
+ if ( rElementType.bModified && xStorage.is() )
+ {
+ impl_storeElementTypeData( xStorage, rElementType );
+ m_pStorageHandler[i]->commitUserChanges();
+ }
+ }
+ catch ( Exception& )
+ {
+ throw IOException();
+ }
+ }
+
+ m_bModified = false;
+ }
+}
+
+void UIConfigurationManagerImpl::storeToStorage( const Reference< XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly )
+ {
+ // Try to access our module sub folder
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ try
+ {
+ Reference< XStorage > xElementTypeStorage( Storage->openStorageElement(
+ rtl::OUString::createFromAscii( UIELEMENTTYPENAMES[i] ), ElementModes::READWRITE ));
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
+
+ if ( rElementType.bModified && xElementTypeStorage.is() )
+ impl_storeElementTypeData( xElementTypeStorage, rElementType, false ); // store data to storage, but don't reset modify flag!
+ }
+ catch ( Exception& )
+ {
+ throw IOException();
+ }
+ }
+
+ Reference< XTransactedObject > xTransactedObject( Storage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
+ }
+}
+
+sal_Bool UIConfigurationManagerImpl::isModified() throw (::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+
+ return m_bModified;
+}
+
+sal_Bool UIConfigurationManagerImpl::isReadOnly() throw (::com::sun::star::uno::RuntimeException)
+{
+ ResetableGuard aGuard( m_aLock );
+
+ return m_bReadOnly;
+}
+
+void UIConfigurationManagerImpl::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp )
+{
+ ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >*) NULL ) );
+ if ( pContainer != NULL )
+ {
+ ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
+ while ( pIterator.hasMoreElements() )
+ {
+ try
+ {
+ switch ( eOp )
+ {
+ case NotifyOp_Replace:
+ ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementReplaced( aEvent );
+ break;
+ case NotifyOp_Insert:
+ ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementInserted( aEvent );
+ break;
+ case NotifyOp_Remove:
+ ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementRemoved( aEvent );
+ break;
+ }
+ }
+ catch( css::uno::RuntimeException& )
+ {
+ pIterator.remove();
+ }
+ }
+ }
+}
+
+} // namespace framework
diff --git a/framework/source/uiconfiguration/uiconfigurationmanagerimpl.hxx b/framework/source/uiconfiguration/uiconfigurationmanagerimpl.hxx
new file mode 100755
index 0000000000..937aca2a9a
--- /dev/null
+++ b/framework/source/uiconfiguration/uiconfigurationmanagerimpl.hxx
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: UIConfigurationManagerImpl.hxx,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 __FRAMEWORK_UICONFIGURATION_UICONFIGMANAGERIMPL_HXX_
+#define __FRAMEWORK_UICONFIGURATION_UICONFIGMANAGERIMPL_HXX_
+
+
+/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
+ with solaris headers ...
+*/
+#include <vector>
+#include <list>
+#include <hash_map>
+
+//_________________________________________________________________________________________________________________
+// my own includes
+//_________________________________________________________________________________________________________________
+#include <accelerators/presethandler.hxx>
+#include <threadhelp/threadhelpbase.hxx>
+#include <macros/generic.hxx>
+#include <macros/xinterface.hxx>
+#include <macros/xtypeprovider.hxx>
+#include <macros/xserviceinfo.hxx>
+#include <stdtypes.h>
+#include <uiconfiguration/moduleimagemanager.hxx>
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
+#include <com/sun/star/ui/XUIConfiguration.hpp>
+#include <com/sun/star/ui/XUIConfigurationManager.hpp>
+#include <com/sun/star/ui/UIElementType.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/ui/ConfigurationEvent.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+
+//_________________________________________________________________________________________________________________
+// other includes
+//_________________________________________________________________________________________________________________
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <rtl/ustring.hxx>
+
+
+namespace framework
+{
+ class UIConfigurationManagerImpl : public ThreadHelpBase // Struct for right initalization of mutex member! Must be first of baseclasses.
+ {
+ public:
+ // XInterface, XTypeProvider, XServiceInfo
+ UIConfigurationManagerImpl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager
+ , const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& _xOwner
+ , bool _bUseDefault);
+ ~UIConfigurationManagerImpl();
+
+ // XComponent
+ void dispose() throw (::com::sun::star::uno::RuntimeException);
+ void addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ void removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ void initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XUIConfiguration
+ void addConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ void removeConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XUIConfigurationManager
+ void reset() throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > getUIElementsInfo( sal_Int16 ElementType ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > createSettings( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Bool hasSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > getSettings( const ::rtl::OUString& ResourceURL, sal_Bool bWriteable ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ void replaceSettings( const ::rtl::OUString& ResourceURL, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& aNewData ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
+ void removeSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
+ void insertSettings( const ::rtl::OUString& NewResourceURL, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& aNewData ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getImageManager() throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getShortCutManager() throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getEventsManager() throw (::com::sun::star::uno::RuntimeException);
+
+ // XUIConfigurationManagerImpl
+ sal_Bool isDefaultSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > getDefaultSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XUIConfigurationPersistence
+ void reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ void store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ void storeToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ sal_Bool isModified() throw (::com::sun::star::uno::RuntimeException);
+ sal_Bool isReadOnly() throw (::com::sun::star::uno::RuntimeException);
+
+ // XUIConfigurationStorage
+ void setStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Bool hasStorage() throw (::com::sun::star::uno::RuntimeException);
+
+ enum Layer
+ {
+ LAYER_DEFAULT,
+ LAYER_USERDEFINED,
+ LAYER_COUNT
+ };
+
+ enum NotifyOp
+ {
+ NotifyOp_Remove,
+ NotifyOp_Insert,
+ NotifyOp_Replace
+ };
+
+ struct UIElementInfo
+ {
+ UIElementInfo( const rtl::OUString& rResourceURL, const rtl::OUString& rUIName ) :
+ aResourceURL( rResourceURL), aUIName( rUIName ) {}
+ rtl::OUString aResourceURL;
+ rtl::OUString aUIName;
+ };
+
+ struct UIElementData
+ {
+ UIElementData() : bModified( false ), bDefault( true ), bDefaultNode( true ) {};
+
+ rtl::OUString aResourceURL;
+ rtl::OUString aName;
+ bool bModified; // has been changed since last storing
+ bool bDefault; // default settings
+ bool bDefaultNode; // this is a default layer element data
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > xSettings;
+ };
+
+ struct UIElementType;
+ friend struct UIElementType;
+ typedef ::std::hash_map< rtl::OUString, UIElementData, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementDataHashMap;
+
+ struct UIElementType
+ {
+ UIElementType() : bModified( false ),
+ bLoaded( false ),
+ bDefaultLayer( false ),
+ nElementType( ::com::sun::star::ui::UIElementType::UNKNOWN ) {}
+
+
+ bool bModified;
+ bool bLoaded;
+ bool bDefaultLayer;
+ sal_Int16 nElementType;
+ UIElementDataHashMap aElementsHashMap;
+ com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage;
+ };
+
+ typedef ::std::vector< UIElementType > UIElementTypesVector;
+ typedef ::std::vector< ::com::sun::star::ui::ConfigurationEvent > ConfigEventNotifyContainer;
+ typedef ::std::hash_map< rtl::OUString, UIElementInfo, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementInfoHashMap;
+
+ // private methods
+ void impl_Initialize();
+ void implts_notifyContainerListener( const ::com::sun::star::ui::ConfigurationEvent& aEvent, NotifyOp eOp );
+ void impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType );
+ void impl_preloadUIElementTypeList( Layer eLayer, sal_Int16 nElementType );
+ UIElementData* impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad = true );
+ void impl_requestUIElementData( sal_Int16 nElementType, Layer eLayer, UIElementData& aUIElementData );
+ void impl_storeElementTypeData( com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage, UIElementType& rElementType, bool bResetModifyState = true );
+ void impl_resetElementTypeData( UIElementType& rUserElementType, UIElementType& rDefaultElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer );
+ void impl_reloadElementTypeData( UIElementType& rUserElementType, UIElementType& rDefaultElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer );
+
+ UIElementTypesVector m_aUIElements[LAYER_COUNT];
+ PresetHandler* m_pStorageHandler[::com::sun::star::ui::UIElementType::COUNT];
+ com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xDefaultConfigStorage;
+ com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserConfigStorage;
+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xOwner;
+ bool m_bUseDefault;
+ bool m_bReadOnly;
+ bool m_bInitialized;
+ bool m_bModified;
+ bool m_bConfigRead;
+ bool m_bDisposed;
+ rtl::OUString m_aXMLPostfix;
+ rtl::OUString m_aPropUIName;
+ rtl::OUString m_aPropResourceURL;
+ rtl::OUString m_aModuleIdentifier;
+ rtl::OUString m_aModuleShortName;
+ com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject > m_xUserRootCommit;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xAccConfig;
+ com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xModuleImageManager;
+ };
+}
+
+#endif // __FRAMEWORK_UICONFIGURATION_UICONFIGMANAGERIMPL_HXX_
diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx
index ea1d499f74..c97caecc01 100644
--- a/framework/source/uiconfiguration/windowstateconfiguration.cxx
+++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx
@@ -369,7 +369,7 @@ throw (::com::sun::star::uno::RuntimeException)
{
try
{
- Any a = getByName( rResourceURL );
+ getByName( rResourceURL );
}
catch ( NoSuchElementException& )
{
@@ -761,7 +761,7 @@ Any ConfigurationAccess_WindowState::impl_insertCacheAndReturnSequence( const rt
nMask |= WINDOWSTATE_MASK_DOCKPOS;
}
- a = makeAny( aPos );
+ a <<= aPos;
bAddToSeq = true;
}
}
@@ -792,7 +792,7 @@ Any ConfigurationAccess_WindowState::impl_insertCacheAndReturnSequence( const rt
nMask |= WINDOWSTATE_MASK_DOCKSIZE;
}
- a = makeAny( aSize );
+ a <<= aSize;
bAddToSeq = true;
}
}
@@ -1312,11 +1312,11 @@ sal_Bool ConfigurationAccess_WindowState::impl_initializeConfigAccess()
try
{
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
- aPropValue.Value = makeAny( m_aConfigWindowAccess );
- aArgs[0] = makeAny( aPropValue );
+ aPropValue.Value <<= m_aConfigWindowAccess;
+ aArgs[0] <<= aPropValue;
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "lazywrite" ));
- aPropValue.Value = makeAny( sal_True );
- aArgs[1] = makeAny( aPropValue );
+ aPropValue.Value <<= sal_True;
+ aArgs[1] <<= aPropValue;
m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
SERVICENAME_CFGUPDATEACCESS, aArgs ),
@@ -1383,8 +1383,7 @@ WindowStateConfiguration::WindowStateConfiguration( const Reference< XMultiServi
for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ )
{
aModuleIdentifier = aElementNames[i];
- Any a = xNameAccess->getByName( aModuleIdentifier );
- if ( a >>= aSeq )
+ if ( xNameAccess->getByName( aModuleIdentifier ) >>= aSeq )
{
::rtl::OUString aWindowStateFileStr;
for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ )
@@ -1439,7 +1438,7 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la
ConfigurationAccess_WindowState* pModuleWindowState = new ConfigurationAccess_WindowState( aWindowStateConfigFile, m_xServiceManager );
xResourceURLWindowState = Reference< XNameAccess >( static_cast< cppu::OWeakObject* >( pModuleWindowState ),UNO_QUERY );
pModuleIter->second = xResourceURLWindowState;
- a = makeAny( xResourceURLWindowState );
+ a <<= xResourceURLWindowState;
}
return a;
diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx
index 9846311591..ad3c5fbfaf 100644
--- a/framework/source/uielement/addonstoolbarmanager.cxx
+++ b/framework/source/uielement/addonstoolbarmanager.cxx
@@ -343,20 +343,20 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
PropertyValue aPropValue;
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" ));
- aPropValue.Value = makeAny( m_aModuleIdentifier );
- aArgs[0] = makeAny( aPropValue );
+ aPropValue.Value <<= m_aModuleIdentifier;
+ aArgs[0] <<= aPropValue;
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- aPropValue.Value = makeAny( m_xFrame );
- aArgs[1] = makeAny( aPropValue );
+ aPropValue.Value <<= m_xFrame;
+ aArgs[1] <<= aPropValue;
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" ));
- aPropValue.Value = makeAny( m_xServiceManager );
- aArgs[2] = makeAny( aPropValue );
+ aPropValue.Value <<= m_xServiceManager;
+ aArgs[2] <<= aPropValue;
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ));
- aPropValue.Value = makeAny( xToolbarWindow );
- aArgs[3] = makeAny( aPropValue );
+ aPropValue.Value <<= xToolbarWindow;
+ aArgs[3] <<= aPropValue;
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ItemId" ));
aPropValue.Value = makeAny( sal_Int32( nId ));
- aArgs[4] = makeAny( aPropValue );
+ aArgs[4] <<= aPropValue;
try
{
@@ -387,14 +387,14 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
PropertyValue aPropValue;
Sequence< Any > aArgs( 3 );
aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- aPropValue.Value = makeAny( m_xFrame );
- aArgs[0] = makeAny( aPropValue );
+ aPropValue.Value <<= m_xFrame;
+ aArgs[0] <<= aPropValue;
aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
- aPropValue.Value = makeAny( aURL );
- aArgs[1] = makeAny( aPropValue );
+ aPropValue.Value <<= aURL;
+ aArgs[1] <<= aPropValue;
aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" ));
- aPropValue.Value = makeAny( m_xServiceManager );
- aArgs[2] = makeAny( aPropValue );
+ aPropValue.Value <<= m_xServiceManager;
+ aArgs[2] <<= aPropValue;
try
{
xInit->initialize( aArgs );
diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx
index 088f440a80..da40a4ee01 100644
--- a/framework/source/uielement/addonstoolbarwrapper.cxx
+++ b/framework/source/uielement/addonstoolbarwrapper.cxx
@@ -51,6 +51,7 @@
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/XSystemDependentMenuPeer.hpp>
#include <com/sun/star/awt/XMenuBar.hpp>
diff --git a/framework/source/uielement/buttontoolbarcontroller.cxx b/framework/source/uielement/buttontoolbarcontroller.cxx
index 8072c8f805..855f1dd3f4 100644
--- a/framework/source/uielement/buttontoolbarcontroller.cxx
+++ b/framework/source/uielement/buttontoolbarcontroller.cxx
@@ -285,7 +285,7 @@ throw (::com::sun::star::uno::RuntimeException)
// Provide key modifier information to dispatch function
aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
- aArgs[0].Value = makeAny( KeyModifier );
+ aArgs[0].Value <<= KeyModifier;
if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
UiEventLogHelper(::rtl::OUString::createFromAscii("ButtonToolbarController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs);
diff --git a/framework/source/uielement/comboboxtoolbarcontroller.cxx b/framework/source/uielement/comboboxtoolbarcontroller.cxx
index 80c267b19e..937c099aaf 100644
--- a/framework/source/uielement/comboboxtoolbarcontroller.cxx
+++ b/framework/source/uielement/comboboxtoolbarcontroller.cxx
@@ -214,52 +214,17 @@ throw ( RuntimeException )
}
// ------------------------------------------------------------------
-
-void SAL_CALL ComboboxToolbarController::execute( sal_Int16 KeyModifier )
-throw ( RuntimeException )
+Sequence<PropertyValue> ComboboxToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const
{
- Reference< XDispatch > xDispatch;
- Reference< XURLTransformer > xURLTransformer;
- ::rtl::OUString aCommandURL;
- ::rtl::OUString aSelectedText;
- ::com::sun::star::util::URL aTargetURL;
-
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_bInitialized &&
- m_xFrame.is() &&
- m_xServiceManager.is() &&
- m_aCommandURL.getLength() )
- {
- xURLTransformer = m_xURLTransformer;
- xDispatch = getDispatchFromCommand( m_aCommandURL );
- aCommandURL = m_aCommandURL;
- aTargetURL = getInitializedURL();
- aSelectedText = m_pComboBox->GetText();
- }
- }
-
- if ( xDispatch.is() && aTargetURL.Complete.getLength() > 0 )
- {
- Sequence<PropertyValue> aArgs( 2 );
-
- // Add key modifier to argument list
- aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
- aArgs[0].Value <<= KeyModifier;
- aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ));
- aArgs[1].Value <<= aSelectedText;
-
- // Execute dispatch asynchronously
- ExecuteInfo* pExecuteInfo = new ExecuteInfo;
- pExecuteInfo->xDispatch = xDispatch;
- pExecuteInfo->aTargetURL = aTargetURL;
- pExecuteInfo->aArgs = aArgs;
- Application::PostUserEvent( STATIC_LINK(0, ComplexToolbarController , ExecuteHdl_Impl), pExecuteInfo );
- }
+ Sequence<PropertyValue> aArgs( 2 );
+ ::rtl::OUString aSelectedText = m_pComboBox->GetText();
+
+ // Add key modifier to argument list
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
+ aArgs[0].Value <<= KeyModifier;
+ aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ));
+ aArgs[1].Value <<= aSelectedText;
+ return aArgs;
}
// ------------------------------------------------------------------
diff --git a/framework/source/uielement/complextoolbarcontroller.cxx b/framework/source/uielement/complextoolbarcontroller.cxx
index a1bdb08e1f..3b5d197261 100644
--- a/framework/source/uielement/complextoolbarcontroller.cxx
+++ b/framework/source/uielement/complextoolbarcontroller.cxx
@@ -92,7 +92,7 @@ ComplexToolbarController::ComplexToolbarController(
, m_nID( nID )
, m_bMadeInvisible( sal_False )
{
- m_xURLTransformer = Reference< XURLTransformer >( m_xServiceManager->createInstance(
+ m_xURLTransformer.set( m_xServiceManager->createInstance(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
UNO_QUERY_THROW );
}
@@ -119,7 +119,16 @@ throw ( RuntimeException )
}
// ------------------------------------------------------------------
+Sequence<PropertyValue> ComplexToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const
+{
+ Sequence<PropertyValue> aArgs( 1 );
+ // Add key modifier to argument list
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
+ aArgs[0].Value <<= KeyModifier;
+ return aArgs;
+}
+// -----------------------------------------------------------------------------
void SAL_CALL ComplexToolbarController::execute( sal_Int16 KeyModifier )
throw ( RuntimeException )
{
@@ -127,6 +136,7 @@ throw ( RuntimeException )
Reference< XURLTransformer > xURLTransformer;
::rtl::OUString aCommandURL;
::com::sun::star::util::URL aTargetURL;
+ Sequence<PropertyValue> aArgs;
{
vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
@@ -143,17 +153,12 @@ throw ( RuntimeException )
xDispatch = getDispatchFromCommand( m_aCommandURL );
aCommandURL = m_aCommandURL;
aTargetURL = getInitializedURL();
+ aArgs = getExecuteArgs(KeyModifier);
}
}
if ( xDispatch.is() && aTargetURL.Complete.getLength() > 0 )
{
- Sequence<PropertyValue> aArgs( 1 );
-
- // Add key modifier to argument list
- aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
- aArgs[0].Value <<= KeyModifier;
-
// Execute dispatch asynchronously
ExecuteInfo* pExecuteInfo = new ExecuteInfo;
pExecuteInfo->xDispatch = xDispatch;
diff --git a/framework/source/uielement/constitemcontainer.cxx b/framework/source/uielement/constitemcontainer.cxx
index e4277aaf1c..91fb93f55c 100644
--- a/framework/source/uielement/constitemcontainer.cxx
+++ b/framework/source/uielement/constitemcontainer.cxx
@@ -201,13 +201,13 @@ ConstItemContainer::ConstItemContainer( const Reference< XIndexAccess >& rSource
try
{
sal_Int32 nCount = rSourceContainer->getCount();
+ m_aItemVector.reserve(nCount);
if ( bFastCopy )
{
for ( sal_Int32 i = 0; i < nCount; i++ )
{
Sequence< PropertyValue > aPropSeq;
- Any a = rSourceContainer->getByIndex( i );
- if ( a >>= aPropSeq )
+ if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
m_aItemVector.push_back( aPropSeq );
}
}
@@ -216,8 +216,7 @@ ConstItemContainer::ConstItemContainer( const Reference< XIndexAccess >& rSource
for ( sal_Int32 i = 0; i < nCount; i++ )
{
Sequence< PropertyValue > aPropSeq;
- Any a = rSourceContainer->getByIndex( i );
- if ( a >>= aPropSeq )
+ if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
{
sal_Int32 nContainerIndex = -1;
Reference< XIndexAccess > xIndexAccess;
@@ -252,7 +251,8 @@ ConstItemContainer::~ConstItemContainer()
// private
void ConstItemContainer::copyItemContainer( const std::vector< Sequence< PropertyValue > >& rSourceVector )
{
- for ( sal_uInt32 i = 0; i < rSourceVector.size(); i++ )
+ const sal_uInt32 nCount = rSourceVector.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
sal_Int32 nContainerIndex = -1;
Sequence< PropertyValue > aPropSeq( rSourceVector[i] );
@@ -328,7 +328,7 @@ ConstItemContainer* ConstItemContainer::GetImplementation( const ::com::sun::sta
sal_Bool SAL_CALL ConstItemContainer::hasElements()
throw ( RuntimeException )
{
- return ( m_aItemVector.size() != 0 );
+ return ( !m_aItemVector.empty() );
}
// XIndexAccess
diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx
index 84d4e217e1..5b1abca913 100644
--- a/framework/source/uielement/controlmenucontroller.cxx
+++ b/framework/source/uielement/controlmenucontroller.cxx
@@ -44,7 +44,6 @@
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/awt/MenuItemStyle.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
@@ -346,51 +345,17 @@ void SAL_CALL ControlMenuController::statusChanged( const FeatureStateEvent& Eve
}
// XMenuListener
-void SAL_CALL ControlMenuController::highlight( const css::awt::MenuEvent& ) throw (RuntimeException)
+void ControlMenuController::impl_select(const Reference< XDispatch >& /*_xDispatch*/,const ::com::sun::star::util::URL& aURL)
{
-}
-
-void SAL_CALL ControlMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException)
-{
- Reference< css::awt::XPopupMenu > xPopupMenu;
- Reference< XDispatch > xRefDispatch;
- Reference< XMultiServiceFactory > xServiceManager;
-
- ResetableGuard aLock( m_aLock );
- xPopupMenu = m_xPopupMenu;
- xRefDispatch = m_xDispatch;
- xServiceManager = m_xServiceManager;
- aLock.unlock();
-
- if ( xPopupMenu.is() )
+ UrlToDispatchMap::iterator pIter = m_aURLToDispatchMap.find( aURL.Complete );
+ if ( pIter != m_aURLToDispatchMap.end() )
{
- VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( xPopupMenu );
- if ( pPopupMenu )
- {
- css::util::URL aTargetURL;
- Sequence<PropertyValue> aArgs( 1 );
- Reference< XURLTransformer > xURLTransformer( xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
-
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
- PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
-
- aTargetURL.Complete = pVCLPopupMenu->GetItemCommand( rEvent.MenuId );
- }
-
- xURLTransformer->parseStrict( aTargetURL );
- UrlToDispatchMap::iterator pIter = m_aURLToDispatchMap.find( aTargetURL.Complete );
- if ( pIter != m_aURLToDispatchMap.end() )
- {
- Reference< XDispatch > xDispatch = pIter->second;
- if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
- UiEventLogHelper(::rtl::OUString::createFromAscii("ControlMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs);
- if ( xDispatch.is() )
- xDispatch->dispatch( aTargetURL, aArgs );
- }
- }
+ Sequence<PropertyValue> aArgs;
+ Reference< XDispatch > xDispatch = pIter->second;
+ if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
+ UiEventLogHelper(::rtl::OUString::createFromAscii("ControlMenuController")).log(m_xServiceManager, m_xFrame, aURL, aArgs);
+ if ( xDispatch.is() )
+ xDispatch->dispatch( aURL, aArgs );
}
}
@@ -425,54 +390,26 @@ void SAL_CALL ControlMenuController::activate( const css::awt::MenuEvent& ) thro
}
}
-void SAL_CALL ControlMenuController::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
// XPopupMenuController
-void SAL_CALL ControlMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException )
+void ControlMenuController::impl_setPopupMenu()
{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xFrame.is() && !m_xPopupMenu.is() )
+ if ( m_pResPopupMenu == 0 )
{
- // Create popup menu on demand
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- if ( m_pResPopupMenu == 0 )
- {
- rtl::OStringBuffer aBuf( 32 );
- aBuf.append( "svx" );
+ rtl::OStringBuffer aBuf( 32 );
+ aBuf.append( "svx" );
- ResMgr* pResMgr = ResMgr::CreateResMgr( aBuf.getStr() );
- if ( pResMgr )
- {
- ResId aResId( RID_FMSHELL_CONVERSIONMENU, *pResMgr );
- aResId.SetRT( RSC_MENU );
- if ( pResMgr->IsAvailable( aResId ))
- m_pResPopupMenu = new PopupMenu( aResId );
+ ResMgr* pResMgr = ResMgr::CreateResMgr( aBuf.getStr() );
+ if ( pResMgr )
+ {
+ ResId aResId( RID_FMSHELL_CONVERSIONMENU, *pResMgr );
+ aResId.SetRT( RSC_MENU );
+ if ( pResMgr->IsAvailable( aResId ))
+ m_pResPopupMenu = new PopupMenu( aResId );
- updateImagesPopupMenu( m_pResPopupMenu );
- delete pResMgr;
- }
+ updateImagesPopupMenu( m_pResPopupMenu );
+ delete pResMgr;
}
-
- m_xPopupMenu = xPopupMenu;
- m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY ));
-
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
-
- com::sun::star::util::URL aTargetURL;
- aTargetURL.Complete = m_aCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
- m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
- }
+ } // if ( m_pResPopupMenu == 0 )
}
void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star::uno::RuntimeException)
@@ -485,10 +422,6 @@ void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star::
if ( m_xFrame.is() && m_xPopupMenu.is() )
{
URL aTargetURL;
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
-
Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
fillPopupMenu( m_xPopupMenu );
m_aURLToDispatchMap.free();
@@ -496,7 +429,7 @@ void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star::
for (sal_uInt32 i=0; i<sizeof(aCommands)/sizeof(aCommands[0]); ++i)
{
aTargetURL.Complete = rtl::OUString::createFromAscii( aCommands[i] );
- xURLTransformer->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
if ( xDispatch.is() )
@@ -512,36 +445,9 @@ void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star::
// XInitialization
void SAL_CALL ControlMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
{
- const rtl::OUString aFrameName( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- const rtl::OUString aCommandURLName( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
-
ResetableGuard aLock( m_aLock );
-
- sal_Bool bInitalized( m_bInitialized );
- if ( !bInitalized )
- {
- PropertyValue aPropValue;
- rtl::OUString aCommandURL;
- Reference< XFrame > xFrame;
-
- for ( int i = 0; i < aArguments.getLength(); i++ )
- {
- if ( aArguments[i] >>= aPropValue )
- {
- if ( aPropValue.Name.equalsAscii( "Frame" ))
- aPropValue.Value >>= xFrame;
- else if ( aPropValue.Name.equalsAscii( "CommandURL" ))
- aPropValue.Value >>= aCommandURL;
- }
- }
-
- if ( xFrame.is() && aCommandURL.getLength() )
- {
- m_xFrame = xFrame;
- m_aCommandURL = aCommandURL;
- m_bInitialized = sal_True;
- }
- }
+ PopupMenuControllerBase::initialize(aArguments);
+ m_aBaseURL = ::rtl::OUString();
}
}
diff --git a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx
index a268d0f63f..e9910d6b45 100644
--- a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx
+++ b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx
@@ -197,52 +197,17 @@ throw ( RuntimeException )
}
// ------------------------------------------------------------------
-
-void SAL_CALL DropdownToolbarController::execute( sal_Int16 KeyModifier )
-throw ( RuntimeException )
+Sequence<PropertyValue> DropdownToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const
{
- Reference< XDispatch > xDispatch;
- Reference< XURLTransformer > xURLTransformer;
- ::rtl::OUString aCommandURL;
- ::rtl::OUString aSelectedText;
- ::com::sun::star::util::URL aTargetURL;
-
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_bInitialized &&
- m_xFrame.is() &&
- m_xServiceManager.is() &&
- m_aCommandURL.getLength() )
- {
- xURLTransformer = m_xURLTransformer;
- xDispatch = getDispatchFromCommand( m_aCommandURL );
- aCommandURL = m_aCommandURL;
- aTargetURL = getInitializedURL();
- aSelectedText = m_pListBoxControl->GetText();
- }
- }
-
- if ( xDispatch.is() && aTargetURL.Complete.getLength() > 0 )
- {
- Sequence<PropertyValue> aArgs( 2 );
-
- // Add key modifier to argument list
- aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
- aArgs[0].Value <<= KeyModifier;
- aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ));
- aArgs[1].Value <<= aSelectedText;
-
- // Execute dispatch asynchronously
- ExecuteInfo* pExecuteInfo = new ExecuteInfo;
- pExecuteInfo->xDispatch = xDispatch;
- pExecuteInfo->aTargetURL = aTargetURL;
- pExecuteInfo->aArgs = aArgs;
- Application::PostUserEvent( STATIC_LINK(0, ComplexToolbarController , ExecuteHdl_Impl), pExecuteInfo );
- }
+ Sequence<PropertyValue> aArgs( 2 );
+ ::rtl::OUString aSelectedText = m_pListBoxControl->GetText();
+
+ // Add key modifier to argument list
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
+ aArgs[0].Value <<= KeyModifier;
+ aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ));
+ aArgs[1].Value <<= aSelectedText;
+ return aArgs;
}
// ------------------------------------------------------------------
diff --git a/framework/source/uielement/edittoolbarcontroller.cxx b/framework/source/uielement/edittoolbarcontroller.cxx
index b65d52581a..5faefa9282 100644
--- a/framework/source/uielement/edittoolbarcontroller.cxx
+++ b/framework/source/uielement/edittoolbarcontroller.cxx
@@ -194,52 +194,17 @@ throw ( RuntimeException )
}
// ------------------------------------------------------------------
-
-void SAL_CALL EditToolbarController::execute( sal_Int16 KeyModifier )
-throw ( RuntimeException )
+Sequence<PropertyValue> EditToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const
{
- Reference< XDispatch > xDispatch;
- Reference< XURLTransformer > xURLTransformer;
- ::rtl::OUString aCommandURL;
- ::rtl::OUString aSelectedText;
- ::com::sun::star::util::URL aTargetURL;
-
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_bInitialized &&
- m_xFrame.is() &&
- m_xServiceManager.is() &&
- m_aCommandURL.getLength() )
- {
- xURLTransformer = m_xURLTransformer;
- xDispatch = getDispatchFromCommand( m_aCommandURL );
- aCommandURL = m_aCommandURL;
- aTargetURL = getInitializedURL();
- aSelectedText = m_pEditControl->GetText();
- }
- }
-
- if ( xDispatch.is() && aTargetURL.Complete.getLength() > 0 )
- {
- Sequence<PropertyValue> aArgs( 2 );
-
- // Add key modifier to argument list
- aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
- aArgs[0].Value <<= KeyModifier;
- aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ));
- aArgs[1].Value <<= aSelectedText;
-
- // Execute dispatch asynchronously
- ExecuteInfo* pExecuteInfo = new ExecuteInfo;
- pExecuteInfo->xDispatch = xDispatch;
- pExecuteInfo->aTargetURL = aTargetURL;
- pExecuteInfo->aArgs = aArgs;
- Application::PostUserEvent( STATIC_LINK(0, ComplexToolbarController , ExecuteHdl_Impl), pExecuteInfo );
- }
+ Sequence<PropertyValue> aArgs( 2 );
+ ::rtl::OUString aSelectedText = m_pEditControl->GetText();
+
+ // Add key modifier to argument list
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
+ aArgs[0].Value <<= KeyModifier;
+ aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ));
+ aArgs[1].Value <<= aSelectedText;
+ return aArgs;
}
// ------------------------------------------------------------------
diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx
index eb23ac5c35..320e7ffbe1 100644
--- a/framework/source/uielement/fontmenucontroller.cxx
+++ b/framework/source/uielement/fontmenucontroller.cxx
@@ -44,7 +44,6 @@
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/awt/MenuItemStyle.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
@@ -119,6 +118,7 @@ void FontMenuController::fillPopupMenu( const Sequence< ::rtl::OUString >& rFont
if ( pVCLPopupMenu )
{
vector<rtl::OUString> aVector;
+ aVector.reserve(rFontNameSeq.getLength());
for ( USHORT i = 0; i < rFontNameSeq.getLength(); i++ )
{
aVector.push_back(MnemonicGenerator::EraseAllMnemonicChars(pFontNameArray[i]));
@@ -126,7 +126,8 @@ void FontMenuController::fillPopupMenu( const Sequence< ::rtl::OUString >& rFont
sort(aVector.begin(), aVector.end(), lcl_I18nCompareString );
const rtl::OUString aFontNameCommandPrefix( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharFontName?CharFontName.FamilyName:string=" ));
- for(USHORT i = 0; i < aVector.size(); i++)
+ const sal_Int16 nCount = (sal_Int16)aVector.size();
+ for ( sal_Int16 i = 0; i < nCount; i++ )
{
const rtl::OUString& rName = aVector[i];
m_xPopupMenu->insertItem( i+1, rName, css::awt::MenuItemStyle::RADIOCHECK | css::awt::MenuItemStyle::AUTOCHECK, i );
@@ -178,51 +179,16 @@ void SAL_CALL FontMenuController::statusChanged( const FeatureStateEvent& Event
}
// XMenuListener
-void SAL_CALL FontMenuController::highlight( const css::awt::MenuEvent& ) throw (RuntimeException)
+void FontMenuController::impl_select(const Reference< XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aTargetURL)
{
-}
-
-void SAL_CALL FontMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException)
-{
- Reference< css::awt::XPopupMenu > xPopupMenu;
- Reference< XDispatch > xDispatch;
- Reference< XMultiServiceFactory > xServiceManager;
-
- ResetableGuard aLock( m_aLock );
- xPopupMenu = m_xPopupMenu;
- xDispatch = m_xDispatch;
- xServiceManager = m_xServiceManager;
- aLock.unlock();
-
- if ( xPopupMenu.is() && xDispatch.is() )
- {
- VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( xPopupMenu );
- if ( pPopupMenu )
- {
- css::util::URL aTargetURL;
- Sequence<PropertyValue> aArgs;
- Reference< XURLTransformer > xURLTransformer( xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
-
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- // Command URL used to dispatch the selected font family name
- PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
- aTargetURL.Complete = pVCLPopupMenu->GetItemCommand( rEvent.MenuId );
- }
-
- xURLTransformer->parseStrict( aTargetURL );
- if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
- UiEventLogHelper(::rtl::OUString::createFromAscii("FontMenuController")).log(
- m_xServiceManager,
- m_xFrame,
- aTargetURL,
- Sequence<PropertyValue>());
- xDispatch->dispatch( aTargetURL, aArgs );
- }
- }
+ Sequence<PropertyValue> aArgs;
+ if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
+ UiEventLogHelper(::rtl::OUString::createFromAscii("FontMenuController")).log(
+ m_xServiceManager,
+ m_xFrame,
+ aTargetURL,
+ Sequence<PropertyValue>());
+ _xDispatch->dispatch( aTargetURL, aArgs );
}
void SAL_CALL FontMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException)
@@ -262,44 +228,16 @@ void SAL_CALL FontMenuController::activate( const css::awt::MenuEvent& ) throw (
}
}
-void SAL_CALL FontMenuController::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
// XPopupMenuController
-void SAL_CALL FontMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw (RuntimeException)
+void FontMenuController::impl_setPopupMenu()
{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
- if ( m_xFrame.is() && !m_xPopupMenu.is() )
- {
- // Create popup menu on demand
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- m_xPopupMenu = xPopupMenu;
- m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY ));
-
-
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
-
- com::sun::star::util::URL aTargetURL;
- aTargetURL.Complete = m_aCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
- m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- // Register for font list updates to get the current font list from the controller
- aTargetURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontNameList" ));
- xURLTransformer->parseStrict( aTargetURL );
- m_xFontListDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- updatePopupMenu();
- }
+ com::sun::star::util::URL aTargetURL;
+ // Register for font list updates to get the current font list from the controller
+ aTargetURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontNameList" ));
+ m_xURLTransformer->parseStrict( aTargetURL );
+ m_xFontListDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
}
void SAL_CALL FontMenuController::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException )
@@ -308,12 +246,9 @@ void SAL_CALL FontMenuController::updatePopupMenu() throw ( ::com::sun::star::un
ResetableGuard aLock( m_aLock );
Reference< XDispatch > xDispatch( m_xFontListDispatch );
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
com::sun::star::util::URL aTargetURL;
aTargetURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontNameList" ));
- xURLTransformer->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
aLock.unlock();
if ( xDispatch.is() )
@@ -323,11 +258,5 @@ void SAL_CALL FontMenuController::updatePopupMenu() throw ( ::com::sun::star::un
}
}
-// XInitialization
-void SAL_CALL FontMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
-{
- PopupMenuControllerBase::initialize( aArguments );
-}
-
}
diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx
index 6a2b967dcc..e3ff3f2033 100644
--- a/framework/source/uielement/fontsizemenucontroller.cxx
+++ b/framework/source/uielement/fontsizemenucontroller.cxx
@@ -44,7 +44,6 @@
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/awt/MenuItemStyle.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/view/XPrintable.hpp>
@@ -322,93 +321,23 @@ void SAL_CALL FontSizeMenuController::statusChanged( const FeatureStateEvent& Ev
}
// XMenuListener
-void SAL_CALL FontSizeMenuController::highlight( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
-void SAL_CALL FontSizeMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException)
-{
- Reference< css::awt::XPopupMenu > xPopupMenu;
- Reference< XDispatch > xDispatch;
- Reference< XMultiServiceFactory > xServiceManager;
-
- ResetableGuard aLock( m_aLock );
- xPopupMenu = m_xPopupMenu;
- xDispatch = m_xDispatch;
- xServiceManager = m_xServiceManager;
- aLock.unlock();
-
- // Command URL used to dispatch the selected font family name
- const rtl::OUString aFontHeightCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontHeight?FontHeight.Height:float=" ));
-
- if ( xPopupMenu.is() && xDispatch.is() )
- {
- VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( xPopupMenu );
- if ( pPopupMenu )
- {
- css::util::URL aTargetURL;
- Sequence<PropertyValue> aArgs;
- Reference< XURLTransformer > xURLTransformer( xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
-
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
- PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
- aTargetURL.Complete = pVCLPopupMenu->GetItemCommand( rEvent.MenuId );
- }
-
- xURLTransformer->parseStrict( aTargetURL );
- if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
- UiEventLogHelper(::rtl::OUString::createFromAscii("FontSizeMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs);
- xDispatch->dispatch( aTargetURL, aArgs );
- }
- }
-}
-
-void SAL_CALL FontSizeMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
-void SAL_CALL FontSizeMenuController::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException)
+void FontSizeMenuController::impl_select(const Reference< XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aTargetURL)
{
+ Sequence<PropertyValue> aArgs;
+ if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
+ UiEventLogHelper(::rtl::OUString::createFromAscii("FontSizeMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs);
+ _xDispatch->dispatch( aTargetURL, aArgs );
}
// XPopupMenuController
-void SAL_CALL FontSizeMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException )
+void FontSizeMenuController::impl_setPopupMenu()
{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xFrame.is() && !m_xPopupMenu.is() )
- {
- // Create popup menu on demand
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- m_xPopupMenu = xPopupMenu;
- m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY ));
-
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
-
- com::sun::star::util::URL aTargetURL;
-
- // Register for font name updates which gives us info about the current font!
- aTargetURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharFontName" ));
- xURLTransformer->parseStrict( aTargetURL );
- m_xCurrentFontDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- // Register for font height updates
- aTargetURL.Complete = m_aCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
- m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- updatePopupMenu();
- }
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
+ com::sun::star::util::URL aTargetURL;
+ // Register for font name updates which gives us info about the current font!
+ aTargetURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharFontName" ));
+ m_xURLTransformer->parseStrict( aTargetURL );
+ m_xCurrentFontDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
}
void SAL_CALL FontSizeMenuController::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException )
@@ -419,12 +348,9 @@ void SAL_CALL FontSizeMenuController::updatePopupMenu() throw ( ::com::sun::star
throw DisposedException();
Reference< XDispatch > xDispatch( m_xCurrentFontDispatch );
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
com::sun::star::util::URL aTargetURL;
aTargetURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharFontName" ));
- xURLTransformer->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
aLock.unlock();
if ( xDispatch.is() )
@@ -435,11 +361,4 @@ void SAL_CALL FontSizeMenuController::updatePopupMenu() throw ( ::com::sun::star
PopupMenuControllerBase::updatePopupMenu();
}
-
-// XInitialization
-void SAL_CALL FontSizeMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
-{
- PopupMenuControllerBase::initialize( aArguments );
-}
-
}
diff --git a/framework/source/uielement/footermenucontroller.cxx b/framework/source/uielement/footermenucontroller.cxx
index 454da1ca03..182a6c3694 100644
--- a/framework/source/uielement/footermenucontroller.cxx
+++ b/framework/source/uielement/footermenucontroller.cxx
@@ -40,7 +40,7 @@
#ifndef __FRAMEWORK_CLASSES_RESOURCE_HRC_
#include <classes/resource.hrc>
#endif
-#include <classes/fwkresid.hxx>
+#include <classes/fwlresid.hxx>
//_________________________________________________________________________________________________________________
// interface includes
@@ -80,8 +80,6 @@ using namespace com::sun::star::util;
using namespace com::sun::star::style;
using namespace com::sun::star::container;
-const USHORT ALL_MENUITEM_ID = 1;
-
namespace framework
{
@@ -91,256 +89,12 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( FooterMenuController ,
IMPLEMENTATIONNAME_FOOTERMENUCONTROLLER
)
-DEFINE_INIT_SERVICE ( FooterMenuController, {} )
-
FooterMenuController::FooterMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) :
- PopupMenuControllerBase( xServiceManager )
+ HeaderMenuController( xServiceManager,true )
{
}
FooterMenuController::~FooterMenuController()
{
}
-
-// private function
-void FooterMenuController::fillPopupMenu( const Reference< ::com::sun::star::frame::XModel >& rModel, Reference< css::awt::XPopupMenu >& rPopupMenu )
-{
- VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu );
- PopupMenu* pVCLPopupMenu = 0;
-
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- resetPopupMenu( rPopupMenu );
- if ( pPopupMenu )
- pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
-
- Reference< XStyleFamiliesSupplier > xStyleFamiliesSupplier( rModel, UNO_QUERY );
- if ( pVCLPopupMenu && xStyleFamiliesSupplier.is())
- {
- Reference< XNameAccess > xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies();
-
- try
- {
- const rtl::OUString aCmd( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPageFooter" ));
- const rtl::OUString aIsPhysicalStr( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ));
- const rtl::OUString aDisplayNameStr( RTL_CONSTASCII_USTRINGPARAM( "DisplayName" ));
- const rtl::OUString aFooterIsOnStr( RTL_CONSTASCII_USTRINGPARAM( "FooterIsOn" ));
-
- Reference< XNameContainer > xNameContainer;
- Any a = xStyleFamilies->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageStyles" )));
- if ( a >>= xNameContainer )
- {
- Sequence< rtl::OUString > aSeqNames = xNameContainer->getElementNames();
-
- USHORT nId = 2;
- USHORT nCount = 0;
- sal_Bool bAllOneState( sal_True );
- sal_Bool bLastCheck( sal_True );
- sal_Bool bFirstChecked( sal_False );
- sal_Bool bFirstItemInserted( sal_False );
- for ( sal_Int32 n = 0; n < aSeqNames.getLength(); n++ )
- {
- rtl::OUString aName = aSeqNames[n];
- Reference< XPropertySet > xPropSet( xNameContainer->getByName( aName ), UNO_QUERY );
- if ( xPropSet.is() )
- {
- sal_Bool bIsPhysical( sal_False );
- a = xPropSet->getPropertyValue( aIsPhysicalStr );
- if (( a >>= bIsPhysical ) && bIsPhysical )
- {
- rtl::OUString aDisplayName;
- sal_Bool bHeaderIsOn( sal_False );
- a = xPropSet->getPropertyValue( aDisplayNameStr );
- a >>= aDisplayName;
- a = xPropSet->getPropertyValue( aFooterIsOnStr );
- a >>= bHeaderIsOn;
-
- rtl::OUStringBuffer aStrBuf( aCmd );
- aStrBuf.appendAscii( "?PageStyle:string=");
- aStrBuf.append( aDisplayName );
- aStrBuf.appendAscii( "&On:bool=" );
- if ( !bHeaderIsOn )
- aStrBuf.appendAscii( "true" );
- else
- aStrBuf.appendAscii( "false" );
- rtl::OUString aCommand( aStrBuf.makeStringAndClear() );
- pVCLPopupMenu->InsertItem( nId, aDisplayName, MIB_CHECKABLE );
- if ( !bFirstItemInserted )
- {
- bFirstItemInserted = sal_True;
- bFirstChecked = bHeaderIsOn;
- }
-
- pVCLPopupMenu->SetItemCommand( nId, aCommand );
- if ( bHeaderIsOn )
- pVCLPopupMenu->CheckItem( nId, sal_True );
- ++nId;
-
- // Check if all entries have the same state
- if( bAllOneState && n && bHeaderIsOn != bLastCheck )
- bAllOneState = FALSE;
- bLastCheck = bHeaderIsOn;
- ++nCount;
- }
- }
- }
-
- if ( bAllOneState && ( nCount > 1 ))
- {
- // Insert special item for all command
- pVCLPopupMenu->InsertItem( ALL_MENUITEM_ID, String( FwkResId( STR_MENU_HEADFOOTALL )), 0, 0 );
-
- rtl::OUStringBuffer aStrBuf( aCmd );
- aStrBuf.appendAscii( "?On:bool=" );
-
- // Command depends on check state of first menu item entry
- if ( !bFirstChecked )
- aStrBuf.appendAscii( "true" );
- else
- aStrBuf.appendAscii( "false" );
-
- pVCLPopupMenu->SetItemCommand( 1, aStrBuf.makeStringAndClear() );
- pVCLPopupMenu->InsertSeparator( 1 );
- }
- }
- }
- catch ( com::sun::star::container::NoSuchElementException& )
- {
- }
- }
-}
-
-// XEventListener
-void SAL_CALL FooterMenuController::disposing( const EventObject& ) throw ( RuntimeException )
-{
- Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY );
-
- ResetableGuard aLock( m_aLock );
- m_xFrame.clear();
- m_xDispatch.clear();
- m_xServiceManager.clear();
-
- if ( m_xPopupMenu.is() )
- m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(( OWeakObject *)this, UNO_QUERY ));
- m_xPopupMenu.clear();
-}
-
-// XStatusListener
-void SAL_CALL FooterMenuController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException )
-{
- Reference< com::sun::star::frame::XModel > xModel;
-
- if ( Event.State >>= xModel )
- {
- ResetableGuard aLock( m_aLock );
- if ( m_xPopupMenu.is() )
- fillPopupMenu( xModel, m_xPopupMenu );
- }
-}
-
-// XMenuListener
-void SAL_CALL FooterMenuController::highlight( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
-void SAL_CALL FooterMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException)
-{
- Reference< css::awt::XPopupMenu > xPopupMenu;
- Reference< XDispatch > xDispatch;
- Reference< XMultiServiceFactory > xServiceManager;
-
- ResetableGuard aLock( m_aLock );
- xPopupMenu = m_xPopupMenu;
- xDispatch = m_xDispatch;
- xServiceManager = m_xServiceManager;
- aLock.unlock();
-
- if ( xPopupMenu.is() && xDispatch.is() )
- {
- VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( xPopupMenu );
- if ( pPopupMenu )
- {
- css::util::URL aTargetURL;
- Sequence<PropertyValue> aArgs( 1 );
- Reference< XURLTransformer > xURLTransformer( xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
-
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
- PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
-
- aTargetURL.Complete = pVCLPopupMenu->GetItemCommand( rEvent.MenuId );
- }
-
- xURLTransformer->parseStrict( aTargetURL );
- if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
- UiEventLogHelper(::rtl::OUString::createFromAscii("FooterMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs);
- xDispatch->dispatch( aTargetURL, aArgs );
- }
- }
-}
-
-void SAL_CALL FooterMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
-void SAL_CALL FooterMenuController::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
-// XPopupMenuController
-void SAL_CALL FooterMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException )
-{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xFrame.is() && !m_xPopupMenu.is() )
- {
- // Create popup menu on demand
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- m_xPopupMenu = xPopupMenu;
- m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY ));
-
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
-
- com::sun::star::util::URL aTargetURL;
- aTargetURL.Complete = m_aCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
- m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- updatePopupMenu();
- }
-}
-
-void SAL_CALL FooterMenuController::updatePopupMenu() throw (::com::sun::star::uno::RuntimeException)
-{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- Reference< com::sun::star::frame::XModel > xModel( m_xModel );
- aLock.unlock();
-
- if ( !xModel.is() )
- PopupMenuControllerBase::updatePopupMenu();
-
- aLock.lock();
- if ( m_xPopupMenu.is() && m_xModel.is() )
- fillPopupMenu( m_xModel, m_xPopupMenu );
-}
-
-// XInitialization
-void SAL_CALL FooterMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
-{
- PopupMenuControllerBase::initialize( aArguments );
-}
-
}
diff --git a/framework/source/uielement/headermenucontroller.cxx b/framework/source/uielement/headermenucontroller.cxx
index ac4f1f9728..7882abbb94 100644
--- a/framework/source/uielement/headermenucontroller.cxx
+++ b/framework/source/uielement/headermenucontroller.cxx
@@ -41,7 +41,7 @@
#ifndef __FRAMEWORK_CLASSES_RESOURCE_HRC_
#include <classes/resource.hrc>
#endif
-#include <classes/fwkresid.hxx>
+#include <classes/fwlresid.hxx>
//_________________________________________________________________________________________________________________
// interface includes
@@ -49,11 +49,11 @@
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/awt/MenuItemStyle.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
@@ -99,8 +99,9 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( HeaderMenuController ,
DEFINE_INIT_SERVICE ( HeaderMenuController, {} )
-HeaderMenuController::HeaderMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) :
+HeaderMenuController::HeaderMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool _bFooter ) :
PopupMenuControllerBase( xServiceManager )
+ ,m_bFooter(_bFooter)
{
}
@@ -125,16 +126,20 @@ void HeaderMenuController::fillPopupMenu( const Reference< ::com::sun::star::fra
{
Reference< XNameAccess > xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies();
+ rtl::OUString aCmd( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPageHeader" ));
+ rtl::OUString aHeaderFooterIsOnStr(RTL_CONSTASCII_USTRINGPARAM( "HeaderIsOn" ));
+ if ( m_bFooter )
+ {
+ aCmd = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPageFooter" ));
+ aHeaderFooterIsOnStr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FooterIsOn" ));
+ }
+ const rtl::OUString aIsPhysicalStr( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ));
+ const rtl::OUString aDisplayNameStr( RTL_CONSTASCII_USTRINGPARAM( "DisplayName" ));
+
try
{
- const rtl::OUString aCmd( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPageHeader" ));
- const rtl::OUString aIsPhysicalStr( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ));
- const rtl::OUString aDisplayNameStr( RTL_CONSTASCII_USTRINGPARAM( "DisplayName" ));
- const rtl::OUString aHeaderIsOnStr( RTL_CONSTASCII_USTRINGPARAM( "HeaderIsOn" ));
-
Reference< XNameContainer > xNameContainer;
- Any a = xStyleFamilies->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageStyles" )));
- if ( a >>= xNameContainer )
+ if ( xStyleFamilies->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageStyles" ))) >>= xNameContainer )
{
Sequence< rtl::OUString > aSeqNames = xNameContainer->getElementNames();
@@ -151,15 +156,12 @@ void HeaderMenuController::fillPopupMenu( const Reference< ::com::sun::star::fra
if ( xPropSet.is() )
{
sal_Bool bIsPhysical( sal_False );
- a = xPropSet->getPropertyValue( aIsPhysicalStr );
- if (( a >>= bIsPhysical ) && bIsPhysical )
+ if (( xPropSet->getPropertyValue( aIsPhysicalStr ) >>= bIsPhysical ) && bIsPhysical )
{
rtl::OUString aDisplayName;
sal_Bool bHeaderIsOn( sal_False );
- a = xPropSet->getPropertyValue( aDisplayNameStr );
- a >>= aDisplayName;
- a = xPropSet->getPropertyValue( aHeaderIsOnStr );
- a >>= bHeaderIsOn;
+ xPropSet->getPropertyValue( aDisplayNameStr ) >>= aDisplayName;
+ xPropSet->getPropertyValue( aHeaderFooterIsOnStr ) >>= bHeaderIsOn;
rtl::OUStringBuffer aStrBuf( aCmd );
aStrBuf.appendAscii( "?PageStyle:string=");
@@ -195,7 +197,7 @@ void HeaderMenuController::fillPopupMenu( const Reference< ::com::sun::star::fra
if ( bAllOneState && ( nCount > 1 ))
{
// Insert special item for all command
- pVCLPopupMenu->InsertItem( ALL_MENUITEM_ID, String( FwkResId( STR_MENU_HEADFOOTALL )), 0, 0 );
+ pVCLPopupMenu->InsertItem( ALL_MENUITEM_ID, String( FwlResId( STR_MENU_HEADFOOTALL )), 0, 0 );
rtl::OUStringBuffer aStrBuf( aCmd );
aStrBuf.appendAscii( "?On:bool=" );
@@ -247,86 +249,14 @@ void SAL_CALL HeaderMenuController::statusChanged( const FeatureStateEvent& Even
}
// XMenuListener
-void SAL_CALL HeaderMenuController::highlight( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
-void SAL_CALL HeaderMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException)
-{
- Reference< css::awt::XPopupMenu > xPopupMenu;
- Reference< XDispatch > xDispatch;
- Reference< XMultiServiceFactory > xServiceManager;
-
- ResetableGuard aLock( m_aLock );
- xPopupMenu = m_xPopupMenu;
- xDispatch = m_xDispatch;
- xServiceManager = m_xServiceManager;
- aLock.unlock();
-
- if ( xPopupMenu.is() && xDispatch.is() )
- {
- VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( xPopupMenu );
- if ( pPopupMenu )
- {
- css::util::URL aTargetURL;
- Sequence<PropertyValue> aArgs( 1 );
- Reference< XURLTransformer > xURLTransformer( xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
-
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
- PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
-
- aTargetURL.Complete = pVCLPopupMenu->GetItemCommand( rEvent.MenuId );
- }
-
- xURLTransformer->parseStrict( aTargetURL );
- if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
- UiEventLogHelper(::rtl::OUString::createFromAscii("HeaderMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs);
- xDispatch->dispatch( aTargetURL, aArgs );
- }
- }
-}
-
-void SAL_CALL HeaderMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
-void SAL_CALL HeaderMenuController::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException)
+void HeaderMenuController::impl_select(const Reference< XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aTargetURL)
{
+ Sequence<PropertyValue> aArgs;
+ if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
+ UiEventLogHelper(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(m_bFooter ? "FooterMenuController" : "HeaderMenuController"))).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs);
+ _xDispatch->dispatch( aTargetURL, aArgs );
}
-// XPopupMenuController
-void SAL_CALL HeaderMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException )
-{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xFrame.is() && !m_xPopupMenu.is() )
- {
- // Create popup menu on demand
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- m_xPopupMenu = xPopupMenu;
- m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY ));
-
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
-
- com::sun::star::util::URL aTargetURL;
- aTargetURL.Complete = m_aCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
- m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- updatePopupMenu();
- }
-}
-
void SAL_CALL HeaderMenuController::updatePopupMenu() throw (::com::sun::star::uno::RuntimeException)
{
ResetableGuard aLock( m_aLock );
@@ -345,10 +275,4 @@ void SAL_CALL HeaderMenuController::updatePopupMenu() throw (::com::sun::star::u
fillPopupMenu( m_xModel, m_xPopupMenu );
}
-// XInitialization
-void SAL_CALL HeaderMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
-{
- PopupMenuControllerBase::initialize( aArguments );
-}
-
}
diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
index 5897f5ea9d..542c15bdb4 100644
--- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx
+++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
@@ -168,14 +168,6 @@ throw ( RuntimeException )
// ------------------------------------------------------------------
-void SAL_CALL ImageButtonToolbarController::execute( sal_Int16 KeyModifier )
-throw ( RuntimeException )
-{
- ComplexToolbarController::execute( KeyModifier );
-}
-
-// ------------------------------------------------------------------
-
void ImageButtonToolbarController::executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand )
{
vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
diff --git a/framework/source/uielement/itemcontainer.cxx b/framework/source/uielement/itemcontainer.cxx
index 5e139a1149..b0fc5d385f 100644
--- a/framework/source/uielement/itemcontainer.cxx
+++ b/framework/source/uielement/itemcontainer.cxx
@@ -55,39 +55,20 @@ namespace framework
//*****************************************************************************************************************
// XInterface, XTypeProvider
//*****************************************************************************************************************
-DEFINE_XINTERFACE_6 ( ItemContainer ,
- OWeakObject ,
- DIRECT_INTERFACE( ::com::sun::star::lang::XTypeProvider ),
- DIRECT_INTERFACE( ::com::sun::star::container::XIndexContainer ),
- DIRECT_INTERFACE( ::com::sun::star::lang::XUnoTunnel ),
- DERIVED_INTERFACE( ::com::sun::star::container::XIndexReplace, com::sun::star::container::XIndexContainer ),
- DERIVED_INTERFACE( ::com::sun::star::container::XIndexAccess, com::sun::star::container::XIndexReplace ),
- DERIVED_INTERFACE( ::com::sun::star::container::XElementAccess, ::com::sun::star::container::XIndexAccess )
- )
-DEFINE_XTYPEPROVIDER_6 ( ItemContainer ,
- ::com::sun::star::lang::XTypeProvider ,
- ::com::sun::star::container::XIndexContainer ,
- ::com::sun::star::container::XIndexReplace ,
- ::com::sun::star::container::XIndexAccess ,
- ::com::sun::star::container::XElementAccess ,
- ::com::sun::star::lang::XUnoTunnel
- )
-
-ItemContainer::ItemContainer( const ShareableMutex& rMutex ) : ::cppu::OWeakObject()
- , m_aShareMutex( rMutex )
+ItemContainer::ItemContainer( const ShareableMutex& rMutex ) :
+ m_aShareMutex( rMutex )
{
}
-ItemContainer::ItemContainer( const ConstItemContainer& rConstItemContainer, const ShareableMutex& rMutex ) : ::cppu::OWeakObject()
- , m_aShareMutex( rMutex )
+ItemContainer::ItemContainer( const ConstItemContainer& rConstItemContainer, const ShareableMutex& rMutex ) : m_aShareMutex( rMutex )
{
copyItemContainer( rConstItemContainer.m_aItemVector, rMutex );
}
-ItemContainer::ItemContainer( const Reference< XIndexAccess >& rSourceContainer, const ShareableMutex& rMutex ) : ::cppu::OWeakObject()
- , m_aShareMutex( rMutex )
+ItemContainer::ItemContainer( const Reference< XIndexAccess >& rSourceContainer, const ShareableMutex& rMutex ) :
+ m_aShareMutex( rMutex )
{
if ( rSourceContainer.is() )
{
@@ -97,8 +78,7 @@ ItemContainer::ItemContainer( const Reference< XIndexAccess >& rSourceContainer,
for ( sal_Int32 i = 0; i < nCount; i++ )
{
Sequence< PropertyValue > aPropSeq;
- Any a = rSourceContainer->getByIndex( i );
- if ( a >>= aPropSeq )
+ if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
{
sal_Int32 nContainerIndex = -1;
Reference< XIndexAccess > xIndexAccess;
@@ -132,7 +112,8 @@ ItemContainer::~ItemContainer()
// private
void ItemContainer::copyItemContainer( const std::vector< Sequence< PropertyValue > >& rSourceVector, const ShareableMutex& rMutex )
{
- for ( sal_uInt32 i = 0; i < rSourceVector.size(); i++ )
+ const sal_uInt32 nCount = rSourceVector.size();
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
{
sal_Int32 nContainerIndex = -1;
Sequence< PropertyValue > aPropSeq( rSourceVector[i] );
@@ -208,7 +189,7 @@ sal_Bool SAL_CALL ItemContainer::hasElements()
throw ( RuntimeException )
{
ShareGuard aLock( m_aShareMutex );
- return ( m_aItemVector.size() != 0 );
+ return ( !m_aItemVector.empty() );
}
// XIndexAccess
diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx
index a18839ea03..a2f8ec271a 100644
--- a/framework/source/uielement/langselectionmenucontroller.cxx
+++ b/framework/source/uielement/langselectionmenucontroller.cxx
@@ -44,7 +44,6 @@
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/awt/MenuItemStyle.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
//_________________________________________________________________________________________________________________
@@ -72,7 +71,7 @@
#include <svtools/languageoptions.hxx>
#include <com/sun/star/awt/MenuItemStyle.hpp>
#include <svtools/langtab.hxx>
-#include <classes/fwkresid.hxx>
+#include <classes/fwlresid.hxx>
#ifndef __FRAMEWORK_CLASSES_RESOURCE_HRC_
#include <classes/resource.hrc>
@@ -107,6 +106,7 @@ DEFINE_INIT_SERVICE ( LanguageSelectionMenuController, {}
LanguageSelectionMenuController::LanguageSelectionMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) :
PopupMenuControllerBase( xServiceManager ),
m_bShowMenu( sal_True )
+ ,m_aLangGuessHelper(xServiceManager)
{
}
@@ -167,129 +167,65 @@ void SAL_CALL LanguageSelectionMenuController::statusChanged( const FeatureState
}
// XMenuListener
-void SAL_CALL LanguageSelectionMenuController::highlight( const css::awt::MenuEvent& ) throw (RuntimeException)
+void LanguageSelectionMenuController::impl_select(const Reference< XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aTargetURL)
{
-}
-
-void SAL_CALL LanguageSelectionMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException)
-{
- Reference< css::awt::XPopupMenu > xPopupMenu;
- Reference< XDispatch > xDispatch;
- Reference< XMultiServiceFactory > xServiceManager;
+ Reference< XDispatch > xDispatch = _xDispatch;
- ResetableGuard aLock( m_aLock );
- xPopupMenu = m_xPopupMenu;
- //xDispatch = m_xDispatch;
- xServiceManager = m_xServiceManager;
- aLock.unlock();
+ if ( aTargetURL.Complete == m_aMenuCommandURL_Font )
+ { //open format/character dialog for current selection
+ xDispatch = m_xMenuDispatch_Font;
+ }
+ else if ( aTargetURL.Complete == m_aMenuCommandURL_Lang )
+ { //open language tab-page in tools/options dialog
+ xDispatch = m_xMenuDispatch_Lang;
+ }
+ else if ( aTargetURL.Complete == m_aMenuCommandURL_CharDlgForParagraph )
+ { //open format/character dialog for current selection
+ xDispatch = m_xMenuDispatch_CharDlgForParagraph;
+ }
- if ( xPopupMenu.is())//&& xDispatch.is()
+ if ( !xDispatch.is() )
{
- VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( xPopupMenu );
- if ( pPopupMenu )
- {
- css::util::URL aTargetURL;
- Sequence< PropertyValue > aArgs;
- Reference< XURLTransformer > xURLTransformer( xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
-
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- // Command URL used to dispatch the selected font family name
- PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
- aTargetURL.Complete = pVCLPopupMenu->GetItemCommand( rEvent.MenuId );
- }
-
- if ( aTargetURL.Complete == m_aMenuCommandURL_Font )
- { //open format/character dialog for current selection
- xDispatch = m_xMenuDispatch_Font;
- }
- else if ( aTargetURL.Complete == m_aMenuCommandURL_Lang )
- { //open language tab-page in tools/options dialog
- xDispatch = m_xMenuDispatch_Lang;
- }
- else if ( aTargetURL.Complete == m_aMenuCommandURL_CharDlgForParagraph )
- { //open format/character dialog for current selection
- xDispatch = m_xMenuDispatch_CharDlgForParagraph;
- }
-
- xURLTransformer->parseStrict( aTargetURL );
- if ( !xDispatch.is() )
- {
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
- if ( xDispatchProvider.is() )
- xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
- }
-
- if ( xDispatch.is() )
- {
- if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
- UiEventLogHelper(::rtl::OUString::createFromAscii("LanguageSelectionMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs);
- xDispatch->dispatch( aTargetURL, aArgs );
- }
- }
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
+ if ( xDispatchProvider.is() )
+ xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
}
-}
-void SAL_CALL LanguageSelectionMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
-void SAL_CALL LanguageSelectionMenuController::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
+ if ( xDispatch.is() )
+ {
+ Sequence<PropertyValue> aArgs;
+ if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
+ UiEventLogHelper(::rtl::OUString::createFromAscii("LanguageSelectionMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs);
+ xDispatch->dispatch( aTargetURL, aArgs );
+ }
}
// XPopupMenuController
-void SAL_CALL LanguageSelectionMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw (RuntimeException)
+void LanguageSelectionMenuController::impl_setPopupMenu()
{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xFrame.is() && !m_xPopupMenu.is() )
- {
- // Create popup menu on demand
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- m_xPopupMenu = xPopupMenu;
- m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY ));
-
-
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
- com::sun::star::util::URL aTargetURL;
- aTargetURL.Complete = m_aCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
- m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- // Register for language updates
- aTargetURL.Complete = m_aLangStatusCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
- m_xLanguageDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- // Register for setting languages and opening language dialog
- aTargetURL.Complete = m_aMenuCommandURL_Lang;
- xURLTransformer->parseStrict( aTargetURL );
- m_xMenuDispatch_Lang = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- // Register for opening character dialog
- aTargetURL.Complete = m_aMenuCommandURL_Font;
- xURLTransformer->parseStrict( aTargetURL );
- m_xMenuDispatch_Font = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- // Register for opening character dialog with preselected paragraph
- aTargetURL.Complete = m_aMenuCommandURL_CharDlgForParagraph;
- xURLTransformer->parseStrict( aTargetURL );
- m_xMenuDispatch_CharDlgForParagraph = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
+ com::sun::star::util::URL aTargetURL;
- updatePopupMenu();
- }
+ // Register for language updates
+ aTargetURL.Complete = m_aLangStatusCommandURL;
+ m_xURLTransformer->parseStrict( aTargetURL );
+ m_xLanguageDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
+
+ // Register for setting languages and opening language dialog
+ aTargetURL.Complete = m_aMenuCommandURL_Lang;
+ m_xURLTransformer->parseStrict( aTargetURL );
+ m_xMenuDispatch_Lang = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
+
+ // Register for opening character dialog
+ aTargetURL.Complete = m_aMenuCommandURL_Font;
+ m_xURLTransformer->parseStrict( aTargetURL );
+ m_xMenuDispatch_Font = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
+
+ // Register for opening character dialog with preselected paragraph
+ aTargetURL.Complete = m_aMenuCommandURL_CharDlgForParagraph;
+ m_xURLTransformer->parseStrict( aTargetURL );
+ m_xMenuDispatch_CharDlgForParagraph = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
}
void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopupMenu , const Mode eMode )
@@ -306,9 +242,9 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
if ( pVCLPopupMenu )
pPopupMenu = (PopupMenu *)pVCLPopupMenu->GetMenu();
- String aCmd=String::CreateFromAscii("");
- String aCmd_Dialog=String::CreateFromAscii("");
- String aCmd_Language=String::CreateFromAscii("");
+ String aCmd;
+ String aCmd_Dialog;
+ String aCmd_Language;
if( eMode == MODE_SetLanguageSelectionMenu )
{
aCmd_Dialog+=String::CreateFromAscii(".uno:FontDialog?Language:string=*");
@@ -332,7 +268,7 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
USHORT nItemId = 1;
//1--add current language
- if(m_aCurLang!=::rtl::OUString::createFromAscii(""))
+ if(m_aCurLang.getLength())
{
LangItems[m_aCurLang]=m_aCurLang;
}
@@ -404,17 +340,18 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
break;
const Locale& rLocale=rLocales[i];
if(IsScriptTypeMatchingToLanguage(m_nScriptType, aLanguageTable.GetType(rLocale.Language)))
- LangItems[::rtl::OUString(rLocale.Language)]=::rtl::OUString(rLocale.Language);
+ LangItems[rLocale.Language] = rLocale.Language;
}
}
}
std::map< sal_Int16, ::rtl::OUString > LangTable;
+ const ::rtl::OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*"));
for(std::map< ::rtl::OUString, ::rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it)
{
if(it->first != ::rtl::OUString( aLangTable.GetString( LANGUAGE_NONE ) )&&
- it->first != ::rtl::OUString::createFromAscii("*") &&
- it->first != ::rtl::OUString::createFromAscii(""))
+ it->first != sAsterix &&
+ it->first.getLength())
{
++nItemId;
pPopupMenu->InsertItem( nItemId,it->first);
@@ -432,14 +369,14 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
//7--none
nItemId++;
- pPopupMenu->InsertItem( nItemId, String(FwkResId( STR_LANGSTATUS_NONE )) );
+ pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_NONE )) );
aCmd=aCmd_Language;
aCmd+=String::CreateFromAscii("LANGUAGE_NONE");
pPopupMenu->SetItemCommand(nItemId,aCmd);
//More...
nItemId++;
- pPopupMenu->InsertItem( nItemId, String(FwkResId( STR_LANGSTATUS_MORE )));
+ pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_MORE )));
pPopupMenu->SetItemCommand(nItemId,aCmd_Dialog);
}
@@ -451,12 +388,9 @@ void SAL_CALL LanguageSelectionMenuController::updatePopupMenu() throw ( ::com::
// Force status update to get information about the current languages
ResetableGuard aLock( m_aLock );
Reference< XDispatch > xDispatch( m_xLanguageDispatch );
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
com::sun::star::util::URL aTargetURL;
aTargetURL.Complete = m_aLangStatusCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
aLock.unlock();
if ( xDispatch.is() )
@@ -484,39 +418,19 @@ void SAL_CALL LanguageSelectionMenuController::updatePopupMenu() throw ( ::com::
// XInitialization
void SAL_CALL LanguageSelectionMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
{
- const rtl::OUString aFrameName( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- const rtl::OUString aCommandURLName( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
-
ResetableGuard aLock( m_aLock );
sal_Bool bInitalized( m_bInitialized );
if ( !bInitalized )
{
- PropertyValue aPropValue;
- rtl::OUString aCommandURL;
- Reference< XFrame > xFrame;
-
- for ( int i = 0; i < aArguments.getLength(); i++ )
- {
- if ( aArguments[i] >>= aPropValue )
- {
- if ( aPropValue.Name.equalsAscii( "Frame" ))
- aPropValue.Value >>= xFrame;
- else if ( aPropValue.Name.equalsAscii( "CommandURL" ))
- aPropValue.Value >>= aCommandURL;
- }
- }
+ PopupMenuControllerBase::initialize(aArguments);
- if ( xFrame.is() && aCommandURL.getLength() )
+ if ( m_bInitialized )
{
- m_xFrame = xFrame;
- m_aCommandURL = aCommandURL;
- m_aBaseURL = determineBaseURL( aCommandURL );
m_aLangStatusCommandURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LanguageStatus" ));
m_aMenuCommandURL_Lang = m_aLangStatusCommandURL;
m_aMenuCommandURL_Font = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialog" ));
m_aMenuCommandURL_CharDlgForParagraph = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialogForParagraph" ));
- m_bInitialized = true;
}
}
}
diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx
index b49f9bf16c..a99c60a10e 100644
--- a/framework/source/uielement/langselectionstatusbarcontroller.cxx
+++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx
@@ -100,6 +100,7 @@ LangSelectionStatusbarController::LangSelectionStatusbarController( const uno::R
svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), rtl::OUString(), 0 ),
m_bShowMenu( sal_True ),
m_nScriptType( 7 )
+ ,m_aLangGuessHelper(xServiceManager)
{
}
@@ -123,6 +124,7 @@ void SAL_CALL LangSelectionStatusbarController::release() throw ()
void SAL_CALL LangSelectionStatusbarController::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::initialize" );
vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
svt::StatusbarController::initialize( aArguments );
@@ -142,6 +144,7 @@ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException
void SAL_CALL LangSelectionStatusbarController::dispose()
throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::dispose" );
svt::StatusbarController::dispose();
}
@@ -149,6 +152,7 @@ throw (::com::sun::star::uno::RuntimeException)
void SAL_CALL LangSelectionStatusbarController::disposing( const com::sun::star::lang::EventObject& Source )
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::disposing" );
svt::StatusbarController::disposing( Source );
}
@@ -157,6 +161,7 @@ throw ( RuntimeException )
const ::com::sun::star::awt::MouseEvent& )
throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::mouseButtonDown" );
return sal_False;
}
@@ -164,6 +169,7 @@ throw (::com::sun::star::uno::RuntimeException)
const ::com::sun::star::awt::MouseEvent& )
throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::mouseMove" );
return sal_False;
}
@@ -171,18 +177,21 @@ throw (::com::sun::star::uno::RuntimeException)
const ::com::sun::star::awt::MouseEvent& )
throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::mouseButtonUp" );
return sal_False;
}
void LangSelectionStatusbarController::LangMenu()throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::LangMenu" );
if (!m_bShowMenu)
return;
//add context menu
- Reference< awt::XPopupMenu > xPopupMenu( m_xServiceManager->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.awt.PopupMenu" ) ), UNO_QUERY );
+ const static ::rtl::OUString s_sPopupMenu(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.PopupMenu"));
+ Reference< awt::XPopupMenu > xPopupMenu( m_xServiceManager->createInstance( s_sPopupMenu ), UNO_QUERY );
//sub menu that contains all items except the last two items: Separator + Set Language for Paragraph
- Reference< awt::XPopupMenu > subPopupMenu(m_xServiceManager->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.awt.PopupMenu" ) ), UNO_QUERY );
+ Reference< awt::XPopupMenu > subPopupMenu(m_xServiceManager->createInstance( s_sPopupMenu ), UNO_QUERY );
std::set< ::rtl::OUString > LangItems;
@@ -190,7 +199,7 @@ void LangSelectionStatusbarController::LangMenu()throw (::com::sun::star::uno::R
USHORT nItemId=1;
//1--add current language
- if( m_aCurLang != ::rtl::OUString::createFromAscii( "" ) &&
+ if( m_aCurLang != ::rtl::OUString( ) &&
LANGUAGE_DONTKNOW != aLanguageTable.GetType( m_aCurLang ))
LangItems.insert( m_aCurLang );
@@ -394,6 +403,7 @@ void SAL_CALL LangSelectionStatusbarController::command(
const ::com::sun::star::uno::Any& /*aData*/ )
throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::command" );
if ( nCommand & ::awt::Command::CONTEXTMENU )
{
LangMenu();
@@ -407,18 +417,21 @@ void SAL_CALL LangSelectionStatusbarController::paint(
::sal_Int32 nStyle )
throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::paint" );
svt::StatusbarController::paint( xGraphics, rOutputRectangle, nItemId, nStyle );
}
void SAL_CALL LangSelectionStatusbarController::click()
throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::click" );
LangMenu();
}
void SAL_CALL LangSelectionStatusbarController::doubleClick()
throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::doubleClick" );
svt::StatusbarController::doubleClick();
}
@@ -426,6 +439,7 @@ throw (::com::sun::star::uno::RuntimeException)
void SAL_CALL LangSelectionStatusbarController::statusChanged( const FeatureStateEvent& Event )
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::statusChanged" );
vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
if ( m_bDisposed )
diff --git a/framework/source/uielement/logoimagestatusbarcontroller.cxx b/framework/source/uielement/logoimagestatusbarcontroller.cxx
index 3e5e83ccfa..7158ccae23 100644
--- a/framework/source/uielement/logoimagestatusbarcontroller.cxx
+++ b/framework/source/uielement/logoimagestatusbarcontroller.cxx
@@ -31,7 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
#include <uielement/logoimagestatusbarcontroller.hxx>
-#include <classes/fwkresid.hxx>
+#include <classes/fwlresid.hxx>
#include <services.h>
#include <classes/resource.hrc>
#include <vos/mutex.hxx>
@@ -64,7 +64,7 @@ DEFINE_INIT_SERVICE ( LogoImageStatusbarController, {} )
LogoImageStatusbarController::LogoImageStatusbarController( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) :
svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), rtl::OUString(), 0 )
{
- Image aImage( FwkResId( RID_IMAGE_STATUSBAR_LOGO ));
+ Image aImage( FwlResId( RID_IMAGE_STATUSBAR_LOGO ));
m_aLogoImage = aImage;
}
diff --git a/framework/source/uielement/logotextstatusbarcontroller.cxx b/framework/source/uielement/logotextstatusbarcontroller.cxx
index 5e88185919..e11bfd1223 100644
--- a/framework/source/uielement/logotextstatusbarcontroller.cxx
+++ b/framework/source/uielement/logotextstatusbarcontroller.cxx
@@ -31,7 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
#include <uielement/logotextstatusbarcontroller.hxx>
-#include <classes/fwkresid.hxx>
+#include <classes/fwlresid.hxx>
#include <services.h>
#include <classes/resource.hrc>
#include <vos/mutex.hxx>
@@ -65,7 +65,7 @@ DEFINE_INIT_SERVICE ( LogoTextStatusbarController, {} )
LogoTextStatusbarController::LogoTextStatusbarController( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) :
svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), rtl::OUString(), 0 )
{
- m_aLogoText = String( FwkResId( STR_STATUSBAR_LOGOTEXT ));
+ m_aLogoText = String( FwlResId( STR_STATUSBAR_LOGOTEXT ));
}
LogoTextStatusbarController::~LogoTextStatusbarController()
diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx
index eed8455db6..65385b780c 100644
--- a/framework/source/uielement/macrosmenucontroller.cxx
+++ b/framework/source/uielement/macrosmenucontroller.cxx
@@ -32,6 +32,7 @@
#include "precompiled_framework.hxx"
#include <uielement/macrosmenucontroller.hxx>
+#include <uielement/menubarmanager.hxx>
#include <threadhelp/resetableguard.hxx>
#include "services.h"
#include <classes/resource.hrc>
@@ -42,7 +43,6 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
#include <comphelper/processfactory.hxx>
#include <vcl/svapp.hxx>
@@ -50,6 +50,7 @@
#include <tools/urlobj.hxx>
#include <rtl/ustrbuf.hxx>
#include <dispatch/uieventloghelper.hxx>
+#include "helper/mischelper.hxx"
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -136,60 +137,25 @@ void SAL_CALL MacrosMenuController::statusChanged( const FeatureStateEvent& ) th
}
// XMenuListener
-void SAL_CALL MacrosMenuController::highlight( const css::awt::MenuEvent& ) throw (RuntimeException)
+void MacrosMenuController::impl_select(const Reference< XDispatch >& /*_xDispatch*/,const ::com::sun::star::util::URL& aTargetURL)
{
-}
-
-void SAL_CALL MacrosMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException)
-{
- Reference< css::awt::XPopupMenu > xPopupMenu;
- Reference< XDispatch > xDispatch;
- Reference< XMultiServiceFactory > xServiceManager;
-
- ResetableGuard aLock( m_aLock );
- xPopupMenu = m_xPopupMenu;
- xDispatch = m_xDispatch;
- xServiceManager = m_xServiceManager;
- aLock.unlock();
-
- if ( xPopupMenu.is() && xDispatch.is() )
+ // need to requery, since we handle more than one type of Command
+ // if we don't do this only .uno:ScriptOrganizer commands are executed
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
+ Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
+ if( xDispatch.is() )
{
- VCLXPopupMenu* pVCLPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( xPopupMenu );
- if ( pVCLPopupMenu )
- {
- css::util::URL aTargetURL;
- Sequence<PropertyValue> aArgs;
- Reference< XURLTransformer > xURLTransformer( xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
-
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
- PopupMenu* pPopupMenu = (PopupMenu *)pVCLPopupMenu->GetMenu();
-
- aTargetURL.Complete = pPopupMenu->GetItemCommand( rEvent.MenuId );
- }
-
- xURLTransformer->parseStrict( aTargetURL );
-
- // need to requery, since we handle more than one type of Command
- // if we don't do this only .uno:ScriptOrganizer commands are executed
- xDispatch = m_xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
- if( xDispatch.is() )
- {
- ExecuteInfo* pExecuteInfo = new ExecuteInfo;
- pExecuteInfo->xDispatch = xDispatch;
- pExecuteInfo->aTargetURL = aTargetURL;
- pExecuteInfo->aArgs = aArgs;
- if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
- UiEventLogHelper(::rtl::OUString::createFromAscii("MacrosMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs);
+ ExecuteInfo* pExecuteInfo = new ExecuteInfo;
+ pExecuteInfo->xDispatch = xDispatch;
+ pExecuteInfo->aTargetURL = aTargetURL;
+ //pExecuteInfo->aArgs = aArgs;
+ if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
+ UiEventLogHelper(::rtl::OUString::createFromAscii("MacrosMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, pExecuteInfo->aArgs);
// xDispatch->dispatch( aTargetURL, aArgs );
- Application::PostUserEvent( STATIC_LINK(0, MacrosMenuController , ExecuteHdl_Impl), pExecuteInfo );
- }
- else
- {
- }
- }
+ Application::PostUserEvent( STATIC_LINK(0, MacrosMenuController , ExecuteHdl_Impl), pExecuteInfo );
+ }
+ else
+ {
}
}
@@ -210,105 +176,10 @@ IMPL_STATIC_LINK_NOINSTANCE( MacrosMenuController, ExecuteHdl_Impl, ExecuteInfo*
return 0;
}
-void SAL_CALL MacrosMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
-void SAL_CALL MacrosMenuController::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
-// XPopupMenuController
-void SAL_CALL MacrosMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException )
-{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xFrame.is() && !m_xPopupMenu.is() )
- {
- // Create popup menu on demand
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- m_xPopupMenu = xPopupMenu;
- m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY ));
-
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
-
- m_xDispatchProvider = xDispatchProvider;
- com::sun::star::util::URL aTargetURL;
- aTargetURL.Complete = m_aCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
- m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- updatePopupMenu();
- }
-}
-
-// XInitialization
-void SAL_CALL MacrosMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
-{
- PopupMenuControllerBase::initialize( aArguments );
-}
-
String MacrosMenuController::RetrieveLabelFromCommand( const String& aCmdURL )
{
- String aLabel;
-
- // Retrieve popup menu labels
- if ( !m_aModuleIdentifier.getLength() )
- {
- Reference< XModuleManager > xModuleManager( ::comphelper::getProcessServiceFactory()->createInstance(
- SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW );
- Reference< XInterface > xIfac( m_xFrame, UNO_QUERY );
- m_aModuleIdentifier = xModuleManager->identify( xIfac );
-
- if ( m_aModuleIdentifier.getLength() > 0 )
- {
- Reference< XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance(
- SERVICENAME_UICOMMANDDESCRIPTION ), UNO_QUERY );
- if ( xNameAccess.is() )
- {
- Any a = xNameAccess->getByName( m_aModuleIdentifier );
- Reference< XNameAccess > xUICommands;
- a >>= m_xUICommandLabels;
- }
- }
- }
-
- if ( m_xUICommandLabels.is() )
- {
- try
- {
- if ( aCmdURL.Len() > 0 )
- {
- rtl::OUString aStr;
- Sequence< PropertyValue > aPropSeq;
- Any a( m_xUICommandLabels->getByName( aCmdURL ));
- if ( a >>= aPropSeq )
- {
- for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
- {
- if ( aPropSeq[i].Name.equalsAscii( "Label" ))
- {
- aPropSeq[i].Value >>= aStr;
- break;
- }
- }
- }
- aLabel = aStr;
- }
- }
- catch ( com::sun::star::uno::Exception& )
- {
- }
- }
-
- return aLabel;
+ sal_Bool bModuleIdentified = m_aModuleIdentifier.getLength() != 0;
+ return framework::RetrieveLabelFromCommand(aCmdURL,m_xServiceManager,m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,bModuleIdentified,"Label");
}
void MacrosMenuController::addScriptItems( PopupMenu* pPopupMenu, USHORT startItemId )
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 07b68c017a..f1add0d0bf 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -36,14 +36,16 @@
// my own includes
//_________________________________________________________________________________________________________________
#include <uielement/menubarmanager.hxx>
-#include <classes/menuconfiguration.hxx>
+#include <xml/menuconfiguration.hxx>
#include <classes/bmkmenu.hxx>
#include <classes/addonmenu.hxx>
#include <helper/imageproducer.hxx>
#include <threadhelp/resetableguard.hxx>
#include "classes/addonsoptions.hxx"
#include <classes/fwkresid.hxx>
+#include <classes/menumanager.hxx>
#include <helper/acceleratorinfo.hxx>
+#include <helper/mischelper.hxx>
#include <classes/menuextensionsupplier.hxx>
#include <classes/resource.hrc>
#include <services.h>
@@ -53,6 +55,7 @@
//_________________________________________________________________________________________________________________
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
@@ -67,7 +70,6 @@
#endif
#include <com/sun/star/ui/ItemType.hpp>
#include <com/sun/star/ui/ImageType.hpp>
-#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
@@ -153,7 +155,7 @@ class StringLength : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XSt
// XStringWidth
sal_Int32 SAL_CALL queryStringWidth( const ::rtl::OUString& aString )
- throw (::com::sun::star::uno::RuntimeException)
+ throw (RuntimeException)
{
return aString.getLength();
}
@@ -172,9 +174,7 @@ namespace framework
#define SID_HELPMENU (SID_SFX_START + 410)
#define SFX_REFERER_USER "private:user"
-#define DESKTOP_SERVICE ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))
-const ::rtl::OUString aSlotString( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
const ::rtl::OUString aCmdHelpIndex( RTL_CONSTASCII_USTRINGPARAM( ".uno:HelpIndex" ));
const ::rtl::OUString aCmdToolsMenu( RTL_CONSTASCII_USTRINGPARAM( ".uno:ToolsMenu" ));
const ::rtl::OUString aCmdHelpMenu( RTL_CONSTASCII_USTRINGPARAM( ".uno:HelpMenu" ));
@@ -204,20 +204,23 @@ static sal_Int16 getImageTypeFromBools( sal_Bool bBig, sal_Bool bHighContrast )
// #110897#
MenuBarManager::MenuBarManager(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const Reference< XMultiServiceFactory >& xServiceFactory,
const Reference< XFrame >& rFrame,
+ const Reference< XURLTransformer >& _xURLTransformer,
const Reference< XDispatchProvider >& rDispatchProvider,
const rtl::OUString& rModuleIdentifier,
Menu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
: ThreadHelpBase( &Application::GetSolarMutex() ), OWeakObject()
, m_bDisposed( sal_False )
- , m_bModuleIdentified( sal_False )
, m_bRetrieveImages( sal_False )
, m_bAcceleratorCfg( sal_False )
+ , m_bModuleIdentified( sal_False )
, m_aListenerContainer( m_aLock.getShareableOslMutex() )
, mxServiceFactory(xServiceFactory)
+ , m_xURLTransformer(_xURLTransformer)
, m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::MenuBarManager" );
m_xPopupMenuControllerRegistration = Reference< ::com::sun::star::frame::XUIControllerRegistration >(
getServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.PopupMenuControllerFactory" ))),
UNO_QUERY );
@@ -226,209 +229,59 @@ MenuBarManager::MenuBarManager(
// #110897#
MenuBarManager::MenuBarManager(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const Reference< XMultiServiceFactory >& xServiceFactory,
const Reference< XFrame >& rFrame,
+ const Reference< XURLTransformer >& _xURLTransformer,
AddonMenu* pAddonMenu,
sal_Bool bDelete,
sal_Bool bDeleteChildren )
: ThreadHelpBase( &Application::GetSolarMutex() )
, OWeakObject()
, m_bDisposed( sal_False )
- , m_bModuleIdentified( sal_False )
, m_bRetrieveImages( sal_True )
, m_bAcceleratorCfg( sal_False )
+ , m_bModuleIdentified( sal_False )
, m_aListenerContainer( m_aLock.getShareableOslMutex() )
, mxServiceFactory(xServiceFactory)
+ , m_xURLTransformer(_xURLTransformer)
, m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() )
{
- m_bActive = sal_False;
- m_bDeleteMenu = bDelete;
- m_bDeleteChildren = bDeleteChildren;
- m_pVCLMenu = pAddonMenu;
- m_xFrame = rFrame;
- m_bInitialized = sal_False;
- m_bIsBookmarkMenu = sal_True;
-
- rtl::OUString aModuleIdentifier;
- m_xPopupMenuControllerRegistration = Reference< ::com::sun::star::frame::XUIControllerRegistration >(
- getServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.PopupMenuControllerFactory" ))),
- UNO_QUERY );
-
- const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- m_bWasHiContrast = rSettings.GetMenuColor().IsDark();
-
- Reference< XStatusListener > xStatusListener;
- Reference< XDispatch > xDispatch;
- USHORT nItemCount = pAddonMenu->GetItemCount();
- for ( USHORT i = 0; i < nItemCount; i++ )
- {
- USHORT nItemId = pAddonMenu->GetItemId( i );
-
- ::rtl::OUString aItemCommand = pAddonMenu->GetItemCommand( nItemId );
- if ( !aItemCommand.getLength() )
- {
- aItemCommand = aSlotString;
- aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
- pAddonMenu->SetItemCommand( nItemId, aItemCommand );
- }
-
- PopupMenu* pPopupMenu = pAddonMenu->GetPopupMenu( nItemId );
- if ( pPopupMenu )
- {
- // #110897#
- Reference< XDispatchProvider > xDispatchProvider;
- MenuBarManager* pSubMenuManager = new MenuBarManager( getServiceFactory(), rFrame, xDispatchProvider, aModuleIdentifier, pPopupMenu, bDeleteChildren, bDeleteChildren );
-
- Reference< XStatusListener > xSubMenuManager( static_cast< OWeakObject *>( pSubMenuManager ), UNO_QUERY );
-
- // store menu item command as we later have to know which menu is active (see Acivate handler)
- pSubMenuManager->m_aMenuItemCommand = aItemCommand;
-
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- xSubMenuManager,
- xDispatch );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- else
- {
- if ( pAddonMenu->GetItemType( i ) != MENUITEM_SEPARATOR )
- {
- MenuConfiguration::Attributes* pAddonAttributes = (MenuConfiguration::Attributes *)(pAddonMenu->GetUserValue( nItemId ));
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler( nItemId, xStatusListener, xDispatch );
-
- if ( pAddonAttributes )
- {
- // read additional attributes from attributes struct and AddonMenu implementation will delete all attributes itself!!
- pMenuItemHandler->aTargetFrame = pAddonAttributes->aTargetFrame;
- }
-
- pMenuItemHandler->aMenuItemURL = aItemCommand;
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- }
- }
-
- m_pVCLMenu->SetHighlightHdl( LINK( this, MenuBarManager, Highlight ));
- m_pVCLMenu->SetActivateHdl( LINK( this, MenuBarManager, Activate ));
- m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuBarManager, Deactivate ));
- m_pVCLMenu->SetSelectHdl( LINK( this, MenuBarManager, Select ));
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::MenuBarManager" );
+ Init(rFrame,pAddonMenu,bDelete,bDeleteChildren);
}
-
// #110897#
MenuBarManager::MenuBarManager(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const Reference< XMultiServiceFactory >& xServiceFactory,
const Reference< XFrame >& rFrame,
+ const Reference< XURLTransformer >& _xURLTransformer,
AddonPopupMenu* pAddonPopupMenu,
sal_Bool bDelete,
sal_Bool bDeleteChildren )
: ThreadHelpBase( &Application::GetSolarMutex() )
, OWeakObject()
, m_bDisposed( sal_False )
- , m_bModuleIdentified( sal_False )
, m_bRetrieveImages( sal_True )
, m_bAcceleratorCfg( sal_False )
+ , m_bModuleIdentified( sal_False )
, m_aListenerContainer( m_aLock.getShareableOslMutex() )
, mxServiceFactory(xServiceFactory)
+ , m_xURLTransformer(_xURLTransformer)
, m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() )
{
- m_bActive = sal_False;
- m_bDeleteMenu = bDelete;
- m_bDeleteChildren = bDeleteChildren;
- m_pVCLMenu = pAddonPopupMenu;
- m_xFrame = rFrame;
- m_bInitialized = sal_False;
- m_bIsBookmarkMenu = sal_True;
-
- rtl::OUString aModuleIdentifier;
- m_xPopupMenuControllerRegistration = Reference< ::com::sun::star::frame::XUIControllerRegistration >(
- getServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.PopupMenuControllerFactory" ))),
- UNO_QUERY );
-
- const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- m_bWasHiContrast = rSettings.GetMenuColor().IsDark();
-
- Reference< XDispatch > xDispatch;
- Reference< XStatusListener > xStatusListener;
- USHORT nItemCount = pAddonPopupMenu->GetItemCount();
- for ( USHORT i = 0; i < nItemCount; i++ )
- {
- USHORT nItemId = pAddonPopupMenu->GetItemId( i );
-
- ::rtl::OUString aItemCommand = pAddonPopupMenu->GetItemCommand( nItemId );
- if ( !aItemCommand.getLength() )
- {
- aItemCommand = aSlotString;
- aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
- pAddonPopupMenu->SetItemCommand( nItemId, aItemCommand );
- }
-
- PopupMenu* pPopupMenu = pAddonPopupMenu->GetPopupMenu( nItemId );
- if ( pPopupMenu )
- {
- // #110897#
- Reference< XDispatchProvider > xDispatchProvider;
- MenuBarManager* pSubMenuManager = new MenuBarManager( getServiceFactory(), rFrame, xDispatchProvider, aModuleIdentifier, pPopupMenu, sal_False, sal_False );
-
- Reference< XStatusListener > xSubMenuManager( static_cast< OWeakObject *>( pSubMenuManager ), UNO_QUERY );
-
- // store menu item command as we later have to know which menu is active (see Acivate handler)
- pSubMenuManager->m_aMenuItemCommand = aItemCommand;
-
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- xSubMenuManager,
- xDispatch );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- else
- {
- if ( pAddonPopupMenu->GetItemType( i ) != MENUITEM_SEPARATOR )
- {
- MenuConfiguration::Attributes* pAttributes = (MenuConfiguration::Attributes *)(pAddonPopupMenu->GetUserValue( nItemId ));
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler( nItemId, xStatusListener, xDispatch );
-
- if ( pAttributes )
- {
- // read additional attributes from attributes struct and BmkMenu implementation will delete all attributes itself!!
- pMenuItemHandler->aTargetFrame = pAttributes->aTargetFrame;
- }
-
- pMenuItemHandler->aMenuItemURL = aItemCommand;
-
- // Check if we have to create a popup menu for a uno based popup menu controller.
- // We have to set an empty popup menu into our menu structure so the controller also
- // works with inplace OLE.
- if ( m_xPopupMenuControllerRegistration.is() &&
- m_xPopupMenuControllerRegistration->hasController( aItemCommand, rtl::OUString() ))
- {
- VCLXPopupMenu* pVCLXPopupMenu = new VCLXPopupMenu;
- PopupMenu* pCtlPopupMenu = (PopupMenu *)pVCLXPopupMenu->GetMenu();
- pAddonPopupMenu->SetPopupMenu( pMenuItemHandler->nItemId, pCtlPopupMenu );
- pMenuItemHandler->xPopupMenu = Reference< com::sun::star::awt::XPopupMenu >( (OWeakObject *)pVCLXPopupMenu, UNO_QUERY );
-
- }
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- }
- }
-
- m_pVCLMenu->SetHighlightHdl( LINK( this, MenuBarManager, Highlight ));
- m_pVCLMenu->SetActivateHdl( LINK( this, MenuBarManager, Activate ));
- m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuBarManager, Deactivate ));
- m_pVCLMenu->SetSelectHdl( LINK( this, MenuBarManager, Select ));
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::MenuBarManager" );
+ Init(rFrame,pAddonPopupMenu,bDelete,bDeleteChildren,true);
}
-Any SAL_CALL MenuBarManager::queryInterface( const ::com::sun::star::uno::Type & rType ) throw ( RuntimeException )
+Any SAL_CALL MenuBarManager::queryInterface( const Type & rType ) throw ( RuntimeException )
{
Any a = ::cppu::queryInterface(
rType ,
SAL_STATIC_CAST( ::com::sun::star::frame::XStatusListener*, this ),
SAL_STATIC_CAST( ::com::sun::star::frame::XFrameActionListener*, this ),
SAL_STATIC_CAST( ::com::sun::star::ui::XUIConfigurationListener*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, (XStatusListener *)this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XComponent*, this ),
+ SAL_STATIC_CAST( XEventListener*, (XStatusListener *)this ),
+ SAL_STATIC_CAST( XComponent*, this ),
SAL_STATIC_CAST( ::com::sun::star::awt::XSystemDependentMenuPeer*, this ));
if ( a.hasValue() )
@@ -450,8 +303,9 @@ void SAL_CALL MenuBarManager::release() throw()
}
-Any SAL_CALL MenuBarManager::getMenuHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 SystemType ) throw (::com::sun::star::uno::RuntimeException)
+Any SAL_CALL MenuBarManager::getMenuHandle( const Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 SystemType ) throw (RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::getMenuHandle" );
ResetableGuard aGuard( m_aLock );
if ( m_bDisposed )
@@ -468,16 +322,16 @@ Any SAL_CALL MenuBarManager::getMenuHandle( const ::com::sun::star::uno::Sequenc
m_pVCLMenu->GetSystemMenuData( &aSystemMenuData );
#ifdef QUARTZ
- if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_MAC )
+ if( SystemType == SystemDependent::SYSTEM_MAC )
{
}
#elif (defined WNT)
- if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 )
+ if( SystemType == SystemDependent::SYSTEM_WIN32 )
{
a <<= (long) aSystemMenuData.hMenu;
}
#elif (defined UNX)
- if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW )
+ if( SystemType == SystemDependent::SYSTEM_XWINDOW )
{
}
#endif
@@ -497,6 +351,7 @@ MenuBarManager::~MenuBarManager()
void MenuBarManager::Destroy()
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::Destroy" );
OGuard aGuard( Application::GetSolarMutex() );
if ( !m_bDisposed )
@@ -529,6 +384,7 @@ void MenuBarManager::Destroy()
// XComponent
void SAL_CALL MenuBarManager::dispose() throw( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::dispose" );
Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
EventObject aEvent( xThis );
@@ -577,6 +433,7 @@ void SAL_CALL MenuBarManager::dispose() throw( RuntimeException )
void SAL_CALL MenuBarManager::addEventListener( const Reference< XEventListener >& xListener ) throw( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::addEventListener" );
ResetableGuard aGuard( m_aLock );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -588,14 +445,16 @@ void SAL_CALL MenuBarManager::addEventListener( const Reference< XEventListener
void SAL_CALL MenuBarManager::removeEventListener( const Reference< XEventListener >& xListener ) throw( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::removeEventListener" );
ResetableGuard aGuard( m_aLock );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
}
void SAL_CALL MenuBarManager::elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event )
-throw (::com::sun::star::uno::RuntimeException)
+throw (RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::elementInserted" );
ResetableGuard aGuard( m_aLock );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -610,41 +469,24 @@ throw (::com::sun::star::uno::RuntimeException)
}
void SAL_CALL MenuBarManager::elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event )
-throw (::com::sun::star::uno::RuntimeException)
+throw (RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- return;
-
- sal_Int16 nImageType = sal_Int16();
- sal_Int16 nCurrentImageType = getImageTypeFromBools( sal_False, m_bWasHiContrast );
- if (( Event.aInfo >>= nImageType ) &&
- ( nImageType == nCurrentImageType ))
- RequestImages();
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::elementRemoved" );
+ elementInserted(Event);
}
void SAL_CALL MenuBarManager::elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event )
-throw (::com::sun::star::uno::RuntimeException)
+throw (RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- return;
-
- sal_Int16 nImageType = sal_Int16();
- sal_Int16 nCurrentImageType = getImageTypeFromBools( sal_False, m_bWasHiContrast );
- if (( Event.aInfo >>= nImageType ) &&
- ( nImageType == nCurrentImageType ))
- RequestImages();
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::elementReplaced" );
+ elementInserted(Event);
}
// XFrameActionListener
void SAL_CALL MenuBarManager::frameAction( const FrameActionEvent& Action )
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::frameAction" );
ResetableGuard aGuard( m_aLock );
if ( m_bDisposed )
@@ -666,6 +508,7 @@ throw ( RuntimeException )
void SAL_CALL MenuBarManager::statusChanged( const FeatureStateEvent& Event )
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::statusChanged" );
::rtl::OUString aFeatureURL = Event.FeatureURL.Complete;
OGuard aSolarGuard( Application::GetSolarMutex() );
@@ -761,6 +604,7 @@ throw ( RuntimeException )
// Helper to retrieve own structure from item ID
MenuBarManager::MenuItemHandler* MenuBarManager::GetMenuItemHandler( USHORT nItemId )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::GetMenuItemHandler" );
ResetableGuard aGuard( m_aLock );
std::vector< MenuItemHandler* >::iterator p;
@@ -777,10 +621,13 @@ MenuBarManager::MenuItemHandler* MenuBarManager::GetMenuItemHandler( USHORT nIte
// Helper to set request images flag
void MenuBarManager::RequestImages()
{
- ResetableGuard aGuard( m_aLock );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::RequestImages" );
+ // must be locked from callee
+ // ResetableGuard aGuard( m_aLock );
m_bRetrieveImages = sal_True;
- for ( sal_uInt32 i = 0; i < m_aMenuItemHandlerVector.size(); i++ )
+ const sal_uInt32 nCount = m_aMenuItemHandlerVector.size();
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
{
MenuItemHandler* pItemHandler = m_aMenuItemHandlerVector[i];
if ( pItemHandler->xSubMenuManager.is() )
@@ -794,6 +641,7 @@ void MenuBarManager::RequestImages()
// Helper to reset objects to prepare shutdown
void MenuBarManager::RemoveListener()
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::RemoveListener" );
ResetableGuard aGuard( m_aLock );
// Check service manager reference. Remove listener can be called due
@@ -802,9 +650,6 @@ void MenuBarManager::RemoveListener()
Reference< XMultiServiceFactory > xServiceManager = getServiceFactory();
if ( xServiceManager.is() )
{
- Reference< XURLTransformer > xTrans( xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-
std::vector< MenuItemHandler* >::iterator p;
for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); p++ )
{
@@ -813,7 +658,7 @@ void MenuBarManager::RemoveListener()
{
URL aTargetURL;
aTargetURL.Complete = pItemHandler->aMenuItemURL;
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
pItemHandler->xMenuItemDispatch->removeStatusListener(
static_cast< XStatusListener* >( this ), aTargetURL );
@@ -879,6 +724,7 @@ void MenuBarManager::RemoveListener()
void SAL_CALL MenuBarManager::disposing( const EventObject& Source ) throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::disposing(evt)" );
MenuItemHandler* pMenuItemDisposing = NULL;
ResetableGuard aGuard( m_aLock );
@@ -907,9 +753,7 @@ void SAL_CALL MenuBarManager::disposing( const EventObject& Source ) throw ( Run
Reference< XMultiServiceFactory > xServiceManager( getServiceFactory() );
if ( xServiceManager.is() )
{
- Reference< XURLTransformer > xTrans( xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
pMenuItemDisposing->xMenuItemDispatch->removeStatusListener(
static_cast< XStatusListener* >( this ), aTargetURL );
@@ -944,78 +788,10 @@ void SAL_CALL MenuBarManager::disposing( const EventObject& Source ) throw ( Run
m_xModuleImageManager.clear();
}
-void MenuBarManager::UpdateSpecialWindowMenu( Menu* pMenu )
-{
- // update window list
- ::std::vector< ::rtl::OUString > aNewWindowListVector;
-
- // #110897#
- // Reference< XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( DESKTOP_SERVICE ), UNO_QUERY );
- Reference< XDesktop > xDesktop( getServiceFactory()->createInstance( DESKTOP_SERVICE ), UNO_QUERY );
-
- USHORT nActiveItemId = 0;
- USHORT nItemId = START_ITEMID_WINDOWLIST;
-
- if ( xDesktop.is() )
- {
- Reference< XFramesSupplier > xTasksSupplier( xDesktop, UNO_QUERY );
- Reference< XFrame > xCurrentFrame = xDesktop->getCurrentFrame();
- Reference< XIndexAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY );
- sal_Int32 nCount = xList->getCount();
- for (sal_Int32 i=0; i<nCount; ++i )
- {
- Any aItem = xList->getByIndex(i);
- Reference< XFrame > xFrame;
- aItem >>= xFrame;
- if (xFrame.is())
- {
- if ( xFrame == xCurrentFrame )
- nActiveItemId = nItemId;
-
- Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
- if ( pWin && pWin->IsVisible() )
- {
- aNewWindowListVector.push_back( pWin->GetText() );
- ++nItemId;
- }
- }
- }
- }
-
- {
- ResetableGuard aGuard( m_aLock );
-
- int nItemCount = pMenu->GetItemCount();
-
- if ( nItemCount > 0 )
- {
- // remove all old window list entries from menu
- sal_uInt16 nPos = pMenu->GetItemPos( START_ITEMID_WINDOWLIST );
- for ( sal_uInt16 n = nPos; n < pMenu->GetItemCount(); )
- pMenu->RemoveItem( n );
-
- if ( pMenu->GetItemType( pMenu->GetItemCount()-1 ) == MENUITEM_SEPARATOR )
- pMenu->RemoveItem( pMenu->GetItemCount()-1 );
- }
-
- if ( aNewWindowListVector.size() > 0 )
- {
- // append new window list entries to menu
- pMenu->InsertSeparator();
- nItemId = START_ITEMID_WINDOWLIST;
- for ( sal_uInt32 i = 0; i < aNewWindowListVector.size(); i++ )
- {
- pMenu->InsertItem( nItemId, aNewWindowListVector.at( i ), MIB_RADIOCHECK );
- if ( nItemId == nActiveItemId )
- pMenu->CheckItem( nItemId );
- ++nItemId;
- }
- }
- }
-}
void MenuBarManager::CheckAndAddMenuExtension( Menu* pMenu )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::CheckAndAddMenuExtension" );
static const char REFERENCECOMMAND_AFTER[] = ".uno:OnlineRegistrationDlg";
static const char REFERENCECOMMAND_BEFORE[] = ".uno:About";
@@ -1064,6 +840,7 @@ static void lcl_CheckForChildren(Menu* pMenu, USHORT nItemId)
IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::Activate" );
if ( pMenu == m_pVCLMenu )
{
// set/unset hiding disabled menu entries
@@ -1090,7 +867,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
if ( m_aMenuItemCommand == aSpecialWindowMenu ||
m_aMenuItemCommand == aSlotSpecialWindowMenu ||
aMenuCommand == aSpecialWindowCommand )
- UpdateSpecialWindowMenu( pMenu );
+ MenuManager::UpdateSpecialWindowMenu( pMenu,getServiceFactory(),m_aLock );
// Check if some modes have changed so we have to update our menu images
sal_Bool bIsHiContrast = rSettings.GetMenuColor().IsDark();
@@ -1106,48 +883,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
m_bShowMenuImages = bShowMenuImages;
m_bRetrieveImages = sal_False;
m_nSymbolsStyle = nSymbolsStyle;
- AddonsOptions aAddonOptions;
-
- for ( USHORT nPos = 0; nPos < pMenu->GetItemCount(); nPos++ )
- {
- USHORT nId = pMenu->GetItemId( nPos );
- if ( pMenu->GetItemType( nPos ) != MENUITEM_SEPARATOR )
- {
- if ( bShowMenuImages )
- {
- sal_Bool bImageSet = sal_False;
- ::rtl::OUString aImageId;
-
- ::framework::MenuConfiguration::Attributes* pMenuAttributes =
- (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( nId );
-
- if ( pMenuAttributes )
- aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes
-
- if ( aImageId.getLength() > 0 )
- {
- Image aImage = GetImageFromURL( m_xFrame, aImageId, FALSE, bIsHiContrast );
- if ( !!aImage )
- {
- bImageSet = sal_True;
- pMenu->SetItemImage( nId, aImage );
- }
- }
-
- if ( !bImageSet )
- {
- rtl::OUString aMenuItemCommand = pMenu->GetItemCommand( nId );
- Image aImage = GetImageFromURL( m_xFrame, aMenuItemCommand, FALSE, bIsHiContrast );
- if ( !aImage )
- aImage = aAddonOptions.GetImageFromURL( aMenuItemCommand, FALSE, bIsHiContrast );
-
- pMenu->SetItemImage( nId, aImage );
- }
- }
- else
- pMenu->SetItemImage( nId, Image() );
- }
- }
+ MenuManager::FillMenuImages(m_xFrame,pMenu,bIsHiContrast,bShowMenuImages);
}
// Try to map commands to labels
@@ -1185,10 +921,6 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
URL aTargetURL;
- // #110897#
- // Reference< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- Reference< XURLTransformer > xTrans( getServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-
// Use provided dispatch provider => fallback to frame as dispatch provider
Reference< XDispatchProvider > xDispatchProvider;
if ( m_xDispatchProvider.is() )
@@ -1227,7 +959,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
aTargetURL.Complete = aItemCommand;
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
if ( bHasDisabledEntries )
{
@@ -1285,7 +1017,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
try
{
aTargetURL.Complete = pMenuItemHandler->aMenuItemURL;
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
pMenuItemHandler->xMenuItemDispatch->addStatusListener(
static_cast< XStatusListener* >( this ), aTargetURL );
@@ -1309,6 +1041,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
IMPL_LINK( MenuBarManager, Deactivate, Menu *, pMenu )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::Deactivate" );
if ( pMenu == m_pVCLMenu )
{
m_bActive = sal_False;
@@ -1344,6 +1077,7 @@ IMPL_LINK( MenuBarManager, AsyncSettingsHdl, Timer*,)
IMPL_LINK( MenuBarManager, Select, Menu *, pMenu )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::Select" );
URL aTargetURL;
Sequence<PropertyValue> aArgs;
Reference< XDispatch > xDispatch;
@@ -1363,7 +1097,7 @@ IMPL_LINK( MenuBarManager, Select, Menu *, pMenu )
// #110897#
// Reference< XFramesSupplier > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( DESKTOP_SERVICE ), UNO_QUERY );
- Reference< XFramesSupplier > xDesktop( getServiceFactory()->createInstance( DESKTOP_SERVICE ), UNO_QUERY );
+ Reference< XFramesSupplier > xDesktop( getServiceFactory()->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY );
if ( xDesktop.is() )
{
@@ -1372,9 +1106,8 @@ IMPL_LINK( MenuBarManager, Select, Menu *, pMenu )
sal_Int32 nCount = xList->getCount();
for ( sal_Int32 i=0; i<nCount; ++i )
{
- Any aItem = xList->getByIndex(i);
Reference< XFrame > xFrame;
- aItem >>= xFrame;
+ xList->getByIndex(i) >>= xFrame;
if ( xFrame.is() && nTaskId == nCurItemId )
{
Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
@@ -1392,21 +1125,15 @@ IMPL_LINK( MenuBarManager, Select, Menu *, pMenu )
MenuItemHandler* pMenuItemHandler = GetMenuItemHandler( nCurItemId );
if ( pMenuItemHandler && pMenuItemHandler->xMenuItemDispatch.is() )
{
- // #110897#
- // Reference< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- Reference< XURLTransformer > xTrans( getServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-
aTargetURL.Complete = pMenuItemHandler->aMenuItemURL;
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
if ( m_bIsBookmarkMenu )
{
// bookmark menu item selected
- Any a;
aArgs.realloc( 1 );
aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Referer" ));
- a <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SFX_REFERER_USER ));
- aArgs[0].Value = a;
+ aArgs[0].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SFX_REFERER_USER ));
}
xDispatch = pMenuItemHandler->xMenuItemDispatch;
@@ -1435,6 +1162,7 @@ IMPL_LINK( MenuBarManager, Highlight, Menu *, EMPTYARG )
sal_Bool MenuBarManager::MustBeHidden( PopupMenu* pPopupMenu, const Reference< XURLTransformer >& rTransformer )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::MustBeHidden" );
if ( pPopupMenu )
{
URL aTargetURL;
@@ -1475,77 +1203,16 @@ sal_Bool MenuBarManager::MustBeHidden( PopupMenu* pPopupMenu, const Reference< X
return sal_True;
}
-
String MenuBarManager::RetrieveLabelFromCommand( const String& aCmdURL )
{
- String aLabel;
-
- // Retrieve popup menu labels
- if ( !m_xUICommandLabels.is() )
- {
- try
- {
- if ( !m_bModuleIdentified )
- {
- m_bModuleIdentified = sal_True;
- Reference< XModuleManager > xModuleManager;
- xModuleManager = Reference< XModuleManager >( getServiceFactory()->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW );
-
- try
- {
- m_aModuleIdentifier = xModuleManager->identify( m_xFrame );
- }
- catch( Exception& )
- {
- }
- }
+ return framework::RetrieveLabelFromCommand(aCmdURL,mxServiceFactory,m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,m_bModuleIdentified,"Label");
+}
- Reference< XNameAccess > xNameAccess( getServiceFactory()->createInstance( SERVICENAME_UICOMMANDDESCRIPTION ), UNO_QUERY );
- if ( xNameAccess.is() )
- {
- Any a = xNameAccess->getByName( m_aModuleIdentifier );
- Reference< XNameAccess > xUICommands;
- a >>= m_xUICommandLabels;
- }
- }
- catch ( Exception& )
- {
- }
- }
- if ( m_xUICommandLabels.is() )
- {
- try
- {
- if ( aCmdURL.Len() > 0 )
- {
- rtl::OUString aStr;
- Sequence< PropertyValue > aPropSeq;
- Any a( m_xUICommandLabels->getByName( aCmdURL ));
- if ( a >>= aPropSeq )
- {
- for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
- {
- if ( aPropSeq[i].Name.equalsAscii( "Label" ))
- {
- aPropSeq[i].Value >>= aStr;
- break;
- }
- }
- }
- aLabel = aStr;
- }
- }
- catch ( com::sun::star::uno::Exception& )
- {
- }
- }
-
- return aLabel;
-}
sal_Bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHandler )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::CreatePopupMenuController" );
rtl::OUString aItemCommand( pMenuItemHandler->aMenuItemURL );
// Try instanciate a popup menu controller. It is stored in the menu item handler.
@@ -1589,6 +1256,7 @@ sal_Bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHa
void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rFrame, const Reference< XDispatchProvider >& rDispatchProvider, const rtl::OUString& rModuleIdentifier, sal_Bool bDelete, sal_Bool bDeleteChildren )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::FillMenuManager" );
m_xFrame = rFrame;
m_bActive = sal_False;
m_bDeleteMenu = bDelete;
@@ -1636,17 +1304,11 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
String aEmpty;
sal_Bool bAccessibilityEnabled( Application::GetSettings().GetMiscSettings().GetEnableATToolSupport() );
USHORT nItemCount = pMenu->GetItemCount();
+ ::rtl::OUString aItemCommand;
+ m_aMenuItemHandlerVector.reserve(nItemCount);
for ( USHORT i = 0; i < nItemCount; i++ )
{
- USHORT nItemId = pMenu->GetItemId( i );
-
- ::rtl::OUString aItemCommand = pMenu->GetItemCommand( nItemId );
- if ( !aItemCommand.getLength() )
- {
- aItemCommand = aSlotString;
- aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
- pMenu->SetItemCommand( nItemId, aItemCommand );
- }
+ USHORT nItemId = FillItemCommand(aItemCommand,pMenu, i );
// Set module identifier when provided from outside
if ( rModuleIdentifier.getLength() > 0 )
@@ -1676,8 +1338,9 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
}
if ( m_xPopupMenuControllerRegistration.is() &&
- m_xPopupMenuControllerRegistration->hasController( aItemCommand, rtl::OUString() ) &&
- pPopup->GetItemCount() == 0 )
+ pPopup->GetItemCount() == 0 &&
+ m_xPopupMenuControllerRegistration->hasController( aItemCommand, rtl::OUString() )
+ )
{
// Check if we have to create a popup menu for a uno based popup menu controller.
// We have to set an empty popup menu into our menu structure so the controller also
@@ -1703,20 +1366,8 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
{
// A special addon popup menu, must be created with a different ctor
// #110897#
- MenuBarManager* pSubMenuManager = new MenuBarManager( getServiceFactory(), rFrame, (AddonPopupMenu *)pPopup, bDeleteChildren, bDeleteChildren );
-
- Reference< XStatusListener > xSubMenuManager( static_cast< OWeakObject *>( pSubMenuManager ), UNO_QUERY );
- rFrame->addFrameActionListener( Reference< XFrameActionListener >( xSubMenuManager, UNO_QUERY ));
-
- // store menu item command as we later have to know which menu is active (see Activate handler)
- pSubMenuManager->m_aMenuItemCommand = aItemCommand;
-
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- xSubMenuManager,
- xDispatch );
- pMenuItemHandler->aMenuItemURL = aItemCommand;
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
+ MenuBarManager* pSubMenuManager = new MenuBarManager( getServiceFactory(), m_xFrame, m_xURLTransformer,(AddonPopupMenu *)pPopup, bDeleteChildren, bDeleteChildren );
+ AddMenu(pSubMenuManager,aItemCommand,nItemId);
}
else
{
@@ -1750,6 +1401,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
pPopup->SetPopupMenu( ITEMID_ADDONLIST, pSubMenu );
// Set item command for popup menu to enable it for GetImageFromURL
+ const ::rtl::OUString aSlotString( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
::rtl::OUString aNewItemCommand( aSlotString );
aNewItemCommand += ::rtl::OUString::valueOf( (sal_Int32)ITEMID_ADDONLIST );
pPopup->SetItemCommand( ITEMID_ADDONLIST, aNewItemCommand );
@@ -1765,17 +1417,9 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
AddonMenu* pSubMenu = dynamic_cast< AddonMenu* >( pPopup );
if ( pSubMenu )
{
- MenuBarManager* pSubMenuManager = new MenuBarManager( getServiceFactory(), rFrame, pSubMenu, sal_True, sal_False );
-
- Reference< XStatusListener > xSubMenuManager( static_cast< OWeakObject *>( pSubMenuManager ), UNO_QUERY );
- rFrame->addFrameActionListener( Reference< XFrameActionListener >( xSubMenuManager, UNO_QUERY ));
-
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- xSubMenuManager,
- xDispatch );
- pMenuItemHandler->aMenuItemURL = aItemCommand;
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
+ MenuBarManager* pSubMenuManager = new MenuBarManager( getServiceFactory(), m_xFrame, m_xURLTransformer,pSubMenu, sal_True, sal_False );
+ AddMenu(pSubMenuManager,aItemCommand,nItemId);
+ pSubMenuManager->m_aMenuItemCommand = ::rtl::OUString();
// Set image for the addon popup menu item
if ( m_bShowMenuImages && !pPopup->GetItemImage( ITEMID_ADDONLIST ))
@@ -1790,19 +1434,8 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
else
{
// #110897# MenuBarManager* pSubMenuManager = new MenuBarManager( rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
- MenuBarManager* pSubMenuMgr = new MenuBarManager( getServiceFactory(), rFrame, rDispatchProvider, aModuleIdentifier, pPopup, bDeleteChildren, bDeleteChildren );
- Reference< XStatusListener > xSubMenuMgr( static_cast< OWeakObject *>( pSubMenuMgr ), UNO_QUERY );
- rFrame->addFrameActionListener( Reference< XFrameActionListener >( xSubMenuMgr, UNO_QUERY ));
-
- // store menu item command as we later have to know which menu is active (see Activate handler)
- pSubMenuMgr->m_aMenuItemCommand = aItemCommand;
-
- MenuItemHandler* pMenuItemHdl = new MenuItemHandler(
- nItemId,
- xSubMenuMgr,
- xDispatch );
- pMenuItemHdl->aMenuItemURL = aItemCommand;
- m_aMenuItemHandlerVector.push_back( pMenuItemHdl );
+ MenuBarManager* pSubMenuMgr = new MenuBarManager( getServiceFactory(), rFrame, m_xURLTransformer,rDispatchProvider, aModuleIdentifier, pPopup, bDeleteChildren, bDeleteChildren );
+ AddMenu(pSubMenuMgr,aItemCommand,nItemId);
}
}
}
@@ -1854,10 +1487,9 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
pMenu->SetPopupMenu( pItemHandler->nItemId, pPopupMenu );
pItemHandler->xPopupMenu = Reference< com::sun::star::awt::XPopupMenu >( (OWeakObject *)pVCLXPopupMenu, UNO_QUERY );
- if ( bAccessibilityEnabled )
+ if ( bAccessibilityEnabled && CreatePopupMenuController( pItemHandler ) )
{
- if ( CreatePopupMenuController( pItemHandler ))
- pItemHandler->xPopupMenuController->updatePopupMenu();
+ pItemHandler->xPopupMenuController->updatePopupMenu();
}
lcl_CheckForChildren(pMenu, pItemHandler->nItemId);
@@ -1887,10 +1519,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
}
}
- m_pVCLMenu->SetHighlightHdl( LINK( this, MenuBarManager, Highlight ));
- m_pVCLMenu->SetActivateHdl( LINK( this, MenuBarManager, Activate ));
- m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuBarManager, Deactivate ));
- m_pVCLMenu->SetSelectHdl( LINK( this, MenuBarManager, Select ));
+ SetHdl();
}
void MenuBarManager::impl_RetrieveShortcutsFromConfiguration(
@@ -1898,6 +1527,7 @@ void MenuBarManager::impl_RetrieveShortcutsFromConfiguration(
const Sequence< rtl::OUString >& rCommands,
std::vector< MenuItemHandler* >& aMenuShortCuts )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::impl_RetrieveShortcutsFromConfiguration" );
if ( rAccelCfg.is() )
{
try
@@ -1918,6 +1548,7 @@ void MenuBarManager::impl_RetrieveShortcutsFromConfiguration(
void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuShortCuts )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::RetrieveShortcuts" );
if ( !m_bModuleIdentified )
{
m_bModuleIdentified = sal_True;
@@ -2000,7 +1631,8 @@ void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuSh
KeyCode aEmptyKeyCode;
Sequence< rtl::OUString > aSeq( aMenuShortCuts.size() );
- for ( sal_uInt32 i = 0; i < aMenuShortCuts.size(); i++ )
+ const sal_uInt32 nCount = aMenuShortCuts.size();
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
{
aSeq[i] = aMenuShortCuts[i]->aMenuItemURL;
aMenuShortCuts[i]->aKeyCode = aEmptyKeyCode;
@@ -2017,6 +1649,7 @@ void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuSh
void MenuBarManager::RetrieveImageManagers()
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::RetrieveImageManagers" );
if ( !m_xDocImageManager.is() )
{
Reference< XController > xController = m_xFrame->getController();
@@ -2041,7 +1674,7 @@ void MenuBarManager::RetrieveImageManagers()
Reference< XModuleManager > xModuleManager;
if ( m_aModuleIdentifier.getLength() == 0 )
- xModuleManager = Reference< XModuleManager >( getServiceFactory()->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW );
+ xModuleManager.set( getServiceFactory()->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW );
try
{
@@ -2058,7 +1691,7 @@ void MenuBarManager::RetrieveImageManagers()
SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ),
UNO_QUERY );
Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier );
- m_xModuleImageManager = Reference< XImageManager >( xUICfgMgr->getImageManager(), UNO_QUERY );
+ m_xModuleImageManager.set( xUICfgMgr->getImageManager(), UNO_QUERY );
m_xModuleImageManager->addConfigurationListener( Reference< XUIConfigurationListener >(
static_cast< OWeakObject* >( this ), UNO_QUERY ));
}
@@ -2071,6 +1704,7 @@ void MenuBarManager::FillMenuWithConfiguration(
const Reference< XIndexAccess >& rItemContainer,
const Reference< XURLTransformer >& rTransformer )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::FillMenuWithConfiguration" );
Reference< XDispatchProvider > xEmptyDispatchProvider;
MenuBarManager::FillMenu( nId, pMenu, rModuleIdentifier, rItemContainer, xEmptyDispatchProvider );
@@ -2106,6 +1740,7 @@ void MenuBarManager::FillMenu(
const Reference< XIndexAccess >& rItemContainer,
const Reference< XDispatchProvider >& rDispatchProvider )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::FillMenu" );
// Fill menu bar with container contents
for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ )
{
@@ -2187,7 +1822,7 @@ void MenuBarManager::FillMenu(
}
}
}
- catch ( ::com::sun::star::lang::IndexOutOfBoundsException& )
+ catch ( IndexOutOfBoundsException& )
{
break;
}
@@ -2199,6 +1834,7 @@ void MenuBarManager::MergeAddonMenus(
const MergeMenuInstructionContainer& aMergeInstructionContainer,
const ::rtl::OUString& rModuleIdentifier )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::MergeAddonMenus" );
// set start value for the item ID for the new addon menu items
sal_uInt16 nItemId = ADDONMENU_MERGE_ITEMID_START;
@@ -2299,10 +1935,7 @@ void MenuBarManager::SetItemContainer( const Reference< XIndexAccess >& rItemCon
USHORT nId = 1;
// Fill menu bar with container contents
- Reference< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- FillMenuWithConfiguration( nId, (Menu *)m_pVCLMenu, m_aModuleIdentifier, rItemContainer, xTrans );
+ FillMenuWithConfiguration( nId, (Menu *)m_pVCLMenu, m_aModuleIdentifier, rItemContainer, m_xURLTransformer );
// Refill menu manager again
Reference< XDispatchProvider > xDispatchProvider;
@@ -2315,6 +1948,7 @@ void MenuBarManager::SetItemContainer( const Reference< XIndexAccess >& rItemCon
void MenuBarManager::GetPopupController( PopupControllerCache& rPopupController )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::GetPopupController" );
String aPopupScheme = String::CreateFromAscii( "vnd.sun.star.popup:" );
vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
@@ -2360,10 +1994,138 @@ void MenuBarManager::GetPopupController( PopupControllerCache& rPopupController
}
// #110897#
-const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& MenuBarManager::getServiceFactory()
+const Reference< XMultiServiceFactory >& MenuBarManager::getServiceFactory()
{
// #110897#
return mxServiceFactory;
}
+void MenuBarManager::AddMenu(MenuBarManager* pSubMenuManager,const ::rtl::OUString& _sItemCommand,USHORT _nItemId)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::AddMenu" );
+ Reference< XStatusListener > xSubMenuManager( static_cast< OWeakObject *>( pSubMenuManager ), UNO_QUERY );
+ m_xFrame->addFrameActionListener( Reference< XFrameActionListener >( xSubMenuManager, UNO_QUERY ));
+
+ // store menu item command as we later have to know which menu is active (see Activate handler)
+ pSubMenuManager->m_aMenuItemCommand = _sItemCommand;
+ Reference< XDispatch > xDispatch;
+ MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
+ _nItemId,
+ xSubMenuManager,
+ xDispatch );
+ pMenuItemHandler->aMenuItemURL = _sItemCommand;
+ m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
+}
+
+USHORT MenuBarManager::FillItemCommand(::rtl::OUString& _rItemCommand,Menu* _pMenu,USHORT _nIndex) const
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::FillItemCommand" );
+ USHORT nItemId = _pMenu->GetItemId( _nIndex );
+
+ _rItemCommand = _pMenu->GetItemCommand( nItemId );
+ if ( !_rItemCommand.getLength() )
+ {
+ const static ::rtl::OUString aSlotString( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
+ _rItemCommand = aSlotString;
+ _rItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
+ _pMenu->SetItemCommand( nItemId, _rItemCommand );
+ }
+ return nItemId;
+}
+void MenuBarManager::Init(const Reference< XFrame >& rFrame,AddonMenu* pAddonMenu,sal_Bool bDelete,sal_Bool bDeleteChildren,bool _bHandlePopUp)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::Init" );
+ m_bActive = sal_False;
+ m_bDeleteMenu = bDelete;
+ m_bDeleteChildren = bDeleteChildren;
+ m_pVCLMenu = pAddonMenu;
+ m_xFrame = rFrame;
+ m_bInitialized = sal_False;
+ m_bIsBookmarkMenu = sal_True;
+
+ rtl::OUString aModuleIdentifier;
+ m_xPopupMenuControllerRegistration = Reference< ::com::sun::star::frame::XUIControllerRegistration >(
+ getServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.PopupMenuControllerFactory" ))),
+ UNO_QUERY );
+
+ const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
+ m_bWasHiContrast = rSettings.GetMenuColor().IsDark();
+
+ Reference< XStatusListener > xStatusListener;
+ Reference< XDispatch > xDispatch;
+ USHORT nItemCount = pAddonMenu->GetItemCount();
+ ::rtl::OUString aItemCommand;
+ m_aMenuItemHandlerVector.reserve(nItemCount);
+ for ( USHORT i = 0; i < nItemCount; i++ )
+ {
+ USHORT nItemId = FillItemCommand(aItemCommand,pAddonMenu, i );
+
+ PopupMenu* pPopupMenu = pAddonMenu->GetPopupMenu( nItemId );
+ if ( pPopupMenu )
+ {
+ // #110897#
+ Reference< XDispatchProvider > xDispatchProvider;
+ MenuBarManager* pSubMenuManager = new MenuBarManager( getServiceFactory(), rFrame, m_xURLTransformer,xDispatchProvider, aModuleIdentifier, pPopupMenu, _bHandlePopUp ? sal_False : bDeleteChildren, _bHandlePopUp ? sal_False : bDeleteChildren );
+
+ Reference< XStatusListener > xSubMenuManager( static_cast< OWeakObject *>( pSubMenuManager ), UNO_QUERY );
+
+ // store menu item command as we later have to know which menu is active (see Acivate handler)
+ pSubMenuManager->m_aMenuItemCommand = aItemCommand;
+
+ MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
+ nItemId,
+ xSubMenuManager,
+ xDispatch );
+ m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
+ }
+ else
+ {
+ if ( pAddonMenu->GetItemType( i ) != MENUITEM_SEPARATOR )
+ {
+ MenuConfiguration::Attributes* pAddonAttributes = (MenuConfiguration::Attributes *)(pAddonMenu->GetUserValue( nItemId ));
+ MenuItemHandler* pMenuItemHandler = new MenuItemHandler( nItemId, xStatusListener, xDispatch );
+
+ if ( pAddonAttributes )
+ {
+ // read additional attributes from attributes struct and AddonMenu implementation will delete all attributes itself!!
+ pMenuItemHandler->aTargetFrame = pAddonAttributes->aTargetFrame;
+ }
+
+ pMenuItemHandler->aMenuItemURL = aItemCommand;
+ if ( _bHandlePopUp )
+ {
+ // Check if we have to create a popup menu for a uno based popup menu controller.
+ // We have to set an empty popup menu into our menu structure so the controller also
+ // works with inplace OLE.
+ if ( m_xPopupMenuControllerRegistration.is() &&
+ m_xPopupMenuControllerRegistration->hasController( aItemCommand, rtl::OUString() ))
+ {
+ VCLXPopupMenu* pVCLXPopupMenu = new VCLXPopupMenu;
+ PopupMenu* pCtlPopupMenu = (PopupMenu *)pVCLXPopupMenu->GetMenu();
+ pAddonMenu->SetPopupMenu( pMenuItemHandler->nItemId, pCtlPopupMenu );
+ pMenuItemHandler->xPopupMenu = Reference< com::sun::star::awt::XPopupMenu >( (OWeakObject *)pVCLXPopupMenu, UNO_QUERY );
+
+ }
+ }
+ m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
+ }
+ }
+ }
+
+ SetHdl();
+}
+
+void MenuBarManager::SetHdl()
+{
+ m_pVCLMenu->SetHighlightHdl( LINK( this, MenuBarManager, Highlight ));
+ m_pVCLMenu->SetActivateHdl( LINK( this, MenuBarManager, Activate ));
+ m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuBarManager, Deactivate ));
+ m_pVCLMenu->SetSelectHdl( LINK( this, MenuBarManager, Select ));
+
+ if ( !m_xURLTransformer.is() && mxServiceFactory.is() )
+ m_xURLTransformer.set( mxServiceFactory->createInstance(
+ SERVICENAME_URLTRANSFORMER),
+ UNO_QUERY );
+}
+
}
diff --git a/framework/source/uielement/menubarmerger.cxx b/framework/source/uielement/menubarmerger.cxx
index 04511c998a..9e497b62c1 100644
--- a/framework/source/uielement/menubarmerger.cxx
+++ b/framework/source/uielement/menubarmerger.cxx
@@ -190,7 +190,7 @@ bool MenuBarMerger::CreateSubMenu(
{
pSubMenu->InsertItem( nItemId, rMenuItem.aTitle, 0, MENU_APPEND );
pSubMenu->SetItemCommand( nItemId, rMenuItem.aURL );
- if ( rMenuItem.aSubMenu.size() > 0 )
+ if ( !rMenuItem.aSubMenu.empty() )
{
PopupMenu* pPopupMenu = new PopupMenu();
pSubMenu->SetPopupMenu( nItemId, pPopupMenu );
@@ -231,7 +231,7 @@ bool MenuBarMerger::MergeMenuItems(
{
pMenu->InsertItem( nItemId, rMenuItem.aTitle, 0, nPos+nModIndex+nIndex );
pMenu->SetItemCommand( nItemId, rMenuItem.aURL );
- if ( rMenuItem.aSubMenu.size() > 0 )
+ if ( !rMenuItem.aSubMenu.empty() )
{
PopupMenu* pSubMenu = new PopupMenu();
pMenu->SetPopupMenu( nItemId, pSubMenu );
@@ -342,7 +342,8 @@ bool MenuBarMerger::ProcessFallbackOperation(
{
if ( nLevel == nSize-1 )
{
- for ( sal_uInt32 i = 0; i < rAddonMenuItems.size(); i++ )
+ const sal_uInt32 nCount = rAddonMenuItems.size();
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
{
const AddonMenuItem& rMenuItem = rAddonMenuItems[i];
if ( IsCorrectContext( rMenuItem.aContext, rModuleIdentifier ))
@@ -429,6 +430,7 @@ void MenuBarMerger::GetSubMenu(
rSubMenu.clear();
const sal_Int32 nCount = rSubMenuEntries.getLength();
+ rSubMenu.reserve(rSubMenu.size() + nCount);
for ( sal_Int32 i = 0; i < nCount; i++ )
{
const uno::Sequence< beans::PropertyValue >& rMenuEntry = rSubMenuEntries[ i ];
diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx
index aaab3672b2..ea4af2ef58 100644
--- a/framework/source/uielement/menubarwrapper.cxx
+++ b/framework/source/uielement/menubarwrapper.cxx
@@ -37,8 +37,6 @@
#include <uielement/menubarwrapper.hxx>
#include <threadhelp/resetableguard.hxx>
#include <helper/actiontriggerhelper.hxx>
-#include <uielement/constitemcontainer.hxx>
-#include <uielement/rootitemcontainer.hxx>
#include <services.h>
//_________________________________________________________________________________________________________________
@@ -110,9 +108,8 @@ DEFINE_XTYPEPROVIDER_11 ( MenuBarWrapper ,
MenuBarWrapper::MenuBarWrapper(
const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager
)
-: UIConfigElementWrapperBase( UIElementType::MENUBAR ),
- m_bRefreshPopupControllerCache( sal_True ),
- mxServiceFactory( xServiceManager )
+: UIConfigElementWrapperBase( UIElementType::MENUBAR,xServiceManager ),
+ m_bRefreshPopupControllerCache( sal_True )
{
}
@@ -120,13 +117,6 @@ MenuBarWrapper::~MenuBarWrapper()
{
}
-// #110897#
-const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& MenuBarWrapper::getServiceFactory()
-{
- // #110897#
- return mxServiceFactory;
-}
-
void SAL_CALL MenuBarWrapper::dispose() throw (::com::sun::star::uno::RuntimeException)
{
Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
@@ -173,7 +163,7 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th
Reference< XModuleManager > xModuleManager;
xModuleManager = Reference< XModuleManager >(
- getServiceFactory()->createInstance(
+ m_xServiceFactory->createInstance(
SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW );
try
@@ -184,15 +174,16 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th
{
}
+ Reference< XURLTransformer > xTrans;
try
{
+ xTrans.set( m_xServiceFactory->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, sal_False );
if ( m_xConfigData.is() )
{
// Fill menubar with container contents
- Reference< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
USHORT nId = 1;
MenuBarManager::FillMenuWithConfiguration( nId, pVCLMenuBar, aModuleIdentifier, m_xConfigData, xTrans );
}
@@ -221,8 +212,9 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th
Reference< XDispatchProvider > xDispatchProvider;
// #110897#
- MenuBarManager* pMenuBarManager = new MenuBarManager( getServiceFactory(),
+ MenuBarManager* pMenuBarManager = new MenuBarManager( m_xServiceFactory,
xFrame,
+ xTrans,
xDispatchProvider,
aModuleIdentifier,
pVCLMenuBar,
@@ -270,61 +262,15 @@ void SAL_CALL MenuBarWrapper::updateSettings() throw ( RuntimeException )
}
}
}
-
-void SAL_CALL MenuBarWrapper::setSettings( const Reference< XIndexAccess >& xSettings ) throw ( RuntimeException )
+void MenuBarWrapper::impl_fillNewData()
{
- ResetableGuard aLock( m_aLock );
+ // Transient menubar => Fill menubar with new data
+ MenuBarManager* pMenuBarManager = static_cast< MenuBarManager *>( m_xMenuBarManager.get() );
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( xSettings.is() )
- {
- // Create a copy of the data if the container is not const
- Reference< XIndexReplace > xReplace( xSettings, UNO_QUERY );
- if ( xReplace.is() )
- m_xConfigData = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( xSettings ) ), UNO_QUERY );
- else
- m_xConfigData = xSettings;
-
- if ( m_xConfigSource.is() && m_bPersistent )
- {
- ::rtl::OUString aResourceURL( m_aResourceURL );
- Reference< XUIConfigurationManager > xUICfgMgr( m_xConfigSource );
-
- aLock.unlock();
-
- try
- {
- xUICfgMgr->replaceSettings( aResourceURL, m_xConfigData );
- }
- catch( NoSuchElementException& )
- {
- }
- }
- else if ( !m_bPersistent )
- {
- // Transient menubar => Fill menubar with new data
- MenuBarManager* pMenuBarManager = static_cast< MenuBarManager *>( m_xMenuBarManager.get() );
-
- if ( pMenuBarManager )
- pMenuBarManager->SetItemContainer( m_xConfigData );
- }
- }
+ if ( pMenuBarManager )
+ pMenuBarManager->SetItemContainer( m_xConfigData );
}
-Reference< XIndexAccess > SAL_CALL MenuBarWrapper::getSettings( sal_Bool bWriteable ) throw ( RuntimeException )
-{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( bWriteable )
- return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( m_xConfigData ) ), UNO_QUERY );
- else
- return m_xConfigData;
-}
void MenuBarWrapper::fillPopupControllerCache()
{
@@ -333,7 +279,7 @@ void MenuBarWrapper::fillPopupControllerCache()
MenuBarManager* pMenuBarManager = static_cast< MenuBarManager *>( m_xMenuBarManager.get() );
if ( pMenuBarManager )
pMenuBarManager->GetPopupController( m_aPopupControllerCache );
- if ( m_aPopupControllerCache.size() > 0 )
+ if ( !m_aPopupControllerCache.empty() )
m_bRefreshPopupControllerCache = sal_False;
}
}
@@ -354,7 +300,7 @@ throw (::com::sun::star::uno::RuntimeException)
throw DisposedException();
fillPopupControllerCache();
- return ( m_aPopupControllerCache.size() > 0 );
+ return ( !m_aPopupControllerCache.empty() );
}
// XNameAccess
@@ -374,12 +320,9 @@ throw ( container::NoSuchElementException,
PopupControllerCache::const_iterator pIter = m_aPopupControllerCache.find( aName );
if ( pIter != m_aPopupControllerCache.end() )
{
- Any a;
uno::Reference< frame::XDispatchProvider > xDispatchProvider;
xDispatchProvider = pIter->second.m_xDispatchProvider;
-
- a = uno::makeAny( xDispatchProvider );
- return a;
+ return uno::makeAny( xDispatchProvider );
}
else
throw container::NoSuchElementException();
diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx
index aa371399c2..c515c7b3ae 100644
--- a/framework/source/uielement/newmenucontroller.cxx
+++ b/framework/source/uielement/newmenucontroller.cxx
@@ -43,7 +43,7 @@
#include <classes/fwkresid.hxx>
#include <classes/bmkmenu.hxx>
#include <helper/imageproducer.hxx>
-#include <classes/menuconfiguration.hxx>
+#include <xml/menuconfiguration.hxx>
//_________________________________________________________________________________________________________________
// interface includes
@@ -280,7 +280,8 @@ void NewMenuController::setAccelerators( PopupMenu* pPopupMenu )
aMenuShortCuts.push_back( aEmptyKeyCode );
}
- for ( sal_uInt32 i = 0; i < aCmds.size(); i++ )
+ const sal_uInt32 nCount = aCmds.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
aSeq[i] = aCmds[i];
if ( m_xGlobalAcceleratorManager.is() )
@@ -290,7 +291,8 @@ void NewMenuController::setAccelerators( PopupMenu* pPopupMenu )
if ( m_xDocAcceleratorManager.is() )
retrieveShortcutsFromConfiguration( xGlobalAccelCfg, aSeq, aMenuShortCuts );
- for ( sal_uInt32 i = 0; i < aIds.size(); i++ )
+ const sal_uInt32 nCount2 = aIds.size();
+ for ( sal_uInt32 i = 0; i < nCount2; i++ )
pPopupMenu->SetAccelKey( USHORT( aIds[i] ), aMenuShortCuts[i] );
// Special handling for "New" menu short-cut should be set at the
@@ -335,10 +337,6 @@ NewMenuController::NewMenuController( const ::com::sun::star::uno::Reference< ::
m_bAcceleratorCfg( sal_False ),
m_aTargetFrame( RTL_CONSTASCII_USTRINGPARAM( "_default" ))
{
- m_xURLTransformer = Reference< XURLTransformer >(
- xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
}
NewMenuController::~NewMenuController()
@@ -420,10 +418,6 @@ void SAL_CALL NewMenuController::statusChanged( const FeatureStateEvent& ) throw
}
// XMenuListener
-void SAL_CALL NewMenuController::highlight( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
void SAL_CALL NewMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException)
{
Reference< css::awt::XPopupMenu > xPopupMenu;
@@ -510,118 +504,66 @@ void SAL_CALL NewMenuController::activate( const css::awt::MenuEvent& ) throw (R
}
}
-void SAL_CALL NewMenuController::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
// XPopupMenuController
-void SAL_CALL NewMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException )
+void NewMenuController::impl_setPopupMenu()
{
- ResetableGuard aLock( m_aLock );
+
+ if ( m_xPopupMenu.is() )
+ fillPopupMenu( m_xPopupMenu );
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xFrame.is() && !m_xPopupMenu.is() )
+ // Identify module that we are attach to. It's our context that we need to know.
+ Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ),UNO_QUERY );
+ if ( xModuleManager.is() )
{
- // Create popup menu on demand
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- m_xPopupMenu = xPopupMenu;
- m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY ));
-
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
-
- com::sun::star::util::URL aTargetURL;
- aTargetURL.Complete = m_aCommandURL;
- m_xURLTransformer->parseStrict( aTargetURL );
- m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- if ( m_xPopupMenu.is() )
- fillPopupMenu( m_xPopupMenu );
-
- // Identify module that we are attach to. It's our context that we need to know.
- Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ),UNO_QUERY );
- if ( xModuleManager.is() )
+ try
{
- try
+ m_aModuleIdentifier = xModuleManager->identify( m_xFrame );
+ m_bModuleIdentified = sal_True;
+
+ Reference< XNameAccess > xNameAccess( xModuleManager, UNO_QUERY );
+ if (( m_aModuleIdentifier.getLength() > 0 ) && xNameAccess.is() )
{
- m_aModuleIdentifier = xModuleManager->identify( m_xFrame );
- m_bModuleIdentified = sal_True;
+ Sequence< PropertyValue > aSeq;
- Reference< XNameAccess > xNameAccess( xModuleManager, UNO_QUERY );
- if (( m_aModuleIdentifier.getLength() > 0 ) && xNameAccess.is() )
+ if ( xNameAccess->getByName( m_aModuleIdentifier ) >>= aSeq )
{
- Sequence< PropertyValue > aSeq;
-
- Any a = xNameAccess->getByName( m_aModuleIdentifier );
- if ( a >>= aSeq )
+ for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ )
{
- for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ )
+ if ( aSeq[y].Name.equalsAscii("ooSetupFactoryEmptyDocumentURL") )
{
- if ( aSeq[y].Name.equalsAscii("ooSetupFactoryEmptyDocumentURL") )
- {
- aSeq[y].Value >>= m_aEmptyDocURL;
- break;
- }
+ aSeq[y].Value >>= m_aEmptyDocURL;
+ break;
}
}
}
}
- catch ( RuntimeException& e )
- {
- throw e;
- }
- catch ( Exception& )
- {
- }
+ }
+ catch ( RuntimeException& e )
+ {
+ throw e;
+ }
+ catch ( Exception& )
+ {
}
}
}
-void SAL_CALL NewMenuController::updatePopupMenu() throw (RuntimeException)
-{
- ResetableGuard aLock( m_aLock );
- if ( m_bDisposed )
- throw DisposedException();
-}
-
// XInitialization
void SAL_CALL NewMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
{
- const rtl::OUString aFrameName( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- const rtl::OUString aCommandURLName( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
-
ResetableGuard aLock( m_aLock );
sal_Bool bInitalized( m_bInitialized );
if ( !bInitalized )
{
- PropertyValue aPropValue;
- rtl::OUString aCommandURL;
- Reference< XFrame > xFrame;
+ PopupMenuControllerBase::initialize( aArguments );
- for ( int i = 0; i < aArguments.getLength(); i++ )
+ if ( m_bInitialized )
{
- if ( aArguments[i] >>= aPropValue )
- {
- if ( aPropValue.Name.equalsAscii( "Frame" ))
- aPropValue.Value >>= xFrame;
- else if ( aPropValue.Name.equalsAscii( "CommandURL" ))
- aPropValue.Value >>= aCommandURL;
- }
- }
-
- if ( xFrame.is() && aCommandURL.getLength() )
- {
- m_xFrame = xFrame;
- m_aCommandURL = aCommandURL;
- m_bInitialized = sal_True;
-
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
m_bShowImages = rSettings.GetUseImagesInMenus();
- m_bHiContrast = rSettings.GetMenuColor().IsDark();
+ m_bHiContrast = rSettings.GetMenuColor().IsDark();
m_bNewMenu = m_aCommandURL.equalsAscii( ".uno:AddDirect" );
}
diff --git a/framework/source/uielement/objectmenucontroller.cxx b/framework/source/uielement/objectmenucontroller.cxx
index 3ed7cbb08c..accc576f31 100644
--- a/framework/source/uielement/objectmenucontroller.cxx
+++ b/framework/source/uielement/objectmenucontroller.cxx
@@ -44,7 +44,6 @@
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/awt/MenuItemStyle.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#ifndef _COM_SUN_STAR_EMBED_VERBDATTRIBUTES_HPP_
@@ -156,90 +155,12 @@ void SAL_CALL ObjectMenuController::statusChanged( const FeatureStateEvent& Even
}
// XMenuListener
-void SAL_CALL ObjectMenuController::highlight( const css::awt::MenuEvent& ) throw (RuntimeException)
+void ObjectMenuController::impl_select(const Reference< XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aTargetURL)
{
-}
-
-void SAL_CALL ObjectMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException)
-{
- Reference< css::awt::XPopupMenu > xPopupMenu;
- Reference< XDispatch > xDispatch;
- Reference< XMultiServiceFactory > xServiceManager;
-
- ResetableGuard aLock( m_aLock );
- xPopupMenu = m_xPopupMenu;
- xDispatch = m_xDispatch;
- xServiceManager = m_xServiceManager;
- aLock.unlock();
-
- if ( xPopupMenu.is() && xDispatch.is() )
- {
- VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( xPopupMenu );
- if ( pPopupMenu )
- {
- css::util::URL aTargetURL;
- Sequence<PropertyValue> aArgs;
- Reference< XURLTransformer > xURLTransformer( xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
-
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
- PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
-
- aTargetURL.Complete = pVCLPopupMenu->GetItemCommand( rEvent.MenuId );
- }
-
- xURLTransformer->parseStrict( aTargetURL );
- if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
- UiEventLogHelper(::rtl::OUString::createFromAscii("ObjectMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs);
- xDispatch->dispatch( aTargetURL, aArgs );
- }
- }
-}
-
-void SAL_CALL ObjectMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
-void SAL_CALL ObjectMenuController::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
-// XPopupMenuController
-void SAL_CALL ObjectMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException )
-{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xFrame.is() && !m_xPopupMenu.is() )
- {
- // Create popup menu on demand
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- m_xPopupMenu = xPopupMenu;
- m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY ));
-
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
-
- com::sun::star::util::URL aTargetURL;
- aTargetURL.Complete = m_aCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
- m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- updatePopupMenu();
- }
-}
-
-// XInitialization
-void SAL_CALL ObjectMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
-{
- PopupMenuControllerBase::initialize( aArguments );
+ Sequence<PropertyValue> aArgs;
+ if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
+ UiEventLogHelper(::rtl::OUString::createFromAscii("ObjectMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs);
+ _xDispatch->dispatch( aTargetURL, aArgs );
}
}
diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx
index 15b267e8f4..7ab450d59c 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -49,9 +49,8 @@
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/awt/MenuItemStyle.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/util/XStringWidth.hpp>
-
+#include <com/sun/star/lang/DisposedException.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
@@ -166,11 +165,12 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >
}
}
- if ( m_aRecentFilesItems.size() > 0 )
+ if ( !m_aRecentFilesItems.empty() )
{
URL aTargetURL;
- for ( sal_uInt32 i = 0; i < m_aRecentFilesItems.size(); i++ )
+ const sal_uInt32 nCount = m_aRecentFilesItems.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
char menuShortCut[5] = "~n: ";
@@ -260,14 +260,10 @@ void RecentFilesMenuController::executeEntry( sal_Int32 nIndex )
if (( nIndex >= 0 ) &&
( nIndex < sal::static_int_cast<sal_Int32>( m_aRecentFilesItems.size() )))
{
- Reference< XURLTransformer > xURLTransformer( xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
-
const RecentFile& rRecentFile = m_aRecentFilesItems[ nIndex ];
aTargetURL.Complete = rRecentFile.aURL;
- xURLTransformer->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
aArgsList.realloc( NUM_OF_PICKLIST_ARGS );
aArgsList[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Referer" ));
@@ -287,14 +283,14 @@ void RecentFilesMenuController::executeEntry( sal_Int32 nIndex )
aFilterOptions = aFilter.copy( nPos+1 );
aArgsList[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterOptions" ));
- aArgsList[2].Value = makeAny( aFilterOptions );
+ aArgsList[2].Value <<= aFilterOptions;
aFilter = aFilter.copy( 0, nPos-1 );
aArgsList.realloc( ++NUM_OF_PICKLIST_ARGS );
}
aArgsList[NUM_OF_PICKLIST_ARGS-1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ));
- aArgsList[NUM_OF_PICKLIST_ARGS-1].Value = makeAny( aFilter );
+ aArgsList[NUM_OF_PICKLIST_ARGS-1].Value <<= aFilter;
xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString::createFromAscii("_default"), 0 );
}
@@ -336,11 +332,6 @@ void SAL_CALL RecentFilesMenuController::statusChanged( const FeatureStateEvent&
m_bDisabled = !Event.IsEnabled;
}
-// XMenuListener
-void SAL_CALL RecentFilesMenuController::highlight( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
void SAL_CALL RecentFilesMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException)
{
Reference< css::awt::XPopupMenu > xPopupMenu;
@@ -368,43 +359,14 @@ void SAL_CALL RecentFilesMenuController::select( const css::awt::MenuEvent& rEve
void SAL_CALL RecentFilesMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException)
{
ResetableGuard aLock( m_aLock );
- if ( m_xPopupMenu.is() )
- fillPopupMenu( m_xPopupMenu );
-}
-
-void SAL_CALL RecentFilesMenuController::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
+ impl_setPopupMenu();
}
// XPopupMenuController
-void SAL_CALL RecentFilesMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException )
+void RecentFilesMenuController::impl_setPopupMenu()
{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_xFrame.is() && !m_xPopupMenu.is() )
- {
- // Create popup menu on demand
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- m_xPopupMenu = xPopupMenu;
- m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY ));
-
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
-
- com::sun::star::util::URL aTargetURL;
- aTargetURL.Complete = m_aCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
- m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
-
- if ( m_xPopupMenu.is() )
- fillPopupMenu( m_xPopupMenu );
- }
+ if ( m_xPopupMenu.is() )
+ fillPopupMenu( m_xPopupMenu );
}
void SAL_CALL RecentFilesMenuController::updatePopupMenu() throw (RuntimeException)
@@ -416,12 +378,9 @@ void SAL_CALL RecentFilesMenuController::updatePopupMenu() throw (RuntimeExcepti
Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
Reference< XDispatch > xDispatch( m_xDispatch );
- Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
com::sun::star::util::URL aTargetURL;
aTargetURL.Complete = m_aCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
aLock.unlock();
// Add/remove status listener to get a status update once
@@ -450,18 +409,6 @@ throw( RuntimeException )
return Reference< XDispatch >();
}
-Sequence< Reference< XDispatch > > SAL_CALL RecentFilesMenuController::queryDispatches(
- const Sequence< DispatchDescriptor >& lDescriptor )
-throw( RuntimeException )
-{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- return PopupMenuControllerBase::queryDispatches( lDescriptor );
-}
-
// XDispatch
void SAL_CALL RecentFilesMenuController::dispatch(
const URL& aURL,
@@ -520,12 +467,6 @@ throw( RuntimeException )
PopupMenuControllerBase::removeStatusListener( xControl, aURL );
}
-// XInitialization
-void SAL_CALL RecentFilesMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
-{
- PopupMenuControllerBase::initialize( aArguments );
-}
-
IMPL_STATIC_LINK_NOINSTANCE( RecentFilesMenuController, ExecuteHdl_Impl, LoadRecentFile*, pLoadRecentFile )
{
try
diff --git a/framework/source/uielement/rootitemcontainer.cxx b/framework/source/uielement/rootitemcontainer.cxx
index f57b7b4949..6275f2a7a8 100644
--- a/framework/source/uielement/rootitemcontainer.cxx
+++ b/framework/source/uielement/rootitemcontainer.cxx
@@ -146,8 +146,7 @@ RootItemContainer::RootItemContainer( const Reference< XIndexAccess >& rSourceCo
for ( sal_Int32 i = 0; i < nCount; i++ )
{
Sequence< PropertyValue > aPropSeq;
- Any a = rSourceContainer->getByIndex( i );
- if ( a >>= aPropSeq )
+ if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
{
sal_Int32 nContainerIndex = -1;
Reference< XIndexAccess > xIndexAccess;
@@ -181,7 +180,9 @@ RootItemContainer::~RootItemContainer()
// private
void RootItemContainer::copyItemContainer( const std::vector< Sequence< PropertyValue > >& rSourceVector )
{
- for ( sal_uInt32 i = 0; i < rSourceVector.size(); i++ )
+ const sal_uInt32 nCount = rSourceVector.size();
+ m_aItemVector.reserve(nCount);
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
sal_Int32 nContainerIndex = -1;
Sequence< PropertyValue > aPropSeq( rSourceVector[i] );
@@ -256,7 +257,7 @@ sal_Bool SAL_CALL RootItemContainer::hasElements()
throw ( RuntimeException )
{
ShareGuard aLock( m_aShareMutex );
- return ( m_aItemVector.size() != 0 );
+ return ( !m_aItemVector.empty() );
}
// XIndexAccess
diff --git a/framework/source/uielement/spinfieldtoolbarcontroller.cxx b/framework/source/uielement/spinfieldtoolbarcontroller.cxx
index d5700398d5..12aa429d8c 100644
--- a/framework/source/uielement/spinfieldtoolbarcontroller.cxx
+++ b/framework/source/uielement/spinfieldtoolbarcontroller.cxx
@@ -255,59 +255,20 @@ throw ( RuntimeException )
}
// ------------------------------------------------------------------
-
-void SAL_CALL SpinfieldToolbarController::execute( sal_Int16 KeyModifier )
-throw ( RuntimeException )
+Sequence<PropertyValue> SpinfieldToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const
{
- Reference< XDispatch > xDispatch;
- Reference< XURLTransformer > xURLTransformer;
- ::rtl::OUString aCommandURL;
- ::rtl::OUString aSpinfieldText;
- ::com::sun::star::util::URL aTargetURL;
- bool bFloat( false );
-
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ Sequence<PropertyValue> aArgs( 2 );
+ ::rtl::OUString aSpinfieldText = m_pSpinfieldControl->GetText();
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_bInitialized &&
- m_xFrame.is() &&
- m_xServiceManager.is() &&
- m_aCommandURL.getLength() )
- {
- xURLTransformer = m_xURLTransformer;
- xDispatch = getDispatchFromCommand( m_aCommandURL );
- aCommandURL = m_aCommandURL;
- aTargetURL = getInitializedURL();
- aSpinfieldText = m_pSpinfieldControl->GetText();
- bFloat = m_bFloat;
- }
- }
-
- if ( xDispatch.is() && aTargetURL.Complete.getLength() > 0 )
- {
- Sequence<PropertyValue> aArgs( 2 );
-
- // Add key modifier to argument list
- aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
- aArgs[0].Value <<= KeyModifier;
- aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Value" ));
-
- // Use correct type
- if ( bFloat )
- aArgs[1].Value <<= aSpinfieldText.toDouble();
- else
- aArgs[1].Value <<= aSpinfieldText.toInt32();
-
- // Execute dispatch asynchronously
- ExecuteInfo* pExecuteInfo = new ExecuteInfo;
- pExecuteInfo->xDispatch = xDispatch;
- pExecuteInfo->aTargetURL = aTargetURL;
- pExecuteInfo->aArgs = aArgs;
- Application::PostUserEvent( STATIC_LINK(0, ComplexToolbarController , ExecuteHdl_Impl), pExecuteInfo );
- }
+ // Add key modifier to argument list
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
+ aArgs[0].Value <<= KeyModifier;
+ aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Value" ));
+ if ( m_bFloat )
+ aArgs[1].Value <<= aSpinfieldText.toDouble();
+ else
+ aArgs[1].Value <<= aSpinfieldText.toInt32();
+ return aArgs;
}
// ------------------------------------------------------------------
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index 718d4b9f81..6c1cdf44f0 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -46,6 +46,7 @@
#include "services.h"
#include "general.h"
#include "properties.h"
+#include <helper/mischelper.hxx>
//_________________________________________________________________________________________________________________
// interface includes
@@ -148,15 +149,16 @@ StatusBarManager::StatusBarManager(
ThreadHelpBase( &Application::GetSolarMutex() ),
OWeakObject(),
m_bDisposed( sal_False ),
- m_bModuleIdentified( sal_False ),
m_bFrameActionRegistered( sal_False ),
m_bUpdateControllers( sal_False ),
+ m_bModuleIdentified( sal_False ),
m_pStatusBar( pStatusBar ),
m_aResourceName( rResourceName ),
m_xFrame( rFrame ),
m_aListenerContainer( m_aLock.getShareableOslMutex() ),
m_xServiceManager( rServiceManager )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::StatusBarManager" );
if ( m_xServiceManager.is() )
m_xStatusbarControllerRegistration = uno::Reference< css::frame::XUIControllerRegistration >(
@@ -173,6 +175,7 @@ StatusBarManager::~StatusBarManager()
StatusBar* StatusBarManager::GetStatusBar() const
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::GetStatusBar" );
ResetableGuard aGuard( m_aLock );
return m_pStatusBar;
}
@@ -180,6 +183,7 @@ StatusBar* StatusBarManager::GetStatusBar() const
void StatusBarManager::frameAction( const frame::FrameActionEvent& Action )
throw ( uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::frameAction" );
ResetableGuard aGuard( m_aLock );
if ( Action.Action == frame::FrameAction_CONTEXT_CHANGED )
UpdateControllers();
@@ -187,6 +191,7 @@ throw ( uno::RuntimeException )
void SAL_CALL StatusBarManager::disposing( const lang::EventObject& Source ) throw ( uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::disposing" );
{
ResetableGuard aGuard( m_aLock );
if ( m_bDisposed )
@@ -207,6 +212,7 @@ void SAL_CALL StatusBarManager::disposing( const lang::EventObject& Source ) thr
// XComponent
void SAL_CALL StatusBarManager::dispose() throw( uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::dispose" );
uno::Reference< lang::XComponent > xThis(
static_cast< OWeakObject* >(this), uno::UNO_QUERY );
@@ -245,6 +251,7 @@ void SAL_CALL StatusBarManager::dispose() throw( uno::RuntimeException )
void SAL_CALL StatusBarManager::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) throw( uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::addEventListener" );
ResetableGuard aGuard( m_aLock );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -257,6 +264,7 @@ void SAL_CALL StatusBarManager::addEventListener( const uno::Reference< lang::XE
void SAL_CALL StatusBarManager::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) throw( uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::removeEventListener" );
m_aListenerContainer.removeInterface( ::getCppuType(
( const uno::Reference< lang::XEventListener >* ) NULL ), xListener );
}
@@ -264,6 +272,7 @@ void SAL_CALL StatusBarManager::removeEventListener( const uno::Reference< lang:
// XUIConfigurationListener
void SAL_CALL StatusBarManager::elementInserted( const css::ui::ConfigurationEvent& ) throw ( uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::elementInserted" );
ResetableGuard aGuard( m_aLock );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -273,6 +282,7 @@ void SAL_CALL StatusBarManager::elementInserted( const css::ui::ConfigurationEve
void SAL_CALL StatusBarManager::elementRemoved( const css::ui::ConfigurationEvent& ) throw ( uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::elementRemoved" );
ResetableGuard aGuard( m_aLock );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -282,6 +292,7 @@ void SAL_CALL StatusBarManager::elementRemoved( const css::ui::ConfigurationEven
void SAL_CALL StatusBarManager::elementReplaced( const css::ui::ConfigurationEvent& ) throw ( uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::elementReplaced" );
ResetableGuard aGuard( m_aLock );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -291,10 +302,12 @@ void SAL_CALL StatusBarManager::elementReplaced( const css::ui::ConfigurationEve
void StatusBarManager::UpdateControllers()
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::UpdateControllers" );
if ( !m_bUpdateControllers )
{
m_bUpdateControllers = sal_True;
- for ( sal_uInt32 n = 0; n < m_aControllerVector.size(); n++ )
+ const sal_uInt32 nCount = m_aControllerVector.size();
+ for ( sal_uInt32 n = 0; n < nCount; n++ )
{
try
{
@@ -312,12 +325,14 @@ void StatusBarManager::UpdateControllers()
void StatusBarManager::RemoveControllers()
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::RemoveControllers" );
ResetableGuard aGuard( m_aLock );
if ( m_bDisposed )
return;
- for ( sal_uInt32 n = 0; n < m_aControllerVector.size(); n++ )
+ const sal_uInt32 nCount = m_aControllerVector.size();
+ for ( sal_uInt32 n = 0; n < nCount; n++ )
{
try
{
@@ -336,71 +351,12 @@ void StatusBarManager::RemoveControllers()
rtl::OUString StatusBarManager::RetrieveLabelFromCommand( const rtl::OUString& aCmdURL )
{
- rtl::OUString aLabel;
-
- // Retrieve short bubble help
- if ( !m_bModuleIdentified )
- {
- uno::Reference< css::frame::XModuleManager > xModuleManager(
- m_xServiceManager->createInstance(
- SERVICENAME_MODULEMANAGER ), uno::UNO_QUERY_THROW );
- uno::Reference< uno::XInterface > xIfac( m_xFrame, uno::UNO_QUERY );
- try
- {
- m_bModuleIdentified = sal_True;
- m_aModuleIdentifier = xModuleManager->identify( xIfac );
-
- if ( m_aModuleIdentifier.getLength() > 0 )
- {
- uno::Reference< container::XNameAccess > xNameAccess(
- m_xServiceManager->createInstance(
- SERVICENAME_UICOMMANDDESCRIPTION ), uno::UNO_QUERY );
- if ( xNameAccess.is() )
- {
- uno::Any a = xNameAccess->getByName( m_aModuleIdentifier );
- uno::Reference< container::XNameAccess > xUICommands;
- a >>= m_xUICommandLabels;
- }
- }
- }
- catch ( uno::Exception& )
- {
- }
- }
-
- if ( m_xUICommandLabels.is() )
- {
- try
- {
- if ( aCmdURL.getLength() > 0 )
- {
- rtl::OUString aStr;
- uno::Sequence< beans::PropertyValue > aPropSeq;
- uno::Any a( m_xUICommandLabels->getByName( aCmdURL ));
- if ( a >>= aPropSeq )
- {
- for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
- {
- if ( aPropSeq[i].Name.equalsAscii( "Name" ))
- {
- aPropSeq[i].Value >>= aStr;
- break;
- }
- }
- }
- aLabel = aStr;
- }
- }
- catch ( uno::Exception& )
- {
- }
- }
-
- return aLabel;
+ return framework::RetrieveLabelFromCommand(aCmdURL,m_xServiceManager,m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,m_bModuleIdentified,"Name");
}
void StatusBarManager::CreateControllers()
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::CreateControllers" );
uno::Reference< lang::XMultiComponentFactory > xStatusbarControllerFactory( m_xStatusbarControllerRegistration, uno::UNO_QUERY );
uno::Reference< uno::XComponentContext > xComponentContext;
uno::Reference< beans::XPropertySet > xProps( m_xServiceManager, uno::UNO_QUERY );
@@ -499,6 +455,7 @@ void StatusBarManager::CreateControllers()
void StatusBarManager::AddFrameActionListener()
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::AddFrameActionListener" );
if ( !m_bFrameActionRegistered && m_xFrame.is() )
{
m_bFrameActionRegistered = sal_True;
@@ -527,6 +484,7 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc
for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::FillStatusBar" );
uno::Sequence< beans::PropertyValue > aProp;
rtl::OUString aCommandURL;
rtl::OUString aHelpURL;
@@ -604,10 +562,12 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc
void StatusBarManager::StateChanged( StateChangedType )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::StateChanged" );
}
void StatusBarManager::DataChanged( const DataChangedEvent& rDCEvt )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::DataChanged" );
ResetableGuard aGuard( m_aLock );
if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS ) ||
@@ -616,12 +576,10 @@ void StatusBarManager::DataChanged( const DataChangedEvent& rDCEvt )
( rDCEvt.GetType() == DATACHANGED_DISPLAY )) &&
( rDCEvt.GetFlags() & SETTINGS_STYLE ))
{
- css::uno::Any a;
css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
css::uno::Reference< css::beans::XPropertySet > xPropSet( m_xFrame, css::uno::UNO_QUERY );
if ( xPropSet.is() )
- a = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )));
- a >>= xLayoutManager;
+ xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))) >>= xLayoutManager;
if ( xLayoutManager.is() )
{
aGuard.unlock();
@@ -632,6 +590,7 @@ void StatusBarManager::DataChanged( const DataChangedEvent& rDCEvt )
void StatusBarManager::UserDraw( const UserDrawEvent& rUDEvt )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::UserDraw" );
ResetableGuard aGuard( m_aLock );
if ( m_bDisposed )
@@ -659,6 +618,7 @@ void StatusBarManager::UserDraw( const UserDrawEvent& rUDEvt )
void StatusBarManager::Command( const CommandEvent& rEvt )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::Command" );
ResetableGuard aGuard( m_aLock );
if ( m_bDisposed )
@@ -684,74 +644,43 @@ void StatusBarManager::Command( const CommandEvent& rEvt )
void StatusBarManager::MouseMove( const MouseEvent& rMEvt )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseMove" );
+ MouseButton(rMEvt,&frame::XStatusbarController::mouseMove);
+}
+void StatusBarManager::MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL frame::XStatusbarController::*_pMethod )(const ::com::sun::star::awt::MouseEvent&))
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseButton" );
ResetableGuard aGuard( m_aLock );
- if ( m_bDisposed )
- return;
-
- USHORT nId = m_pStatusBar->GetItemId( rMEvt.GetPosPixel() );
- if (( nId > 0 ) && ( nId <= m_aControllerVector.size() ))
+ if ( !m_bDisposed )
{
- uno::Reference< frame::XStatusbarController > xController(
- m_aControllerVector[nId-1], uno::UNO_QUERY );
- if ( xController.is() )
+ USHORT nId = m_pStatusBar->GetItemId( rMEvt.GetPosPixel() );
+ if (( nId > 0 ) && ( nId <= m_aControllerVector.size() ))
{
- ::com::sun::star::awt::MouseEvent aMouseEvent;
- aMouseEvent.Buttons = rMEvt.GetButtons();
- aMouseEvent.X = rMEvt.GetPosPixel().X();
- aMouseEvent.Y = rMEvt.GetPosPixel().Y();
- aMouseEvent.ClickCount = rMEvt.GetClicks();
- xController->mouseMove( aMouseEvent );
- }
+ uno::Reference< frame::XStatusbarController > xController(
+ m_aControllerVector[nId-1], uno::UNO_QUERY );
+ if ( xController.is() )
+ {
+ ::com::sun::star::awt::MouseEvent aMouseEvent;
+ aMouseEvent.Buttons = rMEvt.GetButtons();
+ aMouseEvent.X = rMEvt.GetPosPixel().X();
+ aMouseEvent.Y = rMEvt.GetPosPixel().Y();
+ aMouseEvent.ClickCount = rMEvt.GetClicks();
+ (xController.get()->*_pMethod)( aMouseEvent);
+ }
+ } // if (( nId > 0 ) && ( nId <= m_aControllerVector.size() ))
}
}
-
void StatusBarManager::MouseButtonDown( const MouseEvent& rMEvt )
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- return;
-
- USHORT nId = m_pStatusBar->GetItemId( rMEvt.GetPosPixel() );
- if (( nId > 0 ) && ( nId <= m_aControllerVector.size() ))
- {
- uno::Reference< frame::XStatusbarController > xController(
- m_aControllerVector[nId-1], uno::UNO_QUERY );
- if ( xController.is() )
- {
- ::com::sun::star::awt::MouseEvent aMouseEvent;
- aMouseEvent.Buttons = rMEvt.GetButtons();
- aMouseEvent.X = rMEvt.GetPosPixel().X();
- aMouseEvent.Y = rMEvt.GetPosPixel().Y();
- aMouseEvent.ClickCount = rMEvt.GetClicks();
- xController->mouseButtonDown( aMouseEvent );
- }
- }
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseButtonDown" );
+ MouseButton(rMEvt,&frame::XStatusbarController::mouseButtonDown);
}
void StatusBarManager::MouseButtonUp( const MouseEvent& rMEvt )
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- return;
-
- USHORT nId = m_pStatusBar->GetItemId( rMEvt.GetPosPixel() );
- if (( nId > 0 ) && ( nId <= m_aControllerVector.size() ))
- {
- uno::Reference< frame::XStatusbarController > xController(
- m_aControllerVector[nId-1], uno::UNO_QUERY );
- if ( xController.is() )
- {
- ::com::sun::star::awt::MouseEvent aMouseEvent;
- aMouseEvent.Buttons = rMEvt.GetButtons();
- aMouseEvent.X = rMEvt.GetPosPixel().X();
- aMouseEvent.Y = rMEvt.GetPosPixel().Y();
- aMouseEvent.ClickCount = rMEvt.GetClicks();
- xController->mouseButtonUp( aMouseEvent );
- }
- }
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseButtonUp" );
+ MouseButton(rMEvt,&frame::XStatusbarController::mouseButtonUp);
}
IMPL_LINK( StatusBarManager, Click, StatusBar*, EMPTYARG )
diff --git a/framework/source/uielement/statusbarwrapper.cxx b/framework/source/uielement/statusbarwrapper.cxx
index ed9d7a1915..d016dbac10 100644
--- a/framework/source/uielement/statusbarwrapper.cxx
+++ b/framework/source/uielement/statusbarwrapper.cxx
@@ -80,8 +80,7 @@ namespace framework
StatusBarWrapper::StatusBarWrapper(
const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager
)
- : UIConfigElementWrapperBase( UIElementType::STATUSBAR ),
- m_xServiceFactory( xServiceManager )
+ : UIConfigElementWrapperBase( UIElementType::STATUSBAR,xServiceManager )
{
}
@@ -187,53 +186,6 @@ void SAL_CALL StatusBarWrapper::updateSettings() throw ( RuntimeException )
}
}
-void SAL_CALL StatusBarWrapper::setSettings( const Reference< XIndexAccess >& xSettings ) throw ( RuntimeException )
-{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( xSettings.is() )
- {
- // Create a copy of the data if the container is not const
- Reference< XIndexReplace > xReplace( xSettings, UNO_QUERY );
- if ( xReplace.is() )
- m_xConfigData = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( xSettings ) ), UNO_QUERY );
- else
- m_xConfigData = xSettings;
-
- if ( m_xConfigSource.is() && m_bPersistent )
- {
- ::rtl::OUString aResourceURL( m_aResourceURL );
- Reference< XUIConfigurationManager > xUICfgMgr( m_xConfigSource );
-
- aLock.unlock();
-
- try
- {
- xUICfgMgr->replaceSettings( aResourceURL, m_xConfigData );
- }
- catch( NoSuchElementException& )
- {
- }
- }
- }
-}
-
-Reference< XIndexAccess > SAL_CALL StatusBarWrapper::getSettings( sal_Bool bWriteable ) throw ( RuntimeException )
-{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( bWriteable )
- return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( m_xConfigData ) ), UNO_QUERY );
- else
- return m_xConfigData;
-}
-
Reference< XInterface > SAL_CALL StatusBarWrapper::getRealInterface() throw ( RuntimeException )
{
ResetableGuard aLock( m_aLock );
diff --git a/framework/source/uielement/statusindicatorinterfacewrapper.cxx b/framework/source/uielement/statusindicatorinterfacewrapper.cxx
index 0563d84707..5c11a87b24 100644
--- a/framework/source/uielement/statusindicatorinterfacewrapper.cxx
+++ b/framework/source/uielement/statusindicatorinterfacewrapper.cxx
@@ -53,24 +53,10 @@ using namespace com::sun::star::beans;
namespace framework
{
-//*****************************************************************************************************************
-// XInterface, XTypeProvider
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_2 ( StatusIndicatorInterfaceWrapper ,
- cppu::OWeakObject ,
- DIRECT_INTERFACE( ::com::sun::star::lang::XTypeProvider ),
- DIRECT_INTERFACE( ::com::sun::star::task::XStatusIndicator )
- )
-
-DEFINE_XTYPEPROVIDER_2 ( StatusIndicatorInterfaceWrapper ,
- ::com::sun::star::lang::XTypeProvider ,
- ::com::sun::star::task::XStatusIndicator
- )
StatusIndicatorInterfaceWrapper::StatusIndicatorInterfaceWrapper(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rStatusIndicatorImpl ) :
- ::cppu::OWeakObject()
- , m_xStatusIndicatorImpl( rStatusIndicatorImpl )
+ m_xStatusIndicatorImpl( rStatusIndicatorImpl )
{
}
diff --git a/framework/source/uielement/togglebuttontoolbarcontroller.cxx b/framework/source/uielement/togglebuttontoolbarcontroller.cxx
index d8a1682499..b803edb1c3 100644
--- a/framework/source/uielement/togglebuttontoolbarcontroller.cxx
+++ b/framework/source/uielement/togglebuttontoolbarcontroller.cxx
@@ -117,52 +117,16 @@ throw ( RuntimeException )
}
// ------------------------------------------------------------------
-
-void SAL_CALL ToggleButtonToolbarController::execute( sal_Int16 KeyModifier )
-throw ( RuntimeException )
+Sequence<PropertyValue> ToggleButtonToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const
{
- Reference< XDispatch > xDispatch;
- Reference< XURLTransformer > xURLTransformer;
- ::rtl::OUString aCommandURL;
- ::rtl::OUString aSelectedText;
- ::com::sun::star::util::URL aTargetURL;
-
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( m_bInitialized &&
- m_xFrame.is() &&
- m_xServiceManager.is() &&
- m_aCommandURL.getLength() )
- {
- xURLTransformer = m_xURLTransformer;
- xDispatch = getDispatchFromCommand( m_aCommandURL );
- aCommandURL = m_aCommandURL;
- aTargetURL = getInitializedURL();
- aSelectedText = m_aCurrentSelection;
- }
- }
-
- if ( xDispatch.is() && aTargetURL.Complete.getLength() > 0 )
- {
- Sequence<PropertyValue> aArgs( 2 );
-
- // Add key modifier to argument list
- aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
- aArgs[0].Value <<= KeyModifier;
- aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ));
- aArgs[1].Value <<= aSelectedText;
-
- // Execute dispatch asynchronously
- ExecuteInfo* pExecuteInfo = new ExecuteInfo;
- pExecuteInfo->xDispatch = xDispatch;
- pExecuteInfo->aTargetURL = aTargetURL;
- pExecuteInfo->aArgs = aArgs;
- Application::PostUserEvent( STATIC_LINK(0, ComplexToolbarController , ExecuteHdl_Impl), pExecuteInfo );
- }
+ Sequence<PropertyValue> aArgs( 2 );
+
+ // Add key modifier to argument list
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
+ aArgs[0].Value <<= KeyModifier;
+ aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ));
+ aArgs[1].Value <<= m_aCurrentSelection;
+ return aArgs;
}
// ------------------------------------------------------------------
@@ -178,8 +142,8 @@ throw (::com::sun::star::uno::RuntimeException)
{
// create popup menu
PopupMenu aPopup;
-
- for ( sal_uInt32 i = 0; i < m_aDropdownMenuList.size(); i++ )
+ const sal_uInt32 nCount = m_aDropdownMenuList.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
rtl::OUString aLabel( m_aDropdownMenuList[i] );
aPopup.InsertItem( sal_uInt16( i+1 ), aLabel );
diff --git a/framework/source/uielement/toolbar.cxx b/framework/source/uielement/toolbar.cxx
index e56a992f80..eed4602e96 100644
--- a/framework/source/uielement/toolbar.cxx
+++ b/framework/source/uielement/toolbar.cxx
@@ -36,6 +36,7 @@
//_________________________________________________________________________________________________________________
#include <uielement/toolbar.hxx>
#include <uielement/toolbarmanager.hxx>
+#include <rtl/logfile.hxx>
namespace framework
{
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index d6d9ff3c76..38ce1da212 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -60,7 +60,6 @@
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/ui/ItemType.hpp>
-#include <com/sun/star/frame/XToolbarController.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/XDockableWindow.hpp>
@@ -101,6 +100,7 @@
#include <rtl/logfile.hxx>
#include <svtools/menuoptions.hxx>
#include <svtools/cmdoptions.hxx>
+#include <boost/bind.hpp>
//_________________________________________________________________________________________________________________
// namespaces
@@ -200,8 +200,7 @@ static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager
{
try
{
- Any a( xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))) );
- a >>= xLayoutManager;
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))) >>= xLayoutManager;
}
catch ( RuntimeException& )
{
@@ -269,10 +268,16 @@ ToolBarManager::ToolBarManager( const Reference< XMultiServiceFactory >& rServic
((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( m_pToolBar );
if ( m_xServiceManager.is() )
+ {
m_xToolbarControllerRegistration = Reference< XUIControllerRegistration >(
m_xServiceManager->createInstance( SERVICENAME_TOOLBARCONTROLLERFACTORY ),
UNO_QUERY );
+ m_xURLTransformer.set( m_xServiceManager->createInstance(
+ SERVICENAME_URLTRANSFORMER),
+ UNO_QUERY );
+ }
+
m_pToolBar->SetSelectHdl( LINK( this, ToolBarManager, Select) );
m_pToolBar->SetActivateHdl( LINK( this, ToolBarManager, Activate) );
m_pToolBar->SetDeactivateHdl( LINK( this, ToolBarManager, Deactivate) );
@@ -681,56 +686,15 @@ void SAL_CALL ToolBarManager::removeEventListener( const Reference< XEventListen
// XUIConfigurationListener
void SAL_CALL ToolBarManager::elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- return;
-
- Reference< XNameAccess > xNameAccess;
- sal_Int16 nImageType = sal_Int16();
- sal_Int16 nCurrentImageType = getImageTypeFromBools(
- SvtMiscOptions().AreCurrentSymbolsLarge(),
- m_bIsHiContrast );
-
- if (( Event.aInfo >>= nImageType ) &&
- ( nImageType == nCurrentImageType ) &&
- ( Event.Element >>= xNameAccess ))
- {
- sal_Int16 nImageInfo( 1 );
- Reference< XInterface > xIfacDocImgMgr( m_xDocImageManager, UNO_QUERY );
- if ( xIfacDocImgMgr == Event.Source )
- nImageInfo = 0;
-
- Sequence< rtl::OUString > aSeq = xNameAccess->getElementNames();
- for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
- {
- // Check if we have commands which have an image. We stored for every command
- // from which image manager it got its image. Use only images from this
- // notification if stored nImageInfo >= current nImageInfo!
- rtl::OUString aCommandURL = aSeq[i];
- CommandToInfoMap::iterator pIter = m_aCommandMap.find( aCommandURL );
- if ( pIter != m_aCommandMap.end() && ( pIter->second.nImageInfo >= nImageInfo ))
- {
- Reference< XGraphic > xGraphic;
- if ( xNameAccess->getByName( aSeq[i] ) >>= xGraphic )
- {
- Image aImage( xGraphic );
- m_pToolBar->SetItemImage( pIter->second.nId, aImage );
- if ( pIter->second.aIds.size() > 0 )
- {
- for ( sal_uInt32 j=0; j < pIter->second.aIds.size(); j++ )
- m_pToolBar->SetItemImage( pIter->second.aIds[j], aImage );
- }
- }
- pIter->second.nImageInfo = nImageInfo;
- }
- }
- }
+ impl_elementChanged(false,Event);
}
void SAL_CALL ToolBarManager::elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
+ impl_elementChanged(true,Event);
+}
+void ToolBarManager::impl_elementChanged(bool _bRemove,const ::com::sun::star::ui::ConfigurationEvent& Event )
+{
ResetableGuard aGuard( m_aLock );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -755,80 +719,50 @@ void SAL_CALL ToolBarManager::elementRemoved( const ::com::sun::star::ui::Config
Sequence< rtl::OUString > aSeq = xNameAccess->getElementNames();
for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
{
- CommandToInfoMap::const_iterator pIter = m_aCommandMap.find( aSeq[i] );
+ CommandToInfoMap::iterator pIter = m_aCommandMap.find( aSeq[i] );
if ( pIter != m_aCommandMap.end() && ( pIter->second.nImageInfo >= nImageInfo ))
{
- Image aImage;
- if (( pIter->second.nImageInfo == 0 ) && ( pIter->second.nImageInfo == nImageInfo ))
+ if ( _bRemove )
{
- // Special case: An image from the document image manager has been removed.
- // It is possible that we have a image at our module image manager. Before
- // we can remove our image we have to ask our module image manager.
- Sequence< rtl::OUString > aCmdURLSeq( 1 );
- Sequence< Reference< XGraphic > > aGraphicSeq;
- aCmdURLSeq[0] = pIter->first;
- aGraphicSeq = m_xModuleImageManager->getImages( nImageType, aCmdURLSeq );
- aImage = Image( aGraphicSeq[0] );
- }
+ Image aImage;
+ if (( pIter->second.nImageInfo == 0 ) && ( pIter->second.nImageInfo == nImageInfo ))
+ {
+ // Special case: An image from the document image manager has been removed.
+ // It is possible that we have a image at our module image manager. Before
+ // we can remove our image we have to ask our module image manager.
+ Sequence< rtl::OUString > aCmdURLSeq( 1 );
+ Sequence< Reference< XGraphic > > aGraphicSeq;
+ aCmdURLSeq[0] = pIter->first;
+ aGraphicSeq = m_xModuleImageManager->getImages( nImageType, aCmdURLSeq );
+ aImage = Image( aGraphicSeq[0] );
+ }
- m_pToolBar->SetItemImage( pIter->second.nId, aImage );
- if ( pIter->second.aIds.size() > 0 )
+ setToolBarImage(aImage,pIter);
+ } // if ( _bRemove )
+ else
{
- for ( sal_uInt32 j=0; j < pIter->second.aIds.size(); j++ )
- m_pToolBar->SetItemImage( pIter->second.aIds[j], aImage );
+ Reference< XGraphic > xGraphic;
+ if ( xNameAccess->getByName( aSeq[i] ) >>= xGraphic )
+ {
+ Image aImage( xGraphic );
+ setToolBarImage(aImage,pIter);
+ }
+ pIter->second.nImageInfo = nImageInfo;
}
}
}
}
}
+void ToolBarManager::setToolBarImage(const Image& _aImage,const CommandToInfoMap::const_iterator& _pIter)
+{
+ const ::std::vector< USHORT >& _rIDs = _pIter->second.aIds;
+ m_pToolBar->SetItemImage( _pIter->second.nId, _aImage );
+ ::std::for_each(_rIDs.begin(),_rIDs.end(),::boost::bind(&ToolBar::SetItemImage,m_pToolBar,_1,_aImage));
+}
void SAL_CALL ToolBarManager::elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
- ResetableGuard aGuard( m_aLock );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- return;
-
- Reference< XNameAccess > xNameAccess;
- sal_Int16 nImageType = sal_Int16();
- sal_Int16 nCurrentImageType = getImageTypeFromBools(
- SvtMiscOptions().AreCurrentSymbolsLarge(),
- m_bIsHiContrast );
-
- if (( Event.aInfo >>= nImageType ) &&
- ( nImageType == nCurrentImageType ) &&
- ( Event.Element >>= xNameAccess ))
- {
- sal_Int16 nImageInfo( 1 );
- Reference< XInterface > xIfacDocImgMgr( m_xDocImageManager, UNO_QUERY );
- if ( xIfacDocImgMgr == Event.Source )
- nImageInfo = 0;
-
- Sequence< rtl::OUString > aSeq = xNameAccess->getElementNames();
- for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
- {
- // Check if we have commands which have an image. We stored for every command
- // from which image manager it got its image. Use only images from this
- // notification if stored nImageInfo >= current nImageInfo!
- CommandToInfoMap::iterator pIter = m_aCommandMap.find( aSeq[i] );
- if ( pIter != m_aCommandMap.end() && ( pIter->second.nImageInfo >= nImageInfo ))
- {
- Reference< XGraphic > xGraphic;
- if ( xNameAccess->getByName( aSeq[i] ) >>= xGraphic )
- {
- Image aImage( xGraphic );
- m_pToolBar->SetItemImage( pIter->second.nId, aImage );
- if ( pIter->second.aIds.size() > 0 )
- {
- for ( sal_uInt32 j=0; j < pIter->second.aIds.size(); j++ )
- m_pToolBar->SetItemImage( pIter->second.aIds[j], aImage );
- }
- }
- pIter->second.nImageInfo = nImageInfo;
- }
- }
- }
+ impl_elementChanged(false,Event);
}
void ToolBarManager::RemoveControllers()
@@ -887,9 +821,7 @@ void ToolBarManager::RemoveControllers()
Reference< XNameAccess > xNameAccess( m_xServiceManager->createInstance( SERVICENAME_UICOMMANDDESCRIPTION ), UNO_QUERY );
if ( xNameAccess.is() )
{
- Any a = xNameAccess->getByName( m_aModuleIdentifier );
- Reference< XNameAccess > xUICommands;
- a >>= m_xUICommandLabels;
+ xNameAccess->getByName( m_aModuleIdentifier ) >>= m_xUICommandLabels;
}
}
}
@@ -906,8 +838,7 @@ void ToolBarManager::RemoveControllers()
{
rtl::OUString aStr;
Sequence< PropertyValue > aPropSeq;
- Any a( m_xUICommandLabels->getByName( aCmdURL ));
- if ( a >>= aPropSeq )
+ if ( m_xUICommandLabels->getByName( aCmdURL ) >>= aPropSeq )
{
for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
{
@@ -937,8 +868,6 @@ void ToolBarManager::CreateControllers()
Reference< XComponentContext > xComponentContext;
Reference< XPropertySet > xProps( m_xServiceManager, UNO_QUERY );
Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar );
- Reference< css::util::XURLTransformer > xTrans( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), css::uno::UNO_QUERY );
css::util::URL aURL;
sal_Bool bHasDisabledEntries = SvtCommandOptions().HasEntries( SvtCommandOptions::CMDOPTION_DISABLED );
@@ -966,7 +895,7 @@ void ToolBarManager::CreateControllers()
if ( bHasDisabledEntries )
{
aURL.Complete = aCommandURL;
- xTrans->parseStrict( aURL );
+ m_xURLTransformer->parseStrict( aURL );
if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aURL.Path ))
{
m_aControllerMap[ nId ] = xController;
@@ -984,22 +913,22 @@ void ToolBarManager::CreateControllers()
std::vector< Any > aPropertyVector;
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" ));
- aPropValue.Value = makeAny( m_aModuleIdentifier );
+ aPropValue.Value <<= m_aModuleIdentifier;
aPropertyVector.push_back( makeAny( aPropValue ));
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- aPropValue.Value = makeAny( m_xFrame );
+ aPropValue.Value <<= m_xFrame;
aPropertyVector.push_back( makeAny( aPropValue ));
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" ));
- aPropValue.Value = makeAny( m_xServiceManager );
+ aPropValue.Value <<= m_xServiceManager;
aPropertyVector.push_back( makeAny( aPropValue ));
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ));
- aPropValue.Value = makeAny( xToolbarWindow );
+ aPropValue.Value <<= xToolbarWindow;
aPropertyVector.push_back( makeAny( aPropValue ));
if ( nWidth > 0 )
{
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ));
- aPropValue.Value = makeAny( nWidth );
+ aPropValue.Value <<= nWidth;
aPropertyVector.push_back( makeAny( aPropValue ));
}
@@ -1082,21 +1011,21 @@ void ToolBarManager::CreateControllers()
std::vector< Any > aPropertyVector;
aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- aPropValue.Value = makeAny( m_xFrame );
+ aPropValue.Value <<= m_xFrame;
aPropertyVector.push_back( makeAny( aPropValue ));
aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
- aPropValue.Value = makeAny( aCommandURL );
+ aPropValue.Value <<= aCommandURL;
aPropertyVector.push_back( makeAny( aPropValue ));
aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" ));
- aPropValue.Value = makeAny( m_xServiceManager );
+ aPropValue.Value <<= m_xServiceManager;
aPropertyVector.push_back( makeAny( aPropValue ));
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ));
- aPropValue.Value = makeAny( xToolbarWindow );
+ aPropValue.Value <<= xToolbarWindow;
aPropertyVector.push_back( makeAny( aPropValue ));
if ( nWidth > 0 )
{
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ));
- aPropValue.Value = makeAny( nWidth );
+ aPropValue.Value <<= nWidth;
aPropertyVector.push_back( makeAny( aPropValue ));
}
@@ -1340,10 +1269,11 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
AddonsOptions().GetMergeToolbarInstructions( aToolbarName, aMergeInstructionContainer );
- if ( aMergeInstructionContainer.size() > 0 )
+ if ( !aMergeInstructionContainer.empty() )
{
sal_uInt16 nItemId( TOOLBAR_ITEM_STARTID );
- for ( sal_uInt32 i = 0; i < aMergeInstructionContainer.size(); i++ )
+ const sal_uInt32 nCount = aMergeInstructionContainer.size();
+ for ( sal_uInt32 i=0; i < nCount; i++ )
{
MergeToolbarInstruction& rInstruction = aMergeInstructionContainer[i];
if ( ToolBarMerger::IsCorrectContext( rInstruction.aMergeContext, m_aModuleIdentifier ))
@@ -1403,7 +1333,6 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
Reference< XPropertySet > xPropSet( rItemContainer, UNO_QUERY );
if ( xPropSet.is() )
{
- Any a;
try
{
rtl::OUString aUIName;
@@ -1428,7 +1357,8 @@ void ToolBarManager::RequestImages()
sal_uInt32 i = 0;
CommandToInfoMap::iterator pIter = m_aCommandMap.begin();
- while ( pIter != m_aCommandMap.end() )
+ CommandToInfoMap::iterator pEnd = m_aCommandMap.end();
+ while ( pIter != pEnd )
{
aCmdURLSeq[i++] = pIter->first;
++pIter;
@@ -1444,7 +1374,7 @@ void ToolBarManager::RequestImages()
i = 0;
pIter = m_aCommandMap.begin();
- while ( pIter != m_aCommandMap.end() )
+ while ( pIter != pEnd )
{
rtl::OUString aCommandURL = aCmdURLSeq[i];
@@ -1458,24 +1388,14 @@ void ToolBarManager::RequestImages()
// empty image.
if ( !aImage )
aImage = QueryAddonsImage( aCmdURLSeq[i], bBigImages, m_bIsHiContrast );
- m_pToolBar->SetItemImage( pIter->second.nId, aImage );
- if ( pIter->second.aIds.size() > 0 )
- {
- for ( sal_uInt32 j=0; j < pIter->second.aIds.size(); j++ )
- m_pToolBar->SetItemImage( pIter->second.aIds[j], aImage );
- }
+
pIter->second.nImageInfo = 1; // mark image as module based
}
else
{
- m_pToolBar->SetItemImage( pIter->second.nId, aImage );
- if ( pIter->second.aIds.size() > 0 )
- {
- for ( sal_uInt32 j=0; j < pIter->second.aIds.size(); j++ )
- m_pToolBar->SetItemImage( pIter->second.aIds[j], aImage );
- }
pIter->second.nImageInfo = 0; // mark image as document based
}
+ setToolBarImage(aImage,pIter);
++pIter;
++i;
}
@@ -1484,7 +1404,7 @@ void ToolBarManager::RequestImages()
void ToolBarManager::notifyRegisteredControllers( const rtl::OUString& aUIElementName, const rtl::OUString& aCommand )
{
ResetableGuard aGuard( m_aLock );
- if ( m_aSubToolBarControllerMap.size() > 0 )
+ if ( !m_aSubToolBarControllerMap.empty() )
{
SubToolBarToSubToolBarControllerMap::const_iterator pIter =
m_aSubToolBarControllerMap.find( aUIElementName );
@@ -1492,12 +1412,13 @@ void ToolBarManager::notifyRegisteredControllers( const rtl::OUString& aUIElemen
if ( pIter != m_aSubToolBarControllerMap.end() )
{
const SubToolBarControllerVector& rSubToolBarVector = pIter->second;
- if ( rSubToolBarVector.size() > 0 )
+ if ( !rSubToolBarVector.empty() )
{
SubToolBarControllerVector aNotifyVector = rSubToolBarVector;
aGuard.unlock();
- for ( sal_uInt32 i = 0; i < aNotifyVector.size(); i++ )
+ const sal_uInt32 nCount = aNotifyVector.size();
+ for ( sal_uInt32 i=0; i < nCount; i++ )
{
try
{
@@ -1517,8 +1438,7 @@ void ToolBarManager::notifyRegisteredControllers( const rtl::OUString& aUIElemen
}
}
}
-
-IMPL_LINK( ToolBarManager, Click, ToolBox*, EMPTYARG )
+long ToolBarManager::HandleClick(void ( SAL_CALL XToolbarController::*_pClick )())
{
ResetableGuard aGuard( m_aLock );
@@ -1532,12 +1452,16 @@ IMPL_LINK( ToolBarManager, Click, ToolBox*, EMPTYARG )
Reference< XToolbarController > xController( pIter->second, UNO_QUERY );
if ( xController.is() )
- xController->click();
- }
-
+ (xController.get()->*_pClick)( );
+ } // if ( pIter != m_aControllerMap.end() )
return 1;
}
+IMPL_LINK( ToolBarManager, Click, ToolBox*, EMPTYARG )
+{
+ return HandleClick(&XToolbarController::click);
+}
+
IMPL_LINK( ToolBarManager, DropdownClick, ToolBox*, EMPTYARG )
{
ResetableGuard aGuard( m_aLock );
@@ -1554,28 +1478,12 @@ IMPL_LINK( ToolBarManager, DropdownClick, ToolBox*, EMPTYARG )
if ( xController.is() )
xController->createPopupWindow();
}
-
return 1;
}
IMPL_LINK( ToolBarManager, DoubleClick, ToolBox*, EMPTYARG )
{
- ResetableGuard aGuard( m_aLock );
-
- if ( m_bDisposed )
- return 1;
-
- USHORT nId( m_pToolBar->GetCurItemId() );
- ToolBarControllerMap::const_iterator pIter = m_aControllerMap.find( nId );
- if ( pIter != m_aControllerMap.end() )
- {
- Reference< XToolbarController > xController( pIter->second, UNO_QUERY );
-
- if ( xController.is() )
- xController->doubleClick();
- }
-
- return 1;
+ return HandleClick(&XToolbarController::doubleClick);
}
void ToolBarManager::ImplClearPopupMenu( ToolBox *pToolBar )
@@ -1668,11 +1576,8 @@ PopupMenu * ToolBarManager::GetToolBarCustomMeun(ToolBox* pToolBar)
if ( m_xFrame.is() )
{
Reference< XDispatchProvider > xProv( m_xFrame, UNO_QUERY );
- Reference< XURLTransformer > xTrans( m_xServiceManager->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
aURL.Complete = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConfigureDialog" ));
- xTrans->parseStrict( aURL );
+ m_xURLTransformer->parseStrict( aURL );
if ( xProv.is() )
xDisp = xProv->queryDispatch( aURL, ::rtl::OUString(), 0 );
@@ -1841,11 +1746,8 @@ IMPL_LINK( ToolBarManager, MenuSelect, Menu*, pMenu )
if ( m_xFrame.is() )
{
Reference< XDispatchProvider > xProv( m_xFrame, UNO_QUERY );
- Reference< XURLTransformer > xTrans( m_xServiceManager->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
aURL.Complete = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConfigureDialog" ));
- xTrans->parseStrict( aURL );
+ m_xURLTransformer->parseStrict( aURL );
if ( xProv.is() )
xDisp = xProv->queryDispatch( aURL, ::rtl::OUString(), 0 );
}
@@ -1965,9 +1867,7 @@ IMPL_LINK( ToolBarManager, MenuSelect, Menu*, pMenu )
if ( xPropSet.is() )
{
Reference< XUIConfigurationPersistence > xUICfgMgr;
- Any a = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "ConfigurationSource" )));
- if (( a >>= xUICfgMgr ) && ( xUICfgMgr.is() ))
+ if (( xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ConfigurationSource" ))) >>= xUICfgMgr ) && ( xUICfgMgr.is() ))
xUICfgMgr->store();
}
}
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index 4f11003df0..1f7a988da0 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -58,13 +58,10 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/ui/XUIElementSettings.hpp>
-#ifndef _COM_SUN_STAR_UI_XMODULEUICONFIGURATIONMANAGER_HPP_
#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-#endif
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
-#ifndef _COM_SUN_STAR_UI_UIElementType_HPP_
#include <com/sun/star/ui/UIElementType.hpp>
-#endif
+#include <com/sun/star/lang/DisposedException.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
@@ -85,6 +82,7 @@
#include <svtools/menuoptions.hxx>
#include <svtools/cmdoptions.hxx>
#include <dispatch/uieventloghelper.hxx>
+#include <rtl/logfile.hxx>
//_________________________________________________________________________________________________________________
// Defines
@@ -148,8 +146,7 @@ Reference< XLayoutManager > getLayoutManagerFromFrame( const Reference< XFrame >
try
{
- Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )));
- aValue >>= xLayoutManager;
+ xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))) >>= xLayoutManager;
}
catch ( UnknownPropertyException& )
{
@@ -264,8 +261,7 @@ rtl::OUString ToolbarsMenuController::getUINameFromCommand( const rtl::OUString&
Reference< XNameAccess > xNameAccess( m_xServiceManager->createInstance(
SERVICENAME_UICOMMANDDESCRIPTION ),
UNO_QUERY );
- Any a = xNameAccess->getByName( m_aModuleIdentifier );
- a >>= m_xUICommandDescription;
+ xNameAccess->getByName( m_aModuleIdentifier ) >>= m_xUICommandDescription;
}
catch ( Exception& )
{
@@ -278,8 +274,7 @@ rtl::OUString ToolbarsMenuController::getUINameFromCommand( const rtl::OUString&
{
Sequence< PropertyValue > aPropSeq;
rtl::OUString aStr;
- Any a( m_xUICommandDescription->getByName( rCommandURL ));
- if ( a >>= aPropSeq )
+ if ( m_xUICommandDescription->getByName( rCommandURL ) >>= aPropSeq )
{
for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
{
@@ -367,7 +362,8 @@ Sequence< Sequence< com::sun::star::beans::PropertyValue > > ToolbarsMenuControl
aTbSeq[1].Name = m_aPropResourceURL;
Sequence< Sequence< com::sun::star::beans::PropertyValue > > aSeq( aToolBarArray.size() );
- for ( sal_uInt32 i = 0; i < aToolBarArray.size(); i++ )
+ const sal_uInt32 nCount = aToolBarArray.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
aTbSeq[0].Value <<= aToolBarArray[i].aToolBarUIName;
aTbSeq[1].Value <<= aToolBarArray[i].aToolBarResName;
@@ -476,7 +472,8 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r
std::sort( aSortedTbs.begin(), aSortedTbs.end(), CompareToolBarEntry );
sal_Int16 nIndex( 1 );
- for ( sal_uInt32 i = 0; i < aSortedTbs.size(); i++ )
+ const sal_uInt32 nCount = aSortedTbs.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
USHORT nItemCount = m_xPopupMenu->getItemCount();
m_xPopupMenu->insertItem( nIndex, aSortedTbs[i].aUIName, css::awt::MenuItemStyle::CHECKABLE, nItemCount );
@@ -631,10 +628,6 @@ void SAL_CALL ToolbarsMenuController::statusChanged( const FeatureStateEvent& Ev
}
// XMenuListener
-void SAL_CALL ToolbarsMenuController::highlight( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
void SAL_CALL ToolbarsMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException)
{
Reference< css::awt::XPopupMenu > xPopupMenu;
@@ -678,10 +671,8 @@ void SAL_CALL ToolbarsMenuController::select( const css::awt::MenuEvent& rEvent
{
rtl::OUString aElementName = aElementNames[i];
Sequence< PropertyValue > aWindowState;
-
- Any a( xPersistentWindowState->getByName( aElementName ));
-
- if ( a >>= aWindowState )
+
+ if ( xPersistentWindowState->getByName( aElementName ) >>= aWindowState )
{
sal_Bool bVisible( sal_False );
sal_Bool bContextSensitive( sal_False );
@@ -700,7 +691,7 @@ void SAL_CALL ToolbarsMenuController::select( const css::awt::MenuEvent& rEvent
if ( !bVisible && bContextSensitive && nVisibleIndex >= 0 )
{
// Default is: Every context sensitive toolbar is visible
- aWindowState[nVisibleIndex].Value = makeAny( sal_True );
+ aWindowState[nVisibleIndex].Value <<= sal_True;
xNameReplace->replaceByName( aElementName, makeAny( aWindowState ));
bRefreshToolbars = true;
}
@@ -810,7 +801,8 @@ void SAL_CALL ToolbarsMenuController::activate( const css::awt::MenuEvent& ) thr
}
// Update status for all commands inside our toolbars popup menu
- for ( sal_uInt32 i=0; i < aCmdVector.size(); i++ )
+ const sal_uInt32 nCount = aCmdVector.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
bool bInternal = ( aCmdVector[i].indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STATIC_INTERNAL_CMD_PART ))) == 0);
@@ -837,10 +829,6 @@ void SAL_CALL ToolbarsMenuController::activate( const css::awt::MenuEvent& ) thr
}
}
-void SAL_CALL ToolbarsMenuController::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException)
-{
-}
-
// XPopupMenuController
void SAL_CALL ToolbarsMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException )
{
@@ -863,37 +851,14 @@ void SAL_CALL ToolbarsMenuController::setPopupMenu( const Reference< css::awt::X
// XInitialization
void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
{
- const rtl::OUString aFrameName( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- const rtl::OUString aCommandURLName( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
-
ResetableGuard aLock( m_aLock );
-
sal_Bool bInitalized( m_bInitialized );
if ( !bInitalized )
{
- PropertyValue aPropValue;
- rtl::OUString aCommandURL;
- Reference< XFrame > xFrame;
-
- for ( int i = 0; i < aArguments.getLength(); i++ )
- {
- if ( aArguments[i] >>= aPropValue )
- {
- if ( aPropValue.Name.equalsAscii( "Frame" ))
- aPropValue.Value >>= xFrame;
- else if ( aPropValue.Name.equalsAscii( "CommandURL" ))
- aPropValue.Value >>= aCommandURL;
- }
- }
-
- if ( xFrame.is() && aCommandURL.getLength() )
+ PopupMenuControllerBase::initialize(aArguments);
+
+ if ( m_bInitialized )
{
- m_xFrame = xFrame;
- m_aCommandURL = aCommandURL;
- m_bInitialized = true;
-
- m_aBaseURL = determineBaseURL( aCommandURL );
-
Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance(
SERVICENAME_MODULEMANAGER ),
UNO_QUERY );
@@ -932,11 +897,6 @@ void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArgume
{
}
}
-
- m_xURLTransformer = Reference< XURLTransformer >( m_xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.URLTransformer" ))),
- UNO_QUERY );
}
}
}
diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx
index faf14a5674..59b696763a 100644
--- a/framework/source/uielement/toolbarwrapper.cxx
+++ b/framework/source/uielement/toolbarwrapper.cxx
@@ -85,8 +85,7 @@ namespace framework
{
ToolBarWrapper::ToolBarWrapper( const Reference< XMultiServiceFactory >& xServiceManager ) :
- UIConfigElementWrapperBase( UIElementType::TOOLBAR ),
- m_xServiceManager( xServiceManager )
+ UIConfigElementWrapperBase( UIElementType::TOOLBAR,xServiceManager )
{
}
@@ -185,7 +184,7 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments ) th
pToolBar = new ToolBar( pWindow, nStyles );
m_xToolBarWindow = VCLUnoHelper::GetInterface( pToolBar );
- pToolBarManager = new ToolBarManager( m_xServiceManager, xFrame, m_aResourceURL, pToolBar );
+ pToolBarManager = new ToolBarManager( m_xServiceFactory, xFrame, m_aResourceURL, pToolBar );
pToolBar->SetToolBarManager( pToolBarManager );
m_xToolBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pToolBarManager ), UNO_QUERY );
pToolBar->WillUsePopupMode( bPopupMode );
@@ -276,71 +275,12 @@ void SAL_CALL ToolBarWrapper::updateSettings() throw (::com::sun::star::uno::Run
}
}
-Reference< XIndexAccess > SAL_CALL ToolBarWrapper::getSettings( sal_Bool bWriteable ) throw (::com::sun::star::uno::RuntimeException)
-{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( bWriteable )
- return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( m_xConfigData ) ), UNO_QUERY );
- else
- return m_xConfigData;
-}
-
-void SAL_CALL ToolBarWrapper::setSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xSettings ) throw (::com::sun::star::uno::RuntimeException)
-{
- ResetableGuard aLock( m_aLock );
-
- if ( m_bDisposed )
- throw DisposedException();
-
- if ( xSettings.is() )
- {
- // Create a copy of the data if the container is not const
- Reference< XIndexReplace > xReplace( xSettings, UNO_QUERY );
- if ( xReplace.is() )
- m_xConfigData = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( xSettings ) ), UNO_QUERY );
- else
- m_xConfigData = xSettings;
-
- if ( m_xConfigSource.is() && m_bPersistent )
- {
- ::rtl::OUString aResourceURL( m_aResourceURL );
- Reference< XUIConfigurationManager > xUICfgMgr( m_xConfigSource );
-
- aLock.unlock();
-
- try
- {
- xUICfgMgr->replaceSettings( aResourceURL, m_xConfigData );
- }
- catch( NoSuchElementException& )
- {
- }
- }
- else if ( !m_bPersistent )
- {
- // Transient toolbar => Fill toolbar with new data
- ToolBarManager* pToolBarManager = static_cast< ToolBarManager *>( m_xToolBarManager.get() );
- if ( pToolBarManager )
- pToolBarManager->FillToolbar( m_xConfigData );
- }
- }
-}
-
-// XUIConfigurationListener
-void SAL_CALL ToolBarWrapper::elementInserted( const ::com::sun::star::ui::ConfigurationEvent& ) throw (::com::sun::star::uno::RuntimeException)
-{
-}
-
-void SAL_CALL ToolBarWrapper::elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& ) throw (::com::sun::star::uno::RuntimeException)
-{
-}
-
-void SAL_CALL ToolBarWrapper::elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& ) throw (::com::sun::star::uno::RuntimeException)
+void ToolBarWrapper::impl_fillNewData()
{
+ // Transient toolbar => Fill toolbar with new data
+ ToolBarManager* pToolBarManager = static_cast< ToolBarManager *>( m_xToolBarManager.get() );
+ if ( pToolBarManager )
+ pToolBarManager->FillToolbar( m_xConfigData );
}
// XUIElement interface
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx
index 8e1b3d409e..e13ed0e974 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -53,7 +53,7 @@
// includes of other projects
//_________________________________________________________________________________________________________________
#include <rtl/ustrbuf.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <unotools/configmgr.hxx>
#include <tools/string.hxx>
@@ -113,23 +113,14 @@ namespace framework
// Configuration access class for PopupMenuControllerFactory implementation
//*****************************************************************************************************************
-class ConfigurationAccess_UICommand : // interfaces
- public XTypeProvider ,
- public XNameAccess ,
- public XContainerListener ,
- // baseclasses
- // Order is neccessary for right initialization!
+class ConfigurationAccess_UICommand : // Order is neccessary for right initialization!
private ThreadHelpBase ,
- public ::cppu::OWeakObject
+ public ::cppu::WeakImplHelper2<XNameAccess,XContainerListener>
{
public:
ConfigurationAccess_UICommand( const ::rtl::OUString& aModuleName, const Reference< XNameAccess >& xGenericUICommands, const Reference< XMultiServiceFactory >& rServiceManager );
virtual ~ConfigurationAccess_UICommand();
- // XInterface, XTypeProvider
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
// XNameAccess
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);
@@ -177,6 +168,10 @@ class ConfigurationAccess_UICommand : // interfaces
Sequence< rtl::OUString > getAllCommands();
sal_Bool fillCache();
sal_Bool addGenericInfoToCache();
+ void impl_fill(const Reference< XNameAccess >& _xConfigAccess,sal_Bool _bPopup,
+ std::vector< ::rtl::OUString >& aImageCommandVector,
+ std::vector< ::rtl::OUString >& aImageRotateVector,
+ std::vector< ::rtl::OUString >& aImageMirrorVector);
private:
typedef ::std::hash_map< ::rtl::OUString,
@@ -202,7 +197,7 @@ class ConfigurationAccess_UICommand : // interfaces
Reference< XNameAccess > m_xGenericUICommands;
Reference< XMultiServiceFactory > m_xServiceManager;
Reference< XMultiServiceFactory > m_xConfigProvider;
- Reference< XMultiServiceFactory > m_xConfigProviderPopups;
+ //Reference< XMultiServiceFactory > m_xConfigProviderPopups;
Reference< XNameAccess > m_xConfigAccess;
Reference< XNameAccess > m_xConfigAccessPopups;
Sequence< rtl::OUString > m_aCommandImageList;
@@ -217,23 +212,6 @@ class ConfigurationAccess_UICommand : // interfaces
//*****************************************************************************************************************
// XInterface, XTypeProvider
//*****************************************************************************************************************
-DEFINE_XINTERFACE_5 ( ConfigurationAccess_UICommand ,
- OWeakObject ,
- DIRECT_INTERFACE ( css::container::XNameAccess ),
- DIRECT_INTERFACE ( css::container::XContainerListener ),
- DIRECT_INTERFACE ( css::lang::XTypeProvider ),
- DERIVED_INTERFACE( css::container::XElementAccess, css::container::XNameAccess ),
- DERIVED_INTERFACE( css::lang::XEventListener, XContainerListener )
- )
-
-DEFINE_XTYPEPROVIDER_5 ( ConfigurationAccess_UICommand ,
- css::container::XNameAccess ,
- css::container::XElementAccess ,
- css::container::XContainerListener ,
- css::lang::XTypeProvider ,
- css::lang::XEventListener
- )
-
ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const rtl::OUString& aModuleName, const Reference< XNameAccess >& rGenericUICommands, const Reference< XMultiServiceFactory >& rServiceManager ) :
ThreadHelpBase(),
m_aConfigCmdAccess( RTL_CONSTASCII_USTRINGPARAM( CONFIGURATION_ROOT_ACCESS )),
@@ -255,21 +233,14 @@ ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const rtl::OUStrin
m_aConfigCmdAccess += aModuleName;
m_aConfigCmdAccess += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CONFIGURATION_CMD_ELEMENT_ACCESS ));
- m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- UNO_QUERY );
+ m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY );
m_aConfigPopupAccess += aModuleName;
m_aConfigPopupAccess += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CONFIGURATION_POP_ELEMENT_ACCESS ));
- m_xConfigProviderPopups = Reference< XMultiServiceFactory >( rServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- UNO_QUERY );
+ //m_xConfigProviderPopups = Reference< XMultiServiceFactory >( rServiceManager->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY );
- Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME );
rtl::OUString aTmp;
- aRet >>= aTmp;
+ ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ) >>= aTmp;
m_aBrandName = aTmp;
}
@@ -336,11 +307,7 @@ throw ( RuntimeException )
sal_Bool SAL_CALL ConfigurationAccess_UICommand::hasByName( const ::rtl::OUString& rCommandURL )
throw (::com::sun::star::uno::RuntimeException)
{
- Any a = getByName( rCommandURL );
- if ( a != Any() )
- return sal_True;
- else
- return sal_False;
+ return getByName( rCommandURL ).hasValue();
}
// XElementAccess
@@ -381,48 +348,36 @@ Any ConfigurationAccess_UICommand::getSequenceFromCache( const ::rtl::OUString&
aPropSeq[0].Value = pIter->second.aContextLabel.getLength() ?
makeAny( pIter->second.aContextLabel ): makeAny( pIter->second.aLabel );
aPropSeq[1].Name = m_aPropName;
- aPropSeq[1].Value = makeAny( pIter->second.aCommandName );
+ aPropSeq[1].Value <<= pIter->second.aCommandName;
aPropSeq[2].Name = m_aPropPopup;
- aPropSeq[2].Value = makeAny( pIter->second.bPopup );
+ aPropSeq[2].Value <<= pIter->second.bPopup;
return makeAny( aPropSeq );
}
return Any();
}
-
-sal_Bool ConfigurationAccess_UICommand::fillCache()
+void ConfigurationAccess_UICommand::impl_fill(const Reference< XNameAccess >& _xConfigAccess,sal_Bool _bPopup,
+ std::vector< ::rtl::OUString >& aImageCommandVector,
+ std::vector< ::rtl::OUString >& aImageRotateVector,
+ std::vector< ::rtl::OUString >& aImageMirrorVector)
{
- RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ConfigurationAccess_UICommand::fillCache" );
-
- if ( m_bCacheFilled )
- return sal_True;
-
- sal_Int32 i( 0 );
- Any a;
- std::vector< ::rtl::OUString > aImageCommandVector;
- std::vector< ::rtl::OUString > aImageRotateVector;
- std::vector< ::rtl::OUString > aImageMirrorVector;
- Sequence< ::rtl::OUString > aNameSeq;
-
- if ( m_xConfigAccess.is() )
+ if ( _xConfigAccess.is() )
{
- aNameSeq = m_xConfigAccess->getElementNames();
- for ( i = 0; i < aNameSeq.getLength(); i++ )
+ Sequence< ::rtl::OUString> aNameSeq = _xConfigAccess->getElementNames();
+ const sal_Int32 nCount = aNameSeq.getLength();
+ for ( sal_Int32 i = 0; i < nCount; i++ )
{
try
{
- Reference< XNameAccess > xNameAccess;
- a = m_xConfigAccess->getByName( aNameSeq[i] );
- if ( a >>= xNameAccess )
+ Reference< XNameAccess > xNameAccess(_xConfigAccess->getByName( aNameSeq[i] ),UNO_QUERY);
+ if ( xNameAccess.is() )
{
CmdToInfoMap aCmdToInfo;
- a = xNameAccess->getByName( m_aPropUILabel );
- a >>= aCmdToInfo.aLabel;
- a = xNameAccess->getByName( m_aPropUIContextLabel );
- a >>= aCmdToInfo.aContextLabel;
- a = xNameAccess->getByName( m_aPropProperties );
- a >>= aCmdToInfo.nProperties;
+ aCmdToInfo.bPopup = _bPopup;
+ xNameAccess->getByName( m_aPropUILabel ) >>= aCmdToInfo.aLabel;
+ xNameAccess->getByName( m_aPropUIContextLabel ) >>= aCmdToInfo.aContextLabel;
+ xNameAccess->getByName( m_aPropProperties ) >>= aCmdToInfo.nProperties;
m_aCmdInfoCache.insert( CommandToInfoCache::value_type( aNameSeq[i], aCmdToInfo ));
@@ -441,48 +396,21 @@ sal_Bool ConfigurationAccess_UICommand::fillCache()
{
}
}
- }
-
- if ( m_xConfigAccessPopups.is() )
- {
- aNameSeq = m_xConfigAccessPopups->getElementNames();
- for ( i = 0; i < aNameSeq.getLength(); i++ )
- {
- try
- {
- Reference< XNameAccess > xNameAccess;
- a = m_xConfigAccessPopups->getByName( aNameSeq[i] );
- if ( a >>= xNameAccess )
- {
- CmdToInfoMap aCmdToInfo;
-
- aCmdToInfo.bPopup = sal_True;
- a = xNameAccess->getByName( m_aPropUILabel );
- a >>= aCmdToInfo.aLabel;
- a = xNameAccess->getByName( m_aPropUIContextLabel );
- a >>= aCmdToInfo.aContextLabel;
- a = xNameAccess->getByName( m_aPropProperties );
- a >>= aCmdToInfo.nProperties;
+ } // if ( m_xConfigAccessPopups.is() )
+}
+sal_Bool ConfigurationAccess_UICommand::fillCache()
+{
+ RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ConfigurationAccess_UICommand::fillCache" );
- m_aCmdInfoCache.insert( CommandToInfoCache::value_type( aNameSeq[i], aCmdToInfo ));
+ if ( m_bCacheFilled )
+ return sal_True;
- if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_IMAGE )
- aImageCommandVector.push_back( aNameSeq[i] );
- if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_ROTATE )
- aImageRotateVector.push_back( aNameSeq[i] );
- if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_MIRROR )
- aImageMirrorVector.push_back( aNameSeq[i] );
- }
- }
- catch ( com::sun::star::lang::WrappedTargetException& )
- {
- }
- catch ( com::sun::star::container::NoSuchElementException& )
- {
- }
- }
- }
+ std::vector< ::rtl::OUString > aImageCommandVector;
+ std::vector< ::rtl::OUString > aImageRotateVector;
+ std::vector< ::rtl::OUString > aImageMirrorVector;
+ impl_fill(m_xConfigAccess,sal_False,aImageCommandVector,aImageRotateVector,aImageMirrorVector);
+ impl_fill(m_xConfigAccessPopups,sal_True,aImageCommandVector,aImageRotateVector,aImageMirrorVector);
// Create cached sequences for fast retrieving
m_aCommandImageList = comphelper::containerToSequence( aImageCommandVector );
m_aCommandRotateImageList = comphelper::containerToSequence( aImageRotateVector );
@@ -582,7 +510,6 @@ Sequence< rtl::OUString > ConfigurationAccess_UICommand::getAllCommands()
if ( m_xConfigAccess.is() )
{
- Any a;
Reference< XNameAccess > xNameAccess;
try
@@ -624,14 +551,10 @@ sal_Bool ConfigurationAccess_UICommand::initializeConfigAccess()
try
{
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
- aPropValue.Value = makeAny( m_aConfigCmdAccess );
+ aPropValue.Value <<= m_aConfigCmdAccess;
aArgs[0] <<= aPropValue;
- m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- UNO_QUERY );
+ m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,aArgs ),UNO_QUERY );
if ( m_xConfigAccess.is() )
{
// Add as container listener
@@ -640,13 +563,9 @@ sal_Bool ConfigurationAccess_UICommand::initializeConfigAccess()
xContainer->addContainerListener( this );
}
- aPropValue.Value = makeAny( m_aConfigPopupAccess );
+ aPropValue.Value <<= m_aConfigPopupAccess;
aArgs[0] <<= aPropValue;
- m_xConfigAccessPopups = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- UNO_QUERY );
+ m_xConfigAccessPopups = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,aArgs ),UNO_QUERY );
if ( m_xConfigAccessPopups.is() )
{
// Add as container listener
@@ -711,21 +630,6 @@ void SAL_CALL ConfigurationAccess_UICommand::disposing( const EventObject& aEven
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_4 ( UICommandDescription ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XServiceInfo ),
- DIRECT_INTERFACE( css::container::XNameAccess ),
- DERIVED_INTERFACE( css::container::XElementAccess, css::container::XNameAccess )
- )
-
-DEFINE_XTYPEPROVIDER_4 ( UICommandDescription ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- css::container::XNameAccess ,
- css::container::XElementAccess
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UICommandDescription ,
::cppu::OWeakObject ,
SERVICENAME_UICOMMANDDESCRIPTION ,
@@ -739,12 +643,33 @@ UICommandDescription::UICommandDescription( const Reference< XMultiServiceFactor
m_aPrivateResourceURL( RTL_CONSTASCII_USTRINGPARAM( PRIVATE_RESOURCE_URL )),
m_xServiceManager( xServiceManager )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::UICommandDescription" );
Reference< XNameAccess > xEmpty;
rtl::OUString aGenericUICommand( ::rtl::OUString::createFromAscii( "GenericCommands" ));
m_xGenericUICommands = new ConfigurationAccess_UICommand( aGenericUICommand, xEmpty, xServiceManager );
- m_xModuleManager = Reference< XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ),
- UNO_QUERY );
+ impl_fillElements("ooSetupFactoryCommandConfigRef");
+
+ // insert generic commands
+ UICommandsHashMap::iterator pIter = m_aUICommandsHashMap.find( aGenericUICommand );
+ if ( pIter != m_aUICommandsHashMap.end() )
+ pIter->second = m_xGenericUICommands;
+}
+UICommandDescription::UICommandDescription( const Reference< XMultiServiceFactory >& xServiceManager,bool ) :
+ ThreadHelpBase(),
+ m_xServiceManager( xServiceManager )
+{
+}
+UICommandDescription::~UICommandDescription()
+{
+ ResetableGuard aLock( m_aLock );
+ m_aModuleToCommandFileMap.clear();
+ m_aUICommandsHashMap.clear();
+ m_xGenericUICommands.clear();
+}
+void UICommandDescription::impl_fillElements(const sal_Char* _pName)
+{
+ m_xModuleManager.set( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ),UNO_QUERY );
Reference< XNameAccess > xNameAccess( m_xModuleManager, UNO_QUERY_THROW );
Sequence< rtl::OUString > aElementNames = xNameAccess->getElementNames();
Sequence< PropertyValue > aSeq;
@@ -753,13 +678,12 @@ UICommandDescription::UICommandDescription( const Reference< XMultiServiceFactor
for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ )
{
aModuleIdentifier = aElementNames[i];
- Any a = xNameAccess->getByName( aModuleIdentifier );
- if ( a >>= aSeq )
+ if ( xNameAccess->getByName( aModuleIdentifier ) >>= aSeq )
{
::rtl::OUString aCommandStr;
for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ )
{
- if ( aSeq[y].Name.equalsAscii("ooSetupFactoryCommandConfigRef") )
+ if ( aSeq[y].Name.equalsAscii(_pName) )
{
aSeq[y].Value >>= aCommandStr;
break;
@@ -774,25 +698,17 @@ UICommandDescription::UICommandDescription( const Reference< XMultiServiceFactor
if ( pIter == m_aUICommandsHashMap.end() )
m_aUICommandsHashMap.insert( UICommandsHashMap::value_type( aCommandStr, Reference< XNameAccess >() ));
}
- }
-
- // insert generic commands
- UICommandsHashMap::iterator pIter = m_aUICommandsHashMap.find( aGenericUICommand );
- if ( pIter != m_aUICommandsHashMap.end() )
- pIter->second = m_xGenericUICommands;
+ } // for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ )
}
-
-UICommandDescription::~UICommandDescription()
+Reference< XNameAccess > UICommandDescription::impl_createConfigAccess(const ::rtl::OUString& _sName)
{
- ResetableGuard aLock( m_aLock );
- m_aModuleToCommandFileMap.clear();
- m_aUICommandsHashMap.clear();
- m_xGenericUICommands.clear();
+ return new ConfigurationAccess_UICommand( _sName,m_xGenericUICommands,m_xServiceManager );
}
Any SAL_CALL UICommandDescription::getByName( const ::rtl::OUString& aName )
throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::getByName" );
Any a;
ResetableGuard aLock( m_aLock );
@@ -818,7 +734,7 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la
}
}
}
- else if ( aName.indexOf( m_aPrivateResourceURL ) == 0 )
+ else if ( m_aPrivateResourceURL.getLength() && aName.indexOf( m_aPrivateResourceURL ) == 0 )
{
// special keys to retrieve information about a set of commands
return m_xGenericUICommands->getByName( aName );
@@ -834,6 +750,7 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la
Sequence< ::rtl::OUString > SAL_CALL UICommandDescription::getElementNames()
throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::getElementNames" );
ResetableGuard aLock( m_aLock );
Sequence< rtl::OUString > aSeq( m_aModuleToCommandFileMap.size() );
@@ -852,6 +769,7 @@ throw (::com::sun::star::uno::RuntimeException)
sal_Bool SAL_CALL UICommandDescription::hasByName( const ::rtl::OUString& aName )
throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::hasByName" );
ResetableGuard aLock( m_aLock );
ModuleToCommandFileMap::const_iterator pIter = m_aModuleToCommandFileMap.find( aName );
@@ -862,12 +780,14 @@ throw (::com::sun::star::uno::RuntimeException)
Type SAL_CALL UICommandDescription::getElementType()
throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::getElementType" );
return( ::getCppuType( (const Reference< XNameAccess >*)NULL ) );
}
sal_Bool SAL_CALL UICommandDescription::hasElements()
throw (::com::sun::star::uno::RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::hasElements" );
// generic UI commands are always available!
return sal_True;
}
diff --git a/framework/source/uifactory/addonstoolboxfactory.cxx b/framework/source/uifactory/addonstoolboxfactory.cxx
index 9187f54898..c41213d6d2 100644
--- a/framework/source/uifactory/addonstoolboxfactory.cxx
+++ b/framework/source/uifactory/addonstoolboxfactory.cxx
@@ -76,19 +76,6 @@ namespace framework
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( AddonsToolBoxFactory ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XServiceInfo ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XUIElementFactory )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( AddonsToolBoxFactory ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- ::com::sun::star::ui::XUIElementFactory
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( AddonsToolBoxFactory ,
::cppu::OWeakObject ,
SERVICENAME_TOOLBARFACTORY ,
@@ -101,9 +88,7 @@ AddonsToolBoxFactory::AddonsToolBoxFactory(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) :
ThreadHelpBase( &Application::GetSolarMutex() )
, m_xServiceManager( xServiceManager )
- , m_xModuleManager( xServiceManager->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ))),
- UNO_QUERY )
+ , m_xModuleManager( xServiceManager->createInstance(SERVICENAME_MODULEMANAGER),UNO_QUERY )
{
}
diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx
new file mode 100755
index 0000000000..58ff92e5a8
--- /dev/null
+++ b/framework/source/uifactory/factoryconfiguration.cxx
@@ -0,0 +1,344 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ConfigurationAccess_ControllerFactory.cxx,v $
+ * $Revision: 1.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_framework.hxx"
+
+//_________________________________________________________________________________________________________________
+// my own includes
+//_________________________________________________________________________________________________________________
+#include "uifactory/factoryconfiguration.hxx"
+#include <threadhelp/resetableguard.hxx>
+#include "services.h"
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+
+//_________________________________________________________________________________________________________________
+// includes of other projects
+//_________________________________________________________________________________________________________________
+#include <rtl/ustrbuf.hxx>
+#include <cppuhelper/weak.hxx>
+#include <rtl/logfile.hxx>
+
+//_________________________________________________________________________________________________________________
+// Defines
+//_________________________________________________________________________________________________________________
+//
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+using namespace ::com::sun::star::frame;
+
+//_________________________________________________________________________________________________________________
+// Namespace
+//_________________________________________________________________________________________________________________
+//
+
+namespace framework
+{
+rtl::OUString getHashKeyFromStrings( const rtl::OUString& aCommandURL, const rtl::OUString& aModuleName )
+{
+ rtl::OUStringBuffer aKey( aCommandURL );
+ aKey.appendAscii( "-" );
+ aKey.append( aModuleName );
+ return aKey.makeStringAndClear();
+}
+
+//*****************************************************************************************************************
+// XInterface, XTypeProvider
+//*****************************************************************************************************************
+ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory( Reference< XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot,bool _bAskValue ) :
+ ThreadHelpBase(),
+ m_aPropCommand( RTL_CONSTASCII_USTRINGPARAM( "Command" )),
+ m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )),
+ m_aPropController( RTL_CONSTASCII_USTRINGPARAM( "Controller" )),
+ m_aPropValue( RTL_CONSTASCII_USTRINGPARAM( "Value" )),
+ m_sRoot(_sRoot),
+ m_xServiceManager( rServiceManager ),
+ m_bConfigAccessInitialized( sal_False ),
+ m_bAskValue(_bAskValue)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory" );
+ m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance( SERVICENAME_CFGPROVIDER),UNO_QUERY );
+}
+
+ConfigurationAccess_ControllerFactory::~ConfigurationAccess_ControllerFactory()
+{
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
+ if ( xContainer.is() )
+ xContainer->removeContainerListener( this );
+}
+
+rtl::OUString ConfigurationAccess_ControllerFactory::getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::getServiceFromCommandModule" );
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+ MenuControllerMap::const_iterator pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule ));
+
+ if ( pIter != m_aMenuControllerMap.end() )
+ return pIter->second.m_aImplementationName;
+ else if ( rModule.getLength() )
+ {
+ // Try to detect if we have a generic popup menu controller
+ pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rtl::OUString() ));
+
+ if ( pIter != m_aMenuControllerMap.end() )
+ return pIter->second.m_aImplementationName;
+ }
+
+ return rtl::OUString();
+}
+rtl::OUString ConfigurationAccess_ControllerFactory::getValueFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::getValueFromCommandModule" );
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ MenuControllerMap::const_iterator pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule ));
+
+ if ( pIter != m_aMenuControllerMap.end() )
+ return pIter->second.m_aValue;
+ else if ( rModule.getLength() )
+ {
+ // Try to detect if we have a generic popup menu controller
+ pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rtl::OUString() ));
+
+ if ( pIter != m_aMenuControllerMap.end() )
+ return pIter->second.m_aValue;
+ }
+
+ return rtl::OUString();
+}
+
+
+void ConfigurationAccess_ControllerFactory::addServiceToCommandModule(
+ const rtl::OUString& rCommandURL,
+ const rtl::OUString& rModule,
+ const rtl::OUString& rServiceSpecifier )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::addServiceToCommandModule" );
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ rtl::OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule );
+ m_aMenuControllerMap.insert( MenuControllerMap::value_type( aHashKey,ControllerInfo(rServiceSpecifier,::rtl::OUString()) ));
+}
+
+void ConfigurationAccess_ControllerFactory::removeServiceFromCommandModule(
+ const rtl::OUString& rCommandURL,
+ const rtl::OUString& rModule )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::removeServiceFromCommandModule" );
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ rtl::OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule );
+ m_aMenuControllerMap.erase( aHashKey );
+}
+
+// container.XContainerListener
+void SAL_CALL ConfigurationAccess_ControllerFactory::elementInserted( const ContainerEvent& aEvent ) throw(RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::elementInserted" );
+ rtl::OUString aCommand;
+ rtl::OUString aModule;
+ rtl::OUString aService;
+ rtl::OUString aValue;
+
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService, aValue ))
+ {
+ // Create hash key from command and module as they are together a primary key to
+ // the UNO service that implements the popup menu controller.
+ rtl::OUString aHashKey( getHashKeyFromStrings( aCommand, aModule ));
+ ControllerInfo& rControllerInfo = m_aMenuControllerMap[ aHashKey ];
+ rControllerInfo.m_aImplementationName = aService;
+ rControllerInfo.m_aValue = aValue;
+ }
+}
+
+void SAL_CALL ConfigurationAccess_ControllerFactory::elementRemoved ( const ContainerEvent& aEvent ) throw(RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::elementRemoved" );
+ rtl::OUString aCommand;
+ rtl::OUString aModule;
+ rtl::OUString aService;
+ rtl::OUString aValue;
+
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService, aValue ))
+ {
+ // Create hash key from command and module as they are together a primary key to
+ // the UNO service that implements the popup menu controller.
+ rtl::OUString aHashKey( getHashKeyFromStrings( aCommand, aModule ));
+ m_aMenuControllerMap.erase( aHashKey );
+ }
+}
+
+void SAL_CALL ConfigurationAccess_ControllerFactory::elementReplaced( const ContainerEvent& aEvent ) throw(RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::elementReplaced" );
+ elementInserted(aEvent);
+}
+
+// lang.XEventListener
+void SAL_CALL ConfigurationAccess_ControllerFactory::disposing( const EventObject& ) throw(RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::disposing" );
+ // SAFE
+ // remove our reference to the config access
+ ResetableGuard aLock( m_aLock );
+ m_xConfigAccess.clear();
+}
+
+void ConfigurationAccess_ControllerFactory::readConfigurationData()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::readConfigurationData" );
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ if ( !m_bConfigAccessInitialized )
+ {
+ Sequence< Any > aArgs( 1 );
+ PropertyValue aPropValue;
+
+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
+ aPropValue.Value <<= m_sRoot;
+ aArgs[0] <<= aPropValue;
+
+ try
+ {
+ m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,aArgs ), UNO_QUERY );
+ }
+ catch ( WrappedTargetException& )
+ {
+ }
+
+ m_bConfigAccessInitialized = sal_True;
+ }
+
+ if ( m_xConfigAccess.is() )
+ {
+ // Read and update configuration data
+ updateConfigurationData();
+
+ uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
+ // UNSAFE
+ aLock.unlock();
+
+ if ( xContainer.is() )
+ xContainer->addContainerListener( this );
+ }
+}
+
+void ConfigurationAccess_ControllerFactory::updateConfigurationData()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::updateConfigurationData" );
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+ if ( m_xConfigAccess.is() )
+ {
+ Sequence< rtl::OUString > aPopupMenuControllers = m_xConfigAccess->getElementNames();
+
+ rtl::OUString aCommand;
+ rtl::OUString aModule;
+ rtl::OUString aService;
+ rtl::OUString aHashKey;
+ rtl::OUString aValue;
+
+ m_aMenuControllerMap.clear();
+ for ( sal_Int32 i = 0; i < aPopupMenuControllers.getLength(); i++ )
+ {
+ try
+ {
+ if ( impl_getElementProps( m_xConfigAccess->getByName( aPopupMenuControllers[i] ), aCommand, aModule, aService,aValue ))
+ {
+ // Create hash key from command and module as they are together a primary key to
+ // the UNO service that implements the popup menu controller.
+ aHashKey = getHashKeyFromStrings( aCommand, aModule );
+ m_aMenuControllerMap.insert( MenuControllerMap::value_type( aHashKey, ControllerInfo(aService,aValue) ));
+ }
+ }
+ catch ( NoSuchElementException& )
+ {
+ }
+ catch ( WrappedTargetException& )
+ {
+ }
+ }
+ }
+}
+
+sal_Bool ConfigurationAccess_ControllerFactory::impl_getElementProps( const Any& aElement, rtl::OUString& aCommand, rtl::OUString& aModule, rtl::OUString& aServiceSpecifier,rtl::OUString& aValue ) const
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::impl_getElementProps" );
+ Reference< XPropertySet > xPropertySet;
+ aElement >>= xPropertySet;
+
+ if ( xPropertySet.is() )
+ {
+ try
+ {
+ xPropertySet->getPropertyValue( m_aPropCommand ) >>= aCommand;
+ xPropertySet->getPropertyValue( m_aPropModule ) >>= aModule;
+ xPropertySet->getPropertyValue( m_aPropController ) >>= aServiceSpecifier;
+ if ( m_bAskValue )
+ xPropertySet->getPropertyValue( m_aPropValue ) >>= aValue;
+ }
+ catch ( com::sun::star::beans::UnknownPropertyException& )
+ {
+ return sal_False;
+ }
+ catch ( com::sun::star::lang::WrappedTargetException& )
+ {
+ return sal_False;
+ }
+ }
+
+ return sal_True;
+}
+} // namespace framework
diff --git a/framework/source/uifactory/makefile.mk b/framework/source/uifactory/makefile.mk
index a70beb52f3..d5805faba8 100644
--- a/framework/source/uifactory/makefile.mk
+++ b/framework/source/uifactory/makefile.mk
@@ -49,6 +49,7 @@ SLOFILES= \
$(SLO)$/toolbarcontrollerfactory.obj \
$(SLO)$/statusbarfactory.obj \
$(SLO)$/statusbarcontrollerfactory.obj \
+ $(SLO)$/factoryconfiguration.obj \
$(SLO)$/windowcontentfactorymanager.obj
# --- Targets ------------------------------------------------------
diff --git a/framework/source/uifactory/menubarfactory.cxx b/framework/source/uifactory/menubarfactory.cxx
index 86132d86b4..f07700c20b 100644
--- a/framework/source/uifactory/menubarfactory.cxx
+++ b/framework/source/uifactory/menubarfactory.cxx
@@ -62,6 +62,7 @@
#include <vcl/svapp.hxx>
#include <tools/urlobj.hxx>
#include <rtl/ustrbuf.hxx>
+#include <rtl/logfile.hxx>
//_________________________________________________________________________________________________________________
// Defines
@@ -81,19 +82,6 @@ namespace framework
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( MenuBarFactory ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XServiceInfo ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XUIElementFactory )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( MenuBarFactory ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- ::com::sun::star::ui::XUIElementFactory
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( MenuBarFactory ,
::cppu::OWeakObject ,
SERVICENAME_MENUBARFACTORY ,
@@ -108,6 +96,12 @@ MenuBarFactory::MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::s
, m_xModuleManager( xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY )
{
}
+MenuBarFactory::MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ) :
+ ThreadHelpBase(&Application::GetSolarMutex())
+ , m_xServiceManager( xServiceManager )
+ , m_xModuleManager( xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY )
+{
+}
MenuBarFactory::~MenuBarFactory()
{
@@ -121,12 +115,27 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l
{
// SAFE
ResetableGuard aLock( m_aLock );
-
+ MenuBarWrapper* pMenuBarWrapper = new MenuBarWrapper( m_xServiceManager );
+ Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pMenuBarWrapper, UNO_QUERY );
+ Reference< ::com::sun::star::frame::XModuleManager > xModuleManager = m_xModuleManager;
+ aLock.unlock();
+ CreateUIElement(ResourceURL,Args,"MenuOnly","private:resource/menubar/",xMenuBar,xModuleManager,m_xServiceManager);
+ return xMenuBar;
+}
+void MenuBarFactory::CreateUIElement(const ::rtl::OUString& ResourceURL
+ , const Sequence< PropertyValue >& Args
+ ,const char* _pExtraMode
+ ,const char* _pAsciiName
+ ,const Reference< ::com::sun::star::ui::XUIElement >& _xMenuBar
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager >& _xModuleManager
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager)
+{
+ Reference< XUIConfigurationManager > xCfgMgr;
Reference< XUIConfigurationManager > xConfigSource;
Reference< XFrame > xFrame;
rtl::OUString aResourceURL( ResourceURL );
sal_Bool bPersistent( sal_True );
- sal_Bool bMenuOnly( sal_False );
+ sal_Bool bExtraMode( sal_False );
for ( sal_Int32 n = 0; n < Args.getLength(); n++ )
{
@@ -138,51 +147,47 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l
Args[n].Value >>= aResourceURL;
else if ( Args[n].Name.equalsAscii( "Persistent" ))
Args[n].Value >>= bPersistent;
- else if ( Args[n].Name.equalsAscii( "MenuOnly" ))
- Args[n].Value >>= bMenuOnly;
- }
-
- Reference< XUIConfigurationManager > xCfgMgr;
- if ( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/" ))) != 0 )
+ else if ( _pExtraMode && Args[n].Name.equalsAscii( _pExtraMode ))
+ Args[n].Value >>= bExtraMode;
+ } // for ( sal_Int32 n = 0; n < Args.getLength(); n++ )
+ if ( aResourceURL.indexOf( rtl::OUString::createFromAscii(_pAsciiName)) != 0 )
throw IllegalArgumentException();
- else
+
+ // Identify frame and determine document based ui configuration manager/module ui configuration manager
+ if ( xFrame.is() && !xConfigSource.is() )
{
- // Identify frame and determine document based ui configuration manager/module ui configuration manager
- if ( xFrame.is() && !xConfigSource.is() )
- {
- bool bHasSettings( false );
- Reference< XModel > xModel;
+ bool bHasSettings( false );
+ Reference< XModel > xModel;
- Reference< XController > xController = xFrame->getController();
- if ( xController.is() )
- xModel = xController->getModel();
+ Reference< XController > xController = xFrame->getController();
+ if ( xController.is() )
+ xModel = xController->getModel();
- if ( xModel.is() )
+ if ( xModel.is() )
+ {
+ Reference< XUIConfigurationManagerSupplier > xUIConfigurationManagerSupplier( xModel, UNO_QUERY );
+ if ( xUIConfigurationManagerSupplier.is() )
{
- Reference< XUIConfigurationManagerSupplier > xUIConfigurationManagerSupplier( xModel, UNO_QUERY );
- if ( xUIConfigurationManagerSupplier.is() )
- {
- xCfgMgr = xUIConfigurationManagerSupplier->getUIConfigurationManager();
- bHasSettings = xCfgMgr->hasSettings( aResourceURL );
- }
+ xCfgMgr = xUIConfigurationManagerSupplier->getUIConfigurationManager();
+ bHasSettings = xCfgMgr->hasSettings( aResourceURL );
}
+ }
- if ( !bHasSettings )
+ if ( !bHasSettings )
+ {
+ rtl::OUString aModuleIdentifier = _xModuleManager->identify( Reference< XInterface >( xFrame, UNO_QUERY ));
+ if ( aModuleIdentifier.getLength() )
{
- rtl::OUString aModuleIdentifier = m_xModuleManager->identify( Reference< XInterface >( xFrame, UNO_QUERY ));
- if ( aModuleIdentifier.getLength() )
- {
- Reference< ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(
- m_xServiceManager->createInstance( SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ), UNO_QUERY );
- xCfgMgr = xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier );
- bHasSettings = xCfgMgr->hasSettings( aResourceURL );
- }
+ Reference< ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(
+ _xServiceManager->createInstance( SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ), UNO_QUERY );
+ xCfgMgr = xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier );
+ bHasSettings = xCfgMgr->hasSettings( aResourceURL );
}
}
}
-
+
PropertyValue aPropValue;
- Sequence< Any > aPropSeq( 5 );
+ Sequence< Any > aPropSeq( _pExtraMode ? 5 : 4);
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
aPropValue.Value <<= xFrame;
aPropSeq[0] <<= aPropValue;
@@ -195,16 +200,16 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Persistent" ));
aPropValue.Value <<= bPersistent;
aPropSeq[3] <<= aPropValue;
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MenuOnly" ));
- aPropValue.Value <<= bMenuOnly;
- aPropSeq[4] <<= aPropValue;
+ if ( _pExtraMode )
+ {
+ aPropValue.Name = rtl::OUString::createFromAscii(_pExtraMode);
+ aPropValue.Value <<= bExtraMode;
+ aPropSeq[4] <<= aPropValue;
+ }
vos::OGuard aGuard( Application::GetSolarMutex() );
- MenuBarWrapper* pMenuBarWrapper = new MenuBarWrapper( m_xServiceManager );
- Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pMenuBarWrapper, UNO_QUERY );
- Reference< XInitialization > xInit( xMenuBar, UNO_QUERY );
+ Reference< XInitialization > xInit( _xMenuBar, UNO_QUERY );
xInit->initialize( aPropSeq );
- return xMenuBar;
}
} // namespace framework
diff --git a/framework/source/uifactory/popupmenucontrollerfactory.cxx b/framework/source/uifactory/popupmenucontrollerfactory.cxx
index 0cdf512b10..5c9ccdaca2 100644
--- a/framework/source/uifactory/popupmenucontrollerfactory.cxx
+++ b/framework/source/uifactory/popupmenucontrollerfactory.cxx
@@ -37,6 +37,7 @@
#include "uifactory/popupmenucontrollerfactory.hxx"
#include <threadhelp/resetableguard.hxx>
#include "services.h"
+#include "uifactory/factoryconfiguration.hxx"
//_________________________________________________________________________________________________________________
// interface includes
@@ -52,6 +53,7 @@
//_________________________________________________________________________________________________________________
#include <rtl/ustrbuf.hxx>
#include <cppuhelper/weak.hxx>
+#include <rtl/logfile.hxx>
//_________________________________________________________________________________________________________________
// Defines
@@ -72,304 +74,9 @@ using namespace ::com::sun::star::frame;
namespace framework
{
-// global function needed by both implementations
-rtl::OUString getHashKeyFromStrings( const rtl::OUString& aCommandURL, const rtl::OUString& aModuleName )
-{
- rtl::OUStringBuffer aKey( aCommandURL );
- aKey.appendAscii( "-" );
- aKey.append( aModuleName );
- return aKey.makeStringAndClear();
-}
-
-
-//*****************************************************************************************************************
-// Configuration access class for PopupMenuControllerFactory implementation
-//*****************************************************************************************************************
-
-class ConfigurationAccess_PopupMenuControllerFactory : // interfaces
- public XTypeProvider ,
- public XContainerListener ,
- // baseclasses
- // Order is neccessary for right initialization!
- private ThreadHelpBase ,
- public ::cppu::OWeakObject
-{
- public:
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
- ConfigurationAccess_PopupMenuControllerFactory( Reference< XMultiServiceFactory >& rServiceManager );
- virtual ~ConfigurationAccess_PopupMenuControllerFactory();
-
- void readConfigurationData();
- void updateConfigurationData();
-
- rtl::OUString getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const;
- void addServiceToCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule, const rtl::OUString& rServiceSpecifier );
- void removeServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule );
-
- // container.XContainerListener
- virtual void SAL_CALL elementInserted( const ContainerEvent& aEvent ) throw(RuntimeException);
- virtual void SAL_CALL elementRemoved ( const ContainerEvent& aEvent ) throw(RuntimeException);
- virtual void SAL_CALL elementReplaced( const ContainerEvent& aEvent ) throw(RuntimeException);
-
- // lang.XEventListener
- virtual void SAL_CALL disposing( const EventObject& aEvent ) throw(RuntimeException);
-
- private:
- class PopupMenuControllerMap : public std::hash_map< rtl::OUString,
- rtl::OUString,
- OUStringHashCode,
- ::std::equal_to< ::rtl::OUString > >
- {
- inline void free()
- {
- PopupMenuControllerMap().swap( *this );
- }
- };
-
- sal_Bool impl_getElementProps( const Any& aElement, rtl::OUString& aCommand, rtl::OUString& aModule, rtl::OUString& aServiceSpecifier ) const;
-
- rtl::OUString m_aPropCommand;
- rtl::OUString m_aPropModule;
- rtl::OUString m_aPropController;
- PopupMenuControllerMap m_aPopupMenuControllerMap;
- Reference< XMultiServiceFactory > m_xServiceManager;
- Reference< XMultiServiceFactory > m_xConfigProvider;
- Reference< XNameAccess > m_xConfigAccess;
- sal_Bool m_bConfigAccessInitialized;
-};
-
-//*****************************************************************************************************************
-// XInterface, XTypeProvider
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( ConfigurationAccess_PopupMenuControllerFactory ,
- OWeakObject ,
- DIRECT_INTERFACE ( XTypeProvider ),
- DIRECT_INTERFACE ( XContainerListener ),
- DERIVED_INTERFACE( css::lang::XEventListener, XContainerListener )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( ConfigurationAccess_PopupMenuControllerFactory ,
- XTypeProvider ,
- XContainerListener ,
- css::lang::XEventListener
- )
-
-ConfigurationAccess_PopupMenuControllerFactory::ConfigurationAccess_PopupMenuControllerFactory( Reference< XMultiServiceFactory >& rServiceManager ) :
- ThreadHelpBase(),
- m_aPropCommand( RTL_CONSTASCII_USTRINGPARAM( "Command" )),
- m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )),
- m_aPropController( RTL_CONSTASCII_USTRINGPARAM( "Controller" )),
- m_xServiceManager( rServiceManager ),
- m_bConfigAccessInitialized( sal_False )
-{
- m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- UNO_QUERY );
-}
-
-ConfigurationAccess_PopupMenuControllerFactory::~ConfigurationAccess_PopupMenuControllerFactory()
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
- if ( xContainer.is() )
- xContainer->removeContainerListener( this );
-}
-
-rtl::OUString ConfigurationAccess_PopupMenuControllerFactory::getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- PopupMenuControllerMap::const_iterator pIter =
- m_aPopupMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule ));
-
- if ( pIter != m_aPopupMenuControllerMap.end() )
- return pIter->second;
- else
- {
- // Try to detect if we have a generic popup menu controller
- pIter = m_aPopupMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rtl::OUString() ));
-
- if ( pIter != m_aPopupMenuControllerMap.end() )
- return pIter->second;
- }
-
- return rtl::OUString();
-}
-
-void ConfigurationAccess_PopupMenuControllerFactory::addServiceToCommandModule(
- const rtl::OUString& rCommandURL,
- const rtl::OUString& rModule,
- const rtl::OUString& rServiceSpecifier )
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- rtl::OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule );
- m_aPopupMenuControllerMap.insert( PopupMenuControllerMap::value_type( aHashKey, rServiceSpecifier ));
-}
-
-void ConfigurationAccess_PopupMenuControllerFactory::removeServiceFromCommandModule(
- const rtl::OUString& rCommandURL,
- const rtl::OUString& rModule )
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- rtl::OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule );
- m_aPopupMenuControllerMap.erase( aHashKey );
-}
-
-// container.XContainerListener
-void SAL_CALL ConfigurationAccess_PopupMenuControllerFactory::elementInserted( const ContainerEvent& /*aEvent*/ ) throw(RuntimeException)
-{
- updateConfigurationData();
-}
-
-void SAL_CALL ConfigurationAccess_PopupMenuControllerFactory::elementRemoved ( const ContainerEvent& /*aEvent*/ ) throw(RuntimeException)
-{
- updateConfigurationData();
-}
-
-void SAL_CALL ConfigurationAccess_PopupMenuControllerFactory::elementReplaced( const ContainerEvent& /*aEvent*/ ) throw(RuntimeException)
-{
- updateConfigurationData();
-}
-
-// lang.XEventListener
-void SAL_CALL ConfigurationAccess_PopupMenuControllerFactory::disposing( const EventObject& ) throw(RuntimeException)
-{
- // SAFE
- // remove our reference to the config access
- ResetableGuard aLock( m_aLock );
- m_xConfigAccess.clear();
-}
-
-void ConfigurationAccess_PopupMenuControllerFactory::readConfigurationData()
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bConfigAccessInitialized )
- {
- Sequence< Any > aArgs( 1 );
- PropertyValue aPropValue;
-
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
- aPropValue.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/PopupMenu" ));
- aArgs[0] <<= aPropValue;
-
- try
- {
- m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- UNO_QUERY );
- }
- catch ( WrappedTargetException& )
- {
- }
-
- m_bConfigAccessInitialized = sal_True;
- }
-
- if ( m_xConfigAccess.is() )
- {
- // Read and update configuration data
- updateConfigurationData();
-
- Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
- if ( xContainer.is() )
- xContainer->addContainerListener( this );
- }
-}
-
-void ConfigurationAccess_PopupMenuControllerFactory::updateConfigurationData()
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
- if ( m_xConfigAccess.is() )
- {
- Sequence< rtl::OUString > aPopupMenuControllers = m_xConfigAccess->getElementNames();
-
- rtl::OUString aCommand;
- rtl::OUString aModule;
- rtl::OUString aService;
- rtl::OUString aHashKey;
-
- m_aPopupMenuControllerMap.clear();
- for ( sal_Int32 i = 0; i < aPopupMenuControllers.getLength(); i++ )
- {
- try
- {
- if ( impl_getElementProps( m_xConfigAccess->getByName( aPopupMenuControllers[i] ), aCommand, aModule, aService ))
- {
- // Create hash key from command and module as they are together a primary key to
- // the UNO service that implements the popup menu controller.
- aHashKey = getHashKeyFromStrings( aCommand, aModule );
- m_aPopupMenuControllerMap.insert( PopupMenuControllerMap::value_type( aHashKey, aService ));
- }
- }
- catch ( NoSuchElementException& )
- {
- }
- catch ( WrappedTargetException& )
- {
- }
- }
- }
-}
-
-sal_Bool ConfigurationAccess_PopupMenuControllerFactory::impl_getElementProps( const Any& aElement, rtl::OUString& aCommand, rtl::OUString& aModule, rtl::OUString& aServiceSpecifier ) const
-{
- Reference< XPropertySet > xPropertySet;
- aElement >>= xPropertySet;
-
- if ( xPropertySet.is() )
- {
- try
- {
- xPropertySet->getPropertyValue( m_aPropCommand ) >>= aCommand;
- xPropertySet->getPropertyValue( m_aPropModule ) >>= aModule;
- xPropertySet->getPropertyValue( m_aPropController ) >>= aServiceSpecifier;
- }
- catch ( com::sun::star::beans::UnknownPropertyException& )
- {
- return sal_False;
- }
- catch ( com::sun::star::lang::WrappedTargetException& )
- {
- return sal_False;
- }
- }
-
- return sal_True;
-}
-
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_4 ( PopupMenuControllerFactory ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XServiceInfo ),
- DIRECT_INTERFACE( css::lang::XMultiComponentFactory ),
- DIRECT_INTERFACE( ::com::sun::star::frame::XUIControllerRegistration )
- )
-
-DEFINE_XTYPEPROVIDER_4 ( PopupMenuControllerFactory ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- css::lang::XMultiComponentFactory ,
- ::com::sun::star::frame::XUIControllerRegistration
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( PopupMenuControllerFactory ,
::cppu::OWeakObject ,
SERVICENAME_POPUPMENUCONTROLLERFACTORY ,
@@ -379,155 +86,11 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( PopupMenuControllerFactory
DEFINE_INIT_SERVICE ( PopupMenuControllerFactory, {} )
PopupMenuControllerFactory::PopupMenuControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager ) :
- ThreadHelpBase(),
- m_bConfigRead( sal_False ),
- m_xServiceManager( xServiceManager )
+ ToolbarControllerFactory(xServiceManager,true)
{
- m_pConfigAccess = new ConfigurationAccess_PopupMenuControllerFactory( m_xServiceManager );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "PopupMenuControllerFactory::PopupMenuControllerFactory" );
+ m_pConfigAccess = new ConfigurationAccess_ControllerFactory( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/PopupMenu" )) );
m_pConfigAccess->acquire();
}
-PopupMenuControllerFactory::~PopupMenuControllerFactory()
-{
- ResetableGuard aLock( m_aLock );
-
- // reduce reference count
- m_pConfigAccess->release();
-}
-
-// XMultiComponentFactory
-Reference< XInterface > SAL_CALL PopupMenuControllerFactory::createInstanceWithContext(
- const ::rtl::OUString& aServiceSpecifier,
- const Reference< XComponentContext >& )
-throw (Exception, RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bConfigRead )
- {
- m_bConfigRead = sal_True;
- m_pConfigAccess->readConfigurationData();
- }
-
- rtl::OUString aServiceName = m_pConfigAccess->getServiceFromCommandModule( aServiceSpecifier, rtl::OUString() );
- if ( aServiceName.getLength() > 0 )
- return m_xServiceManager->createInstance( aServiceName );
- else
- return Reference< XInterface >();
- // SAFE
-}
-
-Reference< XInterface > SAL_CALL PopupMenuControllerFactory::createInstanceWithArgumentsAndContext(
- const ::rtl::OUString& ServiceSpecifier,
- const Sequence< Any >& Arguments,
- const Reference< XComponentContext >& )
-throw (Exception, RuntimeException)
-{
- const rtl::OUString aPropModuleName( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" ));
-
- rtl::OUString aPropName;
- PropertyValue aPropValue;
-
- // Retrieve the optional module name form the Arguments sequence. It is used as a part of
- // the hash map key to support different controller implementation for the same URL but different
- // module!!
- for ( int i = 0; i < Arguments.getLength(); i++ )
- {
- if (( Arguments[i] >>= aPropValue ) && ( aPropValue.Name.equals( aPropModuleName )))
- {
- aPropValue.Value >>= aPropName;
- break;
- }
- }
-
- // Append the command URL to the Arguments sequence so that one controller can be
- // used for more than one command URL.
- Sequence< Any > aNewArgs( Arguments );
-
- sal_Int32 nAppendIndex = aNewArgs.getLength();
- aNewArgs.realloc( aNewArgs.getLength()+1 );
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
- aPropValue.Value <<= ServiceSpecifier;
- aNewArgs[nAppendIndex] <<= aPropValue;
-
- // SAFE
- {
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bConfigRead )
- {
- m_bConfigRead = sal_True;
- m_pConfigAccess->readConfigurationData();
- }
-
- rtl::OUString aServiceName = m_pConfigAccess->getServiceFromCommandModule( ServiceSpecifier, aPropName );
- if ( aServiceName.getLength() > 0 )
- return m_xServiceManager->createInstanceWithArguments( aServiceName, aNewArgs );
- else
- return Reference< XInterface >();
- }
- // SAFE
-}
-
-Sequence< ::rtl::OUString > SAL_CALL PopupMenuControllerFactory::getAvailableServiceNames()
-throw (RuntimeException)
-{
- return Sequence< ::rtl::OUString >();
-}
-
-// XUIControllerRegistration
-sal_Bool SAL_CALL PopupMenuControllerFactory::hasController(
- const ::rtl::OUString& aCommandURL,
- const rtl::OUString& aModuleName )
-throw (::com::sun::star::uno::RuntimeException)
-{
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bConfigRead )
- {
- m_bConfigRead = sal_True;
- m_pConfigAccess->readConfigurationData();
- }
-
- return ( m_pConfigAccess->getServiceFromCommandModule( aCommandURL, aModuleName ).getLength() > 0 );
-}
-
-void SAL_CALL PopupMenuControllerFactory::registerController(
- const ::rtl::OUString& aCommandURL,
- const ::rtl::OUString& aModuleName,
- const ::rtl::OUString& aControllerImplementationName )
-throw (RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bConfigRead )
- {
- m_bConfigRead = sal_True;
- m_pConfigAccess->readConfigurationData();
- }
-
- m_pConfigAccess->addServiceToCommandModule( aCommandURL, aModuleName, aControllerImplementationName );
- // SAFE
-}
-
-void SAL_CALL PopupMenuControllerFactory::deregisterController(
- const ::rtl::OUString& aCommandURL,
- const rtl::OUString& aModuleName )
-throw (RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bConfigRead )
- {
- m_bConfigRead = sal_True;
- m_pConfigAccess->readConfigurationData();
- }
-
- m_pConfigAccess->removeServiceFromCommandModule( aCommandURL, aModuleName );
- // SAFE
-}
-
} // namespace framework
diff --git a/framework/source/uifactory/statusbarcontrollerfactory.cxx b/framework/source/uifactory/statusbarcontrollerfactory.cxx
index e28c745bcd..b5364b3fb7 100644
--- a/framework/source/uifactory/statusbarcontrollerfactory.cxx
+++ b/framework/source/uifactory/statusbarcontrollerfactory.cxx
@@ -35,6 +35,7 @@
// my own includes
//_________________________________________________________________________________________________________________
#include "uifactory/statusbarcontrollerfactory.hxx"
+#include "uifactory/factoryconfiguration.hxx"
#include <threadhelp/resetableguard.hxx>
#include "services.h"
@@ -71,380 +72,9 @@ using namespace ::com::sun::star::frame;
namespace framework
{
-
-// global function needed by both implementations
-static rtl::OUString getHashKeyFromStrings( const rtl::OUString& aCommandURL, const rtl::OUString& aModuleName )
-{
- rtl::OUStringBuffer aKey( aCommandURL );
- aKey.appendAscii( "-" );
- aKey.append( aModuleName );
- return aKey.makeStringAndClear();
-}
-
-
-//*****************************************************************************************************************
-// Configuration access class for StatusbarControllerFactory implementation
-//*****************************************************************************************************************
-
-class ConfigurationAccess_StatusbarControllerFactory : // interfaces
- public XTypeProvider ,
- public XContainerListener ,
- // baseclasses
- // Order is neccessary for right initialization!
- private ThreadHelpBase ,
- public ::cppu::OWeakObject
-{
- public:
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
- ConfigurationAccess_StatusbarControllerFactory( Reference< XMultiServiceFactory >& rServiceManager );
- virtual ~ConfigurationAccess_StatusbarControllerFactory();
-
- void readConfigurationData();
-
- rtl::OUString getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const;
- rtl::OUString getValueFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const;
- void addServiceToCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule, const rtl::OUString& rServiceSpecifier );
- void removeServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule );
-
- // container.XContainerListener
- virtual void SAL_CALL elementInserted( const ContainerEvent& aEvent ) throw(RuntimeException);
- virtual void SAL_CALL elementRemoved ( const ContainerEvent& aEvent ) throw(RuntimeException);
- virtual void SAL_CALL elementReplaced( const ContainerEvent& aEvent ) throw(RuntimeException);
-
- // lang.XEventListener
- virtual void SAL_CALL disposing( const EventObject& aEvent ) throw(RuntimeException);
-
- private:
- struct StatusbarControllerInfo
- {
- rtl::OUString m_aImplementationName;
- rtl::OUString m_aValue;
- };
-
- class StatusbarControllerMap : public std::hash_map< rtl::OUString,
- StatusbarControllerInfo,
- OUStringHashCode,
- ::std::equal_to< ::rtl::OUString > >
- {
- inline void free()
- {
- StatusbarControllerMap().swap( *this );
- }
- };
-
- sal_Bool impl_getElementProps( const Any& aElement,
- rtl::OUString& aCommand,
- rtl::OUString& aModule,
- rtl::OUString& aServiceSpecifier,
- rtl::OUString& aValue ) const;
-
- rtl::OUString m_aPropCommand;
- rtl::OUString m_aPropModule;
- rtl::OUString m_aPropController;
- rtl::OUString m_aPropValue;
- StatusbarControllerMap m_aStatusbarControllerMap;
- Reference< XMultiServiceFactory > m_xServiceManager;
- Reference< XMultiServiceFactory > m_xConfigProvider;
- Reference< XNameAccess > m_xConfigAccess;
- sal_Bool m_bConfigAccessInitialized;
-};
-
-//*****************************************************************************************************************
-// XInterface, XTypeProvider
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( ConfigurationAccess_StatusbarControllerFactory ,
- OWeakObject ,
- DIRECT_INTERFACE ( XTypeProvider ),
- DIRECT_INTERFACE ( XContainerListener ),
- DERIVED_INTERFACE( css::lang::XEventListener, XContainerListener )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( ConfigurationAccess_StatusbarControllerFactory ,
- XTypeProvider ,
- XContainerListener ,
- css::lang::XEventListener
- )
-
-ConfigurationAccess_StatusbarControllerFactory::ConfigurationAccess_StatusbarControllerFactory( Reference< XMultiServiceFactory >& rServiceManager ) :
- ThreadHelpBase(),
- m_aPropCommand( RTL_CONSTASCII_USTRINGPARAM( "Command" )),
- m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )),
- m_aPropController( RTL_CONSTASCII_USTRINGPARAM( "Controller" )),
- m_aPropValue( RTL_CONSTASCII_USTRINGPARAM( "Value" )),
- m_xServiceManager( rServiceManager ),
- m_bConfigAccessInitialized( sal_False )
-{
- m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- UNO_QUERY );
-}
-
-ConfigurationAccess_StatusbarControllerFactory::~ConfigurationAccess_StatusbarControllerFactory()
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
- if ( xContainer.is() )
- xContainer->removeContainerListener( this );
-}
-
-rtl::OUString ConfigurationAccess_StatusbarControllerFactory::getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- StatusbarControllerMap::const_iterator pIter =
- m_aStatusbarControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule ));
-
- if ( pIter != m_aStatusbarControllerMap.end() )
- return pIter->second.m_aImplementationName;
- else
- {
- // Try to detect if we have a generic controller
- pIter = m_aStatusbarControllerMap.find( getHashKeyFromStrings( rCommandURL, rtl::OUString() ));
-
- if ( pIter != m_aStatusbarControllerMap.end() )
- return pIter->second.m_aImplementationName;
- }
-
- return rtl::OUString();
-}
-
-rtl::OUString ConfigurationAccess_StatusbarControllerFactory::getValueFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- StatusbarControllerMap::const_iterator pIter =
- m_aStatusbarControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule ));
-
- if ( pIter != m_aStatusbarControllerMap.end() )
- return pIter->second.m_aValue;
- else
- {
- // Try to detect if we have a generic popup menu controller
- pIter = m_aStatusbarControllerMap.find( getHashKeyFromStrings( rCommandURL, rtl::OUString() ));
-
- if ( pIter != m_aStatusbarControllerMap.end() )
- return pIter->second.m_aValue;
- }
-
- return rtl::OUString();
-}
-
-void ConfigurationAccess_StatusbarControllerFactory::addServiceToCommandModule(
- const rtl::OUString& rCommandURL,
- const rtl::OUString& rModule,
- const rtl::OUString& rServiceSpecifier )
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- rtl::OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule );
-
- StatusbarControllerInfo& rControllerInfo = m_aStatusbarControllerMap[ aHashKey ];
- rControllerInfo.m_aImplementationName = rServiceSpecifier;
- rControllerInfo.m_aValue = rtl::OUString();
-}
-
-void ConfigurationAccess_StatusbarControllerFactory::removeServiceFromCommandModule(
- const rtl::OUString& rCommandURL,
- const rtl::OUString& rModule )
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- rtl::OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule );
- m_aStatusbarControllerMap.erase( aHashKey );
-}
-
-// container.XContainerListener
-void SAL_CALL ConfigurationAccess_StatusbarControllerFactory::elementInserted( const ContainerEvent& aEvent ) throw(RuntimeException)
-{
- rtl::OUString aCommand;
- rtl::OUString aModule;
- rtl::OUString aService;
- rtl::OUString aValue;
-
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService, aValue ))
- {
- // Create hash key from command and module as they are together a primary key to
- // the UNO service that implements the popup menu controller.
- rtl::OUString aHashKey( getHashKeyFromStrings( aCommand, aModule ));
- StatusbarControllerInfo& rControllerInfo = m_aStatusbarControllerMap[ aHashKey ];
- rControllerInfo.m_aImplementationName = aService;
- rControllerInfo.m_aValue = aValue;
- }
-}
-
-void SAL_CALL ConfigurationAccess_StatusbarControllerFactory::elementRemoved ( const ContainerEvent& aEvent ) throw(RuntimeException)
-{
- rtl::OUString aCommand;
- rtl::OUString aModule;
- rtl::OUString aService;
- rtl::OUString aValue;
-
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService, aValue ))
- {
- // Create hash key from command and module as they are together a primary key to
- // the UNO service that implements the popup menu controller.
- rtl::OUString aHashKey( getHashKeyFromStrings( aCommand, aModule ));
- m_aStatusbarControllerMap.erase( aHashKey );
- }
-}
-
-void SAL_CALL ConfigurationAccess_StatusbarControllerFactory::elementReplaced( const ContainerEvent& aEvent ) throw(RuntimeException)
-{
- rtl::OUString aCommand;
- rtl::OUString aModule;
- rtl::OUString aService;
- rtl::OUString aValue;
-
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService, aValue ))
- {
- // Create hash key from command and module as they are together a primary key to
- // the UNO service that implements the popup menu controller.
- rtl::OUString aHashKey( getHashKeyFromStrings( aCommand, aModule ));
- StatusbarControllerInfo& rControllerInfo = m_aStatusbarControllerMap[ aHashKey ];
- rControllerInfo.m_aImplementationName = aService;
- rControllerInfo.m_aValue = aValue;
- }
-}
-
-// lang.XEventListener
-void SAL_CALL ConfigurationAccess_StatusbarControllerFactory::disposing( const EventObject& ) throw(RuntimeException)
-{
- // SAFE
- // remove our reference to the config access
- ResetableGuard aLock( m_aLock );
- m_xConfigAccess.clear();
-}
-
-void ConfigurationAccess_StatusbarControllerFactory::readConfigurationData()
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bConfigAccessInitialized )
- {
- Sequence< Any > aArgs( 1 );
- PropertyValue aPropValue;
-
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
- aPropValue.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/StatusBar" ));
- aArgs[0] <<= aPropValue;
-
- try
- {
- m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- UNO_QUERY );
- }
- catch ( WrappedTargetException& )
- {
- }
-
- m_bConfigAccessInitialized = sal_True;
- }
-
- if ( m_xConfigAccess.is() )
- {
- Sequence< rtl::OUString > aStatusbarControllers = m_xConfigAccess->getElementNames();
-
- Any a;
- rtl::OUString aCommand;
- rtl::OUString aModule;
- rtl::OUString aService;
- rtl::OUString aValue;
- rtl::OUString aHashKey;
- Reference< XPropertySet > xPropertySet;
- for ( sal_Int32 i = 0; i < aStatusbarControllers.getLength(); i++ )
- {
- if ( impl_getElementProps( m_xConfigAccess->getByName( aStatusbarControllers[i] ), aCommand, aModule, aService, aValue ))
- {
- // Create hash key from command and module as they are together a primary key to
- // the UNO service that implements the popup menu controller.
- aHashKey = getHashKeyFromStrings( aCommand, aModule );
- StatusbarControllerInfo& rControllerInfo = m_aStatusbarControllerMap[ aHashKey ];
- rControllerInfo.m_aImplementationName = aService;
- rControllerInfo.m_aValue = aValue;
- }
- }
-
- // UNSAFE
- aLock.unlock();
-
- Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
- if ( xContainer.is() )
- xContainer->addContainerListener( this );
- }
-}
-
-sal_Bool ConfigurationAccess_StatusbarControllerFactory::impl_getElementProps(
- const Any& aElement,
- rtl::OUString& aCommand,
- rtl::OUString& aModule,
- rtl::OUString& aServiceSpecifier,
- rtl::OUString& aValue ) const
-{
- Reference< XPropertySet > xPropertySet;
- aElement >>= xPropertySet;
-
- if ( xPropertySet.is() )
- {
- try
- {
- xPropertySet->getPropertyValue( m_aPropCommand ) >>= aCommand;
- xPropertySet->getPropertyValue( m_aPropModule ) >>= aModule;
- xPropertySet->getPropertyValue( m_aPropController ) >>= aServiceSpecifier;
- xPropertySet->getPropertyValue( m_aPropValue ) >>= aValue;
- }
- catch ( com::sun::star::beans::UnknownPropertyException& )
- {
- return sal_False;
- }
- catch ( com::sun::star::lang::WrappedTargetException& )
- {
- return sal_False;
- }
- }
-
- return sal_True;
-}
-
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_4 ( StatusbarControllerFactory ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XServiceInfo ),
- DIRECT_INTERFACE( css::lang::XMultiComponentFactory ),
- DIRECT_INTERFACE( ::com::sun::star::frame::XUIControllerRegistration )
- )
-
-DEFINE_XTYPEPROVIDER_4 ( StatusbarControllerFactory ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- css::lang::XMultiComponentFactory ,
- ::com::sun::star::frame::XUIControllerRegistration
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( StatusbarControllerFactory ,
::cppu::OWeakObject ,
SERVICENAME_STATUSBARCONTROLLERFACTORY ,
@@ -454,169 +84,11 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( StatusbarControllerFactory
DEFINE_INIT_SERVICE ( StatusbarControllerFactory, {} )
StatusbarControllerFactory::StatusbarControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager ) :
- ThreadHelpBase(),
- m_bConfigRead( sal_False ),
- m_xServiceManager( xServiceManager )
+ ToolbarControllerFactory(xServiceManager,true)
{
- m_pConfigAccess = new ConfigurationAccess_StatusbarControllerFactory( m_xServiceManager );
+ m_pConfigAccess = new ConfigurationAccess_ControllerFactory( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/StatusBar" )),true );
m_pConfigAccess->acquire();
-}
-
-StatusbarControllerFactory::~StatusbarControllerFactory()
-{
- ResetableGuard aLock( m_aLock );
-
- // reduce reference count
- m_pConfigAccess->release();
-}
-
-// XMultiComponentFactory
-Reference< XInterface > SAL_CALL StatusbarControllerFactory::createInstanceWithContext(
- const ::rtl::OUString& aServiceSpecifier,
- const Reference< XComponentContext >& )
-throw (Exception, RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bConfigRead )
- {
- m_bConfigRead = sal_True;
- m_pConfigAccess->readConfigurationData();
- }
-
- rtl::OUString aServiceName = m_pConfigAccess->getServiceFromCommandModule( aServiceSpecifier, rtl::OUString() );
- if ( aServiceName.getLength() > 0 )
- return m_xServiceManager->createInstance( aServiceName );
- else
- return Reference< XInterface >();
- // SAFE
-}
-
-Reference< XInterface > SAL_CALL StatusbarControllerFactory::createInstanceWithArgumentsAndContext(
- const ::rtl::OUString& ServiceSpecifier,
- const Sequence< Any >& Arguments,
- const Reference< XComponentContext >& )
-throw (Exception, RuntimeException)
-{
- const rtl::OUString aPropModuleName( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" ));
- const rtl::OUString aPropValueName( RTL_CONSTASCII_USTRINGPARAM( "Value" ));
-
- rtl::OUString aPropName;
- PropertyValue aPropValue;
-
- // Retrieve the optional module name form the Arguments sequence. It is used as a part of
- // the hash map key to support different controller implementation for the same URL but different
- // module!!
- for ( int i = 0; i < Arguments.getLength(); i++ )
- {
- if (( Arguments[i] >>= aPropValue ) && ( aPropValue.Name.equals( aPropModuleName )))
- {
- aPropValue.Value >>= aPropName;
- break;
- }
- }
-
- Sequence< Any > aNewArgs( Arguments );
-
- sal_Int32 nAppendIndex = aNewArgs.getLength();
- aNewArgs.realloc( aNewArgs.getLength()+2 );
-
- // Append the command URL to the Arguments sequence so that one controller can be
- // used for more than one command URL.
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
- aPropValue.Value <<= ServiceSpecifier;
- aNewArgs[nAppendIndex] <<= aPropValue;
-
- // Append the optional value argument. It's an empty string if no additional info
- // is provided to the controller.
- rtl::OUString aValue = m_pConfigAccess->getValueFromCommandModule( ServiceSpecifier, aPropName );
- aPropValue.Name = aPropValueName;
- aPropValue.Value <<= aValue;
- aNewArgs[nAppendIndex+1] <<= aPropValue;
-
- {
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bConfigRead )
- {
- m_bConfigRead = sal_True;
- m_pConfigAccess->readConfigurationData();
- }
-
- rtl::OUString aServiceName = m_pConfigAccess->getServiceFromCommandModule( ServiceSpecifier, aPropName );
- Reference< XMultiServiceFactory > xServiceManager( m_xServiceManager );
-
- aLock.unlock();
- // SAFE
-
-
- if ( aServiceName.getLength() > 0 )
- return xServiceManager->createInstanceWithArguments( aServiceName, aNewArgs );
- else
- return Reference< XInterface >();
- }
-}
-
-Sequence< ::rtl::OUString > SAL_CALL StatusbarControllerFactory::getAvailableServiceNames()
-throw (RuntimeException)
-{
- return Sequence< ::rtl::OUString >();
-}
-
-// XUIControllerRegistration
-sal_Bool SAL_CALL StatusbarControllerFactory::hasController(
- const ::rtl::OUString& aCommandURL,
- const rtl::OUString& aModuleName )
-throw (::com::sun::star::uno::RuntimeException)
-{
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bConfigRead )
- {
- m_bConfigRead = sal_True;
- m_pConfigAccess->readConfigurationData();
- }
-
- return ( m_pConfigAccess->getServiceFromCommandModule( aCommandURL, aModuleName ).getLength() > 0 );
-}
-
-void SAL_CALL StatusbarControllerFactory::registerController(
- const ::rtl::OUString& aCommandURL,
- const ::rtl::OUString& aModuleName,
- const ::rtl::OUString& aControllerImplementationName )
-throw (RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bConfigRead )
- {
- m_bConfigRead = sal_True;
- m_pConfigAccess->readConfigurationData();
- }
-
- m_pConfigAccess->addServiceToCommandModule( aCommandURL, aModuleName, aControllerImplementationName );
- // SAFE
-}
-
-void SAL_CALL StatusbarControllerFactory::deregisterController(
- const ::rtl::OUString& aCommandURL,
- const rtl::OUString& aModuleName )
-throw (RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bConfigRead )
- {
- m_bConfigRead = sal_True;
- m_pConfigAccess->readConfigurationData();
- }
+}
- m_pConfigAccess->removeServiceFromCommandModule( aCommandURL, aModuleName );
- // SAFE
-}
} // namespace framework
diff --git a/framework/source/uifactory/statusbarfactory.cxx b/framework/source/uifactory/statusbarfactory.cxx
index 7276556c15..07303c55e7 100644
--- a/framework/source/uifactory/statusbarfactory.cxx
+++ b/framework/source/uifactory/statusbarfactory.cxx
@@ -31,6 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
#include <uifactory/statusbarfactory.hxx>
+#include <uifactory/menubarfactory.hxx>
//_________________________________________________________________________________________________________________
// my own includes
@@ -76,19 +77,6 @@ namespace framework
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( StatusBarFactory ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XServiceInfo ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XUIElementFactory )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( StatusBarFactory ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- ::com::sun::star::ui::XUIElementFactory
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( StatusBarFactory ,
::cppu::OWeakObject ,
SERVICENAME_STATUSBARFACTORY ,
@@ -98,16 +86,9 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( StatusBarFactory
DEFINE_INIT_SERVICE ( StatusBarFactory, {} )
StatusBarFactory::StatusBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) :
- ThreadHelpBase( &Application::GetSolarMutex() )
- , m_xServiceManager( xServiceManager )
- , m_xModuleManager( xServiceManager->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ))),
- UNO_QUERY )
-{
-}
-
-StatusBarFactory::~StatusBarFactory()
+ MenuBarFactory( xServiceManager,true )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarFactory::StatusBarFactory" );
}
// XUIElementFactory
@@ -116,88 +97,15 @@ Reference< XUIElement > SAL_CALL StatusBarFactory::createUIElement(
const Sequence< PropertyValue >& Args )
throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarFactory::createUIElement" );
// SAFE
ResetableGuard aLock( m_aLock );
-
- Reference< XUIConfigurationManager > xConfigSource;
- Reference< XFrame > xFrame;
- rtl::OUString aResourceURL( ResourceURL );
- sal_Bool bPersistent( sal_True );
-
- for ( sal_Int32 n = 0; n < Args.getLength(); n++ )
- {
- if ( Args[n].Name.equalsAscii( "ConfigurationSource" ))
- Args[n].Value >>= xConfigSource;
- else if ( Args[n].Name.equalsAscii( "Frame" ))
- Args[n].Value >>= xFrame;
- else if ( Args[n].Name.equalsAscii( "ResourceURL" ))
- Args[n].Value >>= aResourceURL;
- else if ( Args[n].Name.equalsAscii( "Persistent" ))
- Args[n].Value >>= bPersistent;
- }
-
- Reference< XUIConfigurationManager > xCfgMgr;
- if ( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/" ))) != 0 )
- throw IllegalArgumentException();
- else
- {
- // Identify frame and determine document based ui configuration manager/module ui configuration manager
- if ( xFrame.is() && !xConfigSource.is() )
- {
- bool bHasSettings( false );
- Reference< XModel > xModel;
-
- Reference< XController > xController = xFrame->getController();
- if ( xController.is() )
- xModel = xController->getModel();
-
- if ( xModel.is() )
- {
- Reference< XUIConfigurationManagerSupplier > xUIConfigurationManagerSupplier( xModel, UNO_QUERY );
- if ( xUIConfigurationManagerSupplier.is() )
- {
- xCfgMgr = xUIConfigurationManagerSupplier->getUIConfigurationManager();
- bHasSettings = xCfgMgr->hasSettings( aResourceURL );
- }
- }
-
- if ( !bHasSettings )
- {
- rtl::OUString aModuleIdentifier = m_xModuleManager->identify( Reference< XInterface >( xFrame, UNO_QUERY ));
- if ( aModuleIdentifier.getLength() )
- {
- Reference< ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(
- m_xServiceManager->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ))),
- UNO_QUERY );
- xCfgMgr = xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier );
- bHasSettings = xCfgMgr->hasSettings( aResourceURL );
- }
- }
- }
- }
-
- PropertyValue aPropValue;
- Sequence< Any > aPropSeq( 4 );
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- aPropValue.Value <<= xFrame;
- aPropSeq[0] <<= aPropValue;
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" ));
- aPropValue.Value <<= xCfgMgr;
- aPropSeq[1] <<= aPropValue;
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" ));
- aPropValue.Value <<= aResourceURL;
- aPropSeq[2] <<= aPropValue;
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Persistent" ));
- aPropValue.Value <<= bPersistent;
- aPropSeq[3] <<= aPropValue;
-
- vos::OGuard aGuard( Application::GetSolarMutex() );
- StatusBarWrapper* pStatusBarWrapper = new StatusBarWrapper( m_xServiceManager );
- Reference< ::com::sun::star::ui::XUIElement > xStatusBar( (OWeakObject *)pStatusBarWrapper, UNO_QUERY );
- Reference< XInitialization > xInit( xStatusBar, UNO_QUERY );
- xInit->initialize( aPropSeq );
- return xStatusBar;
+ StatusBarWrapper* pWrapper = new StatusBarWrapper( m_xServiceManager );
+ Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY );
+ Reference< ::com::sun::star::frame::XModuleManager > xModuleManager = m_xModuleManager;
+ aLock.unlock();
+ MenuBarFactory::CreateUIElement(ResourceURL,Args,NULL,"private:resource/statusbar/",xMenuBar,xModuleManager,m_xServiceManager);
+ return xMenuBar;
}
}
diff --git a/framework/source/uifactory/toolbarcontrollerfactory.cxx b/framework/source/uifactory/toolbarcontrollerfactory.cxx
index 96b81b9075..8bff439d50 100644
--- a/framework/source/uifactory/toolbarcontrollerfactory.cxx
+++ b/framework/source/uifactory/toolbarcontrollerfactory.cxx
@@ -35,6 +35,7 @@
// my own includes
//_________________________________________________________________________________________________________________
#include "uifactory/toolbarcontrollerfactory.hxx"
+#include "uifactory/factoryconfiguration.hxx"
#include <threadhelp/resetableguard.hxx>
#include "services.h"
@@ -72,326 +73,9 @@ using namespace ::com::sun::star::frame;
namespace framework
{
-// global function needed by both implementations
-static rtl::OUString getHashKeyFromStrings( const rtl::OUString& aCommandURL, const rtl::OUString& aModuleName )
-{
- rtl::OUStringBuffer aKey( aCommandURL );
- aKey.appendAscii( "-" );
- aKey.append( aModuleName );
- return aKey.makeStringAndClear();
-}
-
-
-//*****************************************************************************************************************
-// Configuration access class for ToolbarControllerFactory implementation
-//*****************************************************************************************************************
-
-class ConfigurationAccess_ToolbarControllerFactory : // interfaces
- public XTypeProvider ,
- public XContainerListener ,
- // baseclasses
- // Order is neccessary for right initialization!
- private ThreadHelpBase ,
- public ::cppu::OWeakObject
-{
- public:
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
- ConfigurationAccess_ToolbarControllerFactory( Reference< XMultiServiceFactory >& rServiceManager );
- virtual ~ConfigurationAccess_ToolbarControllerFactory();
-
- void readConfigurationData();
-
- rtl::OUString getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const;
- void addServiceToCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule, const rtl::OUString& rServiceSpecifier );
- void removeServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule );
-
- // container.XContainerListener
- virtual void SAL_CALL elementInserted( const ContainerEvent& aEvent ) throw(RuntimeException);
- virtual void SAL_CALL elementRemoved ( const ContainerEvent& aEvent ) throw(RuntimeException);
- virtual void SAL_CALL elementReplaced( const ContainerEvent& aEvent ) throw(RuntimeException);
-
- // lang.XEventListener
- virtual void SAL_CALL disposing( const EventObject& aEvent ) throw(RuntimeException);
-
- private:
- class ToolbarControllerMap : public std::hash_map< rtl::OUString,
- rtl::OUString,
- OUStringHashCode,
- ::std::equal_to< ::rtl::OUString > >
- {
- inline void free()
- {
- ToolbarControllerMap().swap( *this );
- }
- };
-
- sal_Bool impl_getElementProps( const Any& aElement, rtl::OUString& aCommand, rtl::OUString& aModule, rtl::OUString& aServiceSpecifier ) const;
-
- rtl::OUString m_aPropCommand;
- rtl::OUString m_aPropModule;
- rtl::OUString m_aPropController;
- ToolbarControllerMap m_aToolbarControllerMap;
- Reference< XMultiServiceFactory > m_xServiceManager;
- Reference< XMultiServiceFactory > m_xConfigProvider;
- Reference< XNameAccess > m_xConfigAccess;
- sal_Bool m_bConfigAccessInitialized;
-};
-
-//*****************************************************************************************************************
-// XInterface, XTypeProvider
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( ConfigurationAccess_ToolbarControllerFactory ,
- OWeakObject ,
- DIRECT_INTERFACE ( XTypeProvider ),
- DIRECT_INTERFACE ( XContainerListener ),
- DERIVED_INTERFACE( css::lang::XEventListener, XContainerListener )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( ConfigurationAccess_ToolbarControllerFactory ,
- XTypeProvider ,
- XContainerListener ,
- css::lang::XEventListener
- )
-
-ConfigurationAccess_ToolbarControllerFactory::ConfigurationAccess_ToolbarControllerFactory( Reference< XMultiServiceFactory >& rServiceManager ) :
- ThreadHelpBase(),
- m_aPropCommand( RTL_CONSTASCII_USTRINGPARAM( "Command" )),
- m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )),
- m_aPropController( RTL_CONSTASCII_USTRINGPARAM( "Controller" )),
- m_xServiceManager( rServiceManager ),
- m_bConfigAccessInitialized( sal_False )
-{
- m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- UNO_QUERY );
-}
-
-ConfigurationAccess_ToolbarControllerFactory::~ConfigurationAccess_ToolbarControllerFactory()
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
- if ( xContainer.is() )
- xContainer->removeContainerListener( this );
-}
-
-rtl::OUString ConfigurationAccess_ToolbarControllerFactory::getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- ToolbarControllerMap::const_iterator pIter =
- m_aToolbarControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule ));
-
- if ( pIter != m_aToolbarControllerMap.end() )
- return pIter->second;
- else
- {
- // Try to detect if we have a generic popup menu controller
- pIter = m_aToolbarControllerMap.find( getHashKeyFromStrings( rCommandURL, rtl::OUString() ));
-
- if ( pIter != m_aToolbarControllerMap.end() )
- return pIter->second;
- }
-
- return rtl::OUString();
-}
-
-void ConfigurationAccess_ToolbarControllerFactory::addServiceToCommandModule(
- const rtl::OUString& rCommandURL,
- const rtl::OUString& rModule,
- const rtl::OUString& rServiceSpecifier )
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- rtl::OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule );
- m_aToolbarControllerMap.insert( ToolbarControllerMap::value_type( aHashKey, rServiceSpecifier ));
-}
-
-void ConfigurationAccess_ToolbarControllerFactory::removeServiceFromCommandModule(
- const rtl::OUString& rCommandURL,
- const rtl::OUString& rModule )
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- rtl::OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule );
- m_aToolbarControllerMap.erase( aHashKey );
-}
-
-// container.XContainerListener
-void SAL_CALL ConfigurationAccess_ToolbarControllerFactory::elementInserted( const ContainerEvent& aEvent ) throw(RuntimeException)
-{
- rtl::OUString aCommand;
- rtl::OUString aModule;
- rtl::OUString aService;
-
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService ))
- {
- // Create hash key from command and module as they are together a primary key to
- // the UNO service that implements the popup menu controller.
- rtl::OUString aHashKey( getHashKeyFromStrings( aCommand, aModule ));
- m_aToolbarControllerMap.insert( ToolbarControllerMap::value_type( aHashKey, aService ));
- }
-}
-
-void SAL_CALL ConfigurationAccess_ToolbarControllerFactory::elementRemoved ( const ContainerEvent& aEvent ) throw(RuntimeException)
-{
- rtl::OUString aCommand;
- rtl::OUString aModule;
- rtl::OUString aService;
-
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService ))
- {
- // Create hash key from command and module as they are together a primary key to
- // the UNO service that implements the popup menu controller.
- rtl::OUString aHashKey( getHashKeyFromStrings( aCommand, aModule ));
- m_aToolbarControllerMap.erase( aHashKey );
- }
-}
-
-void SAL_CALL ConfigurationAccess_ToolbarControllerFactory::elementReplaced( const ContainerEvent& aEvent ) throw(RuntimeException)
-{
- rtl::OUString aCommand;
- rtl::OUString aModule;
- rtl::OUString aService;
-
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService ))
- {
- // Create hash key from command and module as they are together a primary key to
- // the UNO service that implements the popup menu controller.
- rtl::OUString aHashKey( getHashKeyFromStrings( aCommand, aModule ));
- m_aToolbarControllerMap.erase( aHashKey );
- m_aToolbarControllerMap.insert( ToolbarControllerMap::value_type( aHashKey, aService ));
- }
-}
-
-// lang.XEventListener
-void SAL_CALL ConfigurationAccess_ToolbarControllerFactory::disposing( const EventObject& ) throw(RuntimeException)
-{
- // SAFE
- // remove our reference to the config access
- ResetableGuard aLock( m_aLock );
- m_xConfigAccess.clear();
-}
-
-void ConfigurationAccess_ToolbarControllerFactory::readConfigurationData()
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- if ( !m_bConfigAccessInitialized )
- {
- Sequence< Any > aArgs( 1 );
- PropertyValue aPropValue;
-
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
- aPropValue.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/ToolBar" ));
- aArgs[0] <<= aPropValue;
-
- try
- {
- m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- UNO_QUERY );
- }
- catch ( WrappedTargetException& )
- {
- }
-
- m_bConfigAccessInitialized = sal_True;
- }
-
- if ( m_xConfigAccess.is() )
- {
- Sequence< rtl::OUString > aToolbarControllers = m_xConfigAccess->getElementNames();
-
- Any a;
- rtl::OUString aCommand;
- rtl::OUString aModule;
- rtl::OUString aService;
- rtl::OUString aHashKey;
- Reference< XPropertySet > xPropertySet;
- for ( sal_Int32 i = 0; i < aToolbarControllers.getLength(); i++ )
- {
- if ( impl_getElementProps( m_xConfigAccess->getByName( aToolbarControllers[i] ), aCommand, aModule, aService ))
- {
- // Create hash key from command and module as they are together a primary key to
- // the UNO service that implements the popup menu controller.
- aHashKey = getHashKeyFromStrings( aCommand, aModule );
- m_aToolbarControllerMap.insert( ToolbarControllerMap::value_type( aHashKey, aService ));
- }
- }
-
- // UNSAFE
- aLock.unlock();
-
- Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
- if ( xContainer.is() )
- xContainer->addContainerListener( this );
- }
-}
-
-sal_Bool ConfigurationAccess_ToolbarControllerFactory::impl_getElementProps( const Any& aElement, rtl::OUString& aCommand, rtl::OUString& aModule, rtl::OUString& aServiceSpecifier ) const
-{
- Reference< XPropertySet > xPropertySet;
- aElement >>= xPropertySet;
-
- if ( xPropertySet.is() )
- {
- try
- {
- xPropertySet->getPropertyValue( m_aPropCommand ) >>= aCommand;
- xPropertySet->getPropertyValue( m_aPropModule ) >>= aModule;
- xPropertySet->getPropertyValue( m_aPropController ) >>= aServiceSpecifier;
- }
- catch ( com::sun::star::beans::UnknownPropertyException& )
- {
- return sal_False;
- }
- catch ( com::sun::star::lang::WrappedTargetException& )
- {
- return sal_False;
- }
- }
-
- return sal_True;
-}
-
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_4 ( ToolbarControllerFactory ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XServiceInfo ),
- DIRECT_INTERFACE( css::lang::XMultiComponentFactory ),
- DIRECT_INTERFACE( ::com::sun::star::frame::XUIControllerRegistration )
- )
-
-DEFINE_XTYPEPROVIDER_4 ( ToolbarControllerFactory ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- css::lang::XMultiComponentFactory ,
- ::com::sun::star::frame::XUIControllerRegistration
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( ToolbarControllerFactory ,
::cppu::OWeakObject ,
SERVICENAME_TOOLBARCONTROLLERFACTORY ,
@@ -405,10 +89,18 @@ ToolbarControllerFactory::ToolbarControllerFactory( const Reference< XMultiServi
m_bConfigRead( sal_False ),
m_xServiceManager( xServiceManager )
{
- m_pConfigAccess = new ConfigurationAccess_ToolbarControllerFactory( m_xServiceManager );
+ m_pConfigAccess = new ConfigurationAccess_ControllerFactory( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/ToolBar" )) );
m_pConfigAccess->acquire();
}
+ToolbarControllerFactory::ToolbarControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager,bool ) :
+ ThreadHelpBase(),
+ m_bConfigRead( sal_False ),
+ m_xServiceManager( xServiceManager )
+{
+ m_pConfigAccess = NULL;
+}
+
ToolbarControllerFactory::~ToolbarControllerFactory()
{
ResetableGuard aLock( m_aLock );
@@ -447,6 +139,7 @@ Reference< XInterface > SAL_CALL ToolbarControllerFactory::createInstanceWithArg
throw (Exception, RuntimeException)
{
const rtl::OUString aPropModuleName( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" ));
+ const rtl::OUString aPropValueName( RTL_CONSTASCII_USTRINGPARAM( "Value" ));
rtl::OUString aPropName;
PropertyValue aPropValue;
@@ -463,18 +156,30 @@ throw (Exception, RuntimeException)
}
}
- // Append the command URL to the Arguments sequence so that one controller can be
- // used for more than one command URL.
Sequence< Any > aNewArgs( Arguments );
sal_Int32 nAppendIndex = aNewArgs.getLength();
- aNewArgs.realloc( aNewArgs.getLength()+1 );
+ bool bHasValue = m_pConfigAccess->hasValue();
+ aNewArgs.realloc( aNewArgs.getLength() + (bHasValue ? 2 : 1) );
+
+ // Append the command URL to the Arguments sequence so that one controller can be
+ // used for more than one command URL.
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
aPropValue.Value <<= ServiceSpecifier;
aNewArgs[nAppendIndex] <<= aPropValue;
+
+ if ( bHasValue )
+ {
+ // Append the optional value argument. It's an empty string if no additional info
+ // is provided to the controller.
+ rtl::OUString aValue = m_pConfigAccess->getValueFromCommandModule( ServiceSpecifier, aPropName );
+ aPropValue.Name = aPropValueName;
+ aPropValue.Value <<= aValue;
+ aNewArgs[nAppendIndex+1] <<= aPropValue;
+ }
- // SAFE
{
+ // SAFE
ResetableGuard aLock( m_aLock );
if ( !m_bConfigRead )
@@ -482,14 +187,19 @@ throw (Exception, RuntimeException)
m_bConfigRead = sal_True;
m_pConfigAccess->readConfigurationData();
}
-
+
rtl::OUString aServiceName = m_pConfigAccess->getServiceFromCommandModule( ServiceSpecifier, aPropName );
+ Reference< XMultiServiceFactory > xServiceManager( m_xServiceManager );
+
+ aLock.unlock();
+ // SAFE
+
+
if ( aServiceName.getLength() > 0 )
- return m_xServiceManager->createInstanceWithArguments( aServiceName, aNewArgs );
+ return xServiceManager->createInstanceWithArguments( aServiceName, aNewArgs );
else
return Reference< XInterface >();
}
- // SAFE
}
Sequence< ::rtl::OUString > SAL_CALL ToolbarControllerFactory::getAvailableServiceNames()
diff --git a/framework/source/uifactory/toolboxfactory.cxx b/framework/source/uifactory/toolboxfactory.cxx
index 5c969eb3d6..3540c81c3c 100644
--- a/framework/source/uifactory/toolboxfactory.cxx
+++ b/framework/source/uifactory/toolboxfactory.cxx
@@ -76,19 +76,6 @@ namespace framework
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( ToolBoxFactory ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XServiceInfo ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XUIElementFactory )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( ToolBoxFactory ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- ::com::sun::star::ui::XUIElementFactory
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( ToolBoxFactory ,
::cppu::OWeakObject ,
SERVICENAME_TOOLBARFACTORY ,
@@ -98,15 +85,7 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( ToolBoxFactory
DEFINE_INIT_SERVICE ( ToolBoxFactory, {} )
ToolBoxFactory::ToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) :
- ThreadHelpBase( &Application::GetSolarMutex() )
- , m_xServiceManager( xServiceManager )
- , m_xModuleManager( xServiceManager->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ))),
- UNO_QUERY )
-{
-}
-
-ToolBoxFactory::~ToolBoxFactory()
+ MenuBarFactory( xServiceManager,true )
{
}
@@ -116,94 +95,13 @@ Reference< XUIElement > SAL_CALL ToolBoxFactory::createUIElement(
const Sequence< PropertyValue >& Args )
throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
{
- // SAFE
ResetableGuard aLock( m_aLock );
-
- Reference< XUIConfigurationManager > xConfigSource;
- Reference< XFrame > xFrame;
- rtl::OUString aResourceURL( ResourceURL );
- sal_Bool bPersistent( sal_True );
- sal_Bool bPopupMode( sal_False );
-
- for ( sal_Int32 n = 0; n < Args.getLength(); n++ )
- {
- if ( Args[n].Name.equalsAscii( "ConfigurationSource" ))
- Args[n].Value >>= xConfigSource;
- else if ( Args[n].Name.equalsAsciiL( "Frame", 5 ))
- Args[n].Value >>= xFrame;
- else if ( Args[n].Name.equalsAsciiL( "ResourceURL", 11 ))
- Args[n].Value >>= aResourceURL;
- else if ( Args[n].Name.equalsAsciiL( "Persistent", 10 ))
- Args[n].Value >>= bPersistent;
- else if ( Args[n].Name.equalsAsciiL( "PopupMode", 9 ))
- Args[n].Value >>= bPopupMode;
- }
-
- Reference< XUIConfigurationManager > xCfgMgr;
- if ( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/" ))) != 0 )
- throw IllegalArgumentException();
- else
- {
- // Identify frame and determine document based ui configuration manager/module ui configuration manager
- if ( xFrame.is() && !xConfigSource.is() )
- {
- bool bHasSettings( false );
- Reference< XModel > xModel;
-
- Reference< XController > xController = xFrame->getController();
- if ( xController.is() )
- xModel = xController->getModel();
-
- if ( xModel.is() )
- {
- Reference< XUIConfigurationManagerSupplier > xUIConfigurationManagerSupplier( xModel, UNO_QUERY );
- if ( xUIConfigurationManagerSupplier.is() )
- {
- xCfgMgr = xUIConfigurationManagerSupplier->getUIConfigurationManager();
- bHasSettings = xCfgMgr->hasSettings( aResourceURL );
- }
- }
-
- if ( !bHasSettings )
- {
- rtl::OUString aModuleIdentifier = m_xModuleManager->identify( Reference< XInterface >( xFrame, UNO_QUERY ));
- if ( aModuleIdentifier.getLength() )
- {
- Reference< ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(
- m_xServiceManager->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ))),
- UNO_QUERY );
- xCfgMgr = xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier );
- bHasSettings = xCfgMgr->hasSettings( aResourceURL );
- }
- }
- }
- }
-
- PropertyValue aPropValue;
- Sequence< Any > aPropSeq( 5 );
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- aPropValue.Value <<= xFrame;
- aPropSeq[0] <<= aPropValue;
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" ));
- aPropValue.Value <<= xCfgMgr;
- aPropSeq[1] <<= aPropValue;
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" ));
- aPropValue.Value <<= aResourceURL;
- aPropSeq[2] <<= aPropValue;
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Persistent" ));
- aPropValue.Value <<= bPersistent;
- aPropSeq[3] <<= aPropValue;
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PopupMode" ));
- aPropValue.Value <<= bPopupMode;
- aPropSeq[4] <<= aPropValue;
-
- vos::OGuard aGuard( Application::GetSolarMutex() );
- ToolBarWrapper* pToolBarWrapper = new ToolBarWrapper( m_xServiceManager );
- Reference< ::com::sun::star::ui::XUIElement > xToolBar( (OWeakObject *)pToolBarWrapper, UNO_QUERY );
- Reference< XInitialization > xInit( xToolBar, UNO_QUERY );
- xInit->initialize( aPropSeq );
- return xToolBar;
+ ToolBarWrapper* pWrapper = new ToolBarWrapper( m_xServiceManager );
+ Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY );
+ Reference< ::com::sun::star::frame::XModuleManager > xModuleManager = m_xModuleManager;
+ aLock.unlock();
+ CreateUIElement(ResourceURL,Args,"PopupMode","private:resource/toolbar/",xMenuBar,xModuleManager,m_xServiceManager);
+ return xMenuBar;
}
}
diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx
index 59ee742328..67e6a936b0 100644
--- a/framework/source/uifactory/uielementfactorymanager.cxx
+++ b/framework/source/uifactory/uielementfactorymanager.cxx
@@ -35,6 +35,7 @@
// my own includes
//_________________________________________________________________________________________________________________
#include <uifactory/uielementfactorymanager.hxx>
+#include <uifactory/windowcontentfactorymanager.hxx>
#include <threadhelp/resetableguard.hxx>
#include "services.h"
@@ -55,7 +56,7 @@
#include <cppuhelper/weak.hxx>
#include <tools/urlobj.hxx>
#include <vcl/svapp.hxx>
-
+#include <rtl/logfile.hxx>
//_________________________________________________________________________________________________________________
// Defines
//_________________________________________________________________________________________________________________
@@ -93,93 +94,23 @@ rtl::OUString getHashKeyFromStrings( const rtl::OUString& aType, const rtl::OUSt
// Configuration access class for UIElementFactoryManager implementation
//*****************************************************************************************************************
-class ConfigurationAccess_UIElementFactoryManager : // interfaces
- public XTypeProvider ,
- public XContainerListener ,
- // baseclasses
- // Order is neccessary for right initialization!
- private ThreadHelpBase ,
- public ::cppu::OWeakObject
-{
- public:
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
- ConfigurationAccess_UIElementFactoryManager( Reference< XMultiServiceFactory >& rServiceManager );
- virtual ~ConfigurationAccess_UIElementFactoryManager();
-
- void readConfigurationData();
-
- rtl::OUString getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule ) const;
- void addFactorySpecifierToTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule, const rtl::OUString& aServiceSpecifier );
- void removeFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule );
- Sequence< Sequence< PropertyValue > > getFactoriesDescription() const;
-
- // container.XContainerListener
- virtual void SAL_CALL elementInserted( const ContainerEvent& aEvent ) throw(RuntimeException);
- virtual void SAL_CALL elementRemoved ( const ContainerEvent& aEvent ) throw(RuntimeException);
- virtual void SAL_CALL elementReplaced( const ContainerEvent& aEvent ) throw(RuntimeException);
-
- // lang.XEventListener
- virtual void SAL_CALL disposing( const EventObject& aEvent ) throw(RuntimeException);
-
- private:
- class UIElementFactoryManagerMap : public std::hash_map< rtl::OUString,
- rtl::OUString,
- OUStringHashCode,
- ::std::equal_to< ::rtl::OUString > >
- {
- inline void free()
- {
- UIElementFactoryManagerMap().swap( *this );
- }
- };
-
- sal_Bool impl_getElementProps( const Any& rElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const;
-
- rtl::OUString m_aPropType;
- rtl::OUString m_aPropName;
- rtl::OUString m_aPropModule;
- rtl::OUString m_aPropFactory;
- UIElementFactoryManagerMap m_aUIElementFactoryManagerMap;
- Reference< XMultiServiceFactory > m_xServiceManager;
- Reference< XMultiServiceFactory > m_xConfigProvider;
- Reference< XNameAccess > m_xConfigAccess;
- sal_Bool m_bConfigAccessInitialized;
-};
-//*****************************************************************************************************************
-// XInterface, XTypeProvider
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( ConfigurationAccess_UIElementFactoryManager ,
- OWeakObject ,
- DIRECT_INTERFACE ( XTypeProvider ),
- DIRECT_INTERFACE ( XContainerListener ),
- DERIVED_INTERFACE( css::lang::XEventListener, XContainerListener )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( ConfigurationAccess_UIElementFactoryManager ,
- XTypeProvider ,
- XContainerListener ,
- css::lang::XEventListener
- )
-
-ConfigurationAccess_UIElementFactoryManager::ConfigurationAccess_UIElementFactoryManager( Reference< XMultiServiceFactory >& rServiceManager ) :
+ConfigurationAccess_FactoryManager::ConfigurationAccess_FactoryManager( Reference< XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot ) :
ThreadHelpBase(),
m_aPropType( RTL_CONSTASCII_USTRINGPARAM( "Type" )),
m_aPropName( RTL_CONSTASCII_USTRINGPARAM( "Name" )),
m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )),
m_aPropFactory( RTL_CONSTASCII_USTRINGPARAM( "FactoryImplementation" )),
+ m_sRoot(_sRoot),
m_xServiceManager( rServiceManager ),
- m_bConfigAccessInitialized( sal_False )
+ m_bConfigAccessInitialized( sal_False ),
+ m_bConfigDirty(true)
{
- m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- UNO_QUERY );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::ConfigurationAccess_FactoryManager" );
+ m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance( SERVICENAME_CFGPROVIDER),UNO_QUERY );
}
-ConfigurationAccess_UIElementFactoryManager::~ConfigurationAccess_UIElementFactoryManager()
+ConfigurationAccess_FactoryManager::~ConfigurationAccess_FactoryManager()
{
// SAFE
ResetableGuard aLock( m_aLock );
@@ -189,19 +120,20 @@ ConfigurationAccess_UIElementFactoryManager::~ConfigurationAccess_UIElementFacto
xContainer->removeContainerListener( this );
}
-rtl::OUString ConfigurationAccess_UIElementFactoryManager::getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule ) const
+rtl::OUString ConfigurationAccess_FactoryManager::getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule ) const
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::getFactorySpecifierFromTypeNameModule" );
// SAFE
ResetableGuard aLock( m_aLock );
-
- UIElementFactoryManagerMap::const_iterator pIter =
- m_aUIElementFactoryManagerMap.find( getHashKeyFromStrings( rType, rName, rModule ));
- if ( pIter != m_aUIElementFactoryManagerMap.end() )
+
+ FactoryManagerMap::const_iterator pIter =
+ m_aFactoryManagerMap.find( getHashKeyFromStrings( rType, rName, rModule ));
+ if ( pIter != m_aFactoryManagerMap.end() )
return pIter->second;
else
{
- pIter = m_aUIElementFactoryManagerMap.find( getHashKeyFromStrings( rType, rName, rtl::OUString() ));
- if ( pIter != m_aUIElementFactoryManagerMap.end() )
+ pIter = m_aFactoryManagerMap.find( getHashKeyFromStrings( rType, rName, rtl::OUString() ));
+ if ( pIter != m_aFactoryManagerMap.end() )
return pIter->second;
else
{
@@ -210,13 +142,13 @@ rtl::OUString ConfigurationAccess_UIElementFactoryManager::getFactorySpecifierFr
if ( nIndex > 0 )
{
rtl::OUString aName = rName.copy( 0, nIndex+1 );
- pIter = m_aUIElementFactoryManagerMap.find( getHashKeyFromStrings( rType, aName, rtl::OUString() ));
- if ( pIter != m_aUIElementFactoryManagerMap.end() )
+ pIter = m_aFactoryManagerMap.find( getHashKeyFromStrings( rType, aName, rtl::OUString() ));
+ if ( pIter != m_aFactoryManagerMap.end() )
return pIter->second;
}
- pIter = m_aUIElementFactoryManagerMap.find( getHashKeyFromStrings( rType, rtl::OUString(), rtl::OUString() ));
- if ( pIter != m_aUIElementFactoryManagerMap.end() )
+ pIter = m_aFactoryManagerMap.find( getHashKeyFromStrings( rType, rtl::OUString(), rtl::OUString() ));
+ if ( pIter != m_aFactoryManagerMap.end() )
return pIter->second;
}
}
@@ -224,49 +156,50 @@ rtl::OUString ConfigurationAccess_UIElementFactoryManager::getFactorySpecifierFr
return rtl::OUString();
}
-void ConfigurationAccess_UIElementFactoryManager::addFactorySpecifierToTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule, const rtl::OUString& rServiceSpecifier )
+void ConfigurationAccess_FactoryManager::addFactorySpecifierToTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule, const rtl::OUString& rServiceSpecifier )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::addFactorySpecifierToTypeNameModule" );
// SAFE
ResetableGuard aLock( m_aLock );
rtl::OUString aHashKey = getHashKeyFromStrings( rType, rName, rModule );
- UIElementFactoryManagerMap::const_iterator pIter =
- m_aUIElementFactoryManagerMap.find( getHashKeyFromStrings( rType, rName, rModule ));
+ FactoryManagerMap::const_iterator pIter = m_aFactoryManagerMap.find( aHashKey );
- if ( pIter != m_aUIElementFactoryManagerMap.end() )
+ if ( pIter != m_aFactoryManagerMap.end() )
throw ElementExistException();
else
- m_aUIElementFactoryManagerMap.insert( UIElementFactoryManagerMap::value_type( aHashKey, rServiceSpecifier ));
+ m_aFactoryManagerMap.insert( FactoryManagerMap::value_type( aHashKey, rServiceSpecifier ));
}
-void ConfigurationAccess_UIElementFactoryManager::removeFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule )
+void ConfigurationAccess_FactoryManager::removeFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::removeFactorySpecifierFromTypeNameModule" );
// SAFE
ResetableGuard aLock( m_aLock );
rtl::OUString aHashKey = getHashKeyFromStrings( rType, rName, rModule );
- UIElementFactoryManagerMap::const_iterator pIter =
- m_aUIElementFactoryManagerMap.find( getHashKeyFromStrings( rType, rName, rModule ));
+ FactoryManagerMap::const_iterator pIter = m_aFactoryManagerMap.find( aHashKey );
- if ( pIter == m_aUIElementFactoryManagerMap.end() )
+ if ( pIter == m_aFactoryManagerMap.end() )
throw NoSuchElementException();
else
- m_aUIElementFactoryManagerMap.erase( aHashKey );
+ m_aFactoryManagerMap.erase( aHashKey );
}
-Sequence< Sequence< PropertyValue > > ConfigurationAccess_UIElementFactoryManager::getFactoriesDescription() const
+Sequence< Sequence< PropertyValue > > ConfigurationAccess_FactoryManager::getFactoriesDescription() const
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::getFactoriesDescription" );
// SAFE
ResetableGuard aLock( m_aLock );
Sequence< Sequence< PropertyValue > > aSeqSeq;
sal_Int32 nIndex( 0 );
- UIElementFactoryManagerMap::const_iterator pIter = m_aUIElementFactoryManagerMap.begin();
- while ( pIter != m_aUIElementFactoryManagerMap.end() )
+ FactoryManagerMap::const_iterator pIter = m_aFactoryManagerMap.begin();
+ while ( pIter != m_aFactoryManagerMap.end() )
{
rtl::OUString aFactory = pIter->first;
if ( aFactory.getLength() > 0 )
@@ -300,8 +233,9 @@ Sequence< Sequence< PropertyValue > > ConfigurationAccess_UIElementFactoryManage
}
// container.XContainerListener
-void SAL_CALL ConfigurationAccess_UIElementFactoryManager::elementInserted( const ContainerEvent& aEvent ) throw(RuntimeException)
+void SAL_CALL ConfigurationAccess_FactoryManager::elementInserted( const ContainerEvent& aEvent ) throw(RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::elementInserted" );
rtl::OUString aType;
rtl::OUString aName;
rtl::OUString aModule;
@@ -315,12 +249,13 @@ void SAL_CALL ConfigurationAccess_UIElementFactoryManager::elementInserted( cons
// Create hash key from type, name and module as they are together a primary key to
// the UNO service that implements a user interface factory.
rtl::OUString aHashKey( getHashKeyFromStrings( aType, aName, aModule ));
- m_aUIElementFactoryManagerMap.insert( UIElementFactoryManagerMap::value_type( aHashKey, aService ));
+ m_aFactoryManagerMap.insert( FactoryManagerMap::value_type( aHashKey, aService ));
}
}
-void SAL_CALL ConfigurationAccess_UIElementFactoryManager::elementRemoved ( const ContainerEvent& aEvent ) throw(RuntimeException)
+void SAL_CALL ConfigurationAccess_FactoryManager::elementRemoved ( const ContainerEvent& aEvent ) throw(RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::elementRemoved " );
rtl::OUString aType;
rtl::OUString aName;
rtl::OUString aModule;
@@ -334,12 +269,13 @@ void SAL_CALL ConfigurationAccess_UIElementFactoryManager::elementRemoved ( cons
// Create hash key from command and model as they are together a primary key to
// the UNO service that implements the popup menu controller.
rtl::OUString aHashKey( getHashKeyFromStrings( aType, aName, aModule ));
- m_aUIElementFactoryManagerMap.erase( aHashKey );
+ m_aFactoryManagerMap.erase( aHashKey );
}
}
-void SAL_CALL ConfigurationAccess_UIElementFactoryManager::elementReplaced( const ContainerEvent& aEvent ) throw(RuntimeException)
+void SAL_CALL ConfigurationAccess_FactoryManager::elementReplaced( const ContainerEvent& aEvent ) throw(RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::elementReplaced" );
rtl::OUString aType;
rtl::OUString aName;
rtl::OUString aModule;
@@ -353,22 +289,24 @@ void SAL_CALL ConfigurationAccess_UIElementFactoryManager::elementReplaced( cons
// Create hash key from command and model as they are together a primary key to
// the UNO service that implements the popup menu controller.
rtl::OUString aHashKey( getHashKeyFromStrings( aType, aName, aModule ));
- m_aUIElementFactoryManagerMap.erase( aHashKey );
- m_aUIElementFactoryManagerMap.insert( UIElementFactoryManagerMap::value_type( aHashKey, aService ));
+ m_aFactoryManagerMap.erase( aHashKey );
+ m_aFactoryManagerMap.insert( FactoryManagerMap::value_type( aHashKey, aService ));
}
}
// lang.XEventListener
-void SAL_CALL ConfigurationAccess_UIElementFactoryManager::disposing( const EventObject& ) throw(RuntimeException)
+void SAL_CALL ConfigurationAccess_FactoryManager::disposing( const EventObject& ) throw(RuntimeException)
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::disposing" );
// SAFE
// remove our reference to the config access
ResetableGuard aLock( m_aLock );
m_xConfigAccess.clear();
}
-void ConfigurationAccess_UIElementFactoryManager::readConfigurationData()
+void ConfigurationAccess_FactoryManager::readConfigurationData()
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::readConfigurationData" );
// SAFE
ResetableGuard aLock( m_aLock );
@@ -378,16 +316,12 @@ void ConfigurationAccess_UIElementFactoryManager::readConfigurationData()
PropertyValue aPropValue;
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
- aPropValue.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Factories/Registered/UIElementFactories" ));
+ aPropValue.Value <<= m_sRoot;
aArgs[0] <<= aPropValue;
try
{
- m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- UNO_QUERY );
+ m_xConfigAccess.set( m_xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,aArgs ), UNO_QUERY );
}
catch ( WrappedTargetException& )
{
@@ -400,7 +334,6 @@ void ConfigurationAccess_UIElementFactoryManager::readConfigurationData()
{
Sequence< rtl::OUString > aUIElementFactories = m_xConfigAccess->getElementNames();
- Any a;
rtl::OUString aType;
rtl::OUString aName;
rtl::OUString aModule;
@@ -414,7 +347,7 @@ void ConfigurationAccess_UIElementFactoryManager::readConfigurationData()
// Create hash key from type, name and module as they are together a primary key to
// the UNO service that implements the user interface element factory.
aHashKey = getHashKeyFromStrings( aType, aName, aModule );
- m_aUIElementFactoryManagerMap.insert( UIElementFactoryManagerMap::value_type( aHashKey, aService ));
+ m_aFactoryManagerMap.insert( FactoryManagerMap::value_type( aHashKey, aService ));
}
}
@@ -426,12 +359,11 @@ void ConfigurationAccess_UIElementFactoryManager::readConfigurationData()
}
}
-sal_Bool ConfigurationAccess_UIElementFactoryManager::impl_getElementProps( const Any& aElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const
+sal_Bool ConfigurationAccess_FactoryManager::impl_getElementProps( const Any& aElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::impl_getElementProps" );
Reference< XPropertySet > xPropertySet;
- Reference< XNameAccess > xNameAccess;
aElement >>= xPropertySet;
- aElement >>= xNameAccess;
if ( xPropertySet.is() )
{
@@ -458,21 +390,6 @@ sal_Bool ConfigurationAccess_UIElementFactoryManager::impl_getElementProps( cons
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_4 ( UIElementFactoryManager ,
- OWeakObject ,
- DIRECT_INTERFACE( css::lang::XTypeProvider ),
- DIRECT_INTERFACE( css::lang::XServiceInfo ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XUIElementFactory ),
- DIRECT_INTERFACE( ::com::sun::star::ui::XUIElementFactoryRegistration )
- )
-
-DEFINE_XTYPEPROVIDER_4 ( UIElementFactoryManager ,
- css::lang::XTypeProvider ,
- css::lang::XServiceInfo ,
- ::com::sun::star::ui::XUIElementFactory ,
- ::com::sun::star::ui::XUIElementFactoryRegistration
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UIElementFactoryManager ,
::cppu::OWeakObject ,
SERVICENAME_UIELEMENTFACTORYMANAGER ,
@@ -486,7 +403,8 @@ UIElementFactoryManager::UIElementFactoryManager( const Reference< XMultiService
m_bConfigRead( sal_False ),
m_xServiceManager( xServiceManager )
{
- m_pConfigAccess = new ConfigurationAccess_UIElementFactoryManager( m_xServiceManager );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::UIElementFactoryManager" );
+ m_pConfigAccess = new ConfigurationAccess_FactoryManager( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Factories/Registered/UIElementFactories" )) );
m_pConfigAccess->acquire();
m_xModuleManager = Reference< XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY );
}
@@ -499,41 +417,13 @@ UIElementFactoryManager::~UIElementFactoryManager()
m_pConfigAccess->release();
}
-void UIElementFactoryManager::RetrieveTypeNameFromResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aType, rtl::OUString& aName )
-{
- const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17;
- const char RESOURCEURL_PREFIX[] = "private:resource/";
-
- if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
- ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
- {
- rtl::OUString aTmpStr( aResourceURL.copy( RESOURCEURL_PREFIX_SIZE ));
- sal_Int32 nToken = 0;
- sal_Int32 nPart = 0;
- do
- {
- ::rtl::OUString sToken = aTmpStr.getToken( 0, '/', nToken);
- if ( sToken.getLength() )
- {
- if ( nPart == 0 )
- aType = sToken;
- else if ( nPart == 1 )
- aName = sToken;
- else
- break;
- nPart++;
- }
- }
- while( nToken >=0 );
- }
-}
-
// XUIElementFactory
Reference< XUIElement > SAL_CALL UIElementFactoryManager::createUIElement(
const ::rtl::OUString& ResourceURL,
const Sequence< PropertyValue >& Args )
throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::createUIElement" );
// SAFE
ResetableGuard aLock( m_aLock );
@@ -582,6 +472,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l
Sequence< Sequence< PropertyValue > > SAL_CALL UIElementFactoryManager::getRegisteredFactories()
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::getRegisteredFactories" );
// SAFE
ResetableGuard aLock( m_aLock );
@@ -597,6 +488,7 @@ throw ( RuntimeException )
Reference< XUIElementFactory > SAL_CALL UIElementFactoryManager::getFactory( const ::rtl::OUString& aResourceURL, const ::rtl::OUString& aModuleId )
throw ( RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::getFactory" );
ResetableGuard aLock( m_aLock );
if ( !m_bConfigRead )
@@ -608,7 +500,7 @@ throw ( RuntimeException )
rtl::OUString aType;
rtl::OUString aName;
- RetrieveTypeNameFromResourceURL( aResourceURL, aType, aName );
+ WindowContentFactoryManager::RetrieveTypeNameFromResourceURL( aResourceURL, aType, aName );
Reference< XMultiServiceFactory > xSManager( m_xServiceManager );
@@ -624,6 +516,7 @@ throw ( RuntimeException )
void SAL_CALL UIElementFactoryManager::registerFactory( const ::rtl::OUString& aType, const ::rtl::OUString& aName, const ::rtl::OUString& aModuleId, const ::rtl::OUString& aFactoryImplementationName )
throw ( ElementExistException, RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::registerFactory" );
// SAFE
ResetableGuard aLock( m_aLock );
@@ -640,6 +533,7 @@ throw ( ElementExistException, RuntimeException )
void SAL_CALL UIElementFactoryManager::deregisterFactory( const ::rtl::OUString& aType, const ::rtl::OUString& aName, const ::rtl::OUString& aModuleId )
throw ( NoSuchElementException, RuntimeException )
{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::deregisterFactory" );
// SAFE
ResetableGuard aLock( m_aLock );
diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx
index 38cc2b191f..b860deb8f3 100644
--- a/framework/source/uifactory/windowcontentfactorymanager.cxx
+++ b/framework/source/uifactory/windowcontentfactorymanager.cxx
@@ -35,6 +35,7 @@
// my own includes
//_________________________________________________________________________________________________________________
#include <uifactory/windowcontentfactorymanager.hxx>
+#include <uifactory/uielementfactorymanager.hxx>
#include <threadhelp/resetableguard.hxx>
#include "services.h"
@@ -74,298 +75,9 @@ using namespace ::com::sun::star;
namespace framework
{
-// global function needed by both implementations
-static rtl::OUString getHashKeyFromStrings( const rtl::OUString& aType, const rtl::OUString& aName, const rtl::OUString& aModuleName )
-{
- rtl::OUStringBuffer aKey( aType );
- aKey.appendAscii( "^" );
- aKey.append( aName );
- aKey.appendAscii( "^" );
- aKey.append( aModuleName );
- return aKey.makeStringAndClear();
-}
-
-
-//*****************************************************************************************************************
-// Configuration access class for UIElementFactoryManager implementation
-//*****************************************************************************************************************
-
-class ConfigurationAccess_WindowContentFactoryManager : // interfaces
- public lang::XTypeProvider ,
- public container::XContainerListener ,
- // baseclasses
- // Order is neccessary for right initialization!
- private ThreadHelpBase ,
- public ::cppu::OWeakObject
-{
- public:
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
- ConfigurationAccess_WindowContentFactoryManager( uno::Reference< lang::XMultiServiceFactory >& rServiceManager );
- virtual ~ConfigurationAccess_WindowContentFactoryManager();
-
- void readConfigurationData();
-
- rtl::OUString getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule );
-
- // container.XContainerListener
- virtual void SAL_CALL elementInserted( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
- virtual void SAL_CALL elementRemoved ( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
- virtual void SAL_CALL elementReplaced( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
-
- // lang.XEventListener
- virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw(uno::RuntimeException);
-
- private:
- class FactoryMap : public std::hash_map< rtl::OUString,
- rtl::OUString,
- OUStringHashCode,
- ::std::equal_to< ::rtl::OUString > >
- {
- inline void free()
- {
- FactoryMap().swap( *this );
- }
- };
-
- sal_Bool impl_getElementProps( const uno::Any& rElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const;
-
- rtl::OUString m_aPropType;
- rtl::OUString m_aPropName;
- rtl::OUString m_aPropModule;
- rtl::OUString m_aPropFactory;
- FactoryMap m_aFactoryMap;
- uno::Reference< lang::XMultiServiceFactory > m_xServiceManager;
- uno::Reference< lang::XMultiServiceFactory > m_xConfigProvider;
- uno::Reference< container::XNameAccess > m_xConfigAccess;
- bool m_bConfigAccessInitialized;
- bool m_bConfigDirty;
-};
-
-//*****************************************************************************************************************
-// XInterface, XTypeProvider
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( ConfigurationAccess_WindowContentFactoryManager ,
- OWeakObject ,
- DIRECT_INTERFACE ( lang::XTypeProvider ),
- DIRECT_INTERFACE ( container::XContainerListener ),
- DERIVED_INTERFACE( lang::XEventListener, XContainerListener )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( ConfigurationAccess_WindowContentFactoryManager ,
- lang::XTypeProvider ,
- container::XContainerListener ,
- lang::XEventListener
- )
-
-ConfigurationAccess_WindowContentFactoryManager::ConfigurationAccess_WindowContentFactoryManager( uno::Reference< lang::XMultiServiceFactory >& rServiceManager ) :
- ThreadHelpBase(),
- m_aPropType( RTL_CONSTASCII_USTRINGPARAM( "Type" )),
- m_aPropName( RTL_CONSTASCII_USTRINGPARAM( "Name" )),
- m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )),
- m_aPropFactory( RTL_CONSTASCII_USTRINGPARAM( "FactoryImplementation" )),
- m_xServiceManager( rServiceManager ),
- m_bConfigAccessInitialized( false ),
- m_bConfigDirty( true )
-{
- m_xConfigProvider = uno::Reference< lang::XMultiServiceFactory >( rServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- uno::UNO_QUERY );
-}
-
-ConfigurationAccess_WindowContentFactoryManager::~ConfigurationAccess_WindowContentFactoryManager()
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
- if ( xContainer.is() )
- xContainer->removeContainerListener( this );
-}
-
-rtl::OUString ConfigurationAccess_WindowContentFactoryManager::getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule )
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- // Make sure that we read the configuration data at least once.
- // May be more dependent on the dirty flag!
- readConfigurationData();
-
- FactoryMap::const_iterator pIter =
- m_aFactoryMap.find( getHashKeyFromStrings( rType, rName, rModule ));
- if ( pIter != m_aFactoryMap.end() )
- return pIter->second;
- else
- {
- pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, rName, rtl::OUString() ));
- if ( pIter != m_aFactoryMap.end() )
- return pIter->second;
- else
- {
- // Support factories which uses a defined prefix for their element names.
- sal_Int32 nIndex = rName.indexOf( '_' );
- if ( nIndex > 0 )
- {
- rtl::OUString aName = rName.copy( 0, nIndex );
- pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, aName, rtl::OUString() ));
- if ( pIter != m_aFactoryMap.end() )
- return pIter->second;
- }
-
- pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, rtl::OUString(), rtl::OUString() ));
- if ( pIter != m_aFactoryMap.end() )
- return pIter->second;
- }
- }
-
- return rtl::OUString();
-}
-
-// container.XContainerListener
-void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementInserted( const container::ContainerEvent& ) throw(uno::RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
- m_bConfigDirty = true;
-}
-
-void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementRemoved ( const container::ContainerEvent& ) throw(uno::RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
- m_bConfigDirty = true;
-}
-
-void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementReplaced( const container::ContainerEvent& ) throw(uno::RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
- m_bConfigDirty = true;
-}
-
-// lang.XEventListener
-void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::disposing( const lang::EventObject& ) throw(uno::RuntimeException)
-{
- // SAFE
- // remove our reference to the config access
- ResetableGuard aLock( m_aLock );
- m_xConfigAccess.clear();
-}
-
-void ConfigurationAccess_WindowContentFactoryManager::readConfigurationData()
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- bool bConfigAccessInitialized(m_bConfigAccessInitialized);
- if ( !m_bConfigAccessInitialized )
- {
- uno::Sequence< uno::Any > aArgs( 1 );
- beans::PropertyValue aPropValue;
-
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
- aPropValue.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.WindowContentFactories/Registered/ContentFactories" ));
- aArgs[0] <<= aPropValue;
-
- try
- {
- m_xConfigAccess = uno::Reference< container::XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- uno::UNO_QUERY );
- }
- catch ( lang::WrappedTargetException& )
- {
- }
-
- m_bConfigAccessInitialized = sal_True;
- }
-
- if ( m_xConfigAccess.is() && m_bConfigDirty )
- {
- uno::Sequence< rtl::OUString > aUIElementFactories = m_xConfigAccess->getElementNames();
-
- uno::Any a;
- rtl::OUString aType;
- rtl::OUString aName;
- rtl::OUString aModule;
- rtl::OUString aService;
- rtl::OUString aHashKey;
-
- uno::Reference< beans::XPropertySet > xPropertySet;
-
- m_aFactoryMap.clear();
- for ( sal_Int32 i = 0; i < aUIElementFactories.getLength(); i++ )
- {
- if ( impl_getElementProps( m_xConfigAccess->getByName( aUIElementFactories[i] ), aType, aName, aModule, aService ))
- {
- // Create hash key from type, name and module as they are together a primary key to
- // the UNO service that implements the user interface element factory.
- aHashKey = getHashKeyFromStrings( aType, aName, aModule );
- m_aFactoryMap.insert( FactoryMap::value_type( aHashKey, aService ));
- }
- }
-
- uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
- m_bConfigDirty = false;
-
- aLock.unlock();
- // UNSAFE
-
- if ( xContainer.is() && !bConfigAccessInitialized)
- xContainer->addContainerListener( this );
- }
-}
-
-sal_Bool ConfigurationAccess_WindowContentFactoryManager::impl_getElementProps( const uno::Any& aElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const
-{
- uno::Reference< beans::XPropertySet > xPropertySet;
- uno::Reference< container::XNameAccess > xNameAccess;
- aElement >>= xPropertySet;
- aElement >>= xNameAccess;
-
- if ( xPropertySet.is() )
- {
- try
- {
- xPropertySet->getPropertyValue( m_aPropType ) >>= rType;
- xPropertySet->getPropertyValue( m_aPropName ) >>= rName;
- xPropertySet->getPropertyValue( m_aPropModule ) >>= rModule;
- xPropertySet->getPropertyValue( m_aPropFactory ) >>= rServiceSpecifier;
- }
- catch ( beans::UnknownPropertyException& )
- {
- return sal_False;
- }
- catch ( lang::WrappedTargetException& )
- {
- return sal_False;
- }
- }
-
- return sal_True;
-}
-
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( WindowContentFactoryManager ,
- OWeakObject ,
- DIRECT_INTERFACE( lang::XTypeProvider ),
- DIRECT_INTERFACE( lang::XServiceInfo ),
- DIRECT_INTERFACE( lang::XSingleComponentFactory )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( WindowContentFactoryManager ,
- lang::XTypeProvider ,
- lang::XServiceInfo ,
- lang::XSingleComponentFactory
- )
-
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowContentFactoryManager ,
::cppu::OWeakObject ,
SERVICENAME_WINDOWCONTENTFACTORYMANAGER ,
@@ -379,7 +91,7 @@ WindowContentFactoryManager::WindowContentFactoryManager( const uno::Reference<
m_bConfigRead( sal_False ),
m_xServiceManager( xServiceManager )
{
- m_pConfigAccess = new ConfigurationAccess_WindowContentFactoryManager( m_xServiceManager );
+ m_pConfigAccess = new ConfigurationAccess_FactoryManager( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.WindowContentFactories/Registered/ContentFactories" )) );
m_pConfigAccess->acquire();
m_xModuleManager = uno::Reference< frame::XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), uno::UNO_QUERY );
}
diff --git a/framework/source/xml/eventsconfiguration.cxx b/framework/source/xml/eventsconfiguration.cxx
index 0ff9665bcc..320f94b8a6 100644
--- a/framework/source/xml/eventsconfiguration.cxx
+++ b/framework/source/xml/eventsconfiguration.cxx
@@ -32,6 +32,7 @@
#include "precompiled_framework.hxx"
#include <xml/eventsconfiguration.hxx>
#include <xml/eventsdocumenthandler.hxx>
+#include <services.h>
#ifndef __FRAMEWORK_XML_SAXNAMESPACEFILTER_HXX_
#include <xml/saxnamespacefilter.hxx>
@@ -74,8 +75,8 @@ static Reference< XParser > GetSaxParser(
)
{
//Reference< XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
- //return Reference< XParser >( xServiceManager->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Parser" )), UNO_QUERY);
- return Reference< XParser >( xServiceFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Parser" )), UNO_QUERY);
+ //return Reference< XParser >( xServiceManager->createInstance( SERVICENAME_SAXPARSER), UNO_QUERY);
+ return Reference< XParser >( xServiceFactory->createInstance( SERVICENAME_SAXPARSER), UNO_QUERY);
}
static Reference< XDocumentHandler > GetSaxWriter(
@@ -84,8 +85,8 @@ static Reference< XDocumentHandler > GetSaxWriter(
)
{
//Reference< XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
- //return Reference< XDocumentHandler >( xServiceManager->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" )), UNO_QUERY) ;
- return Reference< XDocumentHandler >( xServiceFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" )), UNO_QUERY) ;
+ //return Reference< XDocumentHandler >( xServiceManager->createInstance( SERVICENAME_SAXWRITER), UNO_QUERY) ;
+ return Reference< XDocumentHandler >( xServiceFactory->createInstance( SERVICENAME_SAXWRITER), UNO_QUERY) ;
}
// #110897#
diff --git a/framework/source/xml/eventsdocumenthandler.cxx b/framework/source/xml/eventsdocumenthandler.cxx
index 24764bc7ab..f160ffe895 100644
--- a/framework/source/xml/eventsdocumenthandler.cxx
+++ b/framework/source/xml/eventsdocumenthandler.cxx
@@ -128,7 +128,6 @@ static EventEntryProperty EventEntries[OReadEventsDocumentHandler::EV_XML_ENTRY_
OReadEventsDocumentHandler::OReadEventsDocumentHandler( EventsConfig& aItems ) :
ThreadHelpBase( &Application::GetSolarMutex() ),
- ::cppu::OWeakObject(),
m_aEventItems( aItems )
{
::rtl::OUString aNamespaceEvent( RTL_CONSTASCII_USTRINGPARAM( XMLNS_EVENT ));
@@ -163,18 +162,6 @@ OReadEventsDocumentHandler::~OReadEventsDocumentHandler()
{
}
-Any SAL_CALL OReadEventsDocumentHandler::queryInterface( const Type & rType )
-throw( RuntimeException )
-{
- Any a = ::cppu::queryInterface(
- rType ,
- SAL_STATIC_CAST( XDocumentHandler*, this ));
- if ( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( rType );
-}
-
// XDocumentHandler
void SAL_CALL OReadEventsDocumentHandler::startDocument(void)
throw ( SAXException, RuntimeException )
diff --git a/framework/source/xml/imagesconfiguration.cxx b/framework/source/xml/imagesconfiguration.cxx
index 7fd4050245..995da41240 100644
--- a/framework/source/xml/imagesconfiguration.cxx
+++ b/framework/source/xml/imagesconfiguration.cxx
@@ -31,6 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
#include <xml/imagesconfiguration.hxx>
+#include <services.h>
#ifndef __FRAMEWORK_CLASSES_IMAGESDOCUMENTHANDLER_HXX_
#include <xml/imagesdocumenthandler.hxx>
@@ -78,8 +79,8 @@ static Reference< XParser > GetSaxParser(
)
{
//Reference< XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
- //return Reference< XParser >( xServiceManager->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Parser" )), UNO_QUERY);
- return Reference< XParser >( xServiceFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Parser" )), UNO_QUERY);
+ //return Reference< XParser >( xServiceManager->createInstance( SERVICENAME_SAXPARSER), UNO_QUERY);
+ return Reference< XParser >( xServiceFactory->createInstance( SERVICENAME_SAXPARSER), UNO_QUERY);
}
static Reference< XDocumentHandler > GetSaxWriter(
@@ -88,8 +89,8 @@ static Reference< XDocumentHandler > GetSaxWriter(
)
{
//Reference< XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
- //return Reference< XDocumentHandler >( xServiceManager->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" )), UNO_QUERY) ;
- return Reference< XDocumentHandler >( xServiceFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" )), UNO_QUERY) ;
+ //return Reference< XDocumentHandler >( xServiceManager->createInstance( SERVICENAME_SAXWRITER), UNO_QUERY) ;
+ return Reference< XDocumentHandler >( xServiceFactory->createInstance( SERVICENAME_SAXWRITER), UNO_QUERY) ;
}
// #110897#
diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx
index b4906785bc..ceb187c322 100644
--- a/framework/source/xml/imagesdocumenthandler.cxx
+++ b/framework/source/xml/imagesdocumenthandler.cxx
@@ -134,7 +134,6 @@ ImageXMLEntryProperty ImagesEntries[OReadImagesDocumentHandler::IMG_XML_ENTRY_CO
OReadImagesDocumentHandler::OReadImagesDocumentHandler( ImageListsDescriptor& aItems ) :
ThreadHelpBase( &Application::GetSolarMutex() ),
- ::cppu::OWeakObject(),
m_aImageList( aItems ),
m_pImages( 0 ),
m_pExternalImages( 0 )
@@ -175,18 +174,6 @@ OReadImagesDocumentHandler::~OReadImagesDocumentHandler()
{
}
-Any SAL_CALL OReadImagesDocumentHandler::queryInterface( const Type & rType )
-throw( RuntimeException )
-{
- Any a = ::cppu::queryInterface(
- rType ,
- SAL_STATIC_CAST( XDocumentHandler*, this ));
- if ( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( rType );
-}
-
// XDocumentHandler
void SAL_CALL OReadImagesDocumentHandler::startDocument(void)
throw ( SAXException, RuntimeException )
diff --git a/framework/source/xml/menuconfiguration.cxx b/framework/source/xml/menuconfiguration.cxx
index 602c2ffcb3..7dbe62e38a 100644
--- a/framework/source/xml/menuconfiguration.cxx
+++ b/framework/source/xml/menuconfiguration.cxx
@@ -42,6 +42,7 @@
#include <classes/addonmenu.hxx>
#include <xml/menudocumenthandler.hxx>
#include <xml/saxnamespacefilter.hxx>
+#include <services.h>
#ifndef _FRAMEWORK_SERVICES_LAYOUTMANAGER_HXX_
#include <services/layoutmanager.hxx>
@@ -99,9 +100,7 @@ Reference< XIndexAccess > MenuConfiguration::CreateMenuBarConfigurationFromXML(
Reference< XInputStream >& rInputStream )
throw ( WrappedTargetException )
{
- Reference< XParser > xParser( m_rxServiceManager->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" ))),
- UNO_QUERY);
+ Reference< XParser > xParser( m_rxServiceManager->createInstance(SERVICENAME_SAXPARSER),UNO_QUERY);
// connect stream to input stream to the parser
InputSource aInputSource;
@@ -167,7 +166,7 @@ throw ( WrappedTargetException )
Reference< XDocumentHandler > xWriter;
xWriter = Reference< XDocumentHandler >( m_rxServiceManager->createInstance(
- ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" )), UNO_QUERY) ;
+ SERVICENAME_SAXWRITER), UNO_QUERY) ;
Reference< XActiveDataSource> xDataSource( xWriter , UNO_QUERY );
xDataSource->setOutputStream( rOutputStream );
diff --git a/framework/source/xml/menudocumenthandler.cxx b/framework/source/xml/menudocumenthandler.cxx
index 7b447572d8..66addd1274 100644
--- a/framework/source/xml/menudocumenthandler.cxx
+++ b/framework/source/xml/menudocumenthandler.cxx
@@ -47,7 +47,6 @@
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include <com/sun/star/ui/ItemType.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -55,7 +54,7 @@
// other includes
//_________________________________________________________________________________________________________________
#include <comphelper/processfactory.hxx>
-
+#include <rtl/logfile.hxx>
#include <comphelper/attributelist.hxx>
//_________________________________________________________________________________________________________________
@@ -174,19 +173,6 @@ ReadMenuDocumentHandlerBase::~ReadMenuDocumentHandlerBase()
{
}
-Any SAL_CALL ReadMenuDocumentHandlerBase::queryInterface(
- const Type & rType )
-throw( RuntimeException )
-{
- Any a = ::cppu::queryInterface(
- rType ,
- SAL_STATIC_CAST( XDocumentHandler*, this ));
- if ( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( rType );
-}
-
void SAL_CALL ReadMenuDocumentHandlerBase::ignorableWhitespace(
const ::rtl::OUString& )
throw( SAXException, RuntimeException )
@@ -607,14 +593,15 @@ throw( SAXException, RuntimeException )
m_bMenuMode = sal_True;
// Container must be factory to create sub container
- Reference< XComponentContext > xComponentContext;
- Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>=
- xComponentContext;
+ if ( !m_xComponentContext.is() )
+ {
+ const Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
+ m_xComponentContext.set(xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW );
+ }
Reference< XIndexContainer > xSubItemContainer;
if ( m_xContainerFactory.is() )
- xSubItemContainer = Reference< XIndexContainer >( m_xContainerFactory->createInstanceWithContext( xComponentContext ), UNO_QUERY );
+ xSubItemContainer = Reference< XIndexContainer >( m_xContainerFactory->createInstanceWithContext( m_xComponentContext ), UNO_QUERY );
// read attributes for menu
for ( sal_Int16 i=0; i< xAttrList->getLength(); i++ )
diff --git a/framework/source/xml/saxnamespacefilter.cxx b/framework/source/xml/saxnamespacefilter.cxx
index 47040e63ad..06ba54932b 100644
--- a/framework/source/xml/saxnamespacefilter.cxx
+++ b/framework/source/xml/saxnamespacefilter.cxx
@@ -43,6 +43,7 @@
#include <comphelper/attributelist.hxx>
#include <vcl/svapp.hxx>
+#include <rtl/logfile.hxx>
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::uno;
@@ -54,7 +55,7 @@ namespace framework{
SaxNamespaceFilter::SaxNamespaceFilter( Reference< XDocumentHandler >& rSax1DocumentHandler ) :
- ThreadHelpBase( &Application::GetSolarMutex() ), OWeakObject(),
+ ThreadHelpBase( &Application::GetSolarMutex() ),
m_xLocator( 0 ),
xDocumentHandler( rSax1DocumentHandler ),
m_nDepth( 0 )
@@ -65,17 +66,6 @@ SaxNamespaceFilter::~SaxNamespaceFilter()
{
}
-Any SAL_CALL SaxNamespaceFilter::queryInterface( const Type & rType ) throw( RuntimeException )
-{
- Any a = ::cppu::queryInterface(
- rType ,
- SAL_STATIC_CAST( XDocumentHandler*, this ));
- if ( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( rType );
-}
-
// XDocumentHandler
void SAL_CALL SaxNamespaceFilter::startDocument(void)
throw ( SAXException, RuntimeException )
@@ -92,7 +82,7 @@ void SAL_CALL SaxNamespaceFilter::startElement(
throw( SAXException, RuntimeException )
{
XMLNamespaces aXMLNamespaces;
- if ( m_aNamespaceStack.size() > 0 )
+ if ( !m_aNamespaceStack.empty() )
aXMLNamespaces = m_aNamespaceStack.top();
::comphelper::AttributeList* pNewList = new ::comphelper::AttributeList();
diff --git a/framework/source/xml/statusbarconfiguration.cxx b/framework/source/xml/statusbarconfiguration.cxx
index 23c42c884e..618afd6796 100644
--- a/framework/source/xml/statusbarconfiguration.cxx
+++ b/framework/source/xml/statusbarconfiguration.cxx
@@ -34,6 +34,7 @@
#include <xml/statusbarconfiguration.hxx>
#include <xml/statusbardocumenthandler.hxx>
#include <xml/saxnamespacefilter.hxx>
+#include <services.h>
//_________________________________________________________________________________________________________________
// interface includes
@@ -73,14 +74,14 @@ static Reference< XParser > GetSaxParser(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory
)
{
- return Reference< XParser >( xServiceFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Parser" )), UNO_QUERY);
+ return Reference< XParser >( xServiceFactory->createInstance( SERVICENAME_SAXPARSER), UNO_QUERY);
}
static Reference< XDocumentHandler > GetSaxWriter(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory
)
{
- return Reference< XDocumentHandler >( xServiceFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" )), UNO_QUERY) ;
+ return Reference< XDocumentHandler >( xServiceFactory->createInstance( SERVICENAME_SAXWRITER), UNO_QUERY) ;
}
sal_Bool StatusBarConfiguration::LoadStatusBar(
diff --git a/framework/source/xml/statusbardocumenthandler.cxx b/framework/source/xml/statusbardocumenthandler.cxx
index cebb852d79..321239d03c 100644
--- a/framework/source/xml/statusbardocumenthandler.cxx
+++ b/framework/source/xml/statusbardocumenthandler.cxx
@@ -179,7 +179,6 @@ StatusBarEntryProperty StatusBarEntries[OReadStatusBarDocumentHandler::SB_XML_EN
OReadStatusBarDocumentHandler::OReadStatusBarDocumentHandler(
const Reference< XIndexContainer >& rStatusBarItems ) :
ThreadHelpBase( &Application::GetSolarMutex() ),
- ::cppu::OWeakObject(),
m_aStatusBarItems( rStatusBarItems )
{
::rtl::OUString aNamespaceStatusBar( RTL_CONSTASCII_USTRINGPARAM( XMLNS_STATUSBAR ));
@@ -214,18 +213,6 @@ OReadStatusBarDocumentHandler::~OReadStatusBarDocumentHandler()
{
}
-Any SAL_CALL OReadStatusBarDocumentHandler::queryInterface( const Type & rType )
-throw( RuntimeException )
-{
- Any a = ::cppu::queryInterface(
- rType ,
- SAL_STATIC_CAST( XDocumentHandler*, this ));
- if ( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( rType );
-}
-
// XDocumentHandler
void SAL_CALL OReadStatusBarDocumentHandler::startDocument(void)
throw ( SAXException, RuntimeException )
@@ -428,11 +415,11 @@ throw( SAXException, RuntimeException )
aStatusbarItemProp[4].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_WIDTH ));
aStatusbarItemProp[5].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE ));
- aStatusbarItemProp[0].Value = makeAny( aCommandURL );
- aStatusbarItemProp[1].Value = makeAny( aHelpURL );
- aStatusbarItemProp[2].Value = makeAny( nOffset );
- aStatusbarItemProp[3].Value = makeAny( nItemBits );
- aStatusbarItemProp[4].Value = makeAny( nWidth );
+ aStatusbarItemProp[0].Value <<= aCommandURL;
+ aStatusbarItemProp[1].Value <<= aHelpURL;
+ aStatusbarItemProp[2].Value <<= nOffset;
+ aStatusbarItemProp[3].Value <<= nItemBits;
+ aStatusbarItemProp[4].Value <<= nWidth;
aStatusbarItemProp[5].Value = makeAny( ::com::sun::star::ui::ItemType::DEFAULT );
m_aStatusBarItems->insertByIndex( m_aStatusBarItems->getCount(), makeAny( aStatusbarItemProp ) );
diff --git a/framework/source/xml/toolboxconfiguration.cxx b/framework/source/xml/toolboxconfiguration.cxx
index b165ec89f1..24c1e8840f 100644
--- a/framework/source/xml/toolboxconfiguration.cxx
+++ b/framework/source/xml/toolboxconfiguration.cxx
@@ -35,6 +35,7 @@
#include <xml/toolboxdocumenthandler.hxx>
#include <xml/toolboxlayoutdocumenthandler.hxx>
#include <xml/saxnamespacefilter.hxx>
+#include <services.h>
//_________________________________________________________________________________________________________________
// interface includes
@@ -73,7 +74,7 @@ static Reference< XParser > GetSaxParser(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory
)
{
- return Reference< XParser >( xServiceFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Parser" )), UNO_QUERY);
+ return Reference< XParser >( xServiceFactory->createInstance( SERVICENAME_SAXPARSER), UNO_QUERY);
}
static Reference< XDocumentHandler > GetSaxWriter(
@@ -81,7 +82,7 @@ static Reference< XDocumentHandler > GetSaxWriter(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory
)
{
- return Reference< XDocumentHandler >( xServiceFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" )), UNO_QUERY) ;
+ return Reference< XDocumentHandler >( xServiceFactory->createInstance( SERVICENAME_SAXWRITER), UNO_QUERY) ;
}
// #110897#
diff --git a/framework/source/xml/toolboxdocumenthandler.cxx b/framework/source/xml/toolboxdocumenthandler.cxx
index e48dd41a37..53098b1687 100644
--- a/framework/source/xml/toolboxdocumenthandler.cxx
+++ b/framework/source/xml/toolboxdocumenthandler.cxx
@@ -140,7 +140,6 @@ ToolBarEntryProperty ToolBoxEntries[OReadToolBoxDocumentHandler::TB_XML_ENTRY_CO
OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XIndexContainer >& rItemContainer ) :
ThreadHelpBase( &Application::GetSolarMutex() ),
- ::cppu::OWeakObject(),
m_rItemContainer( rItemContainer ),
m_aType( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE )),
m_aLabel( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL )),
@@ -193,18 +192,6 @@ OReadToolBoxDocumentHandler::~OReadToolBoxDocumentHandler()
{
}
-Any SAL_CALL OReadToolBoxDocumentHandler::queryInterface( const Type & rType )
-throw( RuntimeException )
-{
- Any a = ::cppu::queryInterface(
- rType ,
- SAL_STATIC_CAST( XDocumentHandler*, this ));
- if ( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( rType );
-}
-
// XDocumentHandler
void SAL_CALL OReadToolBoxDocumentHandler::startDocument(void)
throw ( SAXException, RuntimeException )
@@ -435,12 +422,12 @@ throw( SAXException, RuntimeException )
aToolbarItemProp[4].Name = m_aStyle;
aToolbarItemProp[5].Name = m_aIsVisible;
- aToolbarItemProp[0].Value = makeAny( aCommandURL );
- aToolbarItemProp[1].Value = makeAny( aHelpURL );
- aToolbarItemProp[2].Value = makeAny( aLabel );
+ aToolbarItemProp[0].Value <<= aCommandURL;
+ aToolbarItemProp[1].Value <<= aHelpURL;
+ aToolbarItemProp[2].Value <<= aLabel;
aToolbarItemProp[3].Value = makeAny( ::com::sun::star::ui::ItemType::DEFAULT );
- aToolbarItemProp[4].Value = makeAny( nItemBits );
- aToolbarItemProp[5].Value = makeAny( bVisible );
+ aToolbarItemProp[4].Value <<= nItemBits;
+ aToolbarItemProp[5].Value <<= bVisible;
m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
}
@@ -693,8 +680,7 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxDocument() throw
{
try
{
- Any a = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UIName" )));
- a >>= aUIName;
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UIName" ))) >>= aUIName;
}
catch ( UnknownPropertyException& )
{
diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk
index 94409ace99..61d0da2a4c 100644
--- a/framework/util/makefile.mk
+++ b/framework/util/makefile.mk
@@ -60,6 +60,8 @@ LIB1OBJFILES= \
$(SLO)$/rootitemcontainer.obj \
$(SLO)$/constitemcontainer.obj \
$(SLO)$/jobconst.obj \
+ $(SLO)$/popupmenucontrollerbase.obj \
+ $(SLO)$/mischelper.obj \
$(SLO)$/propertysethelper.obj
@@ -118,6 +120,8 @@ SHL1STDLIBS= \
$(CPPUHELPERLIB) \
$(TOOLSLIB) \
$(VOSLIB) \
+ $(VCLLIB) \
+ $(TKLIB) \
$(CPPULIB) \
$(SALLIB)
@@ -174,12 +178,36 @@ SHL3IMPLIB= ifwl
SHL3OBJS= $(SLO)$/mediatypedetectionhelper.obj\
$(SLO)$/registertemp.obj \
- $(SLO)$/substitutepathvars.obj \
- $(SLO)$/pathsettings.obj
+ $(SLO)$/mailtodispatcher.obj \
+ $(SLO)$/oxt_handler.obj \
+ $(SLO)$/toolbarsmenucontroller.obj \
+ $(SLO)$/newmenucontroller.obj \
+ $(SLO)$/macrosmenucontroller.obj \
+ $(SLO)$/langselectionmenucontroller.obj \
+ $(SLO)$/headermenucontroller.obj \
+ $(SLO)$/footermenucontroller.obj \
+ $(SLO)$/fontsizemenucontroller.obj \
+ $(SLO)$/fontmenucontroller.obj \
+ $(SLO)$/tabwindowservice.obj \
+ $(SLO)$/fwktabwindow.obj \
+ $(SLO)$/logotextstatusbarcontroller.obj \
+ $(SLO)$/fwlresid.obj \
+ $(SLO)$/logoimagestatusbarcontroller.obj \
+ $(SLO)$/simpletextstatusbarcontroller.obj \
+ $(SLO)$/uriabbreviation.obj \
+ $(SLO)$/servicehandler.obj \
+ $(SLO)$/license.obj \
+ $(SLO)$/dispatchrecorder.obj \
+ $(SLO)$/dispatchrecordersupplier.obj\
+ $(SLO)$/dispatchhelper.obj \
+ $(SLO)$/popupmenudispatcher.obj \
SHL3STDLIBS= \
$(FWILIB) \
+ $(FWELIB) \
$(SVLLIB) \
+ $(TKLIB) \
+ $(SVTOOLLIB) \
$(UNOTOOLSLIB) \
$(TOOLSLIB) \
$(I18NISOLANGLIB) \
@@ -187,10 +215,11 @@ SHL3STDLIBS= \
$(CPPUHELPERLIB) \
$(COMPHELPERLIB) \
$(CPPULIB) \
+ $(VCLLIB) \
$(SALLIB)
SHL3DEF= $(MISC)$/$(SHL3TARGET).def
-SHL3DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN)
+SHL3DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN) $(SHL2TARGETN)
DEF3NAME= $(SHL3TARGET)
@@ -222,20 +251,15 @@ SHL4OBJS= \
$(SLO)$/contenthandler.obj \
$(SLO)$/controlmenucontroller.obj \
$(SLO)$/desktop.obj \
- $(SLO)$/dispatchhelper.obj \
$(SLO)$/dispatchinformationprovider.obj \
$(SLO)$/dispatchprovider.obj \
- $(SLO)$/dispatchrecorder.obj \
- $(SLO)$/dispatchrecordersupplier.obj\
$(SLO)$/dockingareadefaultacceptor.obj \
$(SLO)$/documentacceleratorconfiguration.obj \
$(SLO)$/dropdownboxtoolbarcontroller.obj \
$(SLO)$/droptargetlistener.obj \
- $(SLO)$/edittoolbarcontroller.obj \
+ $(SLO)$/edittoolbarcontroller.obj \
+ $(SLO)$/factoryconfiguration.obj \
$(SLO)$/filter.obj \
- $(SLO)$/fontmenucontroller.obj \
- $(SLO)$/fontsizemenucontroller.obj \
- $(SLO)$/footermenucontroller.obj \
$(SLO)$/framecontainer.obj \
$(SLO)$/frameloader.obj \
$(SLO)$/frame.obj \
@@ -243,10 +267,10 @@ SHL4OBJS= \
$(SLO)$/globalacceleratorconfiguration.obj \
$(SLO)$/globalsettings.obj \
$(SLO)$/graphicnameaccess.obj \
- $(SLO)$/headermenucontroller.obj \
$(SLO)$/helpagentdispatcher.obj \
$(SLO)$/imagebuttontoolbarcontroller.obj \
$(SLO)$/imagemanager.obj \
+ $(SLO)$/imagemanagerimpl.obj \
$(SLO)$/interceptionhelper.obj \
$(SLO)$/jobdata.obj \
$(SLO)$/jobdispatch.obj \
@@ -255,46 +279,34 @@ SHL4OBJS= \
$(SLO)$/jobresult.obj \
$(SLO)$/joburl.obj \
$(SLO)$/keymapping.obj \
- $(SLO)$/langselectionmenucontroller.obj \
$(SLO)$/langselectionstatusbarcontroller.obj \
$(SLO)$/layoutmanager.obj \
- $(SLO)$/license.obj \
$(SLO)$/loaddispatcher.obj \
$(SLO)$/loaddispatchlistener.obj \
$(SLO)$/loadenv.obj \
- $(SLO)$/logoimagestatusbarcontroller.obj \
- $(SLO)$/logotextstatusbarcontroller.obj \
- $(SLO)$/macrosmenucontroller.obj \
- $(SLO)$/mailtodispatcher.obj \
$(SLO)$/menubarfactory.obj \
$(SLO)$/menubarmanager.obj \
$(SLO)$/menubarmerger.obj \
$(SLO)$/menubarwrapper.obj \
$(SLO)$/menudispatcher.obj \
$(SLO)$/menumanager.obj \
- $(SLO)$/mischelper.obj \
$(SLO)$/moduleacceleratorconfiguration.obj \
$(SLO)$/moduleimagemanager.obj \
$(SLO)$/modulemanager.obj \
$(SLO)$/moduleuicfgsupplier.obj \
$(SLO)$/moduleuiconfigurationmanager.obj \
- $(SLO)$/newmenucontroller.obj \
$(SLO)$/objectmenucontroller.obj \
$(SLO)$/ocomponentaccess.obj \
$(SLO)$/ocomponentenumeration.obj \
$(SLO)$/oframes.obj \
- $(SLO)$/oxt_handler.obj \
+ $(SLO)$/pathsettings.obj \
$(SLO)$/persistentwindowstate.obj \
- $(SLO)$/popupmenucontrollerbase.obj \
$(SLO)$/popupmenucontrollerfactory.obj\
- $(SLO)$/popupmenudispatcher.obj \
$(SLO)$/presethandler.obj \
$(SLO)$/progressbarwrapper.obj \
$(SLO)$/recentfilesmenucontroller.obj \
$(SLO)$/registerservices.obj \
- $(SLO)$/servicehandler.obj \
$(SLO)$/sessionlistener.obj \
- $(SLO)$/simpletextstatusbarcontroller.obj \
$(SLO)$/spinfieldtoolbarcontroller.obj \
$(SLO)$/statusbarcontrollerfactory.obj\
$(SLO)$/statusbarfactory.obj \
@@ -306,8 +318,7 @@ SHL4OBJS= \
$(SLO)$/statusindicator.obj \
$(SLO)$/stillinteraction.obj \
$(SLO)$/storageholder.obj \
- $(SLO)$/tabwindowservice.obj \
- $(SLO)$/fwktabwindow.obj \
+ $(SLO)$/substitutepathvars.obj \
$(SLO)$/tagwindowasmodified.obj \
$(SLO)$/targethelper.obj \
$(SLO)$/taskcreator.obj \
@@ -318,14 +329,13 @@ SHL4OBJS= \
$(SLO)$/toolbarmanager.obj \
$(SLO)$/toolbarmerger.obj \
$(SLO)$/toolbar.obj \
- $(SLO)$/toolbarsmenucontroller.obj \
$(SLO)$/toolbarwrapper.obj \
$(SLO)$/toolboxfactory.obj \
$(SLO)$/uicategorydescription.obj \
$(SLO)$/uicommanddescription.obj \
$(SLO)$/uiconfigurationmanager.obj \
+ $(SLO)$/uiconfigurationmanagerimpl.obj \
$(SLO)$/uielementfactorymanager.obj \
- $(SLO)$/uriabbreviation.obj \
$(SLO)$/urltransformer.obj \
$(SLO)$/vclstatusindicator.obj \
$(SLO)$/wakeupthread.obj \
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index d1d0b45d16..93fbfa1a81 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -375,6 +375,7 @@ private:
const css::uno::Sequence< ::rtl::OUString > & i_rValue,
AttrVector const* = 0);
// throw (css::uno::RuntimeException);
+ void createUserDefined();
};
////////////////////////////////////////////////////////////////////////////
@@ -609,23 +610,23 @@ SfxDocumentMetaData::getURLProperties(
css::uno::UNO_QUERY_THROW);
try {
::rtl::OUString dburl =
- ::rtl::OUString::createFromAscii("DocumentBaseURL");
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentBaseURL"));
::rtl::OUString hdn =
- ::rtl::OUString::createFromAscii("HierarchicalDocumentName");
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HierarchicalDocumentName"));
for (sal_Int32 i = 0; i < i_rMedium.getLength(); ++i) {
if (i_rMedium[i].Name.equals(dburl)) {
xPropArg->addProperty(
- ::rtl::OUString::createFromAscii("BaseURI"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseURI")),
css::beans::PropertyAttribute::MAYBEVOID,
i_rMedium[i].Value);
} else if (i_rMedium[i].Name.equals(hdn)) {
xPropArg->addProperty(
- ::rtl::OUString::createFromAscii("StreamRelPath"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath")),
css::beans::PropertyAttribute::MAYBEVOID,
i_rMedium[i].Value);
}
}
- xPropArg->addProperty(::rtl::OUString::createFromAscii("StreamName"),
+ xPropArg->addProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")),
css::beans::PropertyAttribute::MAYBEVOID,
css::uno::makeAny(::rtl::OUString::createFromAscii(s_metaXml)));
} catch (css::uno::Exception &) {
@@ -902,7 +903,7 @@ propsToStrings(css::uno::Reference<css::beans::XPropertySet> const & i_xPropSet)
::sax::Converter::convertBool(buf, b);
values.push_back(buf.makeStringAndClear());
as.push_back(std::make_pair(vt,
- ::rtl::OUString::createFromAscii("boolean")));
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("boolean"))));
} else if (type == ::cppu::UnoType< ::rtl::OUString>::get()) {
::rtl::OUString s;
any >>= s;
@@ -910,13 +911,13 @@ propsToStrings(css::uno::Reference<css::beans::XPropertySet> const & i_xPropSet)
// #i90847# OOo 2.x does stupid things if value-type="string";
// fortunately string is default anyway, so we can just omit it
// as.push_back(std::make_pair(vt,
-// ::rtl::OUString::createFromAscii("string")));
+// ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("string"))));
} else if (type == ::cppu::UnoType<css::util::DateTime>::get()) {
css::util::DateTime dt;
any >>= dt;
values.push_back(dateTimeToText(dt));
as.push_back(std::make_pair(vt,
- ::rtl::OUString::createFromAscii("date")));
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("date"))));
} else if (type == ::cppu::UnoType<css::util::Date>::get()) {
css::util::Date d;
any >>= d;
@@ -926,13 +927,13 @@ propsToStrings(css::uno::Reference<css::beans::XPropertySet> const & i_xPropSet)
dt.Day = d.Day;
values.push_back(dateTimeToText(dt));
as.push_back(std::make_pair(vt,
- ::rtl::OUString::createFromAscii("date")));
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("date"))));
} else if (type == ::cppu::UnoType<css::util::Time>::get()) {
css::util::Time ut;
any >>= ut;
values.push_back(durationToText(ut));
as.push_back(std::make_pair(vt,
- ::rtl::OUString::createFromAscii("time")));
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("time"))));
} else if (::cppu::UnoType<double>::get().isAssignableFrom(type)) {
// support not just double, but anything that can be converted
double d = 0;
@@ -941,7 +942,7 @@ propsToStrings(css::uno::Reference<css::beans::XPropertySet> const & i_xPropSet)
::sax::Converter::convertDouble(buf, d);
values.push_back(buf.makeStringAndClear());
as.push_back(std::make_pair(vt,
- ::rtl::OUString::createFromAscii("float")));
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("float"))));
} else {
DBG_WARNING1("SfxDocumentMetaData: unsupported property type: %s",
OUStringToOString(any.getValueTypeName(),
@@ -996,12 +997,10 @@ SfxDocumentMetaData::updateElement(const char *i_name,
// update user-defined meta data in DOM tree
void SAL_CALL SfxDocumentMetaData::updateUserDefinedAndAttributes()
{
- css::uno::Reference<css::beans::XPropertySet> xPSet(m_xUserDefined,
- css::uno::UNO_QUERY_THROW);
- std::pair<css::uno::Sequence< ::rtl::OUString>, AttrVector> udStringsAttrs
- = propsToStrings(xPSet);
- (void) setMetaList("meta:user-defined", udStringsAttrs.first,
- &udStringsAttrs.second);
+ createUserDefined();
+ css::uno::Reference<css::beans::XPropertySet> xPSet(m_xUserDefined,css::uno::UNO_QUERY_THROW);
+ std::pair<css::uno::Sequence< ::rtl::OUString>, AttrVector> udStringsAttrs = propsToStrings(xPSet);
+ (void) setMetaList("meta:user-defined", udStringsAttrs.first,&udStringsAttrs.second);
// update elements with attributes
std::vector<std::pair<const char *, ::rtl::OUString> > attributes;
@@ -1009,10 +1008,10 @@ void SAL_CALL SfxDocumentMetaData::updateUserDefinedAndAttributes()
|| isValidDateTime(m_TemplateDate)) {
attributes.push_back(std::make_pair(
static_cast<const char*>("xlink:type"),
- ::rtl::OUString::createFromAscii("simple")));
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("simple"))));
attributes.push_back(std::make_pair(
static_cast<const char*>("xlink:actuate"),
- ::rtl::OUString::createFromAscii("onRequest")));
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("onRequest"))));
attributes.push_back(std::make_pair(
static_cast<const char*>("xlink:title"), m_TemplateName));
attributes.push_back(std::make_pair(
@@ -1088,7 +1087,7 @@ SfxDocumentMetaData::checkInit() const // throw (css::uno::RuntimeException)
"SfxDocumentMetaData::checkInit: not initialized"),
*const_cast<SfxDocumentMetaData*>(this));
}
- DBG_ASSERT((m_xDoc.is() && m_xParent.is() && m_xUserDefined.is()),
+ DBG_ASSERT((m_xDoc.is() && m_xParent.is() ),
"SfxDocumentMetaData::checkInit: reference is null");
}
@@ -1117,13 +1116,13 @@ void SAL_CALL SfxDocumentMetaData::init(
m_xDoc->normalize();
// select nodes for standard meta data stuff
- xPath->registerNS(::rtl::OUString::createFromAscii("xlink"),
+ xPath->registerNS(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xlink")),
::rtl::OUString::createFromAscii(s_nsXLink));
- xPath->registerNS(::rtl::OUString::createFromAscii("dc"),
+ xPath->registerNS(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dc")),
::rtl::OUString::createFromAscii(s_nsDC));
- xPath->registerNS(::rtl::OUString::createFromAscii("office"),
+ xPath->registerNS(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("office")),
::rtl::OUString::createFromAscii(s_nsODF));
- xPath->registerNS(::rtl::OUString::createFromAscii("meta"),
+ xPath->registerNS(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta")),
::rtl::OUString::createFromAscii(s_nsODFMeta));
// NB: we do not handle the single-XML-file ODF variant, which would
// have the root element office:document.
@@ -1216,40 +1215,17 @@ void SAL_CALL SfxDocumentMetaData::init(
getMetaAttr("meta:hyperlink-behaviour", "office:target-frame-name");
+ std::vector<css::uno::Reference<css::xml::dom::XNode> > & vec =
+ m_metaList[::rtl::OUString::createFromAscii("meta:user-defined")];
// user-defined meta data: create PropertyBag which only accepts property
// values of allowed types
- css::uno::Sequence<css::uno::Type> types(10);
- types[0] = ::cppu::UnoType<bool>::get();
- types[1] = ::cppu::UnoType< ::rtl::OUString>::get();
- types[2] = ::cppu::UnoType<css::util::DateTime>::get();
- types[3] = ::cppu::UnoType<css::util::Date>::get();
- types[4] = ::cppu::UnoType<css::util::Time>::get();
- types[5] = ::cppu::UnoType<float>::get();
- types[6] = ::cppu::UnoType<double>::get();
- types[7] = ::cppu::UnoType<sal_Int16>::get();
- types[8] = ::cppu::UnoType<sal_Int32>::get();
- types[9] = ::cppu::UnoType<sal_Int64>::get();
- css::uno::Sequence<css::uno::Any> args(2);
- args[0] <<= css::beans::NamedValue(
- ::rtl::OUString::createFromAscii("AllowedTypes"),
- css::uno::makeAny(types));
- // #i94175#: ODF 1.1 allows empty user-defined property names!
- args[1] <<= css::beans::NamedValue(
- ::rtl::OUString::createFromAscii("AllowEmptyPropertyName"),
- css::uno::makeAny(sal_True));
- m_xUserDefined.set(
- xMsf->createInstanceWithContext(::rtl::OUString::createFromAscii(
- "com.sun.star.beans.PropertyBag"), m_xContext),
- css::uno::UNO_QUERY_THROW);
- css::uno::Reference<css::lang::XInitialization> xInit(m_xUserDefined,
- css::uno::UNO_QUERY);
- if (xInit.is()) {
- xInit->initialize(args);
+ if ( !vec.empty() )
+ {
+ createUserDefined();
}
// user-defined meta data: initialize PropertySet from DOM nodes
- std::vector<css::uno::Reference<css::xml::dom::XNode> > & vec =
- m_metaList[::rtl::OUString::createFromAscii("meta:user-defined")];
+
for (std::vector<css::uno::Reference<css::xml::dom::XNode> >::iterator
it = vec.begin(); it != vec.end(); ++it) {
css::uno::Reference<css::xml::dom::XElement> xElem(*it,
@@ -1257,7 +1233,7 @@ void SAL_CALL SfxDocumentMetaData::init(
css::uno::Any any;
::rtl::OUString name = xElem->getAttributeNS(
::rtl::OUString::createFromAscii(s_nsODFMeta),
- ::rtl::OUString::createFromAscii("name"));
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")));
::rtl::OUString type = xElem->getAttributeNS(
::rtl::OUString::createFromAscii(s_nsODFMeta),
::rtl::OUString::createFromAscii("value-type"));
@@ -1328,10 +1304,7 @@ SfxDocumentMetaData::SfxDocumentMetaData(
css::uno::Reference< css::uno::XComponentContext > const & context) :
BaseMutex(), SfxDocumentMetaData_Base(m_aMutex),
m_xContext(context), m_NotifyListeners(m_aMutex),
- m_isInitialized(false), m_isModified(false),
- m_xDoc(), m_xParent(), m_meta(), m_metaList(), m_xUserDefined(),
- m_TemplateName(), m_TemplateURL(), m_TemplateDate(), m_AutoloadURL(),
- m_AutoloadSecs(), m_DefaultTarget()
+ m_isInitialized(false), m_isModified(false)
{
DBG_ASSERT(context.is(), "SfxDocumentMetaData: context is null");
DBG_ASSERT(context->getServiceManager().is(),
@@ -1843,6 +1816,7 @@ SfxDocumentMetaData::getUserDefinedProperties()
{
::osl::MutexGuard g(m_aMutex);
checkInit();
+ createUserDefined();
return m_xUserDefined;
}
@@ -1895,7 +1869,7 @@ SfxDocumentMetaData::loadFromStorage(
css::uno::Reference<css::beans::XPropertySet> xPropArg =
getURLProperties(Medium);
try {
- xPropArg->getPropertyValue(::rtl::OUString::createFromAscii("BaseURI"))
+ xPropArg->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseURI")))
>>= input.sSystemId;
input.sSystemId += ::rtl::OUString::createFromAscii("/").concat(
::rtl::OUString::createFromAscii(s_metaXml));
@@ -1954,13 +1928,13 @@ SfxDocumentMetaData::storeToStorage(
css::uno::Reference< css::beans::XPropertySet > xStreamProps(xStream,
css::uno::UNO_QUERY_THROW);
xStreamProps->setPropertyValue(
- ::rtl::OUString::createFromAscii("MediaType"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")),
css::uno::makeAny(::rtl::OUString::createFromAscii("text/xml")));
xStreamProps->setPropertyValue(
- ::rtl::OUString::createFromAscii("Compressed"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Compressed")),
css::uno::makeAny(static_cast<sal_Bool> (sal_False)));
xStreamProps->setPropertyValue(
- ::rtl::OUString::createFromAscii("UseCommonStoragePasswordEncryption"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseCommonStoragePasswordEncryption")),
css::uno::makeAny(static_cast<sal_Bool> (sal_False)));
css::uno::Reference<css::io::XOutputStream> xOutStream =
xStream->getOutputStream();
@@ -2194,9 +2168,12 @@ void SAL_CALL SfxDocumentMetaData::setModified( ::sal_Bool bModified )
::osl::MutexGuard g(m_aMutex);
checkInit();
m_isModified = bModified;
- xMB.set(m_xUserDefined, css::uno::UNO_QUERY);
- DBG_ASSERT(xMB.is(),
- "SfxDocumentMetaData::setModified: PropertyBag not Modifiable?");
+ if ( !bModified )
+ {
+ xMB.set(m_xUserDefined, css::uno::UNO_QUERY);
+ DBG_ASSERT(xMB.is(),
+ "SfxDocumentMetaData::setModified: PropertyBag not Modifiable?");
+ }
}
if (bModified) {
try {
@@ -2262,6 +2239,52 @@ void SAL_CALL SfxDocumentMetaData::serialize(
xSAXable->serialize(i_xHandler, i_rNamespaces);
}
+void SfxDocumentMetaData::createUserDefined()
+{
+ if ( !m_xUserDefined.is() )
+ {
+ css::uno::Sequence<css::uno::Type> types(10);
+ types[0] = ::cppu::UnoType<bool>::get();
+ types[1] = ::cppu::UnoType< ::rtl::OUString>::get();
+ types[2] = ::cppu::UnoType<css::util::DateTime>::get();
+ types[3] = ::cppu::UnoType<css::util::Date>::get();
+ types[4] = ::cppu::UnoType<css::util::Time>::get();
+ types[5] = ::cppu::UnoType<float>::get();
+ types[6] = ::cppu::UnoType<double>::get();
+ types[7] = ::cppu::UnoType<sal_Int16>::get();
+ types[8] = ::cppu::UnoType<sal_Int32>::get();
+ types[9] = ::cppu::UnoType<sal_Int64>::get();
+ css::uno::Sequence<css::uno::Any> args(2);
+ args[0] <<= css::beans::NamedValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AllowedTypes")),
+ css::uno::makeAny(types));
+ // #i94175#: ODF 1.1 allows empty user-defined property names!
+ args[1] <<= css::beans::NamedValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AllowEmptyPropertyName")),
+ css::uno::makeAny(sal_True));
+
+ css::uno::Reference<css::lang::XMultiComponentFactory> xMsf (m_xContext->getServiceManager());
+ m_xUserDefined.set(
+ xMsf->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.PropertyBag")), m_xContext),
+ css::uno::UNO_QUERY_THROW);
+ css::uno::Reference<css::lang::XInitialization> xInit(m_xUserDefined,
+ css::uno::UNO_QUERY);
+ if (xInit.is()) {
+ xInit->initialize(args);
+ }
+
+ css::uno::Reference<css::util::XModifyBroadcaster> xMB(m_xUserDefined,css::uno::UNO_QUERY);
+ if (xMB.is())
+ {
+ css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > aListener = m_NotifyListeners.getElements();
+ const css::uno::Reference< css::uno::XInterface >* pIter = aListener.getConstArray();
+ const css::uno::Reference< css::uno::XInterface >* pEnd = pIter + aListener.getLength();
+ for(;pIter != pEnd;++pIter )
+ xMB->addModifyListener(css::uno::Reference< css::util::XModifyListener >(*pIter,css::uno::UNO_QUERY));
+ }
+ }
+}
+
} // closing anonymous implementation namespace
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 2d1a452a02..54401d4b4d 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -138,47 +138,6 @@ static WeakReference< XInterface > s_xCurrentComponent;
//=========================================================================
-/** This Listener is used to get notified when the XDocumentProperties of the
- XModel change.
- If several changes are done the "bQuiet" member can be used to
- temporarily suppress notifications.
- */
-class SfxDocInfoListener_Impl : public ::cppu::WeakImplHelper1<
- ::com::sun::star::util::XModifyListener >
-{
-
-public:
- SfxObjectShell& m_rShell;
- bool bQuiet;
- bool bGotModified;
-
- SfxDocInfoListener_Impl( SfxObjectShell& i_rDoc )
- : m_rShell(i_rDoc)
- , bQuiet(false)
- { };
-
- virtual void SAL_CALL disposing( const lang::EventObject& )
- throw ( uno::RuntimeException );
- virtual void SAL_CALL modified( const lang::EventObject& )
- throw ( uno::RuntimeException );
-};
-
-void SAL_CALL SfxDocInfoListener_Impl::modified( const lang::EventObject& )
- throw ( uno::RuntimeException )
-{
- ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- bGotModified = true;
-
- // notify changes to the SfxObjectShell
- if ( !bQuiet ) {
- m_rShell.FlushDocInfo();
- }
-}
-
-void SAL_CALL SfxDocInfoListener_Impl::disposing( const lang::EventObject& )
- throw ( uno::RuntimeException )
-{
-}
//=========================================================================
@@ -1036,10 +995,10 @@ void SfxObjectShell::SetModel( SfxBaseModel* pModel )
pImp->xModel = pModel;
if ( pModel ) {
pModel->addCloseListener( new SfxModelListener_Impl(this) );
- pImp->m_xDocInfoListener = new SfxDocInfoListener_Impl(*this);
- uno::Reference<util::XModifyBroadcaster> xMB(
- pModel->getDocumentProperties(), uno::UNO_QUERY_THROW);
- xMB->addModifyListener(pImp->m_xDocInfoListener);
+ //pImp->m_xDocInfoListener = new SfxDocInfoListener_Impl(*this);
+ //uno::Reference<util::XModifyBroadcaster> xMB(
+ // pModel->getDocumentProperties(), uno::UNO_QUERY_THROW);
+ //xMB->addModifyListener(pImp->m_xDocInfoListener);
}
}
@@ -1077,7 +1036,8 @@ sal_uInt16 SfxObjectShell::GetAutoStyleFilterIndex()
void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComponent )
{
- if ( _rxComponent.get() == s_xCurrentComponent.get().get() )
+ Reference< XInterface > xTest(s_xCurrentComponent);
+ if ( _rxComponent == xTest )
// nothing to do
return;
// note that "_rxComponent.get() == s_xCurrentComponent.get().get()" is /sufficient/, but not
@@ -1085,9 +1045,8 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp
// In other words, it's still possible that we here do something which is not necessary,
// but we should have filtered quite some unnecessary calls already.
- s_xCurrentComponent = _rxComponent;
-
BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
+ s_xCurrentComponent = _rxComponent;
if ( pAppMgr )
pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxComponent ) );
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index e0472349d8..cf755231bc 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -141,6 +141,52 @@ namespace css = ::com::sun::star;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
+/** This Listener is used to get notified when the XDocumentProperties of the
+ XModel change.
+ If several changes are done the "bQuiet" member can be used to
+ temporarily suppress notifications.
+ */
+class SfxDocInfoListener_Impl : public ::cppu::WeakImplHelper1<
+ ::com::sun::star::util::XModifyListener >
+{
+
+public:
+ SfxObjectShell& m_rShell;
+ bool bQuiet;
+ bool bGotModified;
+
+ SfxDocInfoListener_Impl( SfxObjectShell& i_rDoc )
+ : m_rShell(i_rDoc)
+ , bQuiet(false)
+ { };
+
+ ~SfxDocInfoListener_Impl();
+
+ virtual void SAL_CALL disposing( const lang::EventObject& )
+ throw ( uno::RuntimeException );
+ virtual void SAL_CALL modified( const lang::EventObject& )
+ throw ( uno::RuntimeException );
+};
+SfxDocInfoListener_Impl::~SfxDocInfoListener_Impl()
+{
+}
+void SAL_CALL SfxDocInfoListener_Impl::modified( const lang::EventObject& )
+ throw ( uno::RuntimeException )
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ bGotModified = true;
+
+ // notify changes to the SfxObjectShell
+ if ( !bQuiet ) {
+ m_rShell.FlushDocInfo();
+ }
+}
+
+void SAL_CALL SfxDocInfoListener_Impl::disposing( const lang::EventObject& )
+ throw ( uno::RuntimeException )
+{
+}
+
//________________________________________________________________________________________________________
// impl. declarations
//________________________________________________________________________________________________________
@@ -861,6 +907,8 @@ SfxBaseModel::getDocumentProperties()
uno::UNO_QUERY_THROW);
// xDocProps->initialize(uno::Sequence<uno::Any>());
m_pData->m_xDocumentProperties.set(xDocProps, uno::UNO_QUERY_THROW);
+ uno::Reference<util::XModifyBroadcaster> xMB(m_pData->m_xDocumentProperties, uno::UNO_QUERY_THROW);
+ xMB->addModifyListener(new SfxDocInfoListener_Impl(*m_pData->m_pObjectShell));
}
return m_pData->m_xDocumentProperties;
diff --git a/svx/inc/svx/SmartTagMgr.hxx b/svx/inc/svx/SmartTagMgr.hxx
index 8295ec2189..7821b2ce13 100644
--- a/svx/inc/svx/SmartTagMgr.hxx
+++ b/svx/inc/svx/SmartTagMgr.hxx
@@ -102,7 +102,7 @@ private:
std::vector< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > > maActionList;
std::set< rtl::OUString > maDisabledSmartTagTypes;
std::multimap < rtl::OUString, ActionReference > maSmartTagMap;
- com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > mxBreakIter;
+ mutable com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > mxBreakIter;
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext> mxContext;
com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > mxConfigurationSettings;
@@ -129,6 +129,8 @@ private:
*/
void AssociateActionsWithRecognizers();
+ void CreateBreakIterator() const;
+
public:
SmartTagMgr( const rtl::OUString& rApplicationName );
diff --git a/svx/source/inc/dbcharsethelper.hxx b/svx/inc/svx/dbcharsethelper.hxx
index c88ecc71f2..342f54c1e4 100644..100755
--- a/svx/source/inc/dbcharsethelper.hxx
+++ b/svx/inc/svx/dbcharsethelper.hxx
@@ -30,8 +30,8 @@
#ifndef SVX_DBCHARSETHELPER_HXX
#define SVX_DBCHARSETHELPER_HXX
-
-#include "dbtoolsclient.hxx"
+#include "svx/svxdllapi.h"
+#include "svx/dbtoolsclient.hxx"
//........................................................................
namespace svxform
@@ -41,7 +41,7 @@ namespace svxform
//====================================================================
//= ODataAccessCharsetHelper
//====================================================================
- class ODataAccessCharsetHelper : public ODbtoolsClient
+ class SVX_DLLPUBLIC ODataAccessCharsetHelper : public ODbtoolsClient
{
protected:
mutable ::rtl::Reference< ::connectivity::simple::IDataAccessCharSet > m_xCharsetHelper;
diff --git a/svx/source/inc/dbtoolsclient.hxx b/svx/inc/svx/dbtoolsclient.hxx
index 262b791e80..ae5721a87f 100644..100755
--- a/svx/source/inc/dbtoolsclient.hxx
+++ b/svx/inc/svx/dbtoolsclient.hxx
@@ -36,7 +36,7 @@
#include <osl/module.h>
#include <tools/solar.h>
#include <unotools/sharedunocomponent.hxx>
-#include <svx/svxdllapi.h>
+#include "svx/svxdllapi.h"
//........................................................................
namespace svxform
@@ -94,7 +94,7 @@ namespace svxform
public:
OStaticDataAccessTools();
- SVX_DLLPRIVATE const ::rtl::Reference< ::connectivity::simple::IDataAccessTools >& getDataAccessTools() const { return m_xDataAccessTools; }
+ const ::rtl::Reference< ::connectivity::simple::IDataAccessTools >& getDataAccessTools() const { return m_xDataAccessTools; }
// ------------------------------------------------
::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> getNumberFormats(
@@ -103,13 +103,13 @@ namespace svxform
) const;
// ------------------------------------------------
- SVX_DLLPRIVATE sal_Int32 getDefaultNumberFormat(
+ sal_Int32 getDefaultNumberFormat(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xColumn,
const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _xTypes,
const ::com::sun::star::lang::Locale& _rLocale );
// ------------------------------------------------
- SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback(
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback(
const ::rtl::OUString& _rDataSourceName,
const ::rtl::OUString& _rUser,
const ::rtl::OUString& _rPwd,
@@ -131,26 +131,26 @@ namespace svxform
const SAL_THROW ( (::com::sun::star::uno::RuntimeException) );
// ------------------------------------------------
- SVX_DLLPRIVATE void TransferFormComponentProperties(
+ void TransferFormComponentProperties(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxOld,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxNew,
const ::com::sun::star::lang::Locale& _rLocale
) const;
// ------------------------------------------------
- SVX_DLLPRIVATE ::rtl::OUString quoteName(
+ ::rtl::OUString quoteName(
const ::rtl::OUString& _rQuote,
const ::rtl::OUString& _rName
) const;
// ------------------------------------------------
- SVX_DLLPRIVATE ::rtl::OUString composeTableNameForSelect(
+ ::rtl::OUString composeTableNameForSelect(
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable
) const;
// ------------------------------------------------
- SVX_DLLPRIVATE ::com::sun::star::sdb::SQLContext prependContextInfo(
+ ::com::sun::star::sdb::SQLContext prependContextInfo(
::com::sun::star::sdbc::SQLException& _rException,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
const ::rtl::OUString& _rContextDescription,
@@ -158,7 +158,7 @@ namespace svxform
) const;
// ------------------------------------------------
- SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
const ::rtl::OUString& _rsRegisteredName,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
) const;
@@ -167,22 +167,22 @@ namespace svxform
/** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT
@param _rxCursorSet the property set
*/
- SVX_DLLPRIVATE sal_Bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
+ sal_Bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
// ------------------------------------------------
/** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE
@param _rxCursorSet the property set
*/
- SVX_DLLPRIVATE sal_Bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
+ sal_Bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
// ------------------------------------------------
/** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::DELETE
@param _rxCursorSet the property set
*/
- SVX_DLLPRIVATE sal_Bool canDelete(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
+ sal_Bool canDelete(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
// ------------------------------------------------
- SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
getFieldsByCommandDescriptor(
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
const sal_Int32 _nCommandType,
@@ -201,13 +201,13 @@ namespace svxform
) SAL_THROW( ( ) );
// ------------------------------------------------
- SVX_DLLPRIVATE bool isEmbeddedInDatabase(
+ bool isEmbeddedInDatabase(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
);
// ------------------------------------------------
- SVX_DLLPRIVATE bool isEmbeddedInDatabase(
+ bool isEmbeddedInDatabase(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent
);
};
@@ -215,7 +215,7 @@ namespace svxform
//====================================================================
//= DBToolsObjectFactory
//====================================================================
- class DBToolsObjectFactory : public ODbtoolsClient
+ class SVX_DLLPUBLIC DBToolsObjectFactory : public ODbtoolsClient
{
public:
DBToolsObjectFactory();
diff --git a/svx/inc/svx/svdetc.hxx b/svx/inc/svx/svdetc.hxx
index 5fe0d1245b..8a93741bc3 100644
--- a/svx/inc/svx/svdetc.hxx
+++ b/svx/inc/svx/svdetc.hxx
@@ -309,6 +309,9 @@ public:
class SVX_DLLPUBLIC SdrGlobalData
{
+ const SvtSysLocale* pSysLocale; // follows always locale settings
+ const CharClass* pCharClass; // follows always SysLocale
+ const LocaleDataWrapper* pLocaleData; // follows always SysLocale
public:
SdrLinkList aUserMakeObjHdl;
SdrLinkList aUserMakeObjUserDataHdl;
@@ -317,10 +320,11 @@ public:
ResMgr* pResMgr;
ULONG nExchangeFormat;
OLEObjCache aOLEObjCache;
- const SvtSysLocale* pSysLocale; // follows always locale settings
- const CharClass* pCharClass; // follows always SysLocale
- const LocaleDataWrapper* pLocaleData; // follows always SysLocale
+
+ const SvtSysLocale* GetSysLocale(); // follows always locale settings
+ const CharClass* GetCharClass(); // follows always SysLocale
+ const LocaleDataWrapper* GetLocaleData(); // follows always SysLocale
public:
SdrGlobalData();
~SdrGlobalData();
diff --git a/svx/inc/svx/tstpitem.hxx b/svx/inc/svx/tstpitem.hxx
index d61d03f03c..1e4dc79301 100644
--- a/svx/inc/svx/tstpitem.hxx
+++ b/svx/inc/svx/tstpitem.hxx
@@ -53,11 +53,13 @@ private:
long nTabPos;
SvxTabAdjust eAdjustment;
- sal_Unicode cDecimal;
+ mutable sal_Unicode m_cDecimal;
sal_Unicode cFill;
SVX_DLLPRIVATE friend SvStream& operator<<( SvStream&, SvxTabStop& );
+ void fillDecimal() const;
+
public:
SvxTabStop();
#if (_MSC_VER < 1300)
@@ -78,8 +80,8 @@ public:
SvxTabAdjust& GetAdjustment() { return eAdjustment; }
SvxTabAdjust GetAdjustment() const { return eAdjustment; }
- sal_Unicode& GetDecimal() { return cDecimal; }
- sal_Unicode GetDecimal() const { return cDecimal; }
+ sal_Unicode& GetDecimal() { fillDecimal(); return m_cDecimal; }
+ sal_Unicode GetDecimal() const { fillDecimal(); return m_cDecimal; }
sal_Unicode& GetFill() { return cFill; }
sal_Unicode GetFill() const { return cFill; }
@@ -91,7 +93,7 @@ public:
{
return ( nTabPos == rTS.nTabPos &&
eAdjustment == rTS.eAdjustment &&
- cDecimal == rTS.cDecimal &&
+ m_cDecimal == rTS.m_cDecimal &&
cFill == rTS.cFill );
}
@@ -105,7 +107,7 @@ public:
{
nTabPos = rTS.nTabPos;
eAdjustment = rTS.eAdjustment;
- cDecimal = rTS.cDecimal;
+ m_cDecimal = rTS.m_cDecimal;
cFill = rTS.cFill;
return *this;
}
diff --git a/svx/prj/d.lst b/svx/prj/d.lst
index 227dac4db6..7edc2fbc9c 100644
--- a/svx/prj/d.lst
+++ b/svx/prj/d.lst
@@ -554,6 +554,8 @@ mkdir: %_DEST%\inc%_EXT%\svx
..\inc\svx\SmartTagCtl.hxx %_DEST%\inc%_EXT%\svx\SmartTagCtl.hxx
..\inc\svx\databaselocationinput.hxx %_DEST%\inc%_EXT%\svx\databaselocationinput.hxx
..\inc\xlinjoit.hxx %_DEST%\inc%_EXT%\svx\xlinjoit.hxx
+..\inc\svx\dbcharsethelper.hxx %_DEST%\inc%_EXT%\svx\dbcharsethelper.hxx
+..\inc\svx\dbtoolsclient.hxx %_DEST%\inc%_EXT%\svx\dbtoolsclient.hxx
mkdir: %_DEST%\inc%_EXT%\svx\sdr
mkdir: %_DEST%\inc%_EXT%\svx\sdr\properties
diff --git a/svx/source/dialog/txencbox.cxx b/svx/source/dialog/txencbox.cxx
index 527be2b9b0..7d89f8fa6f 100644
--- a/svx/source/dialog/txencbox.cxx
+++ b/svx/source/dialog/txencbox.cxx
@@ -34,7 +34,7 @@
#include "txencbox.hxx"
#include "txenctab.hxx"
#include <svx/dialogs.hrc>
-#include "dbcharsethelper.hxx"
+#include "svx/dbcharsethelper.hxx"
#include <vcl/svapp.hxx>
#include <rtl/tencinfo.h>
#include <rtl/locale.h>
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 54e5b12455..08a03a6ba3 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -36,7 +36,7 @@
#endif
#include <svx/gridctrl.hxx>
#include "gridcell.hxx"
-#include "dbtoolsclient.hxx"
+#include "svx/dbtoolsclient.hxx"
#include "fmtools.hxx"
#include <svtools/stringtransfer.hxx>
diff --git a/svx/source/form/dbcharsethelper.cxx b/svx/source/form/dbcharsethelper.cxx
index d430f1063d..9f6b1b7401 100644
--- a/svx/source/form/dbcharsethelper.cxx
+++ b/svx/source/form/dbcharsethelper.cxx
@@ -30,7 +30,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-#include "dbcharsethelper.hxx"
+#include "svx/dbcharsethelper.hxx"
//........................................................................
namespace svxform
diff --git a/svx/source/form/dbtoolsclient.cxx b/svx/source/form/dbtoolsclient.cxx
index d467a53b6a..c430a2e14a 100644
--- a/svx/source/form/dbtoolsclient.cxx
+++ b/svx/source/form/dbtoolsclient.cxx
@@ -34,7 +34,7 @@
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/sdb/SQLContext.hpp>
-#include "dbtoolsclient.hxx"
+#include "svx/dbtoolsclient.hxx"
#include <osl/diagnose.h>
#include <connectivity/formattedcolumnvalue.hxx>
diff --git a/svx/source/form/fmdocumentclassification.cxx b/svx/source/form/fmdocumentclassification.cxx
index 58c3db830f..fb5790c35c 100644
--- a/svx/source/form/fmdocumentclassification.cxx
+++ b/svx/source/form/fmdocumentclassification.cxx
@@ -34,7 +34,7 @@
#ifndef SVX_SOURCE_FORM_FMDOCUMENTCLASSIFICATION_HXX
#include "fmdocumentclassification.hxx"
#endif
-#include "dbtoolsclient.hxx"
+#include "svx/dbtoolsclient.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/container/XChild.hpp>
diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx
index edd9b20718..107cf5464e 100644
--- a/svx/source/form/fmpgeimp.cxx
+++ b/svx/source/form/fmpgeimp.cxx
@@ -40,7 +40,7 @@
#include "fmobj.hxx"
#include "svditer.hxx"
#include "fmresids.hrc"
-#include "dbtoolsclient.hxx"
+#include "svx/dbtoolsclient.hxx"
#include "treevisitor.hxx"
#include <com/sun/star/sdb/CommandType.hpp>
diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx
index 9be98fd4b1..6f3c9f5a75 100644
--- a/svx/source/form/fmtools.cxx
+++ b/svx/source/form/fmtools.cxx
@@ -37,7 +37,7 @@
#include <com/sun/star/sdbcx/Privilege.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include "fmtools.hxx"
-#include "dbtoolsclient.hxx"
+#include "svx/dbtoolsclient.hxx"
#include "fmservs.hxx"
#include <svx/fmglob.hxx>
#include <vcl/stdtext.hxx>
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index bc8b334d55..2fc7022f73 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -55,7 +55,7 @@
#include <rtl/logfile.hxx>
#include <svx/dialmgr.hxx>
#include "fmpgeimp.hxx"
-#include "dbtoolsclient.hxx"
+#include "svx/dbtoolsclient.hxx"
#include <svtools/macitem.hxx>
#include <tools/shl.hxx>
#include <tools/diagnose_ex.h>
diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx
index b4151a9531..33f8b47bd6 100644
--- a/svx/source/form/formcontrolfactory.cxx
+++ b/svx/source/form/formcontrolfactory.cxx
@@ -30,7 +30,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-#include "dbtoolsclient.hxx"
+#include "svx/dbtoolsclient.hxx"
#include "formcontrolfactory.hxx"
#include "fmcontrollayout.hxx"
#include "fmprop.hrc"
diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx
index 7aa57d9a81..0ad9062461 100644
--- a/svx/source/form/tabwin.cxx
+++ b/svx/source/form/tabwin.cxx
@@ -52,7 +52,7 @@
#endif
#include <svx/fmshell.hxx>
#include "fmshimp.hxx"
-#include "dbtoolsclient.hxx"
+#include "svx/dbtoolsclient.hxx"
#include <svx/fmpage.hxx>
#ifndef _SVX_FMPGEIMP_HXX
diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx
index 350bf26a5f..0e13eedb31 100644
--- a/svx/source/inc/fmshimp.hxx
+++ b/svx/source/inc/fmshimp.hxx
@@ -79,7 +79,7 @@
#include <cppuhelper/compbase4.hxx>
#include <cppuhelper/compbase6.hxx>
#include <unotools/configitem.hxx>
-#include "dbtoolsclient.hxx"
+#include "svx/dbtoolsclient.hxx"
#include "formcontrolling.hxx"
#include "fmdocumentclassification.hxx"
diff --git a/svx/source/inc/sqlparserclient.hxx b/svx/source/inc/sqlparserclient.hxx
index 61e0e951bd..a17198bea1 100644
--- a/svx/source/inc/sqlparserclient.hxx
+++ b/svx/source/inc/sqlparserclient.hxx
@@ -31,7 +31,7 @@
#ifndef SVX_SQLPARSERCLIENT_HXX
#define SVX_SQLPARSERCLIENT_HXX
-#include "dbtoolsclient.hxx"
+#include "svx/dbtoolsclient.hxx"
#include "ParseContext.hxx"
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
diff --git a/svx/source/inc/tabwin.hxx b/svx/source/inc/tabwin.hxx
index 6f1aaf5d2a..f4a4ecb0b0 100644
--- a/svx/source/inc/tabwin.hxx
+++ b/svx/source/inc/tabwin.hxx
@@ -42,7 +42,7 @@
//#endif
#include <comphelper/propmultiplex.hxx>
#include <svtools/transfer.hxx>
-#include "dbtoolsclient.hxx"
+#include "svx/dbtoolsclient.hxx"
//==================================================================
class FmFieldWin;
diff --git a/svx/source/inc/typeconversionclient.hxx b/svx/source/inc/typeconversionclient.hxx
index d7c3870a96..605e76f208 100644
--- a/svx/source/inc/typeconversionclient.hxx
+++ b/svx/source/inc/typeconversionclient.hxx
@@ -31,7 +31,7 @@
#ifndef SVX_TYPECONVERSION_CLIENT_HXX
#define SVX_TYPECONVERSION_CLIENT_HXX
-#include "dbtoolsclient.hxx"
+#include "svx/dbtoolsclient.hxx"
//........................................................................
namespace svxform
diff --git a/svx/source/items/numitem.cxx b/svx/source/items/numitem.cxx
index d4693fde03..32a493b5bd 100644
--- a/svx/source/items/numitem.cxx
+++ b/svx/source/items/numitem.cxx
@@ -71,28 +71,31 @@ using namespace ::com::sun::star::style;
sal_Int32 SvxNumberType::nRefCount = 0;
com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> SvxNumberType::xFormatter = 0;
-/* -----------------------------22.02.01 14:24--------------------------------
-
- ---------------------------------------------------------------------------*/
-SvxNumberType::SvxNumberType(sal_Int16 nType) :
- nNumType(nType),
- bShowSymbol(sal_True)
+void lcl_getFormatter(com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& _xFormatter)
{
- if(!xFormatter.is())
+ if(!_xFormatter.is())
{
try
- {
+ {
Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
Reference < XInterface > xI = xMSF->createInstance(
::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) );
Reference<XDefaultNumberingProvider> xRet(xI, UNO_QUERY);
DBG_ASSERT(xRet.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\"");
- xFormatter = Reference<XNumberingFormatter> (xRet, UNO_QUERY);
+ _xFormatter = Reference<XNumberingFormatter> (xRet, UNO_QUERY);
}
catch(Exception& )
{
}
}
+}
+/* -----------------------------22.02.01 14:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxNumberType::SvxNumberType(sal_Int16 nType) :
+ nNumType(nType),
+ bShowSymbol(sal_True)
+{
nRefCount++;
}
/* -----------------------------22.02.01 14:31--------------------------------
@@ -126,6 +129,7 @@ String SvxNumberType::GetNumStr( ULONG nNo ) const
* --------------------------------------------------*/
String SvxNumberType::GetNumStr( ULONG nNo, const Locale& rLocale ) const
{
+ lcl_getFormatter(xFormatter);
String aTmpStr;
if(!xFormatter.is())
return aTmpStr;
diff --git a/svx/source/items/paraitem.cxx b/svx/source/items/paraitem.cxx
index 4bb7b62ac7..56436448d7 100644
--- a/svx/source/items/paraitem.cxx
+++ b/svx/source/items/paraitem.cxx
@@ -889,7 +889,7 @@ SvxTabStop::SvxTabStop()
{
nTabPos = 0;
eAdjustment = SVX_TAB_ADJUST_LEFT;
- cDecimal = SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0);
+ m_cDecimal = cDfltDecimalChar;
cFill = cDfltFillChar;
}
@@ -900,10 +900,15 @@ SvxTabStop::SvxTabStop( const long nPos, const SvxTabAdjust eAdjst,
{
nTabPos = nPos;
eAdjustment = eAdjst;
- cDecimal = ( cDfltDecimalChar == cDec ) ? SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0) : cDec;
+ m_cDecimal = cDec;
cFill = cFil;
}
-
+// -----------------------------------------------------------------------------
+void SvxTabStop::fillDecimal() const
+{
+ if ( cDfltDecimalChar == m_cDecimal )
+ m_cDecimal = SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0);
+}
// -----------------------------------------------------------------------
XubString SvxTabStop::GetValueString() const
@@ -918,7 +923,7 @@ XubString SvxTabStop::GetValueString() const
aStr += cpDelim;
aStr += sal_Unicode('[');
aStr += XubString( ResId( RID_SVXITEMS_TAB_DECIMAL_CHAR, DIALOG_MGR() ) );
- aStr += cDecimal;
+ aStr += GetDecimal();
aStr += sal_Unicode(']');
aStr += cpDelim;
aStr += cpDelim;
diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx
index f1bb85a626..43b3dd207e 100644
--- a/svx/source/smarttags/SmartTagMgr.cxx
+++ b/svx/source/smarttags/SmartTagMgr.cxx
@@ -70,10 +70,7 @@ SmartTagMgr::SmartTagMgr( const rtl::OUString& rApplicationName )
maActionList(),
maDisabledSmartTagTypes(),
maSmartTagMap(),
- mxBreakIter(),
mxMSF( ::comphelper::getProcessServiceFactory() ),
- mxContext(),
- mxConfigurationSettings(),
mbLabelTextWithSmartTags(true)
{
}
@@ -93,10 +90,6 @@ void SmartTagMgr::Init( const rtl::OUString& rConfigurationGroupName )
if ( mxContext.is() )
{
- // get the break iterator
- mxBreakIter = Reference< i18n::XBreakIterator >(
- mxMSF->createInstance( C2U( "com.sun.star.i18n.BreakIterator" ) ), UNO_QUERY);
-
PrepareConfiguration( rConfigurationGroupName );
ReadConfiguration( true, true );
RegisterListener();
@@ -104,6 +97,14 @@ void SmartTagMgr::Init( const rtl::OUString& rConfigurationGroupName )
}
}
}
+void SmartTagMgr::CreateBreakIterator() const
+{
+ if ( !mxBreakIter.is() && mxMSF.is() && mxContext.is() )
+ {
+ // get the break iterator
+ mxBreakIter.set(mxMSF->createInstance( C2U( "com.sun.star.i18n.BreakIterator" ) ), UNO_QUERY);
+ }
+}
/** Dispatches the recognize call to all installed smart tag recognizers
*/
@@ -129,10 +130,13 @@ void SmartTagMgr::Recognize( const rtl::OUString& rText,
}
if ( bCallRecognizer )
+ {
+ CreateBreakIterator();
maRecognizerList[i]->recognize( rText, nStart, nLen,
smarttags::SmartTagRecognizerMode_PARAGRAPH,
rLocale, xMarkup, maApplicationName, xController,
mxBreakIter );
+ }
}
}
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 0487aafb3c..b01caa73f8 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -82,14 +82,17 @@ using namespace ::com::sun::star;
******************************************************************************/
SdrGlobalData::SdrGlobalData() :
+ pSysLocale(NULL),
+ pCharClass(NULL),
+ pLocaleData(NULL),
pOutliner(NULL),
pDefaults(NULL),
pResMgr(NULL),
nExchangeFormat(0)
{
- pSysLocale = new SvtSysLocale;
- pCharClass = pSysLocale->GetCharClassPtr();
- pLocaleData = pSysLocale->GetLocaleDataPtr();
+ //pSysLocale = new SvtSysLocale;
+ //pCharClass = pSysLocale->GetCharClassPtr();
+ //pLocaleData = pSysLocale->GetLocaleDataPtr();
svx::ExtrusionBar::RegisterInterface();
svx::FontworkBar::RegisterInterface();
@@ -103,7 +106,24 @@ SdrGlobalData::~SdrGlobalData()
//! do NOT delete pCharClass and pLocaleData
delete pSysLocale;
}
-
+const SvtSysLocale* SdrGlobalData::GetSysLocale()
+{
+ if ( !pSysLocale )
+ pSysLocale = new SvtSysLocale;
+ return pSysLocale;
+}
+const CharClass* SdrGlobalData::GetCharClass()
+{
+ if ( !pCharClass )
+ pCharClass = GetSysLocale()->GetCharClassPtr();
+ return pCharClass;
+}
+const LocaleDataWrapper* SdrGlobalData::GetLocaleData()
+{
+ if ( !pLocaleData )
+ pLocaleData = GetSysLocale()->GetLocaleDataPtr();
+ return pLocaleData;
+}
////////////////////////////////////////////////////////////////////////////////////////////////////
OLEObjCache::OLEObjCache()