diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-06-09 14:50:43 +0200 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-06-09 14:50:43 +0200 |
commit | 75c38455522cd88bbf660c4d30b937ba905d9a05 (patch) | |
tree | 0f7462fe1a276e787e2b82e090107b176035c9c9 /sd/source/ui/framework | |
parent | ab76732221aaf59cc9df43fa99b1883cb7888049 (diff) | |
parent | 47b5ec4b0b48b7108715cb1e780ad3dca284cfa9 (diff) |
cws tl74: merge with DEV300_m81
Diffstat (limited to 'sd/source/ui/framework')
23 files changed, 209 insertions, 170 deletions
diff --git a/sd/source/ui/framework/configuration/ConfigurationController.cxx b/sd/source/ui/framework/configuration/ConfigurationController.cxx index 68bf55bb7495..a33bfdcda268 100644..100755 --- a/sd/source/ui/framework/configuration/ConfigurationController.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationController.cxx @@ -56,7 +56,7 @@ using rtl::OUString; using ::sd::framework::FrameworkHelper; #undef VERBOSE -#define VERBOSE 3 +//#define VERBOSE 3 namespace sd { namespace framework { diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx index e708909ee928..ff167f07520a 100644..100755 --- a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -123,8 +124,7 @@ void ConfigurationControllerBroadcaster::NotifyListeners ( } catch(RuntimeException&) { - DBG_ASSERT(false, - "ConfigurationController: caught exception while notifying listeners"); + DBG_UNHANDLED_EXCEPTION(); } } } @@ -212,8 +212,7 @@ void ConfigurationControllerBroadcaster::DisposeAndClear (void) } catch (RuntimeException&) { - DBG_ASSERT(false, - "ConfigurationController: caught exception while notifying dispose"); + DBG_UNHANDLED_EXCEPTION(); } } else diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx index bb5aab8a05d3..93ff7ee54e00 100644..100755 --- a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx @@ -32,6 +32,7 @@ #include "ResourceFactoryManager.hxx" #include "framework/FrameworkHelper.hxx" #include <com/sun/star/lang/DisposedException.hpp> +#include <tools/diagnose_ex.h> #include <algorithm> #include <boost/bind.hpp> @@ -168,7 +169,7 @@ void ConfigurationControllerResourceManager::ActivateResource ( } catch(Exception&) { - OSL_ENSURE(false, "caught exception while activating resource"); + DBG_UNHANDLED_EXCEPTION(); } if (xResource.is()) @@ -197,7 +198,7 @@ void ConfigurationControllerResourceManager::ActivateResource ( } catch (RuntimeException&) { - OSL_ASSERT(false); + DBG_UNHANDLED_EXCEPTION(); } } @@ -257,7 +258,7 @@ void ConfigurationControllerResourceManager::DeactivateResource ( } catch (RuntimeException&) { - OSL_ASSERT(false); + DBG_UNHANDLED_EXCEPTION(); } #if defined VERBOSE && VERBOSE>=1 diff --git a/sd/source/ui/framework/configuration/ConfigurationTracer.cxx b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx index 63e45f8bb110..498f0670542e 100644..100755 --- a/sd/source/ui/framework/configuration/ConfigurationTracer.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx @@ -41,16 +41,16 @@ void ConfigurationTracer::TraceConfiguration ( const char* pMessage) { #ifdef DEBUG - OSL_TRACE("%s at %p {\n", pMessage, rxConfiguration.get()); + OSL_TRACE("%s at %p {", pMessage, rxConfiguration.get()); if (rxConfiguration.is()) { TraceBoundResources(rxConfiguration, NULL, 0); } else { - OSL_TRACE(" empty\n"); + OSL_TRACE(" empty"); } - OSL_TRACE("}\n"); + OSL_TRACE("}"); #else (void)rxConfiguration; (void)pMessage; @@ -74,7 +74,7 @@ void ConfigurationTracer::TraceBoundResources ( ::rtl::OUString sLine (aResourceList[nIndex]->getResourceURL()); for (int i=0; i<nIndentation; ++i) sLine = sIndentation + sLine; - OSL_TRACE("%s\n", OUStringToOString(sLine, RTL_TEXTENCODING_UTF8).getStr()); + OSL_TRACE("%s", OUStringToOString(sLine, RTL_TEXTENCODING_UTF8).getStr()); TraceBoundResources(rxConfiguration, aResourceList[nIndex], nIndentation+1); } #else diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx index 5db5cb436739..aa8aca5a5ffd 100644..100755 --- a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx @@ -35,6 +35,7 @@ #include "framework/FrameworkHelper.hxx" #include <comphelper/scopeguard.hxx> +#include <tools/diagnose_ex.h> #include <boost/bind.hpp> @@ -46,7 +47,7 @@ using ::rtl::OUString; using ::std::vector; #undef VERBOSE -#define VERBOSE 2 +//#define VERBOSE 2 namespace { static const sal_Int32 snShortTimeout (100); @@ -128,7 +129,7 @@ void ConfigurationUpdater::RequestUpdate ( if (IsUpdatePossible()) { #if defined VERBOSE && VERBOSE>=1 - OSL_TRACE("UpdateConfiguration start\n"); + OSL_TRACE("UpdateConfiguration start"); #endif // Call UpdateConfiguration while that is possible and while someone @@ -146,7 +147,7 @@ void ConfigurationUpdater::RequestUpdate ( { mbUpdatePending = true; #if defined VERBOSE && VERBOSE>=1 - OSL_TRACE("scheduling update for later\n"); + OSL_TRACE("scheduling update for later"); #endif } } @@ -185,7 +186,7 @@ bool ConfigurationUpdater::IsUpdatePossible (void) void ConfigurationUpdater::UpdateConfiguration (void) { #if defined VERBOSE && VERBOSE>=1 - OSL_TRACE("UpdateConfiguration update\n"); + OSL_TRACE("UpdateConfiguration update"); #endif SetUpdateBeingProcessed(true); comphelper::ScopeGuard aScopeGuard ( @@ -200,7 +201,7 @@ void ConfigurationUpdater::UpdateConfiguration (void) if (aClassifier.Partition()) { #if defined VERBOSE && VERBOSE>=2 - OSL_TRACE("ConfigurationUpdater::UpdateConfiguration(\n"); + OSL_TRACE("ConfigurationUpdater::UpdateConfiguration("); ConfigurationTracer::TraceConfiguration( mxRequestedConfiguration, "requested configuration"); ConfigurationTracer::TraceConfiguration( @@ -232,7 +233,7 @@ void ConfigurationUpdater::UpdateConfiguration (void) else { #if defined VERBOSE && VERBOSE>0 - OSL_TRACE("nothing to do\n"); + OSL_TRACE("nothing to do"); #if defined VERBOSE && VERBOSE>=2 ConfigurationTracer::TraceConfiguration( mxRequestedConfiguration, "requested configuration"); @@ -244,8 +245,7 @@ void ConfigurationUpdater::UpdateConfiguration (void) } catch (RuntimeException e) { - OSL_TRACE("caught exception while updating the current configuration"); - DBG_ASSERT(false, "caught exception while updating the current configuration"); + DBG_UNHANDLED_EXCEPTION(); } #if defined VERBOSE && VERBOSE>0 @@ -310,11 +310,11 @@ void ConfigurationUpdater::UpdateCore (const ConfigurationClassifier& rClassifie { #if defined VERBOSE && VERBOSE>=2 rClassifier.TraceResourceIdVector( - "requested but not current resources:\n", rClassifier.GetC1minusC2()); + "requested but not current resources:", rClassifier.GetC1minusC2()); rClassifier.TraceResourceIdVector( - "current but not requested resources:\n", rClassifier.GetC2minusC1()); + "current but not requested resources:", rClassifier.GetC2minusC1()); rClassifier.TraceResourceIdVector( - "requested and current resources:\n", rClassifier.GetC1andC2()); + "requested and current resources:", rClassifier.GetC1andC2()); #endif // Updating of the sub controllers is done in two steps. In the @@ -325,11 +325,11 @@ void ConfigurationUpdater::UpdateCore (const ConfigurationClassifier& rClassifie mpResourceManager->ActivateResources(rClassifier.GetC1minusC2(), mxCurrentConfiguration); #if defined VERBOSE && VERBOSE>=2 - OSL_TRACE("ConfigurationController::UpdateConfiguration)\n"); + OSL_TRACE("ConfigurationController::UpdateConfiguration)"); ConfigurationTracer::TraceConfiguration( - mxRequestedConfiguration, "requested configuration\n"); + mxRequestedConfiguration, "requested configuration"); ConfigurationTracer::TraceConfiguration( - mxCurrentConfiguration, "current configuration\n"); + mxCurrentConfiguration, "current configuration"); #endif // Deactivate pure anchors that have no child. @@ -340,7 +340,7 @@ void ConfigurationUpdater::UpdateCore (const ConfigurationClassifier& rClassifie } catch(RuntimeException) { - OSL_ASSERT(false); + DBG_UNHANDLED_EXCEPTION(); } } @@ -401,7 +401,7 @@ void ConfigurationUpdater::CheckPureAnchors ( if (bDeactiveCurrentResource) { #if defined VERBOSE && VERBOSE>=2 - OSL_TRACE("deactiving pure anchor %s because it has no children\n", + OSL_TRACE("deactiving pure anchor %s because it has no children", OUStringToOString( FrameworkHelper::ResourceIdToString(xResourceId), RTL_TEXTENCODING_UTF8).getStr()); @@ -458,14 +458,14 @@ void ConfigurationUpdater::SetUpdateBeingProcessed (bool bValue) IMPL_LINK(ConfigurationUpdater, TimeoutHandler, Timer*, EMPTYARG) { - OSL_TRACE("configuration update timer\n"); + OSL_TRACE("configuration update timer"); if ( ! mbUpdateBeingProcessed && mxCurrentConfiguration.is() && mxRequestedConfiguration.is()) { if ( ! AreConfigurationsEquivalent(mxCurrentConfiguration, mxRequestedConfiguration)) { - OSL_TRACE("configurations differ, requesting update\n"); + OSL_TRACE("configurations differ, requesting update"); RequestUpdate(mxRequestedConfiguration); } } diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx index 969844f7650d..d6f60506c62f 100644..100755 --- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx @@ -44,6 +44,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; using namespace ::com::sun::star::drawing::framework; using ::rtl::OUString; @@ -270,7 +271,7 @@ void SAL_CALL BasicPaneFactory::initialize (const Sequence<Any>& aArguments) Reference<XResource> SAL_CALL BasicPaneFactory::createResource ( const Reference<XResourceId>& rxPaneId) - throw (RuntimeException) + throw (RuntimeException, IllegalArgumentException, WrappedTargetException) { ThrowIfDisposed(); @@ -528,8 +529,8 @@ Reference<XResource> BasicPaneFactory::CreateChildWindowPane ( break; case RightPaneId: - pShell.reset(new RightPaneShell()); - nChildWindowId = ::sd::RightPaneChildWindow::GetChildWindowId(); + pShell.reset(new ToolPanelPaneShell()); + nChildWindowId = ::sd::ToolPanelChildWindow::GetChildWindowId(); break; default: diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.hxx b/sd/source/ui/framework/factories/BasicPaneFactory.hxx index 1f442656d1d9..bceeae60003a 100644..100755 --- a/sd/source/ui/framework/factories/BasicPaneFactory.hxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.hxx @@ -99,7 +99,7 @@ public: virtual css::uno::Reference<css::drawing::framework::XResource> SAL_CALL createResource ( const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException); virtual void SAL_CALL releaseResource ( diff --git a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx index 4645b0462399..d353cfc58c1f 100644..100755 --- a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx +++ b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx @@ -38,6 +38,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; using namespace ::com::sun::star::drawing::framework; namespace sd { namespace framework { @@ -191,7 +192,7 @@ void SAL_CALL BasicToolBarFactory::disposing ( Reference<XResource> SAL_CALL BasicToolBarFactory::createResource ( const Reference<XResourceId>& rxToolBarId) - throw (RuntimeException) + throw (RuntimeException, IllegalArgumentException, WrappedTargetException) { ThrowIfDisposed(); diff --git a/sd/source/ui/framework/factories/BasicToolBarFactory.hxx b/sd/source/ui/framework/factories/BasicToolBarFactory.hxx index c305c334bf0f..686de897c179 100644..100755 --- a/sd/source/ui/framework/factories/BasicToolBarFactory.hxx +++ b/sd/source/ui/framework/factories/BasicToolBarFactory.hxx @@ -80,7 +80,7 @@ public: createResource ( const css::uno::Reference< css::drawing::framework::XResourceId>& rxToolBarId) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException); virtual void SAL_CALL releaseResource ( diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 4f0137ea6530..1320df5c827b 100644..100755 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -42,7 +42,7 @@ #include "DrawViewShell.hxx" #include "GraphicViewShell.hxx" #include "OutlineViewShell.hxx" -#include "TaskPaneViewShell.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "PresentationViewShell.hxx" #include "SlideSorterViewShell.hxx" #include "FrameView.hxx" @@ -55,6 +55,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; using namespace ::com::sun::star::drawing::framework; using ::rtl::OUString; @@ -189,7 +190,7 @@ void SAL_CALL BasicViewFactory::disposing (void) Reference<XResource> SAL_CALL BasicViewFactory::createResource ( const Reference<XResourceId>& rxViewId) - throw(RuntimeException) + throw(RuntimeException, IllegalArgumentException, WrappedTargetException) { Reference<XResource> xView; const bool bIsCenterPane ( @@ -372,7 +373,7 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments) pDescriptor->mpViewShell, rxViewId, rxPane->getWindow()); - pDescriptor->mxView = Reference<XResource>(pDescriptor->mpWrapper); + pDescriptor->mxView.set( pDescriptor->mpWrapper->queryInterface( XResource::static_type() ), UNO_QUERY_THROW ); } return pDescriptor; @@ -449,7 +450,7 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments) else if (rsViewURL.equals(FrameworkHelper::msTaskPaneURL)) { pViewShell.reset( - new ::sd::toolpanel::TaskPaneViewShell ( + new ::sd::toolpanel::ToolPanelViewShell( &rFrame, *mpBase, &rWindow, diff --git a/sd/source/ui/framework/factories/BasicViewFactory.hxx b/sd/source/ui/framework/factories/BasicViewFactory.hxx index cc9218af26cc..e5bb43551a24 100644..100755 --- a/sd/source/ui/framework/factories/BasicViewFactory.hxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.hxx @@ -96,7 +96,7 @@ public: virtual css::uno::Reference<css::drawing::framework::XResource> SAL_CALL createResource ( const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException); virtual void SAL_CALL releaseResource ( const css::uno::Reference<css::drawing::framework::XResource>& xView) diff --git a/sd/source/ui/framework/factories/ChildWindowPane.cxx b/sd/source/ui/framework/factories/ChildWindowPane.cxx index 290c84c3ec75..5e4e6df987f0 100644..100755 --- a/sd/source/ui/framework/factories/ChildWindowPane.cxx +++ b/sd/source/ui/framework/factories/ChildWindowPane.cxx @@ -191,7 +191,7 @@ void SAL_CALL ChildWindowPane::disposing (void) break; // At last, we have access to the window and its UNO wrapper. - mpWindow = pDockingWindow->GetContentWindow(); + mpWindow = &pDockingWindow->GetContentWindow(); mxWindow = VCLUnoHelper::GetInterface(mpWindow); // Register as window listener to be informed when the child window diff --git a/sd/source/ui/framework/factories/PresentationFactory.cxx b/sd/source/ui/framework/factories/PresentationFactory.cxx index 6ede6e439e02..6f22f1484627 100644..100755 --- a/sd/source/ui/framework/factories/PresentationFactory.cxx +++ b/sd/source/ui/framework/factories/PresentationFactory.cxx @@ -34,10 +34,12 @@ #include "ViewShellBase.hxx" #include <com/sun/star/drawing/framework/XControllerManager.hpp> #include <cppuhelper/compbase1.hxx> +#include <tools/diagnose_ex.h> #include "slideshow.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; using namespace ::com::sun::star::drawing::framework; using ::rtl::OUString; @@ -154,7 +156,7 @@ PresentationFactory::PresentationFactory ( } catch (RuntimeException&) { - OSL_ASSERT(false); + DBG_UNHANDLED_EXCEPTION(); } } @@ -180,7 +182,7 @@ void SAL_CALL PresentationFactory::disposing (void) Reference<XResource> SAL_CALL PresentationFactory::createResource ( const Reference<XResourceId>& rxViewId) - throw (RuntimeException) + throw (RuntimeException, IllegalArgumentException, WrappedTargetException) { ThrowIfDisposed(); @@ -308,7 +310,7 @@ void SAL_CALL PresentationFactoryProvider::initialize( } catch (RuntimeException&) { - OSL_ASSERT(false); + DBG_UNHANDLED_EXCEPTION(); } } } diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/sd/source/ui/framework/factories/TaskPanelFactory.cxx index 8942833d2483..1cd156817afc 100644..100755 --- a/sd/source/ui/framework/factories/TaskPanelFactory.cxx +++ b/sd/source/ui/framework/factories/TaskPanelFactory.cxx @@ -27,18 +27,19 @@ #include "precompiled_sd.hxx" #include "TaskPanelFactory.hxx" -#include "TaskPaneViewShell.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "DrawController.hxx" #include "framework/FrameworkHelper.hxx" #include <cppuhelper/compbase1.hxx> +#include <tools/diagnose_ex.h> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; using namespace ::com::sun::star::drawing::framework; using ::rtl::OUString; using ::sd::framework::FrameworkHelper; -using ::sd::toolpanel::TaskPaneViewShell; namespace sd { namespace framework { @@ -85,14 +86,11 @@ class TaskPanelResource { public: TaskPanelResource ( - const Reference<XResourceId>& rxResourceId, - const TaskPaneViewShell::PanelId ePaneId); + const Reference<XResourceId>& rxResourceId ); virtual ~TaskPanelResource (); virtual void SAL_CALL disposing (); - TaskPaneViewShell::PanelId GetPaneId () const; - // XResource virtual Reference<XResourceId> SAL_CALL getResourceId (void) @@ -103,7 +101,6 @@ public: private: const Reference<XResourceId> mxResourceId; - const TaskPaneViewShell::PanelId mePaneId; }; } // end of anonymous namespace. @@ -185,9 +182,27 @@ void SAL_CALL TaskPanelFactory::initialize( //===== XResourceController =================================================== +namespace +{ + void lcl_collectResourceURLs( const Reference< XResourceId >& i_rResourceId, ::std::vector< ::rtl::OUString >& o_rResourceURLs ) + { + ENSURE_OR_RETURN_VOID( i_rResourceId.is(), "illegal resource ID" ); + o_rResourceURLs.resize(0); + + Reference< XResourceId > xResourceId( i_rResourceId ); + ::rtl::OUString sResourceURL = xResourceId->getResourceURL(); + while ( sResourceURL.getLength() > 0 ) + { + o_rResourceURLs.push_back( sResourceURL ); + xResourceId = xResourceId->getAnchor(); + sResourceURL = xResourceId->getResourceURL(); + } + } +} + Reference<XResource> SAL_CALL TaskPanelFactory::createResource ( const Reference<XResourceId>& rxResourceId) - throw (RuntimeException) + throw (RuntimeException, IllegalArgumentException, WrappedTargetException) { Reference<XResource> xResource; @@ -196,45 +211,26 @@ Reference<XResource> SAL_CALL TaskPanelFactory::createResource ( OUString sResourceURL (rxResourceId->getResourceURL()); - if (sResourceURL.match(FrameworkHelper::msTaskPanelURLPrefix)) + if ( sResourceURL.match( FrameworkHelper::msTaskPanelURLPrefix ) ) { - TaskPaneViewShell::PanelId ePaneId (TaskPaneViewShell::PID_UNKNOWN); + toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sResourceURL ) ); - if (sResourceURL.equals(FrameworkHelper::msMasterPagesTaskPanelURL)) + if ( ( ePanelId != toolpanel::PID_UNKNOWN ) && ( mpViewShellBase != NULL ) ) { - ePaneId = TaskPaneViewShell::PID_MASTER_PAGES; - } - else if (sResourceURL.equals(FrameworkHelper::msLayoutTaskPanelURL)) - { - ePaneId = TaskPaneViewShell::PID_LAYOUT; - } - else if (sResourceURL.equals(FrameworkHelper::msTableDesignPanelURL)) - { - ePaneId = TaskPaneViewShell::PID_TABLE_DESIGN; - } - else if (sResourceURL.equals(FrameworkHelper::msCustomAnimationTaskPanelURL)) - { - ePaneId = TaskPaneViewShell::PID_CUSTOM_ANIMATION; - } - else if (sResourceURL.equals(FrameworkHelper::msSlideTransitionTaskPanelURL)) - { - ePaneId = TaskPaneViewShell::PID_SLIDE_TRANSITION; - } + ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( *mpViewShellBase ) ); - if (ePaneId!=TaskPaneViewShell::PID_UNKNOWN && mpViewShellBase!=NULL) - { - toolpanel::TaskPaneViewShell* pTaskPane - = dynamic_cast<toolpanel::TaskPaneViewShell*>( - FrameworkHelper::Instance(*mpViewShellBase) - ->GetViewShell(FrameworkHelper::msRightPaneURL).get()); - if (pTaskPane != NULL) - { - xResource = new TaskPanelResource( - rxResourceId, - ePaneId); - pTaskPane->ShowPanel(ePaneId); - pTaskPane->ExpandPanel(ePaneId); - } + // assume that the top-level anchor is the URL of the pane + ::std::vector< ::rtl::OUString > aResourceURLs; + lcl_collectResourceURLs( rxResourceId, aResourceURLs ); + + const ::rtl::OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ]; + const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) ); + + toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() ); + if ( pToolPanel != NULL ) + xResource = new TaskPanelResource( rxResourceId ); + + OSL_POSTCOND( xResource.is(), "TaskPanelFactory::createResource: did not find the given resource!" ); } } @@ -248,16 +244,37 @@ void SAL_CALL TaskPanelFactory::releaseResource ( const Reference<XResource>& rxResource) throw (RuntimeException) { - toolpanel::TaskPaneViewShell* pTaskPane - = dynamic_cast<toolpanel::TaskPaneViewShell*>( - FrameworkHelper::Instance(*mpViewShellBase) - ->GetViewShell(FrameworkHelper::msRightPaneURL).get()); + ENSURE_OR_RETURN_VOID( rxResource.is(), "illegal resource" ); + const Reference< XResourceId > xResourceId( rxResource->getResourceId(), UNO_SET_THROW ); + + // assume that the top-level anchor is the URL of the pane + ::std::vector< ::rtl::OUString > aResourceURLs; + lcl_collectResourceURLs( xResourceId, aResourceURLs ); - rtl::Reference<TaskPanelResource> pResource = dynamic_cast<TaskPanelResource*>( - rxResource.get()); + OSL_ENSURE( !aResourceURLs.empty(), "TaskPanelFactory::releaseResource: illegal resource/URL!" ); + if ( !aResourceURLs.empty() ) + { + const ::rtl::OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ]; + ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( *mpViewShellBase ) ); + const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) ); + if ( pPaneViewShell != NULL ) + { + const ::rtl::OUString sPanelResourceURL( xResourceId->getResourceURL() ); + const toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sPanelResourceURL ) ); + toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() ); - if (pTaskPane != NULL && pResource.is()) - pTaskPane->CollapsePanel(pResource->GetPaneId()); + if ( ( ePanelId != toolpanel::PID_UNKNOWN ) + && ( pToolPanel != NULL ) + ) + { + pToolPanel->DeactivatePanel( sPanelResourceURL ); + } + else + { + OSL_ENSURE( false, "TaskPanelFactory::releaseResource: don't know what to do with this resource!" ); + } + } + } Reference<XComponent> xComponent (rxResource, UNO_QUERY); if (xComponent.is()) @@ -289,11 +306,9 @@ void TaskPanelFactory::ThrowIfDisposed (void) const namespace { TaskPanelResource::TaskPanelResource ( - const Reference<XResourceId>& rxResourceId, - const TaskPaneViewShell::PanelId ePaneId) + const Reference<XResourceId>& rxResourceId) : TaskPanelResourceInterfaceBase(m_aMutex), - mxResourceId(rxResourceId), - mePaneId(ePaneId) + mxResourceId(rxResourceId) { } @@ -314,14 +329,6 @@ void SAL_CALL TaskPanelResource::disposing () -TaskPaneViewShell::PanelId TaskPanelResource::GetPaneId () const -{ - return mePaneId; -} - - - - Reference<XResourceId> SAL_CALL TaskPanelResource::getResourceId () throw (css::uno::RuntimeException) { diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.hxx b/sd/source/ui/framework/factories/TaskPanelFactory.hxx index 1130a106a56c..1ab2fa783a4a 100644..100755 --- a/sd/source/ui/framework/factories/TaskPanelFactory.hxx +++ b/sd/source/ui/framework/factories/TaskPanelFactory.hxx @@ -80,7 +80,7 @@ public: SAL_CALL createResource ( const css::uno::Reference< css::drawing::framework::XResourceId>& rxResourcesId) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException); virtual void SAL_CALL releaseResource ( const css::uno::Reference< diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx index 0a3aeccade7c..a1c0bd525c9e 100644..100755 --- a/sd/source/ui/framework/factories/ViewShellWrapper.cxx +++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx @@ -29,22 +29,32 @@ #include "framework/ViewShellWrapper.hxx" #include "framework/Pane.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "ViewShell.hxx" #include "Window.hxx" #include <com/sun/star/drawing/framework/XPane.hpp> +#include <com/sun/star/lang/DisposedException.hpp> #include <rtl/uuid.h> #include <toolkit/helper/vclunohelper.hxx> +#include <comphelper/sequence.hxx> +#include <cppuhelper/typeprovider.hxx> #include <vcl/svapp.hxx> #include <vos/mutex.hxx> +#include <tools/diagnose_ex.h> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; +using ::com::sun::star::awt::XWindow; +using ::com::sun::star::rendering::XCanvas; +using ::com::sun::star::lang::DisposedException; + using ::rtl::OUString; +using ::sd::toolpanel::ToolPanelViewShell; namespace sd { namespace framework { @@ -79,6 +89,8 @@ ViewShellWrapper::~ViewShellWrapper (void) void SAL_CALL ViewShellWrapper::disposing (void) { + ::osl::MutexGuard aGuard( maMutex ); + OSL_TRACE("disposing ViewShellWrapper %x", this); Reference<awt::XWindow> xWindow (mxWindow); if (xWindow.is()) @@ -101,14 +113,6 @@ void SAL_CALL ViewShellWrapper::disposing (void) -bool ViewShellWrapper::IsUnique (void) -{ - return m_refCount==1; -} - - - - //----- XResource ------------------------------------------------------------- Reference<XResourceId> SAL_CALL ViewShellWrapper::getResourceId (void) @@ -177,7 +181,7 @@ const Sequence<sal_Int8>& ViewShellWrapper::getUnoTunnelId (void) static Sequence<sal_Int8>* pSequence = NULL; if (pSequence == NULL) { - const ::vos::OGuard aSolarGuard (Application::GetSolarMutex()); + const ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); if (pSequence == NULL) { static ::com::sun::star::uno::Sequence<sal_Int8> aSequence (16); diff --git a/sd/source/ui/framework/module/ImpressModule.cxx b/sd/source/ui/framework/module/ImpressModule.cxx index 050429b3f289..a5856bc3ebc9 100644..100755 --- a/sd/source/ui/framework/module/ImpressModule.cxx +++ b/sd/source/ui/framework/module/ImpressModule.cxx @@ -33,7 +33,7 @@ #include "ViewTabBarModule.hxx" #include "CenterViewFocusModule.hxx" #include "SlideSorterModule.hxx" -#include "TaskPaneModule.hxx" +#include "ToolPanelModule.hxx" #include "ToolBarModule.hxx" #include "ShellStackGuard.hxx" @@ -54,7 +54,7 @@ void ImpressModule::Initialize (Reference<frame::XController>& rxController) new SlideSorterModule( rxController, FrameworkHelper::msLeftImpressPaneURL); - TaskPaneModule::Initialize(rxController); + ToolPanelModule::Initialize(rxController); new ToolBarModule(rxController); new ShellStackGuard(rxController); } diff --git a/sd/source/ui/framework/module/ModuleController.cxx b/sd/source/ui/framework/module/ModuleController.cxx index b90ebe851f0e..e910a8df7496 100644..100755 --- a/sd/source/ui/framework/module/ModuleController.cxx +++ b/sd/source/ui/framework/module/ModuleController.cxx @@ -35,6 +35,8 @@ #include <boost/bind.hpp> #include <hash_map> +#include <tools/diagnose_ex.h> + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; @@ -168,7 +170,7 @@ void ModuleController::LoadFactories (const Reference<XComponentContext>& rxCont } catch (Exception&) { - OSL_TRACE("ERROR in ModuleController::LoadFactories"); + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/sd/source/ui/framework/module/PresentationModule.cxx b/sd/source/ui/framework/module/PresentationModule.cxx index e28432a25d93..6a5ba5dc5e7f 100644..100755 --- a/sd/source/ui/framework/module/PresentationModule.cxx +++ b/sd/source/ui/framework/module/PresentationModule.cxx @@ -31,7 +31,6 @@ #include "CenterViewFocusModule.hxx" #include "SlideSorterModule.hxx" -#include "TaskPaneModule.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::uno; diff --git a/sd/source/ui/framework/module/TaskPaneModule.cxx b/sd/source/ui/framework/module/ToolPanelModule.cxx index 03e2277bdcd3..888fa68ad708 100644 --- a/sd/source/ui/framework/module/TaskPaneModule.cxx +++ b/sd/source/ui/framework/module/ToolPanelModule.cxx @@ -2,10 +2,13 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * + * $RCSfile: ToolPanelModule.cxx,v $ + * $Revision: 1.4 $ + * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -27,7 +30,7 @@ #include "precompiled_sd.hxx" -#include "TaskPaneModule.hxx" +#include "ToolPanelModule.hxx" #include "ReadOnlyModeObserver.hxx" #include "framework/FrameworkHelper.hxx" @@ -54,7 +57,7 @@ typedef ::cppu::WeakComponentImplHelper1 < > LocalReadOnlyModeObserverInterfaceBase; /** This local class enables or disables the ResourceManager of a - TaskPaneModule. It connects to a ReadOnlyModeObserver and is called + ToolPanelModule. It connects to a ReadOnlyModeObserver and is called when the state of the .uno:EditDoc command changes. When either the ResourceManager or the ReadOnlyModeObserver are disposed then the LocalReadOnlyModeObserver disposes itself. The link @@ -138,9 +141,9 @@ private: -//===== TaskPaneModule ==================================================== +//===== ToolPanelModule ==================================================== -void TaskPaneModule::Initialize (const Reference<frame::XController>& rxController) +void ToolPanelModule::Initialize (const Reference<frame::XController>& rxController) { ::rtl::Reference<ResourceManager> pResourceManager ( new ResourceManager( diff --git a/sd/source/ui/framework/module/TaskPaneModule.hxx b/sd/source/ui/framework/module/ToolPanelModule.hxx index 3495e4c93a73..7d728e60e93d 100644 --- a/sd/source/ui/framework/module/TaskPaneModule.hxx +++ b/sd/source/ui/framework/module/ToolPanelModule.hxx @@ -1,5 +1,4 @@ /************************************************************************* - * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2000, 2010 Oracle and/or its affiliates. @@ -23,10 +22,10 @@ * <http://www.openoffice.org/license.html> * for a copy of the LGPLv3 License. * - ************************************************************************/ +************************************************************************/ -#ifndef SD_FRAMEWORK_TASK_PANE_MODULE_HXX -#define SD_FRAMEWORK_TASK_PANE_MODULE_HXX +#ifndef SD_FRAMEWORK_TOOL_PANEL_MODULE_HXX +#define SD_FRAMEWORK_TOOL_PANEL_MODULE_HXX #include "ResourceManager.hxx" @@ -38,7 +37,7 @@ class ReadOnlyModeObserver; /** This module is responsible for showing the task pane. */ -class TaskPaneModule +class ToolPanelModule { public: static void Initialize ( diff --git a/sd/source/ui/framework/module/makefile.mk b/sd/source/ui/framework/module/makefile.mk index 56c864a7df53..bec9b1a04075 100644..100755 --- a/sd/source/ui/framework/module/makefile.mk +++ b/sd/source/ui/framework/module/makefile.mk @@ -52,7 +52,7 @@ SLOFILES = \ $(SLO)$/ResourceManager.obj \ $(SLO)$/ShellStackGuard.obj \ $(SLO)$/SlideSorterModule.obj \ - $(SLO)$/TaskPaneModule.obj \ + $(SLO)$/ToolPanelModule.obj \ $(SLO)$/ToolBarModule.obj \ $(SLO)$/ViewTabBarModule.obj diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index 25790e736473..8c63a6871483 100644..100755 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -52,6 +52,7 @@ #include "vcl/svapp.hxx" #include <osl/doublecheckedlocking.h> #include <osl/getglobalmutex.hxx> +#include <tools/diagnose_ex.h> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -218,7 +219,7 @@ const OUString FrameworkHelper::msViewTabBarURL( // Task panel URLs. const ::rtl::OUString FrameworkHelper::msTaskPanelURLPrefix( - OUString::createFromAscii("private:resource/taskpanel/")); + OUString::createFromAscii("private:resource/toolpanel/DrawingFramework/")); const ::rtl::OUString FrameworkHelper::msMasterPagesTaskPanelURL( msTaskPanelURLPrefix + OUString::createFromAscii("MasterPages")); const ::rtl::OUString FrameworkHelper::msLayoutTaskPanelURL( @@ -252,6 +253,46 @@ const OUString FrameworkHelper::msModuleControllerService( const OUString FrameworkHelper::msConfigurationControllerService( OUString::createFromAscii("com.sun.star.drawing.framework.ConfigurationController")); +//----- helper ---------------------------------------------------------------- +namespace +{ + static ::boost::shared_ptr< ViewShell > lcl_getViewShell( const Reference< XResource >& i_rViewShellWrapper ) + { + ::boost::shared_ptr< ViewShell > pViewShell; + if ( !i_rViewShellWrapper.is() ) + return pViewShell; + + try + { + Reference<lang::XUnoTunnel> xViewTunnel( i_rViewShellWrapper, UNO_QUERY_THROW ); + pViewShell = reinterpret_cast< ViewShellWrapper* >( + xViewTunnel->getSomething( ViewShellWrapper::getUnoTunnelId() ) )->GetViewShell(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return pViewShell; + } + Reference< XResource > lcl_getFirstViewInPane( const Reference< XConfigurationController >& i_rConfigController, + const Reference< XResourceId >& i_rPaneId ) + { + try + { + Reference< XConfiguration > xConfiguration( i_rConfigController->getRequestedConfiguration(), UNO_SET_THROW ); + Sequence< Reference< XResourceId > > aViewIds( xConfiguration->getResources( + i_rPaneId, FrameworkHelper::msViewURLPrefix, AnchorBindingMode_DIRECT ) ); + if ( aViewIds.getLength() > 0 ) + return i_rConfigController->getResource( aViewIds[0] ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; + } +} + //----- FrameworkHelper::ViewURLMap ------------------------------------------- @@ -438,8 +479,11 @@ bool FrameworkHelper::IsValid (void) ::boost::shared_ptr<ViewShell> FrameworkHelper::GetViewShell (const OUString& rsPaneURL) { - Reference<XResourceId> xPaneId (CreateResourceId(rsPaneURL)); - return GetViewShell(GetView(xPaneId)); + if ( !mxConfigurationController.is() ) + return ::boost::shared_ptr<ViewShell>(); + + Reference<XResourceId> xPaneId( CreateResourceId( rsPaneURL ) ); + return lcl_getViewShell( lcl_getFirstViewInPane( mxConfigurationController, xPaneId ) ); } @@ -447,22 +491,7 @@ bool FrameworkHelper::IsValid (void) ::boost::shared_ptr<ViewShell> FrameworkHelper::GetViewShell (const Reference<XView>& rxView) { - ::boost::shared_ptr<ViewShell> pViewShell; - - try - { - Reference<lang::XUnoTunnel> xViewTunnel (rxView, UNO_QUERY); - if (xViewTunnel.is()) - { - pViewShell = reinterpret_cast<ViewShellWrapper*>(xViewTunnel->getSomething( - ViewShellWrapper::getUnoTunnelId()))->GetViewShell(); - } - } - catch (RuntimeException&) - { - } - - return pViewShell; + return lcl_getViewShell( rxView.get() ); } @@ -479,21 +508,11 @@ Reference<XView> FrameworkHelper::GetView (const Reference<XResourceId>& rxPaneO { if (rxPaneOrViewId->getResourceURL().match(msViewURLPrefix)) { - xView = Reference<XView>( - mxConfigurationController->getResource(rxPaneOrViewId), UNO_QUERY); + xView.set( mxConfigurationController->getResource( rxPaneOrViewId ), UNO_QUERY ); } else { - Reference<XConfiguration> xConfiguration ( - mxConfigurationController->getRequestedConfiguration()); - if (xConfiguration.is()) - { - Sequence<Reference<XResourceId> > aViewIds (xConfiguration->getResources( - rxPaneOrViewId, msViewURLPrefix, AnchorBindingMode_DIRECT)); - if (aViewIds.getLength() >= 1) - xView = Reference<XView>( - mxConfigurationController->getResource(aViewIds[0]), UNO_QUERY); - } + xView.set( lcl_getFirstViewInPane( mxConfigurationController, rxPaneOrViewId ), UNO_QUERY ); } } catch (lang::DisposedException&) @@ -501,7 +520,8 @@ Reference<XView> FrameworkHelper::GetView (const Reference<XResourceId>& rxPaneO Dispose(); } catch (RuntimeException&) - {} + { + } return xView; } @@ -717,7 +737,7 @@ void FrameworkHelper::HandleModeChangeSlot ( } catch (RuntimeException&) { - OSL_TRACE("HandleModeChangeSlot: caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } @@ -800,7 +820,7 @@ void FrameworkHelper::WaitForEvent (const OUString& rsEventType) const if( (osl_getGlobalTimer() - nStartTime) > 60000 ) { - DBG_ERROR("FrameworkHelper::WaitForEvent(), no event since a minute? giving up!"); + DBG_ERROR("FrameworkHelper::WaitForEvent(), no event for a minute? giving up!"); break; } } @@ -852,7 +872,7 @@ void FrameworkHelper::UpdateConfiguration (void) } catch (RuntimeException&) { - DBG_ASSERT(false, "FrameworkHelper::UpdateConfiguration: caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } } @@ -1053,7 +1073,7 @@ CallbackCaller::CallbackCaller ( } catch (RuntimeException&) { - DBG_ASSERT(false,"ConfigurationUpdateGuard: caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } @@ -1080,7 +1100,7 @@ void CallbackCaller::disposing (void) } catch (RuntimeException&) { - DBG_ASSERT(false,"~ConfigurationUpdateGuard: caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } |