From 2ea7ed30cc091d8d33755b3ba28419b689c8ce48 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 11 Mar 2010 10:01:29 +0100 Subject: slidecopy: OSL_TRACE doesn't need a trainling line feed nowadays, this just adds noise to the debug output. Removed. --- .../configuration/ConfigurationTracer.cxx | 8 +++---- .../configuration/ConfigurationUpdater.cxx | 28 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/sd/source/ui/framework/configuration/ConfigurationTracer.cxx b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx index 7c883e489..7e59bf892 100644 --- a/sd/source/ui/framework/configuration/ConfigurationTracer.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx @@ -44,16 +44,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; @@ -77,7 +77,7 @@ void ConfigurationTracer::TraceBoundResources ( ::rtl::OUString sLine (aResourceList[nIndex]->getResourceURL()); for (int i=0; i=1 - OSL_TRACE("UpdateConfiguration start\n"); + OSL_TRACE("UpdateConfiguration start"); #endif // Call UpdateConfiguration while that is possible and while someone @@ -149,7 +149,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 } } @@ -188,7 +188,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 ( @@ -203,7 +203,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( @@ -235,7 +235,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"); @@ -313,11 +313,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 @@ -328,11 +328,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. @@ -404,7 +404,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()); @@ -461,14 +461,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); } } -- cgit v1.2.3 From 7f27ac201fab8bc2b86baf05e55f238b3a3615f3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 11 Mar 2010 10:15:31 +0100 Subject: slidecopy: unused file, just adding noise to my grep results. Removed. --- sd/source/ui/toolpanel/LayoutableWindow.hxx | 82 ----------------------------- 1 file changed, 82 deletions(-) delete mode 100644 sd/source/ui/toolpanel/LayoutableWindow.hxx diff --git a/sd/source/ui/toolpanel/LayoutableWindow.hxx b/sd/source/ui/toolpanel/LayoutableWindow.hxx deleted file mode 100644 index e94f69df7..000000000 --- a/sd/source/ui/toolpanel/LayoutableWindow.hxx +++ /dev/null @@ -1,82 +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: LayoutableWindow.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SD_TOOLPANEL_I_LAYOUTABLE_WINDOW_HXX -#define SD_TOOLPANEL_I_LAYOUTABLE_WINDOW_HXX - -#include - -class Window; - -namespace sd { namespace toolpanel { - - -/** This interface has to be implemented by windows that want to be - layouted by a ToolPanel, SubToolPanel, or ScrollablePanel object. -*/ -class LayoutableWindow -{ -public: - /** Return the preferred size without constraints on either the - height or the width. - The size the window will later be set to may but does not have - to be equal to this size. - */ - virtual Size GetPreferredSize (void) = 0; - - /** Return the preferred width with the constraint, that the - window will be set to the given height. - The width the window will later be set to may but does not have - to be equal to this width. - */ - virtual int GetPreferredWidth (int nHeight) = 0; - - /** Return the preferred height with the constraint, that the - window will be set to the given width. - The height the window will later be set to may but does not have - to be equal to this height. - */ - virtual int GetPreferredHeight (int nWidth) = 0; - - /** Return wether the window is generally resizable. When used by - a VerticalLayouter then the width will always be resized and - the return value of this method determines whether the height - may be modified as well. - */ - virtual bool IsResizable (void) = 0; - - /** Return the window so that its size and position can be set. - */ - virtual ::Window& GetWindow (void) = 0; -}; - -} } // end of namespace ::sd::toolpanel - -#endif -- cgit v1.2.3 From a1a97cbdc2244e71959f27404777bfb6022c60e8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 12 Mar 2010 09:37:32 +0100 Subject: slidecopy: removed unused artifact (referring the currently-unused SID_TOOLPANEL) --- sd/source/ui/app/menuids2_tmpl.src | 35 ------------ sd/source/ui/inc/ToolPanelChildWindow.hrc | 33 ------------ sd/source/ui/inc/ToolPanelChildWindow.hxx | 58 -------------------- sd/source/ui/toolpanel/ToolPanelChildWindow.cxx | 71 ------------------------- sd/source/ui/toolpanel/ToolPanelChildWindow.src | 55 ------------------- 5 files changed, 252 deletions(-) delete mode 100644 sd/source/ui/inc/ToolPanelChildWindow.hrc delete mode 100644 sd/source/ui/inc/ToolPanelChildWindow.hxx delete mode 100644 sd/source/ui/toolpanel/ToolPanelChildWindow.cxx delete mode 100644 sd/source/ui/toolpanel/ToolPanelChildWindow.src diff --git a/sd/source/ui/app/menuids2_tmpl.src b/sd/source/ui/app/menuids2_tmpl.src index fb00da149..86315858d 100644 --- a/sd/source/ui/app/menuids2_tmpl.src +++ b/sd/source/ui/app/menuids2_tmpl.src @@ -986,40 +986,5 @@ Text [ en-US ] = "Pre~view Mode" ; \ }; -#define MN_MULTI_PANE_GUI \ - MenuItem\ - {\ - Identifier = SID_MULTI_PANE_GUI ; \ - HelpID = SID_MULTI_PANE_GUI ; \ - Text = "Multi Pane GUI" ; \ - SubMenu = Menu \ - {\ - ItemList =\ - {\ - MenuItem\ - {\ - Identifier = SID_TOOLPANEL ; \ - HelpID = SID_TOOLPANEL ; \ - Check = TRUE ; \ - Text = "Tool Panel" ; \ - };\ - MenuItem\ - {\ - Identifier = SID_SLIDE_BROWSER ; \ - HelpID = SID_SLIDE_BROWSER ; \ - Check = TRUE ; \ - Text = "Slide Browser" ; \ - };\ - MenuItem\ - {\ - Identifier = SID_NOTES_WINDOW ; \ - HelpID = SID_NOTES_WINDOW ; \ - Check = TRUE ; \ - Text = "Notes Window" ; \ - };\ - };\ - };\ - }; - #endif // _MENUIDS2_SRC diff --git a/sd/source/ui/inc/ToolPanelChildWindow.hrc b/sd/source/ui/inc/ToolPanelChildWindow.hrc deleted file mode 100644 index 180f7d6b8..000000000 --- a/sd/source/ui/inc/ToolPanelChildWindow.hrc +++ /dev/null @@ -1,33 +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: ToolPanelChildWindow.hrc,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define FLT_WIN_TOOLPANEL 788 - -#define TOOLPANEL 1 diff --git a/sd/source/ui/inc/ToolPanelChildWindow.hxx b/sd/source/ui/inc/ToolPanelChildWindow.hxx deleted file mode 100644 index 8490084db..000000000 --- a/sd/source/ui/inc/ToolPanelChildWindow.hxx +++ /dev/null @@ -1,58 +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: ToolPanelChildWindow.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SD_TOOL_PANEL_CHILD_WINDOW_HXX -#define SD_TOOL_PANEL_CHILD_WINDOW_HXX - -#include - -#define TOOLPANEL_CHILD_WINDOW() ( \ - static_cast< ::sd::toolpanel::ToolPanelChildWindow*>( \ - SfxViewFrame::Current()->GetChildWindow( \ - ::sd::toolpanel::ToolPanelChildWindow::GetChildWindowId() \ - )->GetWindow())) - - -namespace sd { namespace toolpanel { - -class ToolPanelChildWindow - : public SfxChildWindow -{ -public: - ToolPanelChildWindow (::Window*, USHORT, SfxBindings*, SfxChildWinInfo*); - virtual ~ToolPanelChildWindow (void); - - SFX_DECL_CHILDWINDOW (ToolPanelChildWindow); -}; - - -} } // end of namespaces ::sd::toolpanel - -#endif diff --git a/sd/source/ui/toolpanel/ToolPanelChildWindow.cxx b/sd/source/ui/toolpanel/ToolPanelChildWindow.cxx deleted file mode 100644 index d71d13124..000000000 --- a/sd/source/ui/toolpanel/ToolPanelChildWindow.cxx +++ /dev/null @@ -1,71 +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: ToolPanelChildWindow.cxx,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "ToolPanelChildWindow.hxx" -#include "ToolPanelDockingWindow.hxx" - -#include "sdresid.hxx" -#include "app.hrc" -#include "sfx2/app.hxx" - - -namespace sd { namespace toolpanel { - - - -ToolPanelChildWindow::ToolPanelChildWindow ( - ::Window* pParentWindow, - USHORT nId, - SfxBindings* pBindings, - SfxChildWinInfo* pInfo) - : SfxChildWindow (pParentWindow, nId) -{ - pWindow = new ToolPanelDockingWindow (pBindings, this, pParentWindow); - eChildAlignment = SFX_ALIGN_RIGHT; - static_cast(pWindow)->Initialize (pInfo); - // SetHideNotDelete (TRUE); -}; - - - - -ToolPanelChildWindow::~ToolPanelChildWindow() -{} - - -SFX_IMPL_DOCKINGWINDOW(ToolPanelChildWindow, SID_TOOLPANEL) - - - - -} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/ToolPanelChildWindow.src b/sd/source/ui/toolpanel/ToolPanelChildWindow.src deleted file mode 100644 index 1ef738c35..000000000 --- a/sd/source/ui/toolpanel/ToolPanelChildWindow.src +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: ToolPanelChildWindow.src,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "app.hrc" -#include "ToolPanelChildWindow.hrc" - -DockingWindow FLT_WIN_TOOLPANEL -{ - HelpID = SID_TOOLPANEL ; - Border = TRUE ; - Hide = FALSE ; - SVLook = TRUE ; - Sizeable = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - Zoomable = TRUE ; - Dockable = TRUE ; - EnableResizing = TRUE ; - Size = MAP_APPFONT ( 140 , 120 ) ; - Text = "Tool Panel" ; - - Control TOOLPANEL - { - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 69, 150 ) ; - Border = FALSE; - }; -}; -- cgit v1.2.3 From 4abcc00fc42428a22079aa5561db4346f24be348 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 12 Mar 2010 11:07:18 +0100 Subject: slidecopy: oops, missed those occurrences of ToolPanelChildWindow (which is dead by now) in the previous commit --- sd/source/ui/toolpanel/TaskPaneViewShell.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/sd/source/ui/toolpanel/TaskPaneViewShell.cxx b/sd/source/ui/toolpanel/TaskPaneViewShell.cxx index 8ece51521..a3cd780f7 100644 --- a/sd/source/ui/toolpanel/TaskPaneViewShell.cxx +++ b/sd/source/ui/toolpanel/TaskPaneViewShell.cxx @@ -34,8 +34,6 @@ #include "TaskPaneViewShell.hxx" #include "TaskPaneShellManager.hxx" -#include "ToolPanelChildWindow.hrc" -#include "ToolPanelChildWindow.hxx" #include "taskpane/SlideSorterCacheDisplay.hxx" #include "taskpane/ToolPanel.hxx" #include "taskpane/TitledControl.hxx" -- cgit v1.2.3 From 0c892cac51e5db45d386f9a1ce1f0ed8585c4591 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 08:49:42 +0100 Subject: autorecovery: ENSURE_OR_RETURN => ENSURE_OR_RETURN_FALSE, added new ENSURE_OR_RETURN taking a return value --- slideshow/source/engine/animationfactory.cxx | 8 ++++---- .../source/engine/animationnodes/animationnodefactory.cxx | 12 ++++++------ slideshow/source/engine/animationnodes/basenode.cxx | 2 +- slideshow/source/engine/eventmultiplexer.cxx | 4 ++-- slideshow/source/engine/eventqueue.cxx | 6 +++--- slideshow/source/engine/shapeattributelayer.cxx | 2 +- slideshow/source/engine/shapes/drawinglayeranimation.cxx | 2 +- slideshow/source/engine/shapes/drawshape.cxx | 4 ++-- slideshow/source/engine/shapes/gdimtftools.cxx | 4 ++-- slideshow/source/engine/shapes/viewappletshape.cxx | 2 +- slideshow/source/engine/shapes/viewbackgroundshape.cxx | 6 +++--- slideshow/source/engine/shapes/viewmediashape.cxx | 2 +- slideshow/source/engine/shapes/viewshape.cxx | 8 ++++---- slideshow/source/engine/slide/shapemanagerimpl.cxx | 2 +- slideshow/source/engine/slide/slideimpl.cxx | 12 ++++++------ slideshow/source/engine/slidebitmap.cxx | 2 +- slideshow/source/engine/slideshowimpl.cxx | 6 +++--- slideshow/source/engine/slideview.cxx | 4 ++-- .../source/engine/transitions/shapetransitionfactory.cxx | 2 +- slideshow/source/engine/usereventqueue.cxx | 2 +- 20 files changed, 46 insertions(+), 46 deletions(-) diff --git a/slideshow/source/engine/animationfactory.cxx b/slideshow/source/engine/animationfactory.cxx index 2431b64f7..64ac9a349 100644 --- a/slideshow/source/engine/animationfactory.cxx +++ b/slideshow/source/engine/animationfactory.cxx @@ -154,7 +154,7 @@ namespace slideshow virtual bool operator()( const ::basegfx::B2DTuple& rValue ) { - ENSURE_OR_RETURN( mpAttrLayer && mpShape, + ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape, "TupleAnimation::operator(): Invalid ShapeAttributeLayer" ); ValueT aValue( rValue.getX(), @@ -317,7 +317,7 @@ namespace slideshow virtual bool operator()( double nValue ) { - ENSURE_OR_RETURN( mpAttrLayer && mpShape, + ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape, "PathAnimation::operator(): Invalid ShapeAttributeLayer" ); ::basegfx::B2DPoint rOutPos = ::basegfx::tools::getPositionRelative( maPathPoly, @@ -537,7 +537,7 @@ namespace slideshow */ bool operator()( const ValueT& x ) { - ENSURE_OR_RETURN( mpAttrLayer && mpShape, + ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape, "GenericAnimation::operator(): Invalid ShapeAttributeLayer" ); ((*mpAttrLayer).*mpSetValueFunc)( maSetterModifier( x ) ); @@ -552,7 +552,7 @@ namespace slideshow */ bool operator()( ValueT x ) { - ENSURE_OR_RETURN( mpAttrLayer && mpShape, + ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape, "GenericAnimation::operator(): Invalid ShapeAttributeLayer" ); ((*mpAttrLayer).*mpSetValueFunc)( maSetterModifier( x ) ); diff --git a/slideshow/source/engine/animationnodes/animationnodefactory.cxx b/slideshow/source/engine/animationnodes/animationnodefactory.cxx index 548e100de..09b112871 100644 --- a/slideshow/source/engine/animationnodes/animationnodefactory.cxx +++ b/slideshow/source/engine/animationnodes/animationnodefactory.cxx @@ -201,7 +201,7 @@ bool implCreateIteratedNodes( // ================================== // TODO(E1): I'm not too sure what to expect here... - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( xIterNode->getTarget().hasValue(), "implCreateIteratedNodes(): no target on ITERATE node" ); @@ -216,14 +216,14 @@ bool implCreateIteratedNodes( { // no shape provided. Maybe a ParagraphTarget? if( !(xIterNode->getTarget() >>= aTarget) ) - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( false, "implCreateIteratedNodes(): could not extract any " "target information" ); xTargetShape = aTarget.Shape; - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( xTargetShape.is(), "implCreateIteratedNodes(): invalid shape in ParagraphTarget" ); @@ -254,7 +254,7 @@ bool implCreateIteratedNodes( // paragraph) if( bParagraphTarget ) { - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( aTarget.Paragraph >= 0 && rTreeNodeSupplier.getNumberOfTreeNodes( DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) > aTarget.Paragraph, @@ -325,7 +325,7 @@ bool implCreateIteratedNodes( if( !::anim::for_each_childNode( xNode, aCreator ) ) { - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( false, "implCreateIteratedNodes(): iterated child node creation failed" ); } @@ -448,7 +448,7 @@ bool implCreateIteratedNodes( if( !::anim::for_each_childNode( xNode, aCreator ) ) { - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( false, "implCreateIteratedNodes(): " "iterated child node creation failed" ); } diff --git a/slideshow/source/engine/animationnodes/basenode.cxx b/slideshow/source/engine/animationnodes/basenode.cxx index 8288eb002..d21be4c00 100644 --- a/slideshow/source/engine/animationnodes/basenode.cxx +++ b/slideshow/source/engine/animationnodes/basenode.cxx @@ -674,7 +674,7 @@ bool BaseNode::registerDeactivatingListener( if (! checkValidNode()) return false; - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( rNotifee, "BaseNode::registerDeactivatingListener(): invalid notifee" ); maDeactivatingListeners.push_back( rNotifee ); diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx index 822eac50f..7a4014746 100644 --- a/slideshow/source/engine/eventmultiplexer.cxx +++ b/slideshow/source/engine/eventmultiplexer.cxx @@ -615,7 +615,7 @@ bool EventMultiplexerImpl::notifyMouseHandlers( uno::Reference xView( e.Source, uno::UNO_QUERY ); - ENSURE_OR_RETURN( xView.is(), "EventMultiplexer::notifyHandlers(): " + ENSURE_OR_RETURN_FALSE( xView.is(), "EventMultiplexer::notifyHandlers(): " "event source is not an XSlideShowView" ); // find corresponding view (to map mouse position into user @@ -630,7 +630,7 @@ bool EventMultiplexerImpl::notifyMouseHandlers( boost::cref( xView ), boost::bind( &UnoView::getUnoView, _1 ) ) ) ) == aEnd) { - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( false, "EventMultiplexer::notifyHandlers(): " "event source not found under registered views" ); } diff --git a/slideshow/source/engine/eventqueue.cxx b/slideshow/source/engine/eventqueue.cxx index 3fe997e73..eceddf850 100644 --- a/slideshow/source/engine/eventqueue.cxx +++ b/slideshow/source/engine/eventqueue.cxx @@ -112,7 +112,7 @@ namespace slideshow rEvent.get(), rEvent->getActivationTime(0.0)); #endif - ENSURE_OR_RETURN( rEvent, + ENSURE_OR_RETURN_FALSE( rEvent, "EventQueue::addEvent: event ptr NULL" ); // prepare entry @@ -141,7 +141,7 @@ namespace slideshow rEvent->getActivationTime(0.0)); #endif - ENSURE_OR_RETURN( rEvent.get() != NULL, + ENSURE_OR_RETURN_FALSE( rEvent.get() != NULL, "EventQueue::addEvent: event ptr NULL" ); maNextEvents.push_back( EventEntry( rEvent, rEvent->getActivationTime( @@ -161,7 +161,7 @@ namespace slideshow rpEvent->getActivationTime(0.0)); #endif - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( rpEvent.get() != NULL, "EventQueue::addEvent: event ptr NULL"); diff --git a/slideshow/source/engine/shapeattributelayer.cxx b/slideshow/source/engine/shapeattributelayer.cxx index 99b51d325..16ee04460 100644 --- a/slideshow/source/engine/shapeattributelayer.cxx +++ b/slideshow/source/engine/shapeattributelayer.cxx @@ -214,7 +214,7 @@ namespace slideshow bool ShapeAttributeLayer::revokeChildLayer( const ShapeAttributeLayerSharedPtr& rChildLayer ) { - ENSURE_OR_RETURN( rChildLayer, + ENSURE_OR_RETURN_FALSE( rChildLayer, "ShapeAttributeLayer::revokeChildLayer(): Will not remove NULL child" ); if( !haveChild() ) diff --git a/slideshow/source/engine/shapes/drawinglayeranimation.cxx b/slideshow/source/engine/shapes/drawinglayeranimation.cxx index 9aa162482..3fce15be2 100644 --- a/slideshow/source/engine/shapes/drawinglayeranimation.cxx +++ b/slideshow/source/engine/shapes/drawinglayeranimation.cxx @@ -703,7 +703,7 @@ bool ActivityImpl::perform() if( !isActive() ) return false; - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( mpDrawShape, "ActivityImpl::perform(): still active, but NULL draw shape" ); diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx index c94b73f3a..ea5acd715 100644 --- a/slideshow/source/engine/shapes/drawshape.cxx +++ b/slideshow/source/engine/shapes/drawshape.cxx @@ -330,7 +330,7 @@ namespace slideshow mbForceUpdate = false; mbAttributeLayerRevoked = false; - ENSURE_OR_RETURN( !maViewShapes.empty(), + ENSURE_OR_RETURN_FALSE( !maViewShapes.empty(), "DrawShape::implRender(): render called on DrawShape without views" ); if( maBounds.isEmpty() ) @@ -1062,7 +1062,7 @@ namespace slideshow bool DrawShape::setIntrinsicAnimationFrame( ::std::size_t nCurrFrame ) { - ENSURE_OR_RETURN( nCurrFrame < maAnimationFrames.size(), + ENSURE_OR_RETURN_FALSE( nCurrFrame < maAnimationFrames.size(), "DrawShape::setIntrinsicAnimationFrame(): frame index out of bounds" ); if( mnCurrFrame != nCurrFrame ) diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx index 909a62e78..ecf8bf2b1 100644 --- a/slideshow/source/engine/shapes/gdimtftools.cxx +++ b/slideshow/source/engine/shapes/gdimtftools.cxx @@ -189,7 +189,7 @@ bool getMetaFile( const uno::Reference< lang::XComponent >& xSource, int mtfLoadFlags, const uno::Reference< uno::XComponentContext >& rxContext ) { - ENSURE_OR_RETURN( rxContext.is(), + ENSURE_OR_RETURN_FALSE( rxContext.is(), "getMetaFile(): Invalid context" ); // create dummy XGraphicRenderer, which receives the @@ -389,7 +389,7 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames, break; default: - ENSURE_OR_RETURN(false, + ENSURE_OR_RETURN_FALSE(false, "getAnimationFromGraphic(): Unexpected case" ); break; } diff --git a/slideshow/source/engine/shapes/viewappletshape.cxx b/slideshow/source/engine/shapes/viewappletshape.cxx index 3055383bd..ae98d3f66 100644 --- a/slideshow/source/engine/shapes/viewappletshape.cxx +++ b/slideshow/source/engine/shapes/viewappletshape.cxx @@ -141,7 +141,7 @@ namespace slideshow bool ViewAppletShape::startApplet( const ::basegfx::B2DRectangle& rBounds ) { - ENSURE_OR_RETURN( mpViewLayer && mpViewLayer->getCanvas() && mpViewLayer->getCanvas()->getUNOCanvas().is(), + ENSURE_OR_RETURN_FALSE( mpViewLayer && mpViewLayer->getCanvas() && mpViewLayer->getCanvas()->getUNOCanvas().is(), "ViewAppletShape::startApplet(): Invalid or disposed view" ); try { diff --git a/slideshow/source/engine/shapes/viewbackgroundshape.cxx b/slideshow/source/engine/shapes/viewbackgroundshape.cxx index 0250f867d..ccbc6087a 100644 --- a/slideshow/source/engine/shapes/viewbackgroundshape.cxx +++ b/slideshow/source/engine/shapes/viewbackgroundshape.cxx @@ -71,7 +71,7 @@ namespace slideshow const GDIMetaFileSharedPtr& rMtf ) const { RTL_LOGFILE_CONTEXT( aLog, "::presentation::internal::ViewBackgroundShape::prefetch()" ); - ENSURE_OR_RETURN( rMtf, + ENSURE_OR_RETURN_FALSE( rMtf, "ViewBackgroundShape::prefetch(): no valid metafile!" ); const ::basegfx::B2DHomMatrix& rCanvasTransform( @@ -131,7 +131,7 @@ namespace slideshow *rMtf.get(), ::cppcanvas::Renderer::Parameters() ) ); - ENSURE_OR_RETURN( pRenderer, + ENSURE_OR_RETURN_FALSE( pRenderer, "ViewBackgroundShape::prefetch(): Could not create Renderer" ); pRenderer->setTransformation( aShapeTransform ); @@ -172,7 +172,7 @@ namespace slideshow if( !prefetch( rDestinationCanvas, rMtf ) ) return false; - ENSURE_OR_RETURN( mxBitmap.is(), + ENSURE_OR_RETURN_FALSE( mxBitmap.is(), "ViewBackgroundShape::draw(): Invalid background bitmap" ); ::basegfx::B2DHomMatrix aTransform( mpViewLayer->getTransformation() ); diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index 609566f73..e1ec7a6df 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -275,7 +275,7 @@ namespace slideshow { if( !mxPlayer.is() && mxShape.is() ) { - ENSURE_OR_RETURN( mpViewLayer->getCanvas(), + ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas(), "ViewMediaShape::update(): Invalid layer canvas" ); uno::Reference< rendering::XCanvas > xCanvas( mpViewLayer->getCanvas()->getUNOCanvas() ); diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx index 76be1b9aa..75c6b140b 100644 --- a/slideshow/source/engine/shapes/viewshape.cxx +++ b/slideshow/source/engine/shapes/viewshape.cxx @@ -81,7 +81,7 @@ namespace slideshow const ShapeAttributeLayerSharedPtr& rAttr ) const { RTL_LOGFILE_CONTEXT( aLog, "::presentation::internal::ViewShape::prefetch()" ); - ENSURE_OR_RETURN( rMtf, + ENSURE_OR_RETURN_FALSE( rMtf, "ViewShape::prefetch(): no valid metafile!" ); if( rMtf != io_rCacheEntry.mpMtf || @@ -207,7 +207,7 @@ namespace slideshow ::cppcanvas::RendererSharedPtr pRenderer( getRenderer( rDestinationCanvas, rMtf, rAttr ) ); - ENSURE_OR_RETURN( pRenderer, "ViewShape::draw(): Invalid renderer" ); + ENSURE_OR_RETURN_FALSE( pRenderer, "ViewShape::draw(): Invalid renderer" ); pRenderer->setTransformation( rTransform ); #if defined(VERBOSE) && OSL_DEBUG_LEVEL > 0 @@ -399,7 +399,7 @@ namespace slideshow mpSprite->resize( rSpriteSizePixel ); } - ENSURE_OR_RETURN( mpSprite, "ViewShape::renderSprite(): No sprite" ); + ENSURE_OR_RETURN_FALSE( mpSprite, "ViewShape::renderSprite(): No sprite" ); VERBOSE_TRACE( "ViewShape::renderSprite(): Rendering sprite 0x%X", mpSprite.get() ); @@ -873,7 +873,7 @@ namespace slideshow bool bIsVisible ) const { RTL_LOGFILE_CONTEXT( aLog, "::presentation::internal::ViewShape::update()" ); - ENSURE_OR_RETURN( mpViewLayer->getCanvas(), "ViewShape::update(): Invalid layer canvas" ); + ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas(), "ViewShape::update(): Invalid layer canvas" ); // Shall we render to a sprite, or to a plain canvas? if( isBackgroundDetached() ) diff --git a/slideshow/source/engine/slide/shapemanagerimpl.cxx b/slideshow/source/engine/slide/shapemanagerimpl.cxx index 052758d20..635d1fc2d 100644 --- a/slideshow/source/engine/slide/shapemanagerimpl.cxx +++ b/slideshow/source/engine/slide/shapemanagerimpl.cxx @@ -342,7 +342,7 @@ bool ShapeManagerImpl::listenerAdded( if( (aIter = mrGlobalListenersMap.find( xShape )) == mrGlobalListenersMap.end() ) { - ENSURE_OR_RETURN(false, + ENSURE_OR_RETURN_FALSE(false, "ShapeManagerImpl::listenerAdded(): global " "shape listener map inconsistency!"); } diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 433b4bc2c..8716747fc 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -825,9 +825,9 @@ bool SlideImpl::implPrefetchShow() if( mbShowLoaded ) return true; - ENSURE_OR_RETURN( mxDrawPage.is(), + ENSURE_OR_RETURN_FALSE( mxDrawPage.is(), "SlideImpl::implPrefetchShow(): Invalid draw page" ); - ENSURE_OR_RETURN( mpLayerManager, + ENSURE_OR_RETURN_FALSE( mpLayerManager, "SlideImpl::implPrefetchShow(): Invalid layer manager" ); // fetch desired page content @@ -971,7 +971,7 @@ bool SlideImpl::applyInitialShapeAttributes( try { - ENSURE_OR_RETURN( maContext.mxComponentContext.is(), + ENSURE_OR_RETURN_FALSE( maContext.mxComponentContext.is(), "SlideImpl::applyInitialShapeAttributes(): Invalid component context" ); uno::Reference xFac( @@ -999,7 +999,7 @@ bool SlideImpl::applyInitialShapeAttributes( // could not determine initial shape attributes - this // is an error, as some effects might then be plainly // invisible - ENSURE_OR_RETURN( false, + ENSURE_OR_RETURN_FALSE( false, "SlideImpl::applyInitialShapeAttributes(): " "couldn't create TargetPropertiesCreator." ); } @@ -1104,9 +1104,9 @@ bool SlideImpl::loadShapes() if( mbShapesLoaded ) return true; - ENSURE_OR_RETURN( mxDrawPage.is(), + ENSURE_OR_RETURN_FALSE( mxDrawPage.is(), "SlideImpl::loadShapes(): Invalid draw page" ); - ENSURE_OR_RETURN( mpLayerManager, + ENSURE_OR_RETURN_FALSE( mpLayerManager, "SlideImpl::loadShapes(): Invalid layer manager" ); // fetch desired page content diff --git a/slideshow/source/engine/slidebitmap.cxx b/slideshow/source/engine/slidebitmap.cxx index 56a0a2e4a..9ce5b8f76 100644 --- a/slideshow/source/engine/slidebitmap.cxx +++ b/slideshow/source/engine/slidebitmap.cxx @@ -68,7 +68,7 @@ namespace slideshow bool SlideBitmap::draw( const ::cppcanvas::CanvasSharedPtr& rCanvas ) const { - ENSURE_OR_RETURN( rCanvas && rCanvas->getUNOCanvas().is(), + ENSURE_OR_RETURN_FALSE( rCanvas && rCanvas->getUNOCanvas().is(), "SlideBitmap::draw(): Invalid canvas" ); // selectively only copy the transformation from current viewstate, diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index b2a3ca50a..f98fdecf6 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -1405,8 +1405,8 @@ sal_Bool SlideShowImpl::addView( DBG_TESTSOLARMUTEX(); // first of all, check if view has a valid canvas - ENSURE_OR_RETURN( xView.is(), "addView(): Invalid view" ); - ENSURE_OR_RETURN( xView->getCanvas().is(), + ENSURE_OR_RETURN_FALSE( xView.is(), "addView(): Invalid view" ); + ENSURE_OR_RETURN_FALSE( xView->getCanvas().is(), "addView(): View does not provide a valid canvas" ); UnoViewSharedPtr const pView( createSlideView( @@ -1449,7 +1449,7 @@ sal_Bool SlideShowImpl::removeView( // precondition: must only be called from the main thread! DBG_TESTSOLARMUTEX(); - ENSURE_OR_RETURN( xView.is(), "removeView(): Invalid view" ); + ENSURE_OR_RETURN_FALSE( xView.is(), "removeView(): Invalid view" ); UnoViewSharedPtr const pView( maViewContainer.removeView( xView ) ); if( !pView ) diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx index b6faaca69..5200f735d 100644 --- a/slideshow/source/engine/slideview.cxx +++ b/slideshow/source/engine/slideview.cxx @@ -855,7 +855,7 @@ bool SlideView::updateScreen() const { osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_RETURN( mpCanvas.get(), + ENSURE_OR_RETURN_FALSE( mpCanvas.get(), "SlideView::updateScreen(): Disposed" ); return mpCanvas->updateScreen( false ); @@ -865,7 +865,7 @@ bool SlideView::paintScreen() const { osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_RETURN( mpCanvas.get(), + ENSURE_OR_RETURN_FALSE( mpCanvas.get(), "SlideView::paintScreen(): Disposed" ); return mpCanvas->updateScreen( true ); diff --git a/slideshow/source/engine/transitions/shapetransitionfactory.cxx b/slideshow/source/engine/transitions/shapetransitionfactory.cxx index 33b085011..1c2221e44 100644 --- a/slideshow/source/engine/transitions/shapetransitionfactory.cxx +++ b/slideshow/source/engine/transitions/shapetransitionfactory.cxx @@ -185,7 +185,7 @@ void ClippingAnimation::end_() bool ClippingAnimation::operator()( double nValue ) { - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape, "ClippingAnimation::operator(): Invalid ShapeAttributeLayer" ); diff --git a/slideshow/source/engine/usereventqueue.cxx b/slideshow/source/engine/usereventqueue.cxx index 2a08faa0c..22cfc39ee 100644 --- a/slideshow/source/engine/usereventqueue.cxx +++ b/slideshow/source/engine/usereventqueue.cxx @@ -181,7 +181,7 @@ public: virtual bool handleAnimationEvent( const AnimationNodeSharedPtr& rNode ) { - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( rNode, "AllAnimationEventHandler::handleAnimationEvent(): Invalid node" ); -- cgit v1.2.3 From 933c48a542da57d20fefbb66baa13223802cbb0e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 15 Mar 2010 13:53:19 +0100 Subject: slidecopy: initial version of a "Tool Panel" At the moment, this implementation is parallel to the existing TaskPane implementation, but on the medium term, it is intended to replace it. No change in functionality is planned for the moment, just the panel selection is done via a tab bar, instead of the the "jumping drawers". Pending tasks (as known so far): - Accessibility. No implementation at all, yet. - showing/hiding tool panels from the "View" drop down menu - connection to the resource framework. At the moment, de/activating panels completely bypasses the resource framework. - alternative implementation of the PanelDeckLayouter which mimics the old design. To be activated by default, for the moment. - removal of the (old, by then) TaskPane implementation. Care needs to be taken that the framework API stays unchanged, i.e., the current ToolPanel resource must be renamed back to RightPane when RightPane is not occupied anymore by the old implementation. Same for other resource names. --- sd/inc/app.hrc | 2 + sd/inc/glob.hrc | 3 + sd/inc/glob.hxx | 2 + sd/sdi/ToolPanelViewShell.sdi | 30 + sd/sdi/ViewShellBase.sdi | 31 + sd/sdi/makefile.mk | 2 + sd/sdi/sdslots.sdi | 1 + sd/source/ui/app/sddll1.cxx | 10 +- sd/source/ui/app/sddll2.cxx | 1 + sd/source/ui/app/strings.src | 8 + sd/source/ui/dlg/PaneChildWindows.cxx | 53 +- sd/source/ui/dlg/PaneDockingWindow.cxx | 12 +- sd/source/ui/dlg/PaneDockingWindow.src | 16 + sd/source/ui/dlg/PaneShells.cxx | 27 + .../ui/framework/factories/BasicPaneFactory.cxx | 14 +- .../ui/framework/factories/BasicViewFactory.cxx | 13 + sd/source/ui/framework/module/ImpressModule.cxx | 2 + .../ui/framework/module/PresentationModule.cxx | 1 - sd/source/ui/framework/module/ToolPanelModule.cxx | 165 ++++++ sd/source/ui/framework/module/ToolPanelModule.hxx | 53 ++ sd/source/ui/framework/module/makefile.mk | 1 + sd/source/ui/framework/tools/FrameworkHelper.cxx | 6 + sd/source/ui/inc/PaneChildWindows.hxx | 18 +- sd/source/ui/inc/PaneDockingWindow.hrc | 7 +- sd/source/ui/inc/PaneDockingWindow.hxx | 12 +- sd/source/ui/inc/PaneShells.hxx | 10 + sd/source/ui/inc/TaskPaneViewShell.hxx | 25 - sd/source/ui/inc/ViewShell.hxx | 3 +- sd/source/ui/inc/framework/FrameworkHelper.hxx | 2 + sd/source/ui/inc/taskpane/ScrollPanel.hxx | 8 + sd/source/ui/inc/taskpane/SubToolPanel.hxx | 3 +- .../ui/inc/taskpane/TaskPaneControlFactory.hxx | 45 ++ sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx | 8 - sd/source/ui/inc/taskpane/TitleBar.hxx | 2 +- sd/source/ui/inc/taskpane/TitledControl.hxx | 2 +- sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx | 182 ++++++ sd/source/ui/toolpanel/LayoutMenu.cxx | 85 ++- sd/source/ui/toolpanel/LayoutMenu.hxx | 14 + sd/source/ui/toolpanel/ScrollPanel.cxx | 24 + sd/source/ui/toolpanel/SubToolPanel.cxx | 29 + sd/source/ui/toolpanel/TaskPaneControlFactory.cxx | 6 + sd/source/ui/toolpanel/TaskPaneShellManager.cxx | 17 +- sd/source/ui/toolpanel/TaskPaneShellManager.hxx | 5 + sd/source/ui/toolpanel/TaskPaneToolPanel.cxx | 131 +++++ sd/source/ui/toolpanel/TaskPaneToolPanel.hxx | 92 +++ sd/source/ui/toolpanel/TaskPaneTreeNode.cxx | 11 - sd/source/ui/toolpanel/TaskPaneViewShell.cxx | 83 +-- sd/source/ui/toolpanel/TestMenu.cxx | 5 + sd/source/ui/toolpanel/TestPanel.cxx | 5 + sd/source/ui/toolpanel/TitleBar.cxx | 38 +- sd/source/ui/toolpanel/TitledControl.cxx | 42 +- sd/source/ui/toolpanel/ToolPanelDeck.cxx | 93 +++ sd/source/ui/toolpanel/ToolPanelDeck.hxx | 75 +++ sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 642 +++++++++++++++++++++ .../ui/toolpanel/controls/CustomAnimationPanel.cxx | 23 + .../ui/toolpanel/controls/CustomAnimationPanel.hxx | 10 + .../ui/toolpanel/controls/MasterPagesPanel.cxx | 38 +- .../ui/toolpanel/controls/MasterPagesPanel.hxx | 14 + .../ui/toolpanel/controls/SlideTransitionPanel.cxx | 26 +- .../ui/toolpanel/controls/SlideTransitionPanel.hxx | 10 + .../ui/toolpanel/controls/TableDesignPanel.cxx | 23 + .../ui/toolpanel/controls/TableDesignPanel.hxx | 10 + sd/source/ui/toolpanel/makefile.mk | 5 +- sd/source/ui/view/GraphicViewShellBase.cxx | 1 + sd/source/ui/view/ToolBarManager.cxx | 1 + sd/source/ui/view/ViewShellBase.cxx | 17 +- sd/source/ui/view/ViewShellImplementation.cxx | 1 + sd/uiconfig/simpress/menubar/menubar.xml | 3 +- 68 files changed, 2157 insertions(+), 202 deletions(-) create mode 100644 sd/sdi/ToolPanelViewShell.sdi create mode 100644 sd/source/ui/framework/module/ToolPanelModule.cxx create mode 100644 sd/source/ui/framework/module/ToolPanelModule.hxx create mode 100644 sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx create mode 100644 sd/source/ui/toolpanel/TaskPaneToolPanel.cxx create mode 100644 sd/source/ui/toolpanel/TaskPaneToolPanel.hxx create mode 100644 sd/source/ui/toolpanel/ToolPanelDeck.cxx create mode 100644 sd/source/ui/toolpanel/ToolPanelDeck.hxx create mode 100644 sd/source/ui/toolpanel/ToolPanelViewShell.cxx diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index e83ccbbb7..328795c7a 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -466,4 +466,6 @@ #define SID_ADD_MOTION_PATH (SID_SD_START+441) #define SID_TABLE_TOOLBOX (SID_SD_START+442) +#define SID_TOOL_PANEL_PANE (SID_SD_START+443) + #endif diff --git a/sd/inc/glob.hrc b/sd/inc/glob.hrc index 9cb0e0f38..7d44a1b92 100644 --- a/sd/inc/glob.hrc +++ b/sd/inc/glob.hrc @@ -141,6 +141,7 @@ #define STR_LEFT_IMPRESS_PANE_SHELL RID_GLOB_START+113 #define STR_LEFT_DRAW_PANE_SHELL RID_GLOB_START+114 #define STR_RIGHT_PANE_SHELL RID_GLOB_START+115 +#define STR_TOOL_PANEL_SHELL RID_GLOB_START+116 #define RID_CUSTOMANIMATION_START RID_GLOB_START+120 #define RID_CUSTOMANIMATION_END RID_GLOB_START+199 @@ -153,6 +154,8 @@ #define DLG_TABLEDESIGNPANE RID_GLOB_START+224 #define STR_TABLEOBJECTBARSHELL RID_GLOB_START+225 #define RID_TABPAGE_PARA_NUMBERING RID_GLOB_START+226 +#define STR_CUSTOMANIMATIONPANE RID_GLOB_START+227 +#define STR_SLIDE_TRANSITION_PANE RID_GLOB_START+228 diff --git a/sd/inc/glob.hxx b/sd/inc/glob.hxx index aee353afb..5acb84da5 100644 --- a/sd/inc/glob.hxx +++ b/sd/inc/glob.hxx @@ -69,6 +69,8 @@ #define SD_IF_SDRIGHTPANESHELL SFX_INTERFACE_SD_START + 26 #define SD_IF_SDDRAWTABLEOBJECTBAR SFX_INTERFACE_SD_START + 27 #define SD_IF_SDANNOTATIONSHELL SFX_INTERFACE_SD_START + 28 +#define SD_IF_SDTOOLPANELPANESHELL SFX_INTERFACE_SD_START + 29 +#define SD_IF_SDTOOLPANELSHELL SFX_INTERFACE_SD_START + 30 // Inventor-Id fuer StarDraw UserData const UINT32 SdUDInventor=UINT32('S')*0x00000001+ diff --git a/sd/sdi/ToolPanelViewShell.sdi b/sd/sdi/ToolPanelViewShell.sdi new file mode 100644 index 000000000..fdbbc9d25 --- /dev/null +++ b/sd/sdi/ToolPanelViewShell.sdi @@ -0,0 +1,30 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +shell ToolPanelViewShell +{ +} + diff --git a/sd/sdi/ViewShellBase.sdi b/sd/sdi/ViewShellBase.sdi index 67d9cfb1e..226bd38cb 100644 --- a/sd/sdi/ViewShellBase.sdi +++ b/sd/sdi/ViewShellBase.sdi @@ -164,6 +164,32 @@ SfxBoolItem RightPane SID_RIGHT_PANE GroupId = GID_MODIFY; ] +SfxBoolItem ToolPanel SID_TOOL_PANEL_PANE + +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_MODIFY; +] + SfxVoidItem NotesChildWindow SID_NOTES_WINDOW [ @@ -288,6 +314,11 @@ interface ViewShellBaseView ExecMethod = Execute; StateMethod = GetState; ] + SID_TOOL_PANEL_PANE + [ + ExecMethod = Execute; + StateMethod = GetState; + ] SID_NOTES_WINDOW [ ExecMethod = Execute; diff --git a/sd/sdi/makefile.mk b/sd/sdi/makefile.mk index 7eb22a96c..dbe86abd7 100644 --- a/sd/sdi/makefile.mk +++ b/sd/sdi/makefile.mk @@ -71,6 +71,7 @@ SVSDI1DEPEND= \ SlideSorterController.sdi \ ViewShellBase.sdi \ TaskPaneViewShell.sdi \ + ToolPanelViewShell.sdi \ sdslots.hrc \ $(PRJ)$/inc$/app.hrc @@ -93,6 +94,7 @@ SVSDI2DEPEND= \ outlnvsh.sdi \ ViewShellBase.sdi \ TaskPaneViewShell.sdi \ + ToolPanelViewShell.sdi \ sdslots.hrc \ $(PRJ)$/inc$/app.hrc diff --git a/sd/sdi/sdslots.sdi b/sd/sdi/sdslots.sdi index 3a0862a17..49350f821 100644 --- a/sd/sdi/sdslots.sdi +++ b/sd/sdi/sdslots.sdi @@ -108,4 +108,5 @@ ModulePrefix( "Sd" ) include "mediaob.sdi" include "tables.sdi" include "TaskPaneViewShell.sdi" + include "ToolPanelViewShell.sdi" } diff --git a/sd/source/ui/app/sddll1.cxx b/sd/source/ui/app/sddll1.cxx index 6b525a0b3..00810fd53 100644 --- a/sd/source/ui/app/sddll1.cxx +++ b/sd/source/ui/app/sddll1.cxx @@ -51,12 +51,9 @@ #include "GraphicViewShellBase.hxx" #include "DrawDocShell.hxx" #include "GraphicDocShell.hxx" -#ifndef SD_SLIDEBROWSER_SLIDE_SORTER_VIEW_SHELL_HXX #include "SlideSorterViewShell.hxx" -#endif -#ifndef SD_SLIDEBROWSER_TASK_PANE_VIEW_SHELL_HXX +#include "taskpane/ToolPanelViewShell.hxx" #include "TaskPaneViewShell.hxx" -#endif #include "FactoryIds.hxx" #include "sdmod.hxx" #include "app.hrc" @@ -135,7 +132,8 @@ void SdDLL::RegisterInterfaces() // View shells for the side panes. ::sd::slidesorter::SlideSorterViewShell::RegisterInterface (pMod); ::sd::toolpanel::TaskPaneViewShell::RegisterInterface(pMod); - // Tell the task pane view shell to register the interfaces of its + ::sd::toolpanel::ToolPanelViewShell::RegisterInterface(pMod); + // Tell the tool panel view shell to register the interfaces of its // controls. - ::sd::toolpanel::TaskPaneViewShell::RegisterControls(); + ::sd::toolpanel::ToolPanelViewShell::RegisterControls(); } diff --git a/sd/source/ui/app/sddll2.cxx b/sd/source/ui/app/sddll2.cxx index 49f7df07e..6796ba1be 100644 --- a/sd/source/ui/app/sddll2.cxx +++ b/sd/source/ui/app/sddll2.cxx @@ -159,6 +159,7 @@ void SdDLL::RegisterControllers() ::sd::LeftPaneImpressChildWindow::RegisterChildWindow(0, pMod); ::sd::LeftPaneDrawChildWindow::RegisterChildWindow(0, pMod); ::sd::RightPaneChildWindow::RegisterChildWindow(0, pMod); + ::sd::ToolPanelChildWindow::RegisterChildWindow(0, pMod); SvxFillToolBoxControl::RegisterControl(0, pMod); SvxLineStyleToolBoxControl::RegisterControl(0, pMod); diff --git a/sd/source/ui/app/strings.src b/sd/source/ui/app/strings.src index 90a507c78..f1f2b3f7f 100644 --- a/sd/source/ui/app/strings.src +++ b/sd/source/ui/app/strings.src @@ -1253,6 +1253,14 @@ String DLG_TABLEDESIGNPANE { Text [ en-US ] = "Table Designs"; }; +String STR_CUSTOMANIMATIONPANE +{ + Text [ en-US ] = "Custom Animation"; +}; +String STR_SLIDE_TRANSITION_PANE +{ + Text [ en-US ] = "Slide Transition"; +}; String STR_NAVIGATOR_SHOW_NAMED_SHAPES { Text [ en-US ] = "Named shapes"; diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx index 6076890a3..c6d6a8550 100644 --- a/sd/source/ui/dlg/PaneChildWindows.cxx +++ b/sd/source/ui/dlg/PaneChildWindows.cxx @@ -32,28 +32,25 @@ #include "precompiled_sd.hxx" #include "PaneChildWindows.hxx" #include "PaneDockingWindow.hrc" +#include "PaneDockingWindow.hxx" +#include "ViewShellBase.hxx" +#include "framework/FrameworkHelper.hxx" #include "app.hrc" #include "strings.hrc" #include "sdresid.hxx" + #include #include #include #include -namespace sd -{ - SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS) - SFX_IMPL_DOCKINGWINDOW(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW) - SFX_IMPL_DOCKINGWINDOW(RightPaneChildWindow, SID_RIGHT_PANE) -} - - -#include "PaneDockingWindow.hxx" -#include "ViewShellBase.hxx" -#include "framework/FrameworkHelper.hxx" - namespace sd { +SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS) +SFX_IMPL_DOCKINGWINDOW(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW) +SFX_IMPL_DOCKINGWINDOW(RightPaneChildWindow, SID_RIGHT_PANE) +SFX_IMPL_DOCKINGWINDOW( ToolPanelChildWindow, SID_TOOL_PANEL_PANE ) + //===== PaneChildWindow ======================================================= PaneChildWindow::PaneChildWindow ( @@ -61,8 +58,8 @@ PaneChildWindow::PaneChildWindow ( USHORT nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo, - const ResId& rResId, - const ::rtl::OUString& rsTitle, + const USHORT nDockWinTitleResId, + const USHORT nTitleBarResId, SfxChildAlignment eAlignment) : SfxChildWindow (pParentWindow, nId) { @@ -70,9 +67,8 @@ PaneChildWindow::PaneChildWindow ( pBindings, this, pParentWindow, - rResId, - framework::FrameworkHelper::msLeftImpressPaneURL, - rsTitle); + SdResId( nDockWinTitleResId ), + String( SdResId( nTitleBarResId ) ) ); eChildAlignment = eAlignment; static_cast(pWindow)->Initialize(pInfo); SetHideNotDelete(TRUE); @@ -115,8 +111,8 @@ LeftPaneImpressChildWindow::LeftPaneImpressChildWindow ( nId, pBindings, pInfo, - SdResId(FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW), - String(SdResId(STR_LEFT_PANE_IMPRESS_TITLE)), + FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW, + STR_LEFT_PANE_IMPRESS_TITLE, SFX_ALIGN_LEFT) { } @@ -136,8 +132,8 @@ LeftPaneDrawChildWindow::LeftPaneDrawChildWindow ( nId, pBindings, pInfo, - SdResId(FLT_LEFT_PANE_DRAW_DOCKING_WINDOW), - String(SdResId(STR_LEFT_PANE_DRAW_TITLE)), + FLT_LEFT_PANE_DRAW_DOCKING_WINDOW, + STR_LEFT_PANE_DRAW_TITLE, SFX_ALIGN_LEFT) { } @@ -157,11 +153,22 @@ RightPaneChildWindow::RightPaneChildWindow ( nId, pBindings, pInfo, - SdResId(FLT_RIGHT_PANE_DOCKING_WINDOW), - String(SdResId(STR_RIGHT_PANE_TITLE)), + FLT_RIGHT_PANE_DOCKING_WINDOW, + STR_RIGHT_PANE_TITLE, SFX_ALIGN_RIGHT) { } +//====================================================================================================================== +//= ToolPanelChildWindow +//====================================================================================================================== +//---------------------------------------------------------------------------------------------------------------------- +ToolPanelChildWindow::ToolPanelChildWindow( ::Window* i_pParentWindow, USHORT i_nId, SfxBindings* i_pBindings, + SfxChildWinInfo* i_pChildWindowInfo ) + :PaneChildWindow( i_pParentWindow, i_nId, i_pBindings, i_pChildWindowInfo, + FLT_TOOL_PANEL_DOCKING_WINDOW, STR_RIGHT_PANE_TITLE, SFX_ALIGN_NOALIGNMENT ) +{ +} + } // end of namespace ::sd diff --git a/sd/source/ui/dlg/PaneDockingWindow.cxx b/sd/source/ui/dlg/PaneDockingWindow.cxx index d4ebe02ae..114bec994 100644 --- a/sd/source/ui/dlg/PaneDockingWindow.cxx +++ b/sd/source/ui/dlg/PaneDockingWindow.cxx @@ -52,7 +52,6 @@ PaneDockingWindow::PaneDockingWindow ( SfxChildWindow *pChildWindow, ::Window* pParent, const ResId& rResId, - const ::rtl::OUString& rsPaneURL, const ::rtl::OUString& rsTitle) : SfxDockingWindow ( _pBindings, @@ -60,7 +59,6 @@ PaneDockingWindow::PaneDockingWindow ( pParent, rResId ), - msPaneURL(rsPaneURL), msTitle(rsTitle), mpTitleToolBox(), maBorder (3,1,3,3), @@ -397,6 +395,16 @@ void PaneDockingWindow::DataChanged (const DataChangedEvent& rEvent) +void PaneDockingWindow::EndDocking( const Rectangle& rRect, BOOL bFloatMode ) +{ + SfxDockingWindow::EndDocking( rRect, bFloatMode ); + + if ( maEndDockingHdl.IsSet() ) + maEndDockingHdl.Call( this ); +} + + + ::Window* PaneDockingWindow::GetContentWindow (void) { return mpContentWindow.get(); diff --git a/sd/source/ui/dlg/PaneDockingWindow.src b/sd/source/ui/dlg/PaneDockingWindow.src index 95f6d7217..a9d7256aa 100644 --- a/sd/source/ui/dlg/PaneDockingWindow.src +++ b/sd/source/ui/dlg/PaneDockingWindow.src @@ -77,3 +77,19 @@ DockingWindow FLT_RIGHT_PANE_DOCKING_WINDOW Size = MAP_APPFONT (100,200) ; Text [ en-US ] = "Task Pane" ; }; + +DockingWindow FLT_TOOL_PANEL_DOCKING_WINDOW +{ + // HelpID = SID_EFFECT_WIN ; + Border = TRUE ; + Hide = TRUE ; + SVLook = TRUE ; + Sizeable = TRUE ; + Moveable = TRUE ; + Closeable = TRUE ; + Zoomable = TRUE ; + Dockable = TRUE ; + EnableResizing = TRUE ; + Size = MAP_APPFONT (100,200) ; + Text [ en-US ] = "Task Pane" ; +}; diff --git a/sd/source/ui/dlg/PaneShells.cxx b/sd/source/ui/dlg/PaneShells.cxx index 4e2786064..1d2092dd6 100644 --- a/sd/source/ui/dlg/PaneShells.cxx +++ b/sd/source/ui/dlg/PaneShells.cxx @@ -145,4 +145,31 @@ RightPaneShell::~RightPaneShell (void) { } +//===== ToolPanelPaneShell ======================================================== + +#undef ShellClass +#define ShellClass ToolPanelPaneShell + +SFX_SLOTMAP( ToolPanelPaneShell ) +{ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + +SFX_IMPL_INTERFACE( ToolPanelPaneShell, SfxShell, SdResId( STR_TOOL_PANEL_SHELL ) ) +{ + SFX_CHILDWINDOW_REGISTRATION( ::sd::ToolPanelChildWindow::GetChildWindowId() ); +} + +TYPEINIT1( ToolPanelPaneShell, SfxShell ); + +ToolPanelPaneShell::ToolPanelPaneShell() + :SfxShell() +{ + SetName( ::rtl::OUString::createFromAscii( "ToolPanel" ) ); +} + +ToolPanelPaneShell::~ToolPanelPaneShell(void) +{ +} + } // end of namespace ::sd diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx index 125143974..9ba4dd41e 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx @@ -59,7 +59,8 @@ namespace { FullScreenPaneId, LeftImpressPaneId, LeftDrawPaneId, - RightPaneId + RightPaneId, + ToolPanelPaneId }; static const sal_Int32 gnConfigurationUpdateStartEvent(0); @@ -243,6 +244,11 @@ void SAL_CALL BasicPaneFactory::initialize (const Sequence& aArguments) aDescriptor.mePaneId = RightPaneId; mpPaneContainer->push_back(aDescriptor); xCC->addResourceFactory(aDescriptor.msPaneURL, this); + + aDescriptor.msPaneURL = FrameworkHelper::msToolPanelPaneURL; + aDescriptor.mePaneId = ToolPanelPaneId; + mpPaneContainer->push_back(aDescriptor); + xCC->addResourceFactory(aDescriptor.msPaneURL, this); } // Register as configuration change listener. @@ -312,6 +318,7 @@ Reference SAL_CALL BasicPaneFactory::createResource ( case LeftImpressPaneId: case LeftDrawPaneId: case RightPaneId: + case ToolPanelPaneId: xPane = CreateChildWindowPane( rxPaneId, *iDescriptor); @@ -536,6 +543,11 @@ Reference BasicPaneFactory::CreateChildWindowPane ( nChildWindowId = ::sd::RightPaneChildWindow::GetChildWindowId(); break; + case ToolPanelPaneId: + pShell.reset(new ToolPanelPaneShell()); + nChildWindowId = ::sd::ToolPanelChildWindow::GetChildWindowId(); + break; + default: break; } diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 519580f47..94ba56a3d 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -47,6 +47,7 @@ #include "GraphicViewShell.hxx" #include "OutlineViewShell.hxx" #include "TaskPaneViewShell.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "PresentationViewShell.hxx" #include "SlideSorterViewShell.hxx" #include "FrameView.hxx" @@ -334,6 +335,7 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence& aArguments) mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msTaskPaneURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msToolPanelViewURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this); } catch (RuntimeException&) @@ -459,6 +461,15 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence& aArguments) &rWindow, pFrameView)); } + else if (rsViewURL.equals(FrameworkHelper::msToolPanelViewURL)) + { + pViewShell.reset( + new ::sd::toolpanel::ToolPanelViewShell( + &rFrame, + *mpBase, + &rWindow, + pFrameView)); + } else if (rsViewURL.equals(FrameworkHelper::msSlideSorterURL)) { pViewShell = ::sd::slidesorter::SlideSorterViewShell::Create ( @@ -535,6 +546,8 @@ bool BasicViewFactory::IsCacheable (const ::boost::shared_ptr& r FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftImpressPaneURL)); maCacheableResources.push_back(pHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL)); + maCacheableResources.push_back(pHelper->CreateResourceId( + FrameworkHelper::msToolPanelViewURL, FrameworkHelper::msToolPanelPaneURL)); } ::std::vector >::const_iterator iId; diff --git a/sd/source/ui/framework/module/ImpressModule.cxx b/sd/source/ui/framework/module/ImpressModule.cxx index a726751a5..1c0b1a758 100644 --- a/sd/source/ui/framework/module/ImpressModule.cxx +++ b/sd/source/ui/framework/module/ImpressModule.cxx @@ -37,6 +37,7 @@ #include "CenterViewFocusModule.hxx" #include "SlideSorterModule.hxx" #include "TaskPaneModule.hxx" +#include "ToolPanelModule.hxx" #include "ToolBarModule.hxx" #include "ShellStackGuard.hxx" @@ -58,6 +59,7 @@ void ImpressModule::Initialize (Reference& rxController) rxController, FrameworkHelper::msLeftImpressPaneURL); TaskPaneModule::Initialize(rxController); + ToolPanelModule::Initialize(rxController); new ToolBarModule(rxController); new ShellStackGuard(rxController); } diff --git a/sd/source/ui/framework/module/PresentationModule.cxx b/sd/source/ui/framework/module/PresentationModule.cxx index b60f65ead..e7db8a4cb 100644 --- a/sd/source/ui/framework/module/PresentationModule.cxx +++ b/sd/source/ui/framework/module/PresentationModule.cxx @@ -34,7 +34,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/ToolPanelModule.cxx b/sd/source/ui/framework/module/ToolPanelModule.cxx new file mode 100644 index 000000000..53f9cbe01 --- /dev/null +++ b/sd/source/ui/framework/module/ToolPanelModule.cxx @@ -0,0 +1,165 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * 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 + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_sd.hxx" + +#include "ToolPanelModule.hxx" +#include "ReadOnlyModeObserver.hxx" +#include "framework/FrameworkHelper.hxx" + +#include +#include + +#include +#include +#include + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::drawing::framework; +using ::rtl::OUString; +using ::sd::framework::FrameworkHelper; + + +namespace sd { namespace framework { + +namespace { + +typedef ::cppu::WeakComponentImplHelper1 < + ::com::sun::star::frame::XStatusListener + > LocalReadOnlyModeObserverInterfaceBase; + +/** This local class enables or disables the ResourceManager of a + 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 + between the ResourceManager and the ReadOnlyModeObserver is removed and + the ReadOnlyModeObserver typically looses its last reference and is + destroyed. +*/ +class LocalReadOnlyModeObserver + : private MutexOwner, + public LocalReadOnlyModeObserverInterfaceBase +{ +public: + LocalReadOnlyModeObserver ( + const Reference& rxController, + const ::rtl::Reference& rpResourceManager) + : MutexOwner(), + LocalReadOnlyModeObserverInterfaceBase(maMutex), + mpResourceManager(rpResourceManager), + mpObserver(new ReadOnlyModeObserver(rxController)) + { + mpObserver->AddStatusListener(this); + + Reference xComponent ( + static_cast(mpResourceManager.get()), UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener(this); + } + + ~LocalReadOnlyModeObserver (void) + { + } + + virtual void SAL_CALL disposing (void) + { + Reference xComponent (static_cast(mpObserver.get()), UNO_QUERY); + if (xComponent.is()) + xComponent->dispose(); + + xComponent = Reference( + static_cast(mpResourceManager.get()), UNO_QUERY); + if (xComponent.is()) + xComponent->removeEventListener(this); + + } + + virtual void SAL_CALL disposing (const com::sun::star::lang::EventObject& rEvent) + throw(RuntimeException) + { + if (rEvent.Source == Reference(static_cast(mpObserver.get()))) + { + mpObserver = NULL; + } + else if (rEvent.Source == Reference( + static_cast(mpResourceManager.get()))) + { + mpResourceManager = NULL; + } + dispose(); + } + + virtual void SAL_CALL statusChanged (const com::sun::star::frame::FeatureStateEvent& rEvent) + throw(RuntimeException) + { + bool bReadWrite (true); + if (rEvent.IsEnabled) + rEvent.State >>= bReadWrite; + + if (bReadWrite) + mpResourceManager->Enable(); + else + mpResourceManager->Disable(); + } + +private: + ::rtl::Reference mpResourceManager; + ::rtl::Reference mpObserver; + +}; +} + + + + +//===== ToolPanelModule ==================================================== + +void ToolPanelModule::Initialize (const Reference& rxController) +{ + ::rtl::Reference pResourceManager ( + new ResourceManager( + rxController, + FrameworkHelper::CreateResourceId( + FrameworkHelper::msToolPanelViewURL, + FrameworkHelper::msToolPanelPaneURL))); + pResourceManager->AddActiveMainView(FrameworkHelper::msImpressViewURL); + pResourceManager->AddActiveMainView(FrameworkHelper::msNotesViewURL); + pResourceManager->AddActiveMainView(FrameworkHelper::msHandoutViewURL); + pResourceManager->AddActiveMainView(FrameworkHelper::msSlideSorterURL); + + new LocalReadOnlyModeObserver(rxController, pResourceManager); +} + + + + +} } // end of namespace sd::framework diff --git a/sd/source/ui/framework/module/ToolPanelModule.hxx b/sd/source/ui/framework/module/ToolPanelModule.hxx new file mode 100644 index 000000000..7697f2a0f --- /dev/null +++ b/sd/source/ui/framework/module/ToolPanelModule.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: TaskPaneModule.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_FRAMEWORK_TOOL_PANEL_MODULE_HXX +#define SD_FRAMEWORK_TOOL_PANEL_MODULE_HXX + +#include "ResourceManager.hxx" + +#include + +namespace sd { namespace framework { + +class ReadOnlyModeObserver; + +/** This module is responsible for showing the task pane. +*/ +class ToolPanelModule +{ +public: + static void Initialize ( + const ::com::sun::star::uno::Reference& rxController); +}; + +} } // end of namespace sd::framework + +#endif diff --git a/sd/source/ui/framework/module/makefile.mk b/sd/source/ui/framework/module/makefile.mk index 24a0b6ba0..78c9e0038 100644 --- a/sd/source/ui/framework/module/makefile.mk +++ b/sd/source/ui/framework/module/makefile.mk @@ -57,6 +57,7 @@ SLOFILES = \ $(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 fcc2ddc7c..122ab528d 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -187,6 +187,8 @@ const OUString FrameworkHelper::msLeftDrawPaneURL( msPaneURLPrefix + OUString::createFromAscii("LeftDrawPane")); const OUString FrameworkHelper::msRightPaneURL( msPaneURLPrefix + OUString::createFromAscii("RightPane")); +const OUString FrameworkHelper::msToolPanelPaneURL( + msPaneURLPrefix + OUString::createFromAscii("ToolPanel")); // View URLs. @@ -209,6 +211,8 @@ const OUString FrameworkHelper::msPresentationViewURL( msViewURLPrefix + OUString::createFromAscii("PresentationView")); const OUString FrameworkHelper::msTaskPaneURL( msViewURLPrefix + OUString::createFromAscii("TaskPane")); +const OUString FrameworkHelper::msToolPanelViewURL( + msViewURLPrefix + OUString::createFromAscii("ToolPanelPane")); // Tool bar URLs. @@ -590,6 +594,7 @@ ViewShell::ShellType FrameworkHelper::GetViewId (const rtl::OUString& rsViewURL) (*mpViewURLMap)[msSlideSorterURL] = ViewShell::ST_SLIDE_SORTER; (*mpViewURLMap)[msPresentationViewURL] = ViewShell::ST_PRESENTATION; (*mpViewURLMap)[msTaskPaneURL] = ViewShell::ST_TASK_PANE; + (*mpViewURLMap)[msToolPanelViewURL] = ViewShell::ST_TOOL_PANEL; } ViewURLMap::const_iterator iView (mpViewURLMap->find(rsViewURL)); if (iView != mpViewURLMap->end()) @@ -613,6 +618,7 @@ ViewShell::ShellType FrameworkHelper::GetViewId (const rtl::OUString& rsViewURL) case ViewShell::ST_SLIDE_SORTER : return msSlideSorterURL; case ViewShell::ST_PRESENTATION : return msPresentationViewURL; case ViewShell::ST_TASK_PANE : return msTaskPaneURL; + case ViewShell::ST_TOOL_PANEL: return msToolPanelViewURL; default: return OUString(); } diff --git a/sd/source/ui/inc/PaneChildWindows.hxx b/sd/source/ui/inc/PaneChildWindows.hxx index 3777483e3..e8fa8ac93 100644 --- a/sd/source/ui/inc/PaneChildWindows.hxx +++ b/sd/source/ui/inc/PaneChildWindows.hxx @@ -44,8 +44,8 @@ public: USHORT nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo, - const ResId& rResId, - const ::rtl::OUString& rsTitle, + const USHORT nDockWinTitleResId, + const USHORT nTitleBarResId, SfxChildAlignment eAlignment); virtual ~PaneChildWindow (void); }; @@ -87,6 +87,20 @@ public: }; +//====================================================================================================================== +//= ToolPanelChildWindow +//====================================================================================================================== +class ToolPanelChildWindow : public PaneChildWindow +{ +public: + ToolPanelChildWindow( + ::Window* i_pParentWindow, + USHORT i_nId, + SfxBindings* i_pBindings, + SfxChildWinInfo* i_pChildWindowInfo ); + + SFX_DECL_CHILDWINDOW( ToolPanelChildWindow ); +}; } // end of namespace ::sd diff --git a/sd/source/ui/inc/PaneDockingWindow.hrc b/sd/source/ui/inc/PaneDockingWindow.hrc index a97e2d6bc..e29562739 100644 --- a/sd/source/ui/inc/PaneDockingWindow.hrc +++ b/sd/source/ui/inc/PaneDockingWindow.hrc @@ -28,6 +28,7 @@ * ************************************************************************/ -#define FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW 792 -#define FLT_LEFT_PANE_DRAW_DOCKING_WINDOW 793 -#define FLT_RIGHT_PANE_DOCKING_WINDOW 794 +#define FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW 792 +#define FLT_LEFT_PANE_DRAW_DOCKING_WINDOW 793 +#define FLT_RIGHT_PANE_DOCKING_WINDOW 794 +#define FLT_TOOL_PANEL_DOCKING_WINDOW 795 diff --git a/sd/source/ui/inc/PaneDockingWindow.hxx b/sd/source/ui/inc/PaneDockingWindow.hxx index bf302d09c..9b60e21d5 100644 --- a/sd/source/ui/inc/PaneDockingWindow.hxx +++ b/sd/source/ui/inc/PaneDockingWindow.hxx @@ -68,7 +68,6 @@ public: SfxChildWindow *pChildWindow, ::Window* pParent, const ResId& rResId, - const ::rtl::OUString& rsPaneURL, const ::rtl::OUString& rsTitle); virtual ~PaneDockingWindow (void); @@ -80,6 +79,8 @@ public: virtual void StateChanged( StateChangedType nType ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void EndDocking( const Rectangle& rRect, BOOL bFloatMode ); + /** Initializing the title tool box either creates a new title tool box or clears all items from an existing one. A closer is added as only item. @@ -96,6 +97,9 @@ public: */ USHORT AddMenu (const String& rsMenuName, ULONG nHelpId, const Link& rCallback); + void SetEndDockingHdl( const Link& i_rEndDockingHdl ) { maEndDockingHdl = i_rEndDockingHdl; } + const Link& GetEndDockingHdl() const { return maEndDockingHdl; } + /** Set the title of the docking window to the given string. Use this method when the title is not yet known at the time of construction or can not be passed to the constructor. @@ -107,10 +111,6 @@ public: ::boost::shared_ptr GetTitleToolBox (void) const; private: - /** The pane which is represented by the docking window. - */ - ::rtl::OUString msPaneURL; - /** Title that is shown at the top of the docking window. */ ::rtl::OUString msTitle; @@ -130,6 +130,8 @@ private: ::boost::scoped_ptr< ::Window> mpContentWindow; + Link maEndDockingHdl; + /** Remember that a layout is pending, i.e. Resize() has been called since the last Paint(). */ diff --git a/sd/source/ui/inc/PaneShells.hxx b/sd/source/ui/inc/PaneShells.hxx index 6f70adc89..77d182a49 100644 --- a/sd/source/ui/inc/PaneShells.hxx +++ b/sd/source/ui/inc/PaneShells.hxx @@ -89,6 +89,16 @@ public: virtual ~RightPaneShell (void); }; +class ToolPanelPaneShell : public SfxShell +{ +public: + TYPEINFO(); + SFX_DECL_INTERFACE( SD_IF_SDTOOLPANELPANESHELL ) + + ToolPanelPaneShell(); + virtual ~ToolPanelPaneShell(); +}; + } // end of namespace sd #endif diff --git a/sd/source/ui/inc/TaskPaneViewShell.hxx b/sd/source/ui/inc/TaskPaneViewShell.hxx index 7251b279b..78058fe49 100644 --- a/sd/source/ui/inc/TaskPaneViewShell.hxx +++ b/sd/source/ui/inc/TaskPaneViewShell.hxx @@ -90,12 +90,6 @@ public: FrameView* pFrameView); virtual ~TaskPaneViewShell (void); - /** Register the SFX interfaces so that (some of) the controls can be - pushed as SFX shells on the shell stack and process slot calls and - so on. - */ - static void RegisterControls (void); - virtual void GetFocus (void); virtual void LoseFocus (void); virtual void KeyInput (const KeyEvent& rEvent); @@ -205,25 +199,6 @@ private: -/** This functor makes visible a panel in the task pane. It can be used - with the FrameworkHelper to make a panel visible after an asynchonous - update of the configuration, e.g. after switching to another view. -*/ -class PanelActivation -{ -public: - /** Create a new object that, when its operator() method is called, will - make the specified panel visible in the task pane that belongs to - the application window specified by the given ViewShellBase. - */ - PanelActivation (ViewShellBase& rBase, TaskPaneViewShell::PanelId nPanelId); - void operator() (bool); -private: - ViewShellBase& mrBase; - TaskPaneViewShell::PanelId mnPanelId; -}; - - } } // end of namespace ::sd::toolpanel #endif diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 004b26bb4..b86c5b1a5 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -118,7 +118,8 @@ public: ST_OUTLINE, ST_SLIDE_SORTER, ST_PRESENTATION, - ST_TASK_PANE + ST_TASK_PANE, + ST_TOOL_PANEL }; static const int MAX_HSPLIT_CNT = 1; static const int MAX_VSPLIT_CNT = 1; diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx index 3e06aac50..700a2ea81 100644 --- a/sd/source/ui/inc/framework/FrameworkHelper.hxx +++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx @@ -80,6 +80,7 @@ public: static const ::rtl::OUString msLeftImpressPaneURL; static const ::rtl::OUString msLeftDrawPaneURL; static const ::rtl::OUString msRightPaneURL; + static const ::rtl::OUString msToolPanelPaneURL; // URLs of frequently used views. static const ::rtl::OUString msViewURLPrefix; @@ -91,6 +92,7 @@ public: static const ::rtl::OUString msSlideSorterURL; static const ::rtl::OUString msPresentationViewURL; static const ::rtl::OUString msTaskPaneURL; + static const ::rtl::OUString msToolPanelViewURL; // URLs of frequently used tool bars. static const ::rtl::OUString msToolBarURLPrefix; diff --git a/sd/source/ui/inc/taskpane/ScrollPanel.hxx b/sd/source/ui/inc/taskpane/ScrollPanel.hxx index 8111d3975..4f36283ec 100644 --- a/sd/source/ui/inc/taskpane/ScrollPanel.hxx +++ b/sd/source/ui/inc/taskpane/ScrollPanel.hxx @@ -63,6 +63,10 @@ public: parent. This will usually be a child window. */ ScrollPanel (TreeNode* pParent); + /** Create a new scroll panel which itself is the root of a TreeNode hierarchy + parent. This will usually be a child window. + */ + ScrollPanel (::Window& i_rParentWindow); virtual ~ScrollPanel (void); /** Add a control to the sub panel. An title bar is added above the @@ -174,6 +178,10 @@ private: */ sal_Int32 LayoutChildren (void); + /** ctor-impl + */ + void Construct(); + Size SetupScrollBars (const Size& rRequiresSize); sal_Int32 SetupVerticalScrollBar (bool bShow, sal_Int32 nRange); sal_Int32 SetupHorizontalScrollBar (bool bShow, sal_Int32 nRange); diff --git a/sd/source/ui/inc/taskpane/SubToolPanel.hxx b/sd/source/ui/inc/taskpane/SubToolPanel.hxx index d9b8dc8c6..3104a09a8 100644 --- a/sd/source/ui/inc/taskpane/SubToolPanel.hxx +++ b/sd/source/ui/inc/taskpane/SubToolPanel.hxx @@ -43,8 +43,6 @@ class Window; namespace sd { namespace toolpanel { -class ToolPanel; - /** The sub tool panel is in function similar to the tool panel. It differes in two points. First, it is a control that can be used as element in a tool panel and thus is actually a nested tool @@ -70,6 +68,7 @@ public: parent. This will usually be a child window. */ SubToolPanel (TreeNode* pParent); + SubToolPanel (Window& i_rParentWindow); virtual ~SubToolPanel (void); /** Add a control to the sub panel. diff --git a/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx b/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx index 67fa6c2c1..17a1fa840 100644 --- a/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx +++ b/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx @@ -66,11 +66,21 @@ public: */ ::std::auto_ptr CreateControl (TreeNode* pTreeNode); + /** creates a tree node which acts as root of an own tree + + An implementation is allowed to return NULL here, but must return non-NULL then in the other + factory method. + Derived classes should overload InternalCreateControl. + */ + ::std::auto_ptr CreateRootControl( ::Window& i_rParent ); + protected: /** This is the internal hook for derived classes to overload in order to provide a new control instance. */ virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) = 0; + + virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) = 0; }; @@ -94,6 +104,41 @@ protected: return new ControlType(pTreeNode, mrArgument); } + virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) + { + OSL_ENSURE( false, "ControlFactoryWithArgs1::InternalCreateRootControl: not implemented!" ); + return NULL; + } + +private: + ArgumentType& mrArgument; +}; + + +/** A simple helper class that realizes a ControlFactory that is able to create root controls, providing + the to-be-created control with an additional parameter. +*/ +template +class RootControlFactoryWithArg + : public ControlFactory +{ +public: + RootControlFactoryWithArg (ArgumentType& rArgument) + : mrArgument(rArgument) + {} + +protected: + virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) + { + OSL_ENSURE( false, "ControlFactoryWithArgs1::InternalCreateControl: not implemented!" ); + return NULL; + } + + virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) + { + return new ControlType( i_rParent, mrArgument ); + } + private: ArgumentType& mrArgument; }; diff --git a/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx b/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx index 4dbe85e99..7a68bd0fb 100644 --- a/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx +++ b/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx @@ -97,14 +97,6 @@ public: */ virtual sal_Int32 GetMinimumWidth (void); - /** Give each node access to the object bar manager of the tool panel. - - At least the root node has to overwrite this method since the - default implementation simply returns the object bar manager of the - parent. - */ - virtual ObjectBarManager* GetObjectBarManager (void); - /** The default implementaion always returns */ virtual bool IsResizable (void); diff --git a/sd/source/ui/inc/taskpane/TitleBar.hxx b/sd/source/ui/inc/taskpane/TitleBar.hxx index b5271e85c..64669be9d 100644 --- a/sd/source/ui/inc/taskpane/TitleBar.hxx +++ b/sd/source/ui/inc/taskpane/TitleBar.hxx @@ -92,7 +92,7 @@ public: virtual void Paint (const Rectangle& rBoundingBox); virtual bool Expand (bool bFlag = true); virtual bool IsExpanded (void) const; - virtual void SetEnabledState(bool bFlag); + virtual void SetEnabledState(bool bFlag); void SetFocus (bool bFlag); diff --git a/sd/source/ui/inc/taskpane/TitledControl.hxx b/sd/source/ui/inc/taskpane/TitledControl.hxx index 8103c18ea..a299abcf0 100644 --- a/sd/source/ui/inc/taskpane/TitledControl.hxx +++ b/sd/source/ui/inc/taskpane/TitledControl.hxx @@ -135,7 +135,7 @@ public: */ virtual bool IsExpandable (void) const; - virtual void SetEnabledState(bool bFlag); + virtual void SetEnabledState(bool bFlag); /** Ownership of the given data remains with the caller. The data is thus not destroyed when the destructor of this class is diff --git a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx new file mode 100644 index 000000000..ebfc92f36 --- /dev/null +++ b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx @@ -0,0 +1,182 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ToolPanelViewShell.hxx,v $ + * $Revision: 1.12 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_TOOL_PANEL_VIEW_SHELL_HXX +#define SD_TOOL_PANEL_VIEW_SHELL_HXX + +#include "ViewShell.hxx" +#include "glob.hxx" +#include "framework/FrameworkHelper.hxx" +#include +#include +#include +#include + +#include +#include + +class PopupMenu; + +namespace sd { +class PaneDockingWindow; + +namespace toolpanel { +class TaskPaneShellManager; +class TitleToolBox; +class TitleBar; +class TitledControl; +class ToolPanelDeck; + +/** The tool panel is a view shell for some very specific reasons: + - It fits better into the concept of panes being docking windows whose + content, a view shell, can be exchanged on runtime. + - A control in the tool panel that wants to show a context menu has to + do that over the dispatcher of a shell. These shells, usually + implemented by the controls themselves, have to be managed by someone. + If interpreted as object bars this can be handled by the + ObjectBarManager of the ViewShell. +*/ +class ToolPanelViewShell + : public ViewShell +{ +public: + TYPEINFO(); + SFX_DECL_INTERFACE(SD_IF_SDTOOLPANELSHELL) + + /** List of top level panels that can be shown in the task pane. + */ + enum PanelId + { + PID__START = 0, + PID_UNKNOWN = PID__START, + PID_MASTER_PAGES, + PID_LAYOUT, + PID_TABLE_DESIGN, + PID_ANIMATION_SCHEMES, + PID_CUSTOM_ANIMATION, + PID_SLIDE_TRANSITION, + PID__END = PID_SLIDE_TRANSITION + }; + + ToolPanelViewShell ( + SfxViewFrame* pFrame, + ViewShellBase& rViewShellBase, + ::Window* pParentWindow, + FrameView* pFrameView); + virtual ~ToolPanelViewShell (void); + + /** Register the SFX interfaces so that (some of) the controls can be + pushed as SFX shells on the shell stack and process slot calls and + so on. + */ + static void RegisterControls (void); + + virtual void GetFocus (void); + virtual void LoseFocus (void); + virtual void KeyInput (const KeyEvent& rEvent); + using sd::ViewShell::KeyInput; + + virtual SdPage* GetActualPage (void); + virtual SdPage* getCurrentPage (void) const; + + void Execute (SfxRequest& rRequest); + void GetState (SfxItemSet& rItemSet); + + virtual void ArrangeGUIElements (void); + + TaskPaneShellManager& GetSubShellManager (void) const; + + /** Called when a mouse button has been pressed but not yet + released, this handler is used to show the popup menu of the + title bar. + */ + DECL_LINK(ToolboxClickHandler, ToolBox*); + DECL_LINK(MenuSelectHandler, Menu*); + DECL_LINK(DockingChanged, PaneDockingWindow*); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible> + CreateAccessibleDocumentView (::sd::Window* pWindow); + + virtual css::uno::Reference CreateSubController (void); + + /** Relocate all toplevel controls to the given parent window. + */ + virtual bool RelocateToParentWindow (::Window* pParentWindow); + +private: + class Implementation; + ::boost::scoped_ptr< Implementation > mpImpl; + ::boost::scoped_ptr< ToolPanelDeck > mpPanelDeck; + + bool mbIsInitialized; + + ::boost::shared_ptr mpSubShellManager; + + /** The id of the menu in the menu bar/tool box of the parent docking + window. + */ + USHORT mnMenuId; + + /** Create a popup menu. it contains two sections, one for + docking or un-docking the tool panel, one for toggling the + visibility state of the tool panel items. + @param bIsDocking + According to this flag one of the lock/unlock entries is + made disabled. + */ + ::std::auto_ptr CreatePopupMenu (bool bIsDocking); + + + /** Return a pointer to the docking window that is the parent or a + predecessor of the content window. + @return + When the view shell is not placed in a docking window, e.g. when + shown in the center pane, then is returned. + */ + DockingWindow* GetDockingWindow (void); + + /** connects to a (new) (Pane)DockingWindow + */ + void ConnectToDockingWindow(); + + /** Initialize the task pane view shell if that has not yet been done + before. If mbIsInitialized is already set to then this + method returns immediately. + */ + void Initialize (void); +}; + + + + +} } // end of namespace ::sd::toolpanel + +#endif diff --git a/sd/source/ui/toolpanel/LayoutMenu.cxx b/sd/source/ui/toolpanel/LayoutMenu.cxx index 15f9b9f09..46dea1531 100644 --- a/sd/source/ui/toolpanel/LayoutMenu.cxx +++ b/sd/source/ui/toolpanel/LayoutMenu.cxx @@ -50,6 +50,7 @@ #include "controller/SlideSorterController.hxx" #include "controller/SlsPageSelector.hxx" #include "taskpane/TaskPaneControlFactory.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "taskpane/ScrollPanel.hxx" #include "tools/SlotStateListener.hxx" #include "EventMultiplexer.hxx" @@ -113,6 +114,12 @@ protected: return pScrollPanel; } + virtual TreeNode* InternalCreateRootControl( ::Window& /*i_rParent*/ ) + { + OSL_ENSURE( false, "LayoutMenuFactory::InternalCreateRootControl: not implemented!" ); + return NULL; + } + private: ViewShellBase& mrBase; DrawDocShell& mrDocShell; @@ -120,6 +127,37 @@ private: +class LayoutMenuRootFactory + : public ControlFactory +{ +public: + LayoutMenuRootFactory (ToolPanelViewShell& i_rPanelViewShell) + :mrPanelViewShell(i_rPanelViewShell) + { + } + +protected: + virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) + { + OSL_ENSURE( false, "LayoutMenuRootFactory::InternalCreateControl: not implemented!" ); + return NULL; + } + + virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) + { + ScrollPanel* pScrollPanel = new ScrollPanel (i_rParent); + ::std::auto_ptr pMenu ( + new LayoutMenu ( + pScrollPanel, + mrPanelViewShell)); + pScrollPanel->AddControl(pMenu); + return pScrollPanel; + } + +private: + ToolPanelViewShell& mrPanelViewShell; +}; + SFX_IMPL_INTERFACE(LayoutMenu, SfxShell, SdResId(STR_TASKPANELAYOUTMENU)) @@ -235,12 +273,41 @@ LayoutMenu::LayoutMenu ( DragSourceHelper(this), DropTargetHelper(this), mrBase (rViewShellBase), + mpShellManager (NULL), mbUseOwnScrollBar (bUseOwnScrollBar), mnPreferredColumnCount(3), mxListener(NULL), mbSelectionUpdatePending(true), mbIsMainViewChangePending(false) { + ImplConstruct( rDocumentShell ); +} + + + +LayoutMenu::LayoutMenu( TreeNode* pParent, ToolPanelViewShell& i_rPanelViewShell ) + : ValueSet (pParent->GetWindow()), + TreeNode(pParent), + DragSourceHelper(this), + DropTargetHelper(this), + mrBase( i_rPanelViewShell.GetViewShellBase() ), + mpShellManager (&i_rPanelViewShell.GetSubShellManager()), + mbUseOwnScrollBar( false ), + mnPreferredColumnCount(3), + mxListener(NULL), + mbSelectionUpdatePending(true), + mbIsMainViewChangePending(false) +{ + ImplConstruct( *mrBase.GetDocument()->GetDocSh() ); +} + + +void LayoutMenu::ImplConstruct( DrawDocShell& rDocumentShell ) +{ + OSL_ENSURE( mrBase.GetDocument()->GetDocSh() == &rDocumentShell, + "LayoutMenu::ImplConstruct: hmm?" ); + // if this fires, then my assumption that the rDocumentShell parameter to our first ctor is superfluous ... + SetStyle ( ( GetStyle() & ~(WB_ITEMBORDER) ) | WB_TABSTOP @@ -279,7 +346,6 @@ LayoutMenu::LayoutMenu ( - LayoutMenu::~LayoutMenu (void) { // Tell the shell factory that this object is no longer available. @@ -308,6 +374,15 @@ LayoutMenu::~LayoutMenu (void) +::std::auto_ptr LayoutMenu::CreateControlFactory ( + ToolPanelViewShell& i_rPanelViewShell ) +{ + return ::std::auto_ptr(new LayoutMenuRootFactory(i_rPanelViewShell)); +} + + + + String LayoutMenu::GetSelectedLayoutName (void) { return GetItemText (GetSelectItemId()); @@ -434,6 +509,7 @@ void LayoutMenu::UpdateEnabledState (const MasterMode eMode) case ViewShell::ST_OUTLINE: case ViewShell::ST_PRESENTATION: case ViewShell::ST_TASK_PANE: + case ViewShell::ST_TOOL_PANEL: // The complete task pane is disabled for these values or // not even visible. Disabling the LayoutMenu would be // logical but unnecessary. The main disadvantage is that @@ -634,6 +710,13 @@ void LayoutMenu::InsertPageWithLayout (AutoLayout aLayout) +TaskPaneShellManager* LayoutMenu::GetShellManager() +{ + if ( mpShellManager ) + return mpShellManager; + return TreeNode::GetShellManager(); +} + void LayoutMenu::InvalidateContent (void) { // The number of items may have changed. Request a resize so that the diff --git a/sd/source/ui/toolpanel/LayoutMenu.hxx b/sd/source/ui/toolpanel/LayoutMenu.hxx index f866ce46b..9355cce1f 100644 --- a/sd/source/ui/toolpanel/LayoutMenu.hxx +++ b/sd/source/ui/toolpanel/LayoutMenu.hxx @@ -63,6 +63,7 @@ class EventMultiplexerEvent; namespace sd { namespace toolpanel { class ControlFactory; +class ToolPanelViewShell; class LayoutMenu @@ -96,11 +97,16 @@ public: DrawDocShell& rDocumentShell, ViewShellBase& rViewShellBase, bool bUseOwnScrollBar); + LayoutMenu ( + TreeNode* pParent, + ToolPanelViewShell& i_rPanelViewShell); virtual ~LayoutMenu (void); static std::auto_ptr CreateControlFactory ( ViewShellBase& rBase, DrawDocShell& rDocShell); + static std::auto_ptr CreateControlFactory ( + ToolPanelViewShell& i_rPanelViewShell ); /** Return the name of the currently selected layout. */ @@ -143,6 +149,9 @@ public: enum MasterMode { MM_NORMAL, MM_MASTER, MM_UNKNOWN }; void UpdateEnabledState (const MasterMode eMode); + // TreeNode overridables + virtual TaskPaneShellManager* GetShellManager (void); + /** Call this method when the set of displayed layouts is not up-to-date anymore. It will re-assemple this set according to the current settings. @@ -171,6 +180,8 @@ public: private: ViewShellBase& mrBase; + TaskPaneShellManager* mpShellManager; + /** Do we use our own scroll bar or is viewport handling done by our parent? */ @@ -234,6 +245,9 @@ private: */ void UpdateSelection (void); + // internal ctor + void ImplConstruct( DrawDocShell& rDocumentShell ); + /** When clicked then set the current page of the view in the center pane. */ DECL_LINK(ClickHandler, ValueSet*); diff --git a/sd/source/ui/toolpanel/ScrollPanel.cxx b/sd/source/ui/toolpanel/ScrollPanel.cxx index 1efd770db..658dcb8ce 100644 --- a/sd/source/ui/toolpanel/ScrollPanel.cxx +++ b/sd/source/ui/toolpanel/ScrollPanel.cxx @@ -58,6 +58,30 @@ ScrollPanel::ScrollPanel ( mnVerticalBorder(2), mnVerticalGap(3), mnHorizontalBorder(2) +{ + Construct(); +} + +ScrollPanel::ScrollPanel ( + ::Window& i_rParentWindow) + : Control (&i_rParentWindow, WB_DIALOGCONTROL), + TreeNode(NULL), + maScrollWindow(this, WB_DIALOGCONTROL), + maVerticalScrollBar(this, WB_VERT), + maHorizontalScrollBar(this, WB_HORZ), + maScrollBarFiller(this), + maScrollWindowFiller(&maScrollWindow), + mbIsRearrangePending(true), + mbIsLayoutPending(true), + mnChildrenWidth(0), + mnVerticalBorder(2), + mnVerticalGap(3), + mnHorizontalBorder(2) +{ + Construct(); +} + +void ScrollPanel::Construct() { SetAccessibleName ( ::rtl::OUString::createFromAscii("Sub Task Panel")); diff --git a/sd/source/ui/toolpanel/SubToolPanel.cxx b/sd/source/ui/toolpanel/SubToolPanel.cxx index c345ea643..94992dd06 100644 --- a/sd/source/ui/toolpanel/SubToolPanel.cxx +++ b/sd/source/ui/toolpanel/SubToolPanel.cxx @@ -73,6 +73,35 @@ SubToolPanel::SubToolPanel ( +SubToolPanel::SubToolPanel ( + Window& i_rParentWindow) + : Control (&i_rParentWindow, WB_DIALOGCONTROL), + TreeNode(NULL), + maWindowFiller(this), + mbIsRearrangePending(true), + mbIsLayoutPending(true), + mnChildrenWidth(0), + mnVerticalBorder(0), + mnVerticalGap(3), + mnHorizontalBorder(2) +{ + SetAccessibleName ( + ::rtl::OUString::createFromAscii("Sub Task Panel")); + mpControlContainer->SetMultiSelection (true); + + SetBorderStyle (WINDOW_BORDER_NORMAL); + SetMapMode (MapMode(MAP_PIXEL)); + + // To reduce flickering during repaints make the container windows + // transparent and rely on their children to paint the whole area. + SetBackground(Wallpaper()); + maWindowFiller.SetBackground( + Application::GetSettings().GetStyleSettings().GetWindowColor()); +} + + + + SubToolPanel::~SubToolPanel (void) { sal_uInt32 nCount = mpControlContainer->GetControlCount(); diff --git a/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx b/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx index 082adc6b3..827a63f5c 100644 --- a/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx +++ b/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx @@ -60,4 +60,10 @@ ControlFactory::~ControlFactory (void) } +::std::auto_ptr ControlFactory::CreateRootControl( ::Window& i_rParent ) +{ + TreeNode* pNewNode = InternalCreateRootControl( i_rParent ); + return ::std::auto_ptr( pNewNode ); +} + } } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/TaskPaneShellManager.cxx b/sd/source/ui/toolpanel/TaskPaneShellManager.cxx index adb534c6e..31afba830 100644 --- a/sd/source/ui/toolpanel/TaskPaneShellManager.cxx +++ b/sd/source/ui/toolpanel/TaskPaneShellManager.cxx @@ -34,7 +34,7 @@ #include "TaskPaneShellManager.hxx" #include "ViewShellManager.hxx" -#include +#include #include #include @@ -114,6 +114,21 @@ void TaskPaneShellManager::AddSubShell ( +void TaskPaneShellManager::RemoveSubShell (const ShellId i_nShellId) +{ + SubShells::iterator pos = maSubShells.find( i_nShellId ); + ENSURE_OR_RETURN_VOID( pos != maSubShells.end(), "no shell for this ID" ); + if ( pos->second.mpWindow != NULL ) + { + pos->second.mpWindow->RemoveEventListener( LINK( this, TaskPaneShellManager, WindowCallback ) ); + } + mpViewShellManager->DeactivateSubShell( mrViewShell, pos->first ); + maSubShells.erase( pos ); +} + + + + void TaskPaneShellManager::RemoveSubShell (const SfxShell* pShell) { if (pShell != NULL) diff --git a/sd/source/ui/toolpanel/TaskPaneShellManager.hxx b/sd/source/ui/toolpanel/TaskPaneShellManager.hxx index e7a6a2a5b..93cb88548 100644 --- a/sd/source/ui/toolpanel/TaskPaneShellManager.hxx +++ b/sd/source/ui/toolpanel/TaskPaneShellManager.hxx @@ -89,6 +89,11 @@ public: NULL when this shell is requested. */ void RemoveSubShell (const SfxShell* pShell); + /** removes the shell given by its ID from the set of sub shells managed by the + TaskPaneShellManager. Subsequent calls to CreateShell() will return + NULL when this shell is requested. + */ + void RemoveSubShell (const ShellId i_nShellId); /** Move the given sub-shell to the top of the local shell stack. Furthermore move the view shell whose sub-shells this class manages diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx new file mode 100644 index 000000000..18d4397b0 --- /dev/null +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx @@ -0,0 +1,131 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_sd.hxx" + +#include "TaskPaneToolPanel.hxx" +#include "ToolPanelDeck.hxx" +#include "sdresid.hxx" + +#include +#include + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + //================================================================================================================== + //= TaskPaneToolPanel + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + TaskPaneToolPanel::TaskPaneToolPanel( ToolPanelDeck& i_rPanelDeck, ::std::auto_ptr< ControlFactory >& i_rControlFactory, + const Image& i_rImage, const USHORT i_nTitleResId, const ULONG i_nHelpId ) + :m_pPanelDeck( &i_rPanelDeck ) + ,m_pControlFactory( i_rControlFactory ) + ,m_pControl() + ,m_aImage( i_rImage ) + ,m_sTitle( SdResId( i_nTitleResId ) ) + ,m_aHelpId( i_nHelpId ) + { + ENSURE_OR_THROW( m_pControlFactory.get(), "illegal control factory" ); + } + + //------------------------------------------------------------------------------------------------------------------ + TaskPaneToolPanel::~TaskPaneToolPanel() + { + m_pControl.reset(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString TaskPaneToolPanel::GetDisplayName() const + { + return m_sTitle; + } + + //------------------------------------------------------------------------------------------------------------------ + Image TaskPaneToolPanel::GetImage() const + { + return m_aImage; + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneToolPanel::Show() + { + ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to show" ); + m_pControl->GetWindow()->Show(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneToolPanel::Hide() + { + ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to hide" ); + m_pControl->GetWindow()->Hide(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneToolPanel::SetPosSizePixel( const Rectangle& i_rPanelPlayground ) + { + ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to position" ); + m_pControl->GetWindow()->SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneToolPanel::GrabFocus() + { + ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to focus" ); + m_pControl->GetWindow()->GrabFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + bool TaskPaneToolPanel::HasFocus() const + { + ENSURE_OR_RETURN_FALSE( const_cast< TaskPaneToolPanel* >( this )->impl_ensureControl(), "no control to ask" ); + return m_pControl->GetWindow()->HasChildPathFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneToolPanel::Dispose() + { + ENSURE_OR_RETURN_VOID( m_pPanelDeck, "disposed twice" ); + m_pControl.reset(); + m_pPanelDeck = NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + bool TaskPaneToolPanel::impl_ensureControl() + { + if ( m_pControl.get() ) + return true; + if ( !m_pPanelDeck ) + return false; + m_pControl = m_pControlFactory->CreateRootControl( *m_pPanelDeck ); + return ( m_pControl.get() != NULL ); + } + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx new file mode 100644 index 000000000..b4628961b --- /dev/null +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SD_TASKPANETOOLPANEL_HXX +#define SD_TASKPANETOOLPANEL_HXX + +#include "taskpane/TaskPaneControlFactory.hxx" + +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + +#include + +#include +#include + +#include + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + class ToolPanelDeck; + + //================================================================================================================== + //= TaskPaneToolPanel + //================================================================================================================== + class TaskPaneToolPanel : public ::svt::ToolPanelBase + { + public: + TaskPaneToolPanel( + ToolPanelDeck& i_rPanelDeck, + ::std::auto_ptr< ControlFactory >& i_rControlFactory, + const Image& i_rImage, + const USHORT i_nTitleResId, + const ULONG i_nHelpId/*, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPanelContent*/ + ); + ~TaskPaneToolPanel(); + + // IToolPanel overridables + virtual ::rtl::OUString GetDisplayName() const; + virtual Image GetImage() const; + virtual void Show(); + virtual void Hide(); + virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); + virtual void GrabFocus(); + virtual bool HasFocus() const; + virtual void Dispose(); + + private: + bool impl_ensureControl(); + + private: + ToolPanelDeck* m_pPanelDeck; + ::std::auto_ptr< ControlFactory > m_pControlFactory; + ::std::auto_ptr< TreeNode > m_pControl; + const Image m_aImage; + const String m_sTitle; + const SmartId m_aHelpId; + }; + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... + +#endif // SD_TASKPANETOOLPANEL_HXX diff --git a/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx b/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx index ec7fc1a92..b7934b8eb 100644 --- a/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx +++ b/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx @@ -125,17 +125,6 @@ sal_Int32 TreeNode::GetMinimumWidth (void) -ObjectBarManager* TreeNode::GetObjectBarManager (void) -{ - if (mpParent != NULL) - return mpParent->GetObjectBarManager(); - else - return NULL; -} - - - - bool TreeNode::IsResizable (void) { return false; diff --git a/sd/source/ui/toolpanel/TaskPaneViewShell.cxx b/sd/source/ui/toolpanel/TaskPaneViewShell.cxx index a3cd780f7..bfa47fe87 100644 --- a/sd/source/ui/toolpanel/TaskPaneViewShell.cxx +++ b/sd/source/ui/toolpanel/TaskPaneViewShell.cxx @@ -47,7 +47,6 @@ #include "controls/TableDesignPanel.hxx" #include "controls/CustomAnimationPanel.hxx" #include "controls/SlideTransitionPanel.hxx" -#include "controls/AnimationSchemesPanel.hxx" #include "TitleToolBox.hxx" #include "taskpane/ControlContainer.hxx" #include "FrameView.hxx" @@ -260,37 +259,29 @@ void TaskPaneViewShell::Implementation::Setup ( AddPanel (nId, PID_TABLE_DESIGN); } - { - DummyControl aControl (pToolPanel, SdResId(RID_CUSTOMANIMATION_START+0)); - - // CustomAnimationPanel - nId = pToolPanel->AddControl ( - controls::CustomAnimationPanel::CreateControlFactory(rBase), - aControl.GetText(), - HID_SD_CUSTOM_ANIMATIONS, - ResourceActivationClickHandler( - pFrameworkHelper, - pFrameworkHelper->CreateResourceId( - FrameworkHelper::msCustomAnimationTaskPanelURL, xTaskPaneId), - pToolPanel->GetControlContainer())); - AddPanel (nId, PID_CUSTOM_ANIMATION); - } + // CustomAnimationPanel + nId = pToolPanel->AddControl ( + controls::CustomAnimationPanel::CreateControlFactory(rBase), + SdResId( STR_CUSTOMANIMATIONPANE ), + HID_SD_CUSTOM_ANIMATIONS, + ResourceActivationClickHandler( + pFrameworkHelper, + pFrameworkHelper->CreateResourceId( + FrameworkHelper::msCustomAnimationTaskPanelURL, xTaskPaneId), + pToolPanel->GetControlContainer())); + AddPanel (nId, PID_CUSTOM_ANIMATION); // SlideTransitionPanel - { - DummyControl aControl (pToolPanel, SdResId(RID_CUSTOMANIMATION_START+3)); - - nId = pToolPanel->AddControl ( - controls::SlideTransitionPanel::CreateControlFactory(rBase), - aControl.GetText(), - HID_SD_SLIDE_TRANSITIONS, - ResourceActivationClickHandler( - pFrameworkHelper, - pFrameworkHelper->CreateResourceId( - FrameworkHelper::msSlideTransitionTaskPanelURL, xTaskPaneId), - pToolPanel->GetControlContainer())); - AddPanel (nId, PID_SLIDE_TRANSITION); - } + nId = pToolPanel->AddControl ( + controls::SlideTransitionPanel::CreateControlFactory(rBase), + SdResId( STR_SLIDE_TRANSITION_PANE ), + HID_SD_SLIDE_TRANSITIONS, + ResourceActivationClickHandler( + pFrameworkHelper, + pFrameworkHelper->CreateResourceId( + FrameworkHelper::msSlideTransitionTaskPanelURL, xTaskPaneId), + pToolPanel->GetControlContainer())); + AddPanel (nId, PID_SLIDE_TRANSITION); #ifdef SHOW_COLOR_MENU // Test Menu. @@ -425,17 +416,6 @@ TaskPaneViewShell::~TaskPaneViewShell (void) -// static -void TaskPaneViewShell::RegisterControls (void) -{ - SfxModule* pModule = SD_MOD(); - controls::MasterPagesSelector::RegisterInterface (pModule); - LayoutMenu::RegisterInterface (pModule); -} - - - - void TaskPaneViewShell::ArrangeGUIElements (void) { ViewShell::ArrangeGUIElements(); @@ -841,27 +821,6 @@ sal_uInt32 -//===== PanelActivation ======================================================= - -PanelActivation::PanelActivation (ViewShellBase& rBase, TaskPaneViewShell::PanelId nPanelId) - : mrBase(rBase), - mnPanelId(nPanelId) -{ -} - -void PanelActivation::operator() (bool) -{ - toolpanel::TaskPaneViewShell* pTaskPane - = dynamic_cast( - framework::FrameworkHelper::Instance(mrBase) - ->GetViewShell(framework::FrameworkHelper::msRightPaneURL).get()); - if (pTaskPane != NULL) - pTaskPane->ShowPanel(mnPanelId); -} - - - - //===== ResourceActivationClickHandler ======================================== ResourceActivationClickHandler::ResourceActivationClickHandler ( diff --git a/sd/source/ui/toolpanel/TestMenu.cxx b/sd/source/ui/toolpanel/TestMenu.cxx index b05824c54..f5b851a01 100644 --- a/sd/source/ui/toolpanel/TestMenu.cxx +++ b/sd/source/ui/toolpanel/TestMenu.cxx @@ -52,6 +52,11 @@ protected: { return new ColorMenu (pTreeNode); } + virtual TreeNode* InternalCreateRootControl( ::Window& /*i_rParent*/ ) + { + OSL_ENSURE( false, "ColorMenuFactory::InternalCreateRootControl: not implemented!" ); + return NULL; + } }; diff --git a/sd/source/ui/toolpanel/TestPanel.cxx b/sd/source/ui/toolpanel/TestPanel.cxx index d3b8eb4c8..21e2e35b1 100644 --- a/sd/source/ui/toolpanel/TestPanel.cxx +++ b/sd/source/ui/toolpanel/TestPanel.cxx @@ -52,6 +52,11 @@ protected: { return new TestPanel (pTreeNode); } + virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) + { + OSL_ENSURE( false, "TestPanelFactory::InternalCreateRootControl: not implemented!" ); + return NULL; + } }; diff --git a/sd/source/ui/toolpanel/TitleBar.cxx b/sd/source/ui/toolpanel/TitleBar.cxx index c32176cc4..d53336709 100644 --- a/sd/source/ui/toolpanel/TitleBar.cxx +++ b/sd/source/ui/toolpanel/TitleBar.cxx @@ -216,14 +216,14 @@ bool TitleBar::IsExpanded (void) const } -void TitleBar::SetEnabledState(bool bFlag) -{ - if(bFlag) - Enable(); - else - Disable(); - Invalidate (); -} +void TitleBar::SetEnabledState(bool bFlag) +{ + if(bFlag) + Enable(); + else + Disable(); + Invalidate (); +} void TitleBar::SetFocus (bool bFlag) @@ -462,17 +462,17 @@ void TitleBar::PaintText (const Rectangle& rTextBox) USHORT TitleBar::GetTextStyle (void) { - if(IsEnabled()) - { - return TEXT_DRAW_LEFT - | TEXT_DRAW_TOP - | TEXT_DRAW_MULTILINE - | TEXT_DRAW_WORDBREAK; - } - else - { - return TEXT_DRAW_DISABLE; - } + if(IsEnabled()) + { + return TEXT_DRAW_LEFT + | TEXT_DRAW_TOP + | TEXT_DRAW_MULTILINE + | TEXT_DRAW_WORDBREAK; + } + else + { + return TEXT_DRAW_DISABLE; + } } diff --git a/sd/source/ui/toolpanel/TitledControl.cxx b/sd/source/ui/toolpanel/TitledControl.cxx index ccd85fc72..371857eab 100644 --- a/sd/source/ui/toolpanel/TitledControl.cxx +++ b/sd/source/ui/toolpanel/TitledControl.cxx @@ -338,27 +338,27 @@ bool TitledControl::IsExpanded (void) const return false; } -void TitledControl::SetEnabledState(bool bFlag) -{ - if (!bFlag) - { - GetParentNode()->GetControlContainer().SetExpansionState ( - this, - ControlContainer::ES_COLLAPSE); - Disable(); - } - else - { -/* - GetParentNode()->GetControlContainer().SetExpansionState ( - this, - ControlContainer::ES_EXPAND); -*/ - Enable(); - } - - GetTitleBar()->SetEnabledState(bFlag); -} +void TitledControl::SetEnabledState(bool bFlag) +{ + if (!bFlag) + { + GetParentNode()->GetControlContainer().SetExpansionState ( + this, + ControlContainer::ES_COLLAPSE); + Disable(); + } + else + { +/* + GetParentNode()->GetControlContainer().SetExpansionState ( + this, + ControlContainer::ES_EXPAND); +*/ + Enable(); + } + + GetTitleBar()->SetEnabledState(bFlag); +} diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.cxx b/sd/source/ui/toolpanel/ToolPanelDeck.cxx new file mode 100644 index 000000000..e59b78292 --- /dev/null +++ b/sd/source/ui/toolpanel/ToolPanelDeck.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_sd.hxx" + +#include "ToolPanelDeck.hxx" +#include "taskpane/ToolPanelViewShell.hxx" +#include "taskpane/ControlContainer.hxx" +#include "TaskPaneToolPanel.hxx" + +#include + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + //================================================================================================================== + //= ToolPanelDeck + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ToolPanelDeck::ToolPanelDeck( Window& i_rParent, ToolPanelViewShell& i_rViewShell ) + :ToolPanelDeck_Base( i_rParent, 0 ) + ,m_rViewShell( i_rViewShell ) + { + SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY ); + } + + //------------------------------------------------------------------------------------------------------------------ + ToolPanelDeck::~ToolPanelDeck() + { + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDeck::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ) + { + ::svt::PDeckLayouter pLayouter( GetLayouter() ); + ::svt::TabDeckLayouter* pTabLayouter = dynamic_cast< ::svt::TabDeckLayouter* >( pLayouter.get() ); + if ( ( pTabLayouter != NULL ) + && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) + && ( pTabLayouter->GetTabItemContent() == i_eTabContent ) + ) + return; + + if ( pTabLayouter && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) ) + { + // changing only the item content does not require a new layouter instance + pTabLayouter->SetTabItemContent( i_eTabContent ); + return; + } + + SetLayouter( new ::svt::TabDeckLayouter( *this, i_eTabAlignment, i_eTabContent ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + size_t ToolPanelDeck::CreateAndInsertPanel( ::std::auto_ptr< ControlFactory >& i_rControlFactory, + const Image& i_rImage, const USHORT i_nTitleResId, const ULONG i_nHelpId ) + { + // create panel + ::svt::PToolPanel pNewPanel( new TaskPaneToolPanel( + *this, i_rControlFactory, + i_rImage, i_nTitleResId, i_nHelpId + ) ); + // insert as new panel + return InsertPanel( pNewPanel, GetPanelCount() ); + } + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.hxx b/sd/source/ui/toolpanel/ToolPanelDeck.hxx new file mode 100644 index 000000000..145f1d978 --- /dev/null +++ b/sd/source/ui/toolpanel/ToolPanelDeck.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SD_TOOLPANELDECK_HXX +#define SD_TOOLPANELDECK_HXX + +#include "taskpane/TaskPaneTreeNode.hxx" +#include "taskpane/TaskPaneControlFactory.hxx" + +#include +#include +#include + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + class ToolPanelViewShell; + + //================================================================================================================== + //= ToolPanelDeck + //================================================================================================================== + typedef ::svt::ToolPanelDeck ToolPanelDeck_Base; + class ToolPanelDeck : public ToolPanelDeck_Base + { + public: + ToolPanelDeck( + ::Window& i_rParent, + ToolPanelViewShell& i_rViewShell + ); + ~ToolPanelDeck(); + + // panel maintenance + size_t CreateAndInsertPanel( + ::std::auto_ptr< ControlFactory >& i_rControlFactory, + const Image& i_rImage, + const USHORT i_nTitleResId, + const ULONG i_nHelpId + ); + + void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ); + + private: + ToolPanelViewShell& m_rViewShell; + }; + +//...................................................................................................................... +} } // sd::toolpanel +//...................................................................................................................... + +#endif // SD_TOOLPANELDECK_HXX diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx new file mode 100644 index 000000000..807d9b040 --- /dev/null +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -0,0 +1,642 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "taskpane/ToolPanelViewShell.hxx" + +#include "TaskPaneShellManager.hxx" +#include "TaskPaneFocusManager.hxx" +#include "controls/MasterPagesPanel.hxx" +#include "LayoutMenu.hxx" +#include "controls/TableDesignPanel.hxx" +#include "controls/CustomAnimationPanel.hxx" +#include "controls/SlideTransitionPanel.hxx" +#include "controls/MasterPagesSelector.hxx" +#include "PaneDockingWindow.hxx" +#include "FrameView.hxx" +#include "Window.hxx" +#include "PaneDockingWindow.hxx" +#include "ToolPanelDeck.hxx" +#include "sdmod.hxx" +#include "app.hrc" +#include "glob.hrc" +#include "res_bmp.hrc" +#include "helpids.h" +#include "strings.hrc" +#include "sdresid.hxx" +#include "framework/FrameworkHelper.hxx" +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "sdtreelb.hxx" +#include "DrawViewShell.hxx" +#include "drawdoc.hxx" +#include "ViewShellBase.hxx" +#include +#include +#include +#include + +#include + +using namespace ::sd::toolpanel; + +#define ToolPanelViewShell +#include "sdslots.hxx" + +/** === begin UNO using === **/ +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::XInterface; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::makeAny; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Type; +using ::com::sun::star::accessibility::XAccessible; +using ::com::sun::star::drawing::XDrawSubController; +using ::com::sun::star::frame::XFrame; +/** === end UNO using === **/ + +using ::sd::framework::FrameworkHelper; + +namespace sd { namespace toolpanel { + +// ===================================================================================================================== +// = ToolPanelViewShell::Implementation - declaration +// ===================================================================================================================== +/** Inner implementation class of ToolPanelViewShell. +*/ +class ToolPanelViewShell::Implementation +{ +public: + static const size_t mnInvalidId = static_cast< size_t >( -1 ); + + Implementation(); + ~Implementation(); + + /** Here the panels are created that are shown in the task pane. + */ + void Setup( ToolPanelViewShell& i_rViewShell, ToolPanelDeck& i_rPanelDeck ); + + /** Return the public id for the given internal one. + @return + When the given public id is not known then PID_UNKNOWN is + returned. + */ + PanelId GetPublicId (size_t nInternalId) const; + + /** Return the internal id for the given public one. + @return + When the given public id is not known then mnInvalidId is + returned. + */ + size_t GetInternalId (PanelId nPublicId) const; + +private: + /** Make a new panel known to the translation table that translates + between internal indices as returned by + ControlContainer::AddControl() and public indices defined by + ToolPanelViewShell::PanelId. + */ + void AddPanel (size_t nInternalId, PanelId nPublicId); + + /** This map translates between internal indices returned by + ControlContainer::AddControl() and public indices defined by + ToolPanelViewShell::PanelId. + */ + typedef ::std::vector InternalIdToPanelIdMap; + InternalIdToPanelIdMap maIndexMap; +}; + +// ===================================================================================================================== +// = helpers +// ===================================================================================================================== +// --------------------------------------------------------------------------------------------------------------------- +namespace { + +enum MenuId { + MID_UNLOCK_TASK_PANEL = 1, + MID_LOCK_TASK_PANEL = 2, + MID_FIRST_CONTROL = 3 +}; + +} // end of anonymouse namespace + +// ===================================================================================================================== +// = ToolPanelViewShell +// ===================================================================================================================== +// --------------------------------------------------------------------------------------------------------------------- +SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL)) +{ +} + +// --------------------------------------------------------------------------------------------------------------------- +TYPEINIT1(ToolPanelViewShell, ViewShell); + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Implementation::Setup( ToolPanelViewShell& i_rViewShell, ToolPanelDeck& i_rPanelDeck ) +{ + typedef std::auto_ptr (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell ); + + struct PanelDescriptor + { + ControlFactoryFactory pFactory; + const sal_Char* pImageCommandName; + USHORT nTitleResourceID; + ULONG nHelpID; + PanelId nPanelID; + }; + + PanelDescriptor aPanels[] = { + // "Master Pages" + { &controls::MasterPagesPanel::CreateControlFactory, "PresentationLayout", STR_TASKPANEL_MASTER_PAGE_TITLE, HID_SD_SLIDE_DESIGNS, PID_MASTER_PAGES }, + // "Layout" + { &LayoutMenu::CreateControlFactory, "ModifyPage", STR_TASKPANEL_LAYOUT_MENU_TITLE, HID_SD_SLIDE_LAYOUTS, PID_LAYOUT }, + // "Tables Design" + { &controls::TableDesignPanel::CreateControlFactory, "InsertTable", DLG_TABLEDESIGNPANE, HID_SD_TABLE_DESIGN, PID_TABLE_DESIGN }, + // "Custom Animation" + { &controls::CustomAnimationPanel::CreateControlFactory, "CustomAnimation", STR_CUSTOMANIMATIONPANE, HID_SD_CUSTOM_ANIMATIONS, PID_CUSTOM_ANIMATION }, + // "Slide Transition" + { &controls::SlideTransitionPanel::CreateControlFactory, "RehearseTimings", STR_SLIDE_TRANSITION_PANE, HID_SD_SLIDE_TRANSITIONS, PID_SLIDE_TRANSITION } + }; + + Reference< XFrame > xFrame( i_rViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ); + for ( size_t i=0; i < sizeof( aPanels ) / sizeof( aPanels[0] ); ++i ) + { + ::rtl::OUStringBuffer aCommandName; + aCommandName.appendAscii( ".uno:" ); + aCommandName.appendAscii( aPanels[i].pImageCommandName ); + + size_t nPanelPos = i_rPanelDeck.CreateAndInsertPanel( + (*aPanels[i].pFactory)( i_rViewShell ), + GetImage( xFrame, aCommandName.makeStringAndClear(), FALSE, FALSE ), + aPanels[i].nTitleResourceID, + aPanels[i].nHelpID + ); + AddPanel( nPanelPos, aPanels[i].nPanelID ); + } + + // activate default panel + i_rPanelDeck.ActivatePanel( GetInternalId( PID_LAYOUT ) ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Initialize() +{ + if ( !mbIsInitialized ) + { + mbIsInitialized = true; + mpImpl->Setup( *this, *mpPanelDeck ); + mpPanelDeck->Show(); + } +} + +// --------------------------------------------------------------------------------------------------------------------- +ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, + FrameView* pFrameViewArgument ) + :ViewShell(pFrame, pParentWindow, rViewShellBase) + ,mpImpl( new Implementation ) + ,mpPanelDeck( new ToolPanelDeck( *mpContentWindow.get(), *this ) ) + ,mbIsInitialized(false) + ,mpSubShellManager() + ,mnMenuId(0) +{ + meShellType = ST_TOOL_PANEL; + + mpContentWindow->SetCenterAllowed( false ); + pParentWindow->SetStyle( pParentWindow->GetStyle() | WB_DIALOGCONTROL ); + + GetParentWindow()->SetBackground( Wallpaper() ); + mpContentWindow->SetBackground( Wallpaper() ); + + GetParentWindow()->SetHelpId(HID_SD_TASK_PANE); + + ConnectToDockingWindow(); + + SetPool( &GetDoc()->GetPool() ); + + if ( pFrameViewArgument ) + mpFrameView = pFrameViewArgument; + else + mpFrameView = new FrameView( GetDoc() ); + GetFrameView()->Connect(); + + // Hide or delete unused controls that we have inherited from the + // ViewShell base class. + mpHorizontalScrollBar.reset(); + mpVerticalScrollBar.reset(); + mpScrollBarBox.reset(); + mpHorizontalRuler.reset(); + mpVerticalRuler.reset(); + + SetName( String( RTL_CONSTASCII_USTRINGPARAM( "ToolPanelViewShell" ) ) ); + + // For accessibility we have to shortly hide the content window. This + // triggers the construction of a new accessibility object for the new + // view shell. (One is created earlier while the construtor of the base + // class is executed. At that time the correct accessibility object can + // not be constructed.) + if ( mpContentWindow.get() ) + { + mpContentWindow->Hide(); + mpContentWindow->Show(); + } + + // Register the shell manager as factory at the ViewShellManager. + mpSubShellManager.reset( new TaskPaneShellManager( + GetViewShellBase().GetViewShellManager(), + *this + ) ); + GetViewShellBase().GetViewShellManager()->AddSubShellFactory( this, mpSubShellManager ); +} + +// --------------------------------------------------------------------------------------------------------------------- +ToolPanelViewShell::~ToolPanelViewShell() +{ + mpPanelDeck.reset(); + GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager); +} + +// --------------------------------------------------------------------------------------------------------------------- +// static +void ToolPanelViewShell::RegisterControls() +{ + SfxModule* pModule = SD_MOD(); + controls::MasterPagesSelector::RegisterInterface( pModule ); + LayoutMenu::RegisterInterface( pModule ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::ArrangeGUIElements() +{ + ViewShell::ArrangeGUIElements(); + + Initialize(); + + mpPanelDeck->SetPosSizePixel( Point(), maViewSize ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::GetFocus() +{ + Invalidate(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::LoseFocus() +{ + Invalidate(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::KeyInput( const KeyEvent& i_rKeyEvent ) +{ + const KeyCode nCode = i_rKeyEvent.GetKeyCode(); + if ( nCode == KEY_RETURN ) + { + if ( !mpPanelDeck->HasChildPathFocus() ) + mpPanelDeck->GrabFocus(); + } + else + ViewShell::KeyInput( i_rKeyEvent, NULL ); +} + +// --------------------------------------------------------------------------------------------------------------------- +IMPL_LINK( ToolPanelViewShell, DockingChanged, PaneDockingWindow*, i_pDockingWindow ) +{ + ENSURE_OR_RETURN( i_pDockingWindow == dynamic_cast< PaneDockingWindow* >( GetDockingWindow() ), "unknown source", 0 ); + switch ( i_pDockingWindow->GetAlignment() ) + { + case SFX_ALIGN_LEFT: + mpPanelDeck->SetTabsLayout( ::svt::TABS_LEFT, ::svt::TABITEM_IMAGE_ONLY ); + break; + case SFX_ALIGN_RIGHT: + case SFX_ALIGN_NOALIGNMENT: + mpPanelDeck->SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY ); + break; + case SFX_ALIGN_TOP: + mpPanelDeck->SetTabsLayout( ::svt::TABS_TOP, ::svt::TABITEM_IMAGE_ONLY ); + break; + case SFX_ALIGN_BOTTOM: + mpPanelDeck->SetTabsLayout( ::svt::TABS_BOTTOM, ::svt::TABITEM_IMAGE_ONLY ); + break; + default: + OSL_ENSURE( false, "ToolPanelViewShell::DockingChanged: unexpected alignment!" ); + break; + } + return 0L; +} + +// --------------------------------------------------------------------------------------------------------------------- +IMPL_LINK(ToolPanelViewShell, ToolboxClickHandler, ToolBox*, pToolBox) +{ + if (pToolBox->GetCurItemId() == mnMenuId) + { + pToolBox->EndSelection(); + + DockingWindow* pDockingWindow = GetDockingWindow(); + ::std::auto_ptr pMenu = CreatePopupMenu ( + pDockingWindow!=NULL && !pDockingWindow->IsFloatingMode()); + pMenu->SetSelectHdl ( + LINK(this, ToolPanelViewShell, MenuSelectHandler)); + + // pass toolbox button rect so the menu can stay open on button up + Rectangle aRect = pToolBox->GetItemRect(mnMenuId); + aRect.SetPos(pToolBox->GetPosPixel() ); + pMenu->Execute (pDockingWindow, aRect, POPUPMENU_EXECUTE_DOWN); + } + + return 0; +} + +// --------------------------------------------------------------------------------------------------------------------- +IMPL_LINK(ToolPanelViewShell, MenuSelectHandler, Menu*, pMenu) +{ + if (pMenu) + { + pMenu->Deactivate(); + switch (pMenu->GetCurItemId()) + { + case MID_UNLOCK_TASK_PANEL: + { + DockingWindow* pDockingWindow = GetDockingWindow(); + if (pDockingWindow != NULL) + pDockingWindow->SetFloatingMode (TRUE); + } + break; + + case MID_LOCK_TASK_PANEL: + { + DockingWindow* pDockingWindow = GetDockingWindow(); + if (pDockingWindow != NULL) + pDockingWindow->SetFloatingMode (FALSE); + } + break; + + default: +// { +// sal_uInt32 nIndex (pMenu->GetUserValue(pMenu->GetCurItemId())); +// mpTaskPane->GetControlContainer().SetVisibilityState ( +// nIndex, +// ControlContainer::VS_TOGGLE); +// // mpTaskPane->Resize(); +// // mpTaskPane->Invalidate(); +// } + break; + } + } + + return 0; +} + +// --------------------------------------------------------------------------------------------------------------------- +::std::auto_ptr ToolPanelViewShell::CreatePopupMenu ( + bool bIsDocking) +{ + ::std::auto_ptr pMenu (new PopupMenu ()); + FloatingWindow* pFloat = static_cast(pMenu->GetWindow()); + if (pFloat != NULL) + { + pFloat->SetPopupModeFlags ( + pFloat->GetPopupModeFlags() + | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE); + } + + // Add one entry for every tool panel element to individually make + // them visible or hide them. +// USHORT nIndex = MID_FIRST_CONTROL; +// sal_uInt32 nControlIndex; +// ControlContainer& rContainer (mpTaskPane->GetControlContainer()); +// for (nControlIndex=0; +// nControlIndex(pChild->GetWindow()); +// pMenu->InsertItem (nIndex, +// pControl->GetTitle(), +// MIB_CHECKABLE); +// pMenu->SetUserValue (nIndex, nControlIndex); +// if (pControl->IsVisible()) +// pMenu->CheckItem (nIndex, TRUE); +// nIndex++; +// } + + pMenu->InsertSeparator (); + + // Add entry for docking or un-docking the tool panel. + if (bIsDocking) + pMenu->InsertItem ( + MID_UNLOCK_TASK_PANEL, + String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_UNLOCK))); + else + pMenu->InsertItem ( + MID_LOCK_TASK_PANEL, + String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_LOCK))); + pMenu->RemoveDisabledEntries (FALSE, FALSE); + + return pMenu; +} + +// --------------------------------------------------------------------------------------------------------------------- +SdPage* ToolPanelViewShell::GetActualPage() +{ + return NULL; +} + +// --------------------------------------------------------------------------------------------------------------------- +SdPage* ToolPanelViewShell::getCurrentPage() const +{ + return NULL; +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Execute( SfxRequest& ) +{ + OSL_ENSURE( false, "ToolPanelViewShell::Execute: not to be called! (right?)" ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::GetState( SfxItemSet& ) +{ + OSL_ENSURE( false, "ToolPanelViewShell::GetState: not to be called! (right?)" ); +} + +// --------------------------------------------------------------------------------------------------------------------- +TaskPaneShellManager& ToolPanelViewShell::GetSubShellManager() const +{ + return *mpSubShellManager.get(); +} + +// --------------------------------------------------------------------------------------------------------------------- +DockingWindow* ToolPanelViewShell::GetDockingWindow() +{ + ::Window* pParentWindow = GetParentWindow(); + DockingWindow* pDockingWindow = NULL; + while (pParentWindow!=NULL && pDockingWindow==NULL) + { + pDockingWindow = dynamic_cast(pParentWindow); + pParentWindow = pParentWindow->GetParent(); + } + return pDockingWindow; +} + +// --------------------------------------------------------------------------------------------------------------------- +Reference< XAccessible > ToolPanelViewShell::CreateAccessibleDocumentView( ::sd::Window* pWindow ) +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible> xAccessible; + + OSL_ENSURE( false, "ToolPanelViewShell::CreateAccessibleDocumentView: missing implementation!" ); +// if (mpTaskPane.get()!=NULL && pWindow!=NULL) +// { +// // We have to call CreateAccessible directly so that we can specify +// // the correct accessible parent. +// ::Window* pParentWindow = pWindow->GetAccessibleParentWindow(); +// if (pParentWindow != NULL) +// xAccessible = mpTaskPane->CreateAccessibleObject( +// pParentWindow->GetAccessible()); +// } + + return xAccessible; +} + +// --------------------------------------------------------------------------------------------------------------------- +Reference< XDrawSubController > ToolPanelViewShell::CreateSubController() +{ + // This view shell is not designed to be the main view shell and thus + // does not support a UNO sub controller. + return Reference< XDrawSubController >(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::ConnectToDockingWindow() +{ + PaneDockingWindow* pDockingWindow = dynamic_cast(GetDockingWindow()); + if (pDockingWindow != NULL) + { + pDockingWindow->InitializeTitleToolBox(); + mnMenuId = pDockingWindow->AddMenu ( + String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_TITLE)), + HID_SD_TASK_PANE_VIEW_MENU, + LINK(this, ToolPanelViewShell, ToolboxClickHandler)); + + // be notified when the docking position of the window changes + pDockingWindow->SetEndDockingHdl( LINK( this, ToolPanelViewShell, DockingChanged ) ); + } + + // Tell the focus manager that we want to pass the focus to our + // child. + FocusManager::Instance().RegisterDownLink( GetParentWindow(), mpPanelDeck.get() ); +} + +// --------------------------------------------------------------------------------------------------------------------- +bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow ) +{ + ::Window* pOldParentWindow = GetParentWindow(); + FocusManager::Instance().RemoveLinks( pOldParentWindow, mpPanelDeck.get() ); + FocusManager::Instance().RemoveLinks( mpPanelDeck.get(), pOldParentWindow ); + + PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( GetDockingWindow() ); + if ( pDockingWindow != NULL ) + { + pDockingWindow->SetEndDockingHdl( Link() ); + } + + ViewShell::RelocateToParentWindow(pParentWindow); + + ConnectToDockingWindow(); + + Resize(); + + return true; +} + + + + +// ===================================================================================================================== +// = ToolPanelViewShell:Implementation - implementation +// ===================================================================================================================== +// --------------------------------------------------------------------------------------------------------------------- +ToolPanelViewShell::Implementation::Implementation() + :maIndexMap( (InternalIdToPanelIdMap::size_type)PID__END, PID_UNKNOWN ) +{ +} + +// --------------------------------------------------------------------------------------------------------------------- +ToolPanelViewShell::Implementation::~Implementation() +{ +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Implementation::AddPanel( size_t nInternalId, PanelId nPublicId ) +{ + maIndexMap[nInternalId] = nPublicId; +} + +// --------------------------------------------------------------------------------------------------------------------- +ToolPanelViewShell::PanelId ToolPanelViewShell::Implementation::GetPublicId ( size_t nInternalId ) const +{ + if ( nInternalId < maIndexMap.size() ) + return maIndexMap[nInternalId]; + else + return PID_UNKNOWN; +} + +// --------------------------------------------------------------------------------------------------------------------- +size_t ToolPanelViewShell::Implementation::GetInternalId( ToolPanelViewShell::PanelId nPublicId ) const +{ + for ( size_t i = 0; i < maIndexMap.size(); ++i ) + { + if ( maIndexMap[i] == nPublicId ) + { + return i; + } + } + + return mnInvalidId; +} + +} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx index 10d0cf028..35673e61b 100644 --- a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx +++ b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx @@ -34,6 +34,7 @@ #include "CustomAnimationPanel.hxx" #include "taskpane/TaskPaneControlFactory.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "strings.hrc" #include "sdresid.hxx" @@ -49,11 +50,20 @@ namespace toolpanel { namespace controls { CustomAnimationPanel::CustomAnimationPanel(TreeNode* pParent, ViewShellBase& rBase) : SubToolPanel (pParent) + , m_pPanelViewShell (NULL) { mpWrappedControl = createCustomAnimationPanel( pParent->GetWindow(), rBase ); mpWrappedControl->Show(); } +CustomAnimationPanel::CustomAnimationPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell) + :SubToolPanel( i_rParentWindow ) + ,m_pPanelViewShell( &i_rPanelViewShell ) +{ + mpWrappedControl = createCustomAnimationPanel( &i_rParentWindow, i_rPanelViewShell.GetViewShellBase() ); + mpWrappedControl->Show(); +} + CustomAnimationPanel::~CustomAnimationPanel() { delete mpWrappedControl; @@ -65,6 +75,19 @@ std::auto_ptr CustomAnimationPanel::CreateControlFactory (ViewSh new ControlFactoryWithArgs1(rBase)); } +std::auto_ptr< ControlFactory > CustomAnimationPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) +{ + return std::auto_ptr< ControlFactory >( + new RootControlFactoryWithArg< CustomAnimationPanel, ToolPanelViewShell >( i_rToolPanelShell ) ); +} + +TaskPaneShellManager* CustomAnimationPanel::GetShellManager() +{ + if ( m_pPanelViewShell ) + return &m_pPanelViewShell->GetSubShellManager(); + return SubToolPanel::GetShellManager(); +} + Size CustomAnimationPanel::GetPreferredSize() { return maPreferredSize; diff --git a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx index 36522d7f4..2f0eb4ed7 100644 --- a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx +++ b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx @@ -40,6 +40,7 @@ class ViewShellBase; namespace sd { namespace toolpanel { class TreeNode; class ControlFactory; +class ToolPanelViewShell; } } namespace sd { namespace toolpanel { namespace controls { @@ -51,10 +52,18 @@ public: CustomAnimationPanel ( TreeNode* pParent, ViewShellBase& rBase); + CustomAnimationPanel ( + Window& i_rParentWindow, + ToolPanelViewShell& i_rPanelViewShell); virtual ~CustomAnimationPanel (void); static std::auto_ptr CreateControlFactory (ViewShellBase& rBase); + static std::auto_ptr CreateControlFactory (ToolPanelViewShell& i_rPanelViewShell); + + // TreeNode overridables + virtual TaskPaneShellManager* GetShellManager(); + // ILayoutableWindow overridables virtual Size GetPreferredSize (void); virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh); virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); @@ -71,6 +80,7 @@ public: private: Size maPreferredSize; ::Window* mpWrappedControl; + ToolPanelViewShell* m_pPanelViewShell; }; } } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx index 76f5370da..5ea3a7836 100644 --- a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx +++ b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx @@ -36,6 +36,7 @@ #include "CurrentMasterPagesSelector.hxx" #include "RecentMasterPagesSelector.hxx" #include "AllMasterPagesSelector.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "taskpane/TaskPaneControlFactory.hxx" #include "taskpane/TitledControl.hxx" #include "../TaskPaneShellManager.hxx" @@ -53,6 +54,19 @@ namespace sd { namespace toolpanel { namespace controls { MasterPagesPanel::MasterPagesPanel (TreeNode* pParent, ViewShellBase& rBase) : ScrollPanel (pParent) + , m_pPanelViewShell (NULL) +{ + impl_construct( rBase ); +} + +MasterPagesPanel::MasterPagesPanel (::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell) + :ScrollPanel (i_rParentWindow) + ,m_pPanelViewShell( &i_rPanelViewShell ) +{ + impl_construct( m_pPanelViewShell->GetViewShellBase() ); +} + +void MasterPagesPanel::impl_construct( ViewShellBase& rBase ) { SdDrawDocument* pDocument = rBase.GetDocument(); ::std::auto_ptr pSelector; @@ -121,6 +135,24 @@ MasterPagesPanel::MasterPagesPanel (TreeNode* pParent, ViewShellBase& rBase) MasterPagesPanel::~MasterPagesPanel (void) { + TaskPaneShellManager* pShellManager( GetShellManager() ); + OSL_ENSURE( pShellManager, "MasterPagesPanel::~MasterPagesPanel: no shell manager anymore - cannot remove sub shells!" ); + if ( pShellManager ) + { + pShellManager->RemoveSubShell( HID_SD_TASK_PANE_PREVIEW_CURRENT ); + pShellManager->RemoveSubShell( HID_SD_TASK_PANE_PREVIEW_RECENT ); + pShellManager->RemoveSubShell( HID_SD_TASK_PANE_PREVIEW_ALL ); + } +} + + + + +TaskPaneShellManager* MasterPagesPanel::GetShellManager() +{ + if ( m_pPanelViewShell ) + return &m_pPanelViewShell->GetSubShellManager(); + return TreeNode::GetShellManager(); } @@ -133,6 +165,10 @@ std::auto_ptr MasterPagesPanel::CreateControlFactory (ViewShellB } - +std::auto_ptr< ControlFactory > MasterPagesPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) +{ + return std::auto_ptr< ControlFactory >( + new RootControlFactoryWithArg< MasterPagesPanel, ToolPanelViewShell >( i_rToolPanelShell ) ); +} } } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx index a5c557677..3475e2a5f 100644 --- a/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx +++ b/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx @@ -40,6 +40,7 @@ class ViewShellBase; namespace sd { namespace toolpanel { class ControlFactory; class TreeNode; +class ToolPanelViewShell; } } namespace sd { namespace toolpanel { namespace controls { @@ -55,9 +56,22 @@ public: MasterPagesPanel ( TreeNode* pParent, ViewShellBase& rBase); + MasterPagesPanel ( + ::Window& i_rParentWindow, + ToolPanelViewShell& i_rPanelViewShell); virtual ~MasterPagesPanel (void); + // TreeNode overridables + virtual TaskPaneShellManager* GetShellManager (void); + static std::auto_ptr CreateControlFactory (ViewShellBase& rBase); + static std::auto_ptr CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell); + +private: + void impl_construct( ViewShellBase& rBase ); + +private: + ToolPanelViewShell* m_pPanelViewShell; }; } } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx index 4c09330ec..b333e3d3d 100644 --- a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx +++ b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx @@ -33,6 +33,7 @@ #include "SlideTransitionPanel.hxx" #include "taskpane/TaskPaneControlFactory.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "strings.hrc" #include "sdresid.hxx" @@ -50,12 +51,22 @@ namespace toolpanel { namespace controls { SlideTransitionPanel::SlideTransitionPanel(TreeNode* pParent, ViewShellBase& rBase) : SubToolPanel (pParent), - maPreferredSize( 100, 200 ) + maPreferredSize( 100, 200 ), + m_pPanelViewShell( NULL ) { mpWrappedControl = createSlideTransitionPanel( pParent->GetWindow(), rBase ); mpWrappedControl->Show(); } +SlideTransitionPanel::SlideTransitionPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rToolPanelShell) + :SubToolPanel( i_rParentWindow ) + ,maPreferredSize( 100, 200 ) + ,m_pPanelViewShell( &i_rToolPanelShell ) +{ + mpWrappedControl = createSlideTransitionPanel( &i_rParentWindow, i_rToolPanelShell.GetViewShellBase() ); + mpWrappedControl->Show(); +} + SlideTransitionPanel::~SlideTransitionPanel() { delete mpWrappedControl; @@ -67,6 +78,19 @@ std::auto_ptr SlideTransitionPanel::CreateControlFactory (ViewSh new ControlFactoryWithArgs1(rBase)); } +std::auto_ptr< ControlFactory > SlideTransitionPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) +{ + return std::auto_ptr< ControlFactory >( + new RootControlFactoryWithArg< SlideTransitionPanel, ToolPanelViewShell >( i_rToolPanelShell ) ); +} + +TaskPaneShellManager* SlideTransitionPanel::GetShellManager() +{ + if ( m_pPanelViewShell ) + return &m_pPanelViewShell->GetSubShellManager(); + return SubToolPanel::GetShellManager(); +} + Size SlideTransitionPanel::GetPreferredSize() { return maPreferredSize; diff --git a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx index 6422afce4..99747c955 100644 --- a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx +++ b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx @@ -39,6 +39,7 @@ class ViewShellBase; namespace sd { namespace toolpanel { class ControlFactory; class TreeNode; +class ToolPanelViewShell; } } namespace sd { namespace toolpanel { namespace controls { @@ -50,10 +51,18 @@ public: SlideTransitionPanel ( TreeNode* pParent, ViewShellBase& rBase); + SlideTransitionPanel ( + Window& i_rParentWindow, + ToolPanelViewShell& i_rToolPanelShell); virtual ~SlideTransitionPanel (void); static std::auto_ptr CreateControlFactory (ViewShellBase& rBase); + static std::auto_ptr CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell); + + // TreeNode overridables + virtual TaskPaneShellManager* GetShellManager(); + // ILayoutableWindow overridables virtual Size GetPreferredSize (void); virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh); virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); @@ -71,6 +80,7 @@ public: private: Size maPreferredSize; ::Window* mpWrappedControl; + ToolPanelViewShell* m_pPanelViewShell; }; } } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx b/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx index 78a629888..1a5832e47 100644 --- a/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx +++ b/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx @@ -34,6 +34,7 @@ #include "TableDesignPanel.hxx" #include "taskpane/TaskPaneControlFactory.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "strings.hrc" #include "sdresid.hxx" @@ -49,11 +50,20 @@ namespace toolpanel { namespace controls { TableDesignPanel::TableDesignPanel(TreeNode* pParent, ViewShellBase& rBase) : SubToolPanel (pParent) + ,m_pPanelViewShell( NULL ) { mpWrappedControl = createTableDesignPanel( pParent->GetWindow(), rBase ); mpWrappedControl->Show(); } +TableDesignPanel::TableDesignPanel( ::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell ) + :SubToolPanel( i_rParentWindow ) + ,m_pPanelViewShell( &i_rPanelViewShell ) +{ + mpWrappedControl = createTableDesignPanel( &i_rParentWindow, i_rPanelViewShell.GetViewShellBase() ); + mpWrappedControl->Show(); +} + TableDesignPanel::~TableDesignPanel() { delete mpWrappedControl; @@ -65,6 +75,19 @@ std::auto_ptr TableDesignPanel::CreateControlFactory (ViewShellB new ControlFactoryWithArgs1(rBase)); } +std::auto_ptr< ControlFactory > TableDesignPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) +{ + return std::auto_ptr< ControlFactory >( + new RootControlFactoryWithArg< TableDesignPanel, ToolPanelViewShell >( i_rToolPanelShell ) ); +} + +TaskPaneShellManager* TableDesignPanel::GetShellManager() +{ + if ( m_pPanelViewShell ) + return &m_pPanelViewShell->GetSubShellManager(); + return SubToolPanel::GetShellManager(); +} + Size TableDesignPanel::GetPreferredSize() { return maPreferredSize; diff --git a/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx b/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx index c62749ae0..6902029c7 100644 --- a/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx +++ b/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx @@ -40,6 +40,7 @@ class ViewShellBase; namespace sd { namespace toolpanel { class TreeNode; class ControlFactory; +class ToolPanelViewShell; } } namespace sd { namespace toolpanel { namespace controls { @@ -51,10 +52,18 @@ public: TableDesignPanel ( TreeNode* pParent, ViewShellBase& rBase); + TableDesignPanel ( + ::Window& i_rParentWindow, + ToolPanelViewShell& i_rPanelViewShell); virtual ~TableDesignPanel (void); static std::auto_ptr CreateControlFactory (ViewShellBase& rBase); + static std::auto_ptr CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell); + + // TreeNode overridables + virtual TaskPaneShellManager* GetShellManager(); + // ILayoutableWindow overridables virtual Size GetPreferredSize (void); virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh); virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); @@ -71,6 +80,7 @@ public: private: Size maPreferredSize; ::Window* mpWrappedControl; + ToolPanelViewShell* m_pPanelViewShell; }; } } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/makefile.mk b/sd/source/ui/toolpanel/makefile.mk index ba6a5d29f..4ba8968bd 100644 --- a/sd/source/ui/toolpanel/makefile.mk +++ b/sd/source/ui/toolpanel/makefile.mk @@ -59,7 +59,10 @@ SLOFILES = \ $(SLO)$/TaskPaneFocusManager.obj \ $(SLO)$/TaskPaneShellManager.obj \ $(SLO)$/TaskPaneTreeNode.obj \ - $(SLO)$/TaskPaneViewShell.obj \ + $(SLO)$/TaskPaneViewShell.obj \ + $(SLO)$/ToolPanelViewShell.obj \ + $(SLO)$/ToolPanelDeck.obj \ + $(SLO)$/TaskPaneToolPanel.obj \ \ $(SLO)$/EmptyWindow.obj \ $(SLO)$/LayoutMenu.obj \ diff --git a/sd/source/ui/view/GraphicViewShellBase.cxx b/sd/source/ui/view/GraphicViewShellBase.cxx index f0f541d2d..da342cc3e 100644 --- a/sd/source/ui/view/GraphicViewShellBase.cxx +++ b/sd/source/ui/view/GraphicViewShellBase.cxx @@ -104,6 +104,7 @@ void GraphicViewShellBase::Execute (SfxRequest& rRequest) switch (nSlotId) { case SID_RIGHT_PANE: + case SID_TOOL_PANEL_PANE: case SID_NOTES_WINDOW: case SID_SLIDE_SORTER_MULTI_PANE_GUI: case SID_DIAMODE: diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index 82b32c3ea..1d36d990d 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -1310,6 +1310,7 @@ void ToolBarRules::MainViewShellChanged (ViewShell::ShellType nShellType) case ViewShell::ST_NONE: case ViewShell::ST_PRESENTATION: case ViewShell::ST_TASK_PANE: + case ViewShell::ST_TOOL_PANEL: default: break; } diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 90a920ad2..83847b242 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -94,6 +94,7 @@ #include #include #include +#include #include "fubullet.hxx" @@ -822,6 +823,13 @@ void ViewShellBase::Execute (SfxRequest& rRequest) framework::FrameworkHelper::msTaskPaneURL); break; + case SID_TOOL_PANEL_PANE: + mpImpl->SetPaneVisibility( + rRequest, + framework::FrameworkHelper::msToolPanelPaneURL, + framework::FrameworkHelper::msToolPanelViewURL); + break; + case SID_NORMAL_MULTI_PANE_GUI: case SID_SLIDE_SORTER_MULTI_PANE_GUI: case SID_DRAWINGMODE: @@ -1494,9 +1502,9 @@ void ViewShellBase::Implementation::SetPaneVisibility ( xConfigurationController->requestResourceDeactivation( xPaneId); } - catch (RuntimeException&) + catch (const Exception &) { - DBG_ASSERT(false, "ViewShellBase::Implementation::SetPaneVisibility(): caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } @@ -1546,6 +1554,11 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet) xContext, FrameworkHelper::msRightPaneURL); break; + case SID_TOOL_PANEL_PANE: + xResourceId = ResourceId::create( + xContext, FrameworkHelper::msToolPanelPaneURL); + break; + case SID_NORMAL_MULTI_PANE_GUI: xResourceId = ResourceId::createWithAnchorURL( xContext, diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index 90269fb89..2f6ec927d 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -376,6 +376,7 @@ sal_uInt16 ViewShell::Implementation::GetViewId (void) // and there is not (yet) a proper ViewShellBase sub class for the // remaining types we chose the Impress factory as a fall back. case ViewShell::ST_TASK_PANE: + case ViewShell::ST_TOOL_PANEL: case ViewShell::ST_NONE: default: return IMPRESS_FACTORY_ID; diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml index c1dacd33e..be0035c51 100644 --- a/sd/uiconfig/simpress/menubar/menubar.xml +++ b/sd/uiconfig/simpress/menubar/menubar.xml @@ -100,7 +100,8 @@ - + + -- cgit v1.2.3 From d026c4d7c539d7c5255d0d9c66cee98da7197c0d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 15 Mar 2010 15:54:52 +0100 Subject: slidecopy: showing and hiding of panels in the new ToolPanel implementation --- sd/source/ui/inc/TaskPaneViewShell.hxx | 1 - sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx | 1 - sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 167 +++++++++++++---------- 3 files changed, 92 insertions(+), 77 deletions(-) diff --git a/sd/source/ui/inc/TaskPaneViewShell.hxx b/sd/source/ui/inc/TaskPaneViewShell.hxx index 78058fe49..0bfc84f00 100644 --- a/sd/source/ui/inc/TaskPaneViewShell.hxx +++ b/sd/source/ui/inc/TaskPaneViewShell.hxx @@ -77,7 +77,6 @@ public: PID_MASTER_PAGES, PID_LAYOUT, PID_TABLE_DESIGN, - PID_ANIMATION_SCHEMES, PID_CUSTOM_ANIMATION, PID_SLIDE_TRANSITION, PID__END = PID_SLIDE_TRANSITION diff --git a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx index ebfc92f36..2c16658f5 100644 --- a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx +++ b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx @@ -79,7 +79,6 @@ public: PID_MASTER_PAGES, PID_LAYOUT, PID_TABLE_DESIGN, - PID_ANIMATION_SCHEMES, PID_CUSTOM_ANIMATION, PID_SLIDE_TRANSITION, PID__END = PID_SLIDE_TRANSITION diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 807d9b040..46b847e4c 100644 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -101,6 +101,33 @@ using ::sd::framework::FrameworkHelper; namespace sd { namespace toolpanel { +// ===================================================================================================================== +// = PanelDescriptor +// ===================================================================================================================== +/** is a helper class for ToolPanelViewShell::Implementation, holding the details about a single panel which is not + contained in the IToolPanel implementation itself. +*/ +struct PanelDescriptor +{ + ToolPanelViewShell::PanelId nId; + ::svt::PToolPanel pPanel; + bool bHidden; + + PanelDescriptor() + :nId( ToolPanelViewShell::PID_UNKNOWN ) + ,pPanel() + ,bHidden( false ) + { + } + + PanelDescriptor( const ToolPanelViewShell::PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ) + :nId( i_nPanelId ) + ,pPanel( i_rPanel ) + ,bHidden( false ) + { + } +}; + // ===================================================================================================================== // = ToolPanelViewShell::Implementation - declaration // ===================================================================================================================== @@ -118,34 +145,23 @@ public: */ void Setup( ToolPanelViewShell& i_rViewShell, ToolPanelDeck& i_rPanelDeck ); - /** Return the public id for the given internal one. - @return - When the given public id is not known then PID_UNKNOWN is - returned. - */ - PanelId GetPublicId (size_t nInternalId) const; + size_t GetPanelCount() const + { + return size_t( PID__END ); + } - /** Return the internal id for the given public one. - @return - When the given public id is not known then mnInvalidId is - returned. - */ - size_t GetInternalId (PanelId nPublicId) const; + const PanelDescriptor& GetPanel( const size_t i_nLogicalPanelIndex ) const + { + return maPanels[ i_nLogicalPanelIndex ]; + } + + void TogglePanelVisibility( const size_t i_nLogicalPanelIndex, ToolPanelDeck& i_rPanelDeck ); private: - /** Make a new panel known to the translation table that translates - between internal indices as returned by - ControlContainer::AddControl() and public indices defined by - ToolPanelViewShell::PanelId. - */ - void AddPanel (size_t nInternalId, PanelId nPublicId); + void RegisterPanel( size_t i_nPosition, PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ); - /** This map translates between internal indices returned by - ControlContainer::AddControl() and public indices defined by - ToolPanelViewShell::PanelId. - */ - typedef ::std::vector InternalIdToPanelIdMap; - InternalIdToPanelIdMap maIndexMap; + typedef ::std::vector< PanelDescriptor > PanelDescriptors; + PanelDescriptors maPanels; }; // ===================================================================================================================== @@ -157,7 +173,7 @@ namespace { enum MenuId { MID_UNLOCK_TASK_PANEL = 1, MID_LOCK_TASK_PANEL = 2, - MID_FIRST_CONTROL = 3 + MID_FIRST_PANEL = 3 }; } // end of anonymouse namespace @@ -200,7 +216,11 @@ void ToolPanelViewShell::Implementation::Setup( ToolPanelViewShell& i_rViewShell { &controls::SlideTransitionPanel::CreateControlFactory, "RehearseTimings", STR_SLIDE_TRANSITION_PANE, HID_SD_SLIDE_TRANSITIONS, PID_SLIDE_TRANSITION } }; + const PanelId nPanelIdToActivate = PID_LAYOUT; + size_t nPanelPosToActivate = size_t( -1 ); + Reference< XFrame > xFrame( i_rViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ); + const BOOL bHiContrast( i_rPanelDeck.GetSettings().GetStyleSettings().GetHighContrastMode() ); for ( size_t i=0; i < sizeof( aPanels ) / sizeof( aPanels[0] ); ++i ) { ::rtl::OUStringBuffer aCommandName; @@ -209,15 +229,18 @@ void ToolPanelViewShell::Implementation::Setup( ToolPanelViewShell& i_rViewShell size_t nPanelPos = i_rPanelDeck.CreateAndInsertPanel( (*aPanels[i].pFactory)( i_rViewShell ), - GetImage( xFrame, aCommandName.makeStringAndClear(), FALSE, FALSE ), + GetImage( xFrame, aCommandName.makeStringAndClear(), FALSE, bHiContrast ), aPanels[i].nTitleResourceID, aPanels[i].nHelpID ); - AddPanel( nPanelPos, aPanels[i].nPanelID ); + RegisterPanel( nPanelPos, aPanels[i].nPanelID, i_rPanelDeck.GetPanel( nPanelPos ) ); + + if ( nPanelIdToActivate == aPanels[i].nPanelID ) + nPanelPosToActivate = nPanelPos; } // activate default panel - i_rPanelDeck.ActivatePanel( GetInternalId( PID_LAYOUT ) ); + i_rPanelDeck.ActivatePanel( nPanelPosToActivate ); } // --------------------------------------------------------------------------------------------------------------------- @@ -293,6 +316,9 @@ ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rVi // --------------------------------------------------------------------------------------------------------------------- ToolPanelViewShell::~ToolPanelViewShell() { + // reset our impl before destroying the panel deck, to ensure the hidden panels are properly + // disposed/destroyed, too + mpImpl.reset(); mpPanelDeck.reset(); GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager); } @@ -414,14 +440,10 @@ IMPL_LINK(ToolPanelViewShell, MenuSelectHandler, Menu*, pMenu) break; default: -// { -// sal_uInt32 nIndex (pMenu->GetUserValue(pMenu->GetCurItemId())); -// mpTaskPane->GetControlContainer().SetVisibilityState ( -// nIndex, -// ControlContainer::VS_TOGGLE); -// // mpTaskPane->Resize(); -// // mpTaskPane->Invalidate(); -// } + { + size_t nPanelIndex = size_t( pMenu->GetCurItemId() - MID_FIRST_PANEL ); + mpImpl->TogglePanelVisibility( nPanelIndex, *mpPanelDeck ); + } break; } } @@ -444,25 +466,14 @@ IMPL_LINK(ToolPanelViewShell, MenuSelectHandler, Menu*, pMenu) // Add one entry for every tool panel element to individually make // them visible or hide them. -// USHORT nIndex = MID_FIRST_CONTROL; -// sal_uInt32 nControlIndex; -// ControlContainer& rContainer (mpTaskPane->GetControlContainer()); -// for (nControlIndex=0; -// nControlIndex(pChild->GetWindow()); -// pMenu->InsertItem (nIndex, -// pControl->GetTitle(), -// MIB_CHECKABLE); -// pMenu->SetUserValue (nIndex, nControlIndex); -// if (pControl->IsVisible()) -// pMenu->CheckItem (nIndex, TRUE); -// nIndex++; -// } - + USHORT nIndex = MID_FIRST_PANEL; + for ( size_t i=0; iGetPanelCount(); ++i, ++nIndex ) + { + const PanelDescriptor& rPanelDesc( mpImpl->GetPanel(i) ); + pMenu->InsertItem( nIndex, rPanelDesc.pPanel->GetDisplayName(), MIB_CHECKABLE ); + pMenu->SetUserValue( nIndex, rPanelDesc.nId ); + pMenu->CheckItem( nIndex, !rPanelDesc.bHidden ); + } pMenu->InsertSeparator (); // Add entry for docking or un-docking the tool panel. @@ -601,7 +612,7 @@ bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow ) // ===================================================================================================================== // --------------------------------------------------------------------------------------------------------------------- ToolPanelViewShell::Implementation::Implementation() - :maIndexMap( (InternalIdToPanelIdMap::size_type)PID__END, PID_UNKNOWN ) + :maPanels( PanelDescriptors::size_type( PID__END ) ) { } @@ -611,32 +622,38 @@ ToolPanelViewShell::Implementation::~Implementation() } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::AddPanel( size_t nInternalId, PanelId nPublicId ) +void ToolPanelViewShell::Implementation::TogglePanelVisibility( const size_t i_nLogicalPanelIndex, ToolPanelDeck& i_rPanelDeck ) { - maIndexMap[nInternalId] = nPublicId; -} + ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < maPanels.size(), "illegal index" ); -// --------------------------------------------------------------------------------------------------------------------- -ToolPanelViewShell::PanelId ToolPanelViewShell::Implementation::GetPublicId ( size_t nInternalId ) const -{ - if ( nInternalId < maIndexMap.size() ) - return maIndexMap[nInternalId]; + // get the actual panel index, within the deck + size_t nActualPanelIndex(0); + for ( size_t i=0; i < i_nLogicalPanelIndex; ++i ) + { + if ( !maPanels[i].bHidden ) + ++nActualPanelIndex; + } + if ( maPanels[ i_nLogicalPanelIndex ].bHidden ) + { + OSL_VERIFY( i_rPanelDeck.InsertPanel( maPanels[ i_nLogicalPanelIndex ].pPanel, nActualPanelIndex ) == nActualPanelIndex ); + // if there has not been an active panel before, activate the newly inserted one + ::boost::optional< size_t > aActivePanel( i_rPanelDeck.GetActivePanel() ); + if ( !aActivePanel ) + i_rPanelDeck.ActivatePanel( nActualPanelIndex ); + } else - return PID_UNKNOWN; + { + OSL_VERIFY( i_rPanelDeck.RemovePanel( nActualPanelIndex ).get() == maPanels[ i_nLogicalPanelIndex ].pPanel.get() ); + } + maPanels[ i_nLogicalPanelIndex ].bHidden = !maPanels[ i_nLogicalPanelIndex ].bHidden; } // --------------------------------------------------------------------------------------------------------------------- -size_t ToolPanelViewShell::Implementation::GetInternalId( ToolPanelViewShell::PanelId nPublicId ) const +void ToolPanelViewShell::Implementation::RegisterPanel( size_t i_nPosition, PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ) { - for ( size_t i = 0; i < maIndexMap.size(); ++i ) - { - if ( maIndexMap[i] == nPublicId ) - { - return i; - } - } - - return mnInvalidId; + OSL_PRECOND( maPanels[ i_nPosition ].nId == PID_UNKNOWN, "ToolPanelViewShell::Implementation::RegisterPanel: " + "already registered a panel for this ID!" ); + maPanels[ i_nPosition ] = PanelDescriptor( i_nPanelId, i_rPanel ); } } } // end of namespace ::sd::toolpanel -- cgit v1.2.3 From f4de46ddc3ecba58940a5f4e643395a021a34fc8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 16 Mar 2010 13:36:35 +0100 Subject: slidecopy: de/activate panels via the drawing framework Instead of simply letting svtool's ToolPanelDeck decide on panel activation, requests are re-routed through the view's ConfigurationController. So, clicking onto a tab just requests the activation of the respective resource, which in turn - when the requested configuration becomes the active configuration - will activate the ToolPanel. --- .../ui/framework/factories/TaskPanelFactory.cxx | 178 ++++++++++++++------- sd/source/ui/inc/TaskPaneViewShell.hxx | 15 +- sd/source/ui/inc/taskpane/PanelId.hxx | 56 +++++++ sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx | 23 ++- sd/source/ui/toolpanel/TaskPaneToolPanel.cxx | 18 ++- sd/source/ui/toolpanel/TaskPaneToolPanel.hxx | 10 +- sd/source/ui/toolpanel/TaskPaneViewShell.cxx | 8 +- sd/source/ui/toolpanel/ToolPanelDeck.cxx | 68 +++++++- sd/source/ui/toolpanel/ToolPanelDeck.hxx | 26 ++- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 139 ++++++++++++++-- sd/source/ui/view/ViewShellBase.cxx | 8 +- sd/source/ui/view/ViewShellImplementation.cxx | 2 +- 12 files changed, 435 insertions(+), 116 deletions(-) create mode 100644 sd/source/ui/inc/taskpane/PanelId.hxx diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/sd/source/ui/framework/factories/TaskPanelFactory.cxx index 41d399c7a..a28980504 100644 --- a/sd/source/ui/framework/factories/TaskPanelFactory.cxx +++ b/sd/source/ui/framework/factories/TaskPanelFactory.cxx @@ -32,9 +32,11 @@ #include "precompiled_sd.hxx" #include "TaskPanelFactory.hxx" #include "TaskPaneViewShell.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "DrawController.hxx" #include "framework/FrameworkHelper.hxx" #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -89,14 +91,11 @@ class TaskPanelResource { public: TaskPanelResource ( - const Reference& rxResourceId, - const TaskPaneViewShell::PanelId ePaneId); + const Reference& rxResourceId ); virtual ~TaskPanelResource (); virtual void SAL_CALL disposing (); - TaskPaneViewShell::PanelId GetPaneId () const; - // XResource virtual Reference SAL_CALL getResourceId (void) @@ -107,7 +106,6 @@ public: private: const Reference mxResourceId; - const TaskPaneViewShell::PanelId mePaneId; }; } // end of anonymous namespace. @@ -189,56 +187,102 @@ void SAL_CALL TaskPanelFactory::initialize( //===== XResourceController =================================================== -Reference SAL_CALL TaskPanelFactory::createResource ( - const Reference& rxResourceId) - throw (RuntimeException) +namespace { - Reference xResource; - - if ( ! rxResourceId.is()) - return NULL; + 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); - OUString sResourceURL (rxResourceId->getResourceURL()); + 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(); + } + } - if (sResourceURL.match(FrameworkHelper::msTaskPanelURLPrefix)) + toolpanel::PanelId lcl_getPanelId( const ::rtl::OUString& i_rResourceURL ) { - TaskPaneViewShell::PanelId ePaneId (TaskPaneViewShell::PID_UNKNOWN); + toolpanel::PanelId ePanelId( toolpanel::PID_UNKNOWN ); - if (sResourceURL.equals(FrameworkHelper::msMasterPagesTaskPanelURL)) + // TODO: this translation table PanelId<->PanelResourceURL is used in multiple files, + // perhaps it is worth putting this into a dedicated helper/meta-data class. + if ( i_rResourceURL.equals( FrameworkHelper::msMasterPagesTaskPanelURL ) ) { - ePaneId = TaskPaneViewShell::PID_MASTER_PAGES; + ePanelId = toolpanel::PID_MASTER_PAGES; } - else if (sResourceURL.equals(FrameworkHelper::msLayoutTaskPanelURL)) + else if ( i_rResourceURL.equals( FrameworkHelper::msLayoutTaskPanelURL ) ) { - ePaneId = TaskPaneViewShell::PID_LAYOUT; + ePanelId = toolpanel::PID_LAYOUT; } - else if (sResourceURL.equals(FrameworkHelper::msTableDesignPanelURL)) + else if ( i_rResourceURL.equals( FrameworkHelper::msTableDesignPanelURL ) ) { - ePaneId = TaskPaneViewShell::PID_TABLE_DESIGN; + ePanelId = toolpanel::PID_TABLE_DESIGN; } - else if (sResourceURL.equals(FrameworkHelper::msCustomAnimationTaskPanelURL)) + else if ( i_rResourceURL.equals( FrameworkHelper::msCustomAnimationTaskPanelURL ) ) { - ePaneId = TaskPaneViewShell::PID_CUSTOM_ANIMATION; + ePanelId = toolpanel::PID_CUSTOM_ANIMATION; } - else if (sResourceURL.equals(FrameworkHelper::msSlideTransitionTaskPanelURL)) + else if ( i_rResourceURL.equals( FrameworkHelper::msSlideTransitionTaskPanelURL ) ) { - ePaneId = TaskPaneViewShell::PID_SLIDE_TRANSITION; + ePanelId = toolpanel::PID_SLIDE_TRANSITION; } + else + { + OSL_ENSURE( false, "lcl_getPanelId: cannot translate the given resource URL!" ); + } + + return ePanelId; + } +} + +Reference SAL_CALL TaskPanelFactory::createResource ( + const Reference& rxResourceId) + throw (RuntimeException) +{ + Reference xResource; + + if ( ! rxResourceId.is()) + return NULL; + + OUString sResourceURL (rxResourceId->getResourceURL()); + + if ( sResourceURL.match( FrameworkHelper::msTaskPanelURLPrefix ) ) + { + toolpanel::PanelId ePanelId( lcl_getPanelId( sResourceURL ) ); - if (ePaneId!=TaskPaneViewShell::PID_UNKNOWN && mpViewShellBase!=NULL) + if ( ( ePanelId != toolpanel::PID_UNKNOWN ) && ( mpViewShellBase != NULL ) ) { - toolpanel::TaskPaneViewShell* pTaskPane - = dynamic_cast( - FrameworkHelper::Instance(*mpViewShellBase) - ->GetViewShell(FrameworkHelper::msRightPaneURL).get()); - if (pTaskPane != NULL) + ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( *mpViewShellBase ) ); + + // 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::TaskPaneViewShell* pTaskPane = dynamic_cast< toolpanel::TaskPaneViewShell* >( pPaneViewShell.get() ); + if ( pTaskPane != NULL ) { - xResource = new TaskPanelResource( - rxResourceId, - ePaneId); - pTaskPane->ShowPanel(ePaneId); - pTaskPane->ExpandPanel(ePaneId); + xResource = new TaskPanelResource( rxResourceId ); + pTaskPane->ShowPanel(ePanelId); + pTaskPane->ExpandPanel(ePanelId); } + else + { + toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() ); + if ( pToolPanel != NULL ) + { + xResource = new TaskPanelResource( rxResourceId ); + pToolPanel->ActivatePanel( ePanelId ); + } + } + + OSL_POSTCOND( xResource.is(), "TaskPanelFactory::createResource: did not find the given resource!" ); } } @@ -252,17 +296,47 @@ void SAL_CALL TaskPanelFactory::releaseResource ( const Reference& rxResource) throw (RuntimeException) { - toolpanel::TaskPaneViewShell* pTaskPane - = dynamic_cast( - FrameworkHelper::Instance(*mpViewShellBase) - ->GetViewShell(FrameworkHelper::msRightPaneURL).get()); + ENSURE_OR_RETURN_VOID( rxResource.is(), "illegal resource" ); + const Reference< XResourceId > xResourceId( rxResource->getResourceId(), UNO_SET_THROW ); - rtl::Reference pResource = dynamic_cast( - rxResource.get()); + // assume that the top-level anchor is the URL of the pane + ::std::vector< ::rtl::OUString > aResourceURLs; + lcl_collectResourceURLs( xResourceId, aResourceURLs ); + + 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 ) + { + toolpanel::PanelId ePanelId( lcl_getPanelId( xResourceId->getResourceURL() ) ); + toolpanel::TaskPaneViewShell* pTaskPane( dynamic_cast< toolpanel::TaskPaneViewShell* >( pPaneViewShell.get() ) ); + toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() ); + + if ( ( ePanelId != toolpanel::PID_UNKNOWN ) + && ( ( pTaskPane != NULL ) + || ( pToolPanel != NULL ) + ) + ) + { + if ( pTaskPane != NULL ) + { + pTaskPane->CollapsePanel( ePanelId ); + } + if ( pToolPanel != NULL ) + { + pToolPanel->DeactivatePanel( ePanelId ); + } + } + else + { + OSL_ENSURE( false, "TaskPanelFactory::releaseResource: don't know what to do with this resource!" ); + } + } + } - if (pTaskPane != NULL && pResource.is()) - pTaskPane->CollapsePanel(pResource->GetPaneId()); - Reference xComponent (rxResource, UNO_QUERY); if (xComponent.is()) xComponent->dispose(); @@ -293,11 +367,9 @@ void TaskPanelFactory::ThrowIfDisposed (void) const namespace { TaskPanelResource::TaskPanelResource ( - const Reference& rxResourceId, - const TaskPaneViewShell::PanelId ePaneId) + const Reference& rxResourceId) : TaskPanelResourceInterfaceBase(m_aMutex), - mxResourceId(rxResourceId), - mePaneId(ePaneId) + mxResourceId(rxResourceId) { } @@ -318,14 +390,6 @@ void SAL_CALL TaskPanelResource::disposing () -TaskPaneViewShell::PanelId TaskPanelResource::GetPaneId () const -{ - return mePaneId; -} - - - - Reference SAL_CALL TaskPanelResource::getResourceId () throw (css::uno::RuntimeException) { diff --git a/sd/source/ui/inc/TaskPaneViewShell.hxx b/sd/source/ui/inc/TaskPaneViewShell.hxx index 0bfc84f00..d52361afa 100644 --- a/sd/source/ui/inc/TaskPaneViewShell.hxx +++ b/sd/source/ui/inc/TaskPaneViewShell.hxx @@ -34,6 +34,7 @@ #include "ViewShell.hxx" #include "glob.hxx" #include "framework/FrameworkHelper.hxx" +#include "taskpane/PanelId.hxx" #include #include #include @@ -68,20 +69,6 @@ public: TYPEINFO(); SFX_DECL_INTERFACE(SD_IF_SDTASKPANEVIEWSHELL) - /** List of top level panels that can be shown in the task pane. - */ - enum PanelId - { - PID__START = 0, - PID_UNKNOWN = PID__START, - PID_MASTER_PAGES, - PID_LAYOUT, - PID_TABLE_DESIGN, - PID_CUSTOM_ANIMATION, - PID_SLIDE_TRANSITION, - PID__END = PID_SLIDE_TRANSITION - }; - TaskPaneViewShell ( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, diff --git a/sd/source/ui/inc/taskpane/PanelId.hxx b/sd/source/ui/inc/taskpane/PanelId.hxx new file mode 100644 index 000000000..af9ceade6 --- /dev/null +++ b/sd/source/ui/inc/taskpane/PanelId.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SD_UI_TASKPANE_PANELID_HXX +#define SD_UI_TASKPANE_PANELID_HXX + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + //================================================================================================================== + //= PanelId + //================================================================================================================== + /** List of top level panels that can be shown in the task pane. + */ + enum PanelId + { + PID__START = 0, + PID_UNKNOWN = PID__START, + PID_MASTER_PAGES, + PID_LAYOUT, + PID_TABLE_DESIGN, + PID_CUSTOM_ANIMATION, + PID_SLIDE_TRANSITION, + PID__END = PID_SLIDE_TRANSITION + }; + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... + +#endif // SD_UI_TASKPANE_PANELID_HXX diff --git a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx index 2c16658f5..933f10737 100644 --- a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx +++ b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx @@ -33,6 +33,7 @@ #include "ViewShell.hxx" #include "glob.hxx" +#include "taskpane/PanelId.hxx" #include "framework/FrameworkHelper.hxx" #include #include @@ -70,20 +71,6 @@ public: TYPEINFO(); SFX_DECL_INTERFACE(SD_IF_SDTOOLPANELSHELL) - /** List of top level panels that can be shown in the task pane. - */ - enum PanelId - { - PID__START = 0, - PID_UNKNOWN = PID__START, - PID_MASTER_PAGES, - PID_LAYOUT, - PID_TABLE_DESIGN, - PID_CUSTOM_ANIMATION, - PID_SLIDE_TRANSITION, - PID__END = PID_SLIDE_TRANSITION - }; - ToolPanelViewShell ( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, @@ -112,6 +99,14 @@ public: TaskPaneShellManager& GetSubShellManager (void) const; + /** activates the given panel, bypassing the configuration controller, deactivates the previously active one. + */ + void ActivatePanel( const PanelId i_ePanelId ); + + /** deactivates the given panel, bypassing the configuration controller + */ + void DeactivatePanel( const PanelId i_ePanelId ); + /** Called when a mouse button has been pressed but not yet released, this handler is used to show the popup menu of the title bar. diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx index 18d4397b0..95ffb6aca 100644 --- a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx @@ -38,18 +38,34 @@ namespace sd { namespace toolpanel { //...................................................................................................................... + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::drawing::framework::XResourceId; + /** === end UNO using === **/ + //================================================================================================================== //= TaskPaneToolPanel //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ TaskPaneToolPanel::TaskPaneToolPanel( ToolPanelDeck& i_rPanelDeck, ::std::auto_ptr< ControlFactory >& i_rControlFactory, - const Image& i_rImage, const USHORT i_nTitleResId, const ULONG i_nHelpId ) + const Image& i_rImage, const USHORT i_nTitleResId, const ULONG i_nHelpId, const Reference< XResourceId >& i_rPanelResourceId ) :m_pPanelDeck( &i_rPanelDeck ) ,m_pControlFactory( i_rControlFactory ) ,m_pControl() ,m_aImage( i_rImage ) ,m_sTitle( SdResId( i_nTitleResId ) ) ,m_aHelpId( i_nHelpId ) + ,m_xPanelResourceId( i_rPanelResourceId ) { ENSURE_OR_THROW( m_pControlFactory.get(), "illegal control factory" ); } diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx index b4628961b..ea589441b 100644 --- a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx @@ -58,8 +58,8 @@ namespace sd { namespace toolpanel ::std::auto_ptr< ControlFactory >& i_rControlFactory, const Image& i_rImage, const USHORT i_nTitleResId, - const ULONG i_nHelpId/*, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPanelContent*/ + const ULONG i_nHelpId, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPanelResourceId ); ~TaskPaneToolPanel(); @@ -73,6 +73,10 @@ namespace sd { namespace toolpanel virtual bool HasFocus() const; virtual void Dispose(); + // own attributes + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& + getResourceId() const { return m_xPanelResourceId; } + private: bool impl_ensureControl(); @@ -83,6 +87,8 @@ namespace sd { namespace toolpanel const Image m_aImage; const String m_sTitle; const SmartId m_aHelpId; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > + m_xPanelResourceId; }; //...................................................................................................................... diff --git a/sd/source/ui/toolpanel/TaskPaneViewShell.cxx b/sd/source/ui/toolpanel/TaskPaneViewShell.cxx index bfa47fe87..07b09cd4b 100644 --- a/sd/source/ui/toolpanel/TaskPaneViewShell.cxx +++ b/sd/source/ui/toolpanel/TaskPaneViewShell.cxx @@ -131,7 +131,7 @@ public: /** Make a new panel known to the translation table that translates between internal indices as returned by ControlContainer::AddControl() and public indices defined by - TaskPaneViewShell::PanelId. + PanelId. */ void AddPanel (sal_uInt32 nInternalId, PanelId nPublicId); @@ -152,7 +152,7 @@ public: private: /** This map translates between internal indices returned by ControlContainer::AddControl() and public indices defined by - TaskPaneViewShell::PanelId. + PanelId. */ typedef ::std::vector InternalIdToPanelIdMap; InternalIdToPanelIdMap maIndexMap; @@ -790,7 +790,7 @@ void TaskPaneViewShell::Implementation::AddPanel ( -TaskPaneViewShell::PanelId +PanelId TaskPaneViewShell::Implementation::GetPublicId ( sal_uInt32 nInternalId) const { @@ -805,7 +805,7 @@ TaskPaneViewShell::PanelId sal_uInt32 TaskPaneViewShell::Implementation::GetInternalId ( - TaskPaneViewShell::PanelId nPublicId) const + PanelId nPublicId) const { sal_uInt32 nId = mnInvalidId; for (sal_uInt32 nI=0; nI +/** === end UNO includes === **/ + #include +#include //...................................................................................................................... namespace sd { namespace toolpanel { //...................................................................................................................... + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::drawing::framework::XResourceId; + using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE; + /** === end UNO using === **/ + using ::sd::framework::FrameworkHelper; + //================================================================================================================== //= ToolPanelDeck //================================================================================================================== @@ -72,22 +95,61 @@ namespace sd { namespace toolpanel return; } - SetLayouter( new ::svt::TabDeckLayouter( *this, i_eTabAlignment, i_eTabContent ) ); + SetLayouter( new ::svt::TabDeckLayouter( *this, *this, i_eTabAlignment, i_eTabContent ) ); } //------------------------------------------------------------------------------------------------------------------ size_t ToolPanelDeck::CreateAndInsertPanel( ::std::auto_ptr< ControlFactory >& i_rControlFactory, - const Image& i_rImage, const USHORT i_nTitleResId, const ULONG i_nHelpId ) + const Image& i_rImage, const USHORT i_nTitleResId, const ULONG i_nHelpId, const Reference< XResourceId >& i_rPanelResourceId ) { // create panel ::svt::PToolPanel pNewPanel( new TaskPaneToolPanel( *this, i_rControlFactory, - i_rImage, i_nTitleResId, i_nHelpId + i_rImage, i_nTitleResId, i_nHelpId, + i_rPanelResourceId ) ); // insert as new panel return InsertPanel( pNewPanel, GetPanelCount() ); } + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDeck::ActivatePanelDirectly( const ::boost::optional< size_t >& i_rPanel ) + { + ToolPanelDeck_Base::ActivatePanel( i_rPanel ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDeck::ActivatePanelResource( const size_t i_nPanel ) + { + // determine resource ID for the given panel + ::svt::PToolPanel pPanel( GetPanel( i_nPanel ) ); + const TaskPaneToolPanel* pTaskPanePanel( dynamic_cast< const TaskPaneToolPanel* >( pPanel.get() ) ); + ENSURE_OR_RETURN_VOID( pTaskPanePanel, "did not find the right panel/type at the given position" ); + const Reference< XResourceId > xPanelId( pTaskPanePanel->getResourceId() ); + + // delegate the request to the configuration controller + ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rViewShell.GetViewShellBase() ) ); + pFrameworkHelper->GetConfigurationController()->requestResourceActivation( + xPanelId, ResourceActivationMode_REPLACE ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDeck::ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) + { + if ( !i_rPanel ) + { + // this is a de-activate request. Quite improbable that this really happens: We're within the overloaded + // version of IToolPanelDeck::ActivatePanel. The only instance which has access to this IToolPanel + // interface is the panel layouter, which is not expected to call us with a NULL panel position. + // All other instances should now have access to this method, as it is protected in this class here. + OSL_ENSURE( false, "ToolPanelDeck::ActivatePanel: is this legitimate?" ); + // well, handle it nonetheless. + ActivatePanelDirectly( i_rPanel ); + } + else + ActivatePanelResource( *i_rPanel ); + } + //...................................................................................................................... } } // namespace sd::toolpanel //...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.hxx b/sd/source/ui/toolpanel/ToolPanelDeck.hxx index 145f1d978..0022ad967 100644 --- a/sd/source/ui/toolpanel/ToolPanelDeck.hxx +++ b/sd/source/ui/toolpanel/ToolPanelDeck.hxx @@ -30,6 +30,10 @@ #include "taskpane/TaskPaneTreeNode.hxx" #include "taskpane/TaskPaneControlFactory.hxx" +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + #include #include #include @@ -59,11 +63,31 @@ namespace sd { namespace toolpanel ::std::auto_ptr< ControlFactory >& i_rControlFactory, const Image& i_rImage, const USHORT i_nTitleResId, - const ULONG i_nHelpId + const ULONG i_nHelpId, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPanelResourceId ); void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ); + /** directly activates the given panel, without re-routing the activation request through the drawing + framework's configuration controller. + */ + void ActivatePanelDirectly( const ::boost::optional< size_t >& i_rPanel ); + + /** activates the given panel by delegating the acvtivation request to the drawing framework's configuration + controller. + */ + void ActivatePanelResource( const size_t i_nPanel ); + + protected: + // IToolPanelDeck + /** this method, which is part of the callback used by the PanelSelector, does not forward the request to + the base class. Instead, it forwards it to the ToolPanelViewShell, which transforms it into a request + to the drawing framework's configuration controller, which in turn will end up in our public + ActivatePanelDirectly method. + */ + virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ); + private: ToolPanelViewShell& m_rViewShell; }; diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 46b847e4c..22dbdca2b 100644 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -40,7 +40,6 @@ #include "PaneDockingWindow.hxx" #include "FrameView.hxx" #include "Window.hxx" -#include "PaneDockingWindow.hxx" #include "ToolPanelDeck.hxx" #include "sdmod.hxx" #include "app.hrc" @@ -50,9 +49,12 @@ #include "strings.hrc" #include "sdresid.hxx" #include "framework/FrameworkHelper.hxx" + +/** === begin UNO includes === **/ #include #include #include +/** === end UNO includes === **/ #include #include @@ -95,6 +97,7 @@ using ::com::sun::star::uno::Type; using ::com::sun::star::accessibility::XAccessible; using ::com::sun::star::drawing::XDrawSubController; using ::com::sun::star::frame::XFrame; +using ::com::sun::star::drawing::framework::XResourceId; /** === end UNO using === **/ using ::sd::framework::FrameworkHelper; @@ -109,18 +112,18 @@ namespace sd { namespace toolpanel { */ struct PanelDescriptor { - ToolPanelViewShell::PanelId nId; - ::svt::PToolPanel pPanel; - bool bHidden; + PanelId nId; + ::svt::PToolPanel pPanel; + bool bHidden; PanelDescriptor() - :nId( ToolPanelViewShell::PID_UNKNOWN ) + :nId( PID_UNKNOWN ) ,pPanel() ,bHidden( false ) { } - PanelDescriptor( const ToolPanelViewShell::PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ) + PanelDescriptor( const PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ) :nId( i_nPanelId ) ,pPanel( i_rPanel ) ,bHidden( false ) @@ -157,6 +160,23 @@ public: void TogglePanelVisibility( const size_t i_nLogicalPanelIndex, ToolPanelDeck& i_rPanelDeck ); + /** ensures the panel with the given ID is visible, and directly activates it, bypassing the configuration controller + */ + void ActivatePanelDirectly( const PanelId i_nPanelId, ToolPanelDeck& i_rPanelDeck ); + + /** de-activates the panel given by ID, bypassing the configuration controller + + If the panel is not active currently, nothing happens. + */ + void DeactivatePanelDirectly( const PanelId i_nPanelId, ToolPanelDeck& i_rPanelDeck ); + +protected: + // IToolPanelDeckListener overridables + virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void PanelRemoved( const size_t i_nPosition ); + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void Dying(); + private: void RegisterPanel( size_t i_nPosition, PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ); @@ -201,38 +221,84 @@ void ToolPanelViewShell::Implementation::Setup( ToolPanelViewShell& i_rViewShell USHORT nTitleResourceID; ULONG nHelpID; PanelId nPanelID; + ::rtl::OUString sResourceURL; }; PanelDescriptor aPanels[] = { // "Master Pages" - { &controls::MasterPagesPanel::CreateControlFactory, "PresentationLayout", STR_TASKPANEL_MASTER_PAGE_TITLE, HID_SD_SLIDE_DESIGNS, PID_MASTER_PAGES }, + { &controls::MasterPagesPanel::CreateControlFactory, + "PresentationLayout", + STR_TASKPANEL_MASTER_PAGE_TITLE, + HID_SD_SLIDE_DESIGNS, + PID_MASTER_PAGES, + FrameworkHelper::msMasterPagesTaskPanelURL + }, // "Layout" - { &LayoutMenu::CreateControlFactory, "ModifyPage", STR_TASKPANEL_LAYOUT_MENU_TITLE, HID_SD_SLIDE_LAYOUTS, PID_LAYOUT }, + { &LayoutMenu::CreateControlFactory, + "ModifyPage", + STR_TASKPANEL_LAYOUT_MENU_TITLE, + HID_SD_SLIDE_LAYOUTS, + PID_LAYOUT, + FrameworkHelper::msLayoutTaskPanelURL + }, // "Tables Design" - { &controls::TableDesignPanel::CreateControlFactory, "InsertTable", DLG_TABLEDESIGNPANE, HID_SD_TABLE_DESIGN, PID_TABLE_DESIGN }, + { &controls::TableDesignPanel::CreateControlFactory, + "InsertTable", + DLG_TABLEDESIGNPANE, + HID_SD_TABLE_DESIGN, + PID_TABLE_DESIGN, + FrameworkHelper::msTableDesignPanelURL + }, // "Custom Animation" - { &controls::CustomAnimationPanel::CreateControlFactory, "CustomAnimation", STR_CUSTOMANIMATIONPANE, HID_SD_CUSTOM_ANIMATIONS, PID_CUSTOM_ANIMATION }, + { &controls::CustomAnimationPanel::CreateControlFactory, + "CustomAnimation", + STR_CUSTOMANIMATIONPANE, + HID_SD_CUSTOM_ANIMATIONS, + PID_CUSTOM_ANIMATION, + FrameworkHelper::msCustomAnimationTaskPanelURL + }, // "Slide Transition" - { &controls::SlideTransitionPanel::CreateControlFactory, "RehearseTimings", STR_SLIDE_TRANSITION_PANE, HID_SD_SLIDE_TRANSITIONS, PID_SLIDE_TRANSITION } + { &controls::SlideTransitionPanel::CreateControlFactory, + "RehearseTimings", + STR_SLIDE_TRANSITION_PANE, + HID_SD_SLIDE_TRANSITIONS, + PID_SLIDE_TRANSITION, + FrameworkHelper::msSlideTransitionTaskPanelURL + } }; + // compose the resource ID for the ToolPanel view + ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( i_rViewShell.GetViewShellBase() ) ); + const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msToolPanelViewURL, FrameworkHelper::msToolPanelPaneURL ) ); + + // want to activate the "Layout" panel later on, need to translate its PanelId to an actual position const PanelId nPanelIdToActivate = PID_LAYOUT; size_t nPanelPosToActivate = size_t( -1 ); + // create the panels Reference< XFrame > xFrame( i_rViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ); const BOOL bHiContrast( i_rPanelDeck.GetSettings().GetStyleSettings().GetHighContrastMode() ); for ( size_t i=0; i < sizeof( aPanels ) / sizeof( aPanels[0] ); ++i ) { + // compose the command name, and obtain the image for it ::rtl::OUStringBuffer aCommandName; aCommandName.appendAscii( ".uno:" ); aCommandName.appendAscii( aPanels[i].pImageCommandName ); + const Image aPanelImage( GetImage( xFrame, aCommandName.makeStringAndClear(), FALSE, bHiContrast ) ); + // compose the resource ID of the panel + const Reference< XResourceId > xPanelId( pFrameworkHelper->CreateResourceId( aPanels[i].sResourceURL, xToolPanelId ) ); + + // create and insert the panel size_t nPanelPos = i_rPanelDeck.CreateAndInsertPanel( (*aPanels[i].pFactory)( i_rViewShell ), - GetImage( xFrame, aCommandName.makeStringAndClear(), FALSE, bHiContrast ), + aPanelImage, aPanels[i].nTitleResourceID, - aPanels[i].nHelpID + aPanels[i].nHelpID, + xPanelId ); + + // remember it RegisterPanel( nPanelPos, aPanels[i].nPanelID, i_rPanelDeck.GetPanel( nPanelPos ) ); if ( nPanelIdToActivate == aPanels[i].nPanelID ) @@ -240,7 +306,7 @@ void ToolPanelViewShell::Implementation::Setup( ToolPanelViewShell& i_rViewShell } // activate default panel - i_rPanelDeck.ActivatePanel( nPanelPosToActivate ); + i_rPanelDeck.ActivatePanelResource( nPanelPosToActivate ); } // --------------------------------------------------------------------------------------------------------------------- @@ -604,7 +670,17 @@ bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow ) return true; } +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::DeactivatePanel( const PanelId i_ePanelId ) +{ + mpImpl->DeactivatePanelDirectly( i_ePanelId, *mpPanelDeck ); +} +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::ActivatePanel( const PanelId i_ePanelId ) +{ + mpImpl->ActivatePanelDirectly( i_ePanelId, *mpPanelDeck ); +} // ===================================================================================================================== @@ -639,7 +715,7 @@ void ToolPanelViewShell::Implementation::TogglePanelVisibility( const size_t i_n // if there has not been an active panel before, activate the newly inserted one ::boost::optional< size_t > aActivePanel( i_rPanelDeck.GetActivePanel() ); if ( !aActivePanel ) - i_rPanelDeck.ActivatePanel( nActualPanelIndex ); + i_rPanelDeck.ActivatePanelResource( nActualPanelIndex ); } else { @@ -648,6 +724,39 @@ void ToolPanelViewShell::Implementation::TogglePanelVisibility( const size_t i_n maPanels[ i_nLogicalPanelIndex ].bHidden = !maPanels[ i_nLogicalPanelIndex ].bHidden; } +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Implementation::DeactivatePanelDirectly( const PanelId i_nPanelId, ToolPanelDeck& i_rPanelDeck ) +{ + for ( size_t i=0; i() ); + return; + } + } +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Implementation::ActivatePanelDirectly( const PanelId i_nPanelId, ToolPanelDeck& i_rPanelDeck ) +{ + size_t nActualPanelIndex(0); + for ( size_t i=0; i( + toolpanel::PanelId>( pPanelId->GetValue()); bPanelIdGiven = true; } @@ -1690,7 +1690,7 @@ void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest) // Ignore the request for some combinations of panels and view // shell types. if (bPanelIdGiven - && ! (nPanelId==toolpanel::TaskPaneViewShell::PID_LAYOUT + && ! (nPanelId==toolpanel::PID_LAYOUT && mrBase.GetMainViewShell()!=NULL && mrBase.GetMainViewShell()->GetShellType()==ViewShell::ST_OUTLINE)) { diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index 2f6ec927d..d6dfc11d3 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -198,7 +198,7 @@ void ViewShell::Implementation::ProcessModifyPageSlot ( // Make the layout menu visible in the tool pane. SfxBoolItem aMakeToolPaneVisible (ID_VAL_ISVISIBLE, TRUE); SfxUInt32Item aPanelId (ID_VAL_PANEL_INDEX, - ::sd::toolpanel::TaskPaneViewShell::PID_LAYOUT); + ::sd::toolpanel::PID_LAYOUT); SfxViewFrame* pFrame = mrViewShell.GetViewFrame(); if (pFrame!=NULL && pFrame->GetDispatcher()!=NULL) { -- cgit v1.2.3 From cc317619323d332190e30f120b46d2f79d233a09 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 16 Mar 2010 13:36:45 +0100 Subject: slidecopy: display the name of the active panel in the tool panel window's title control --- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 105 ++++++++++++++++++++------ 1 file changed, 84 insertions(+), 21 deletions(-) diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 22dbdca2b..a243978c3 100644 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -136,17 +136,20 @@ struct PanelDescriptor // ===================================================================================================================== /** Inner implementation class of ToolPanelViewShell. */ -class ToolPanelViewShell::Implementation +class ToolPanelViewShell::Implementation : public ::svt::IToolPanelDeckListener { public: static const size_t mnInvalidId = static_cast< size_t >( -1 ); - Implementation(); + Implementation( ToolPanelViewShell& i_rPanelViewShell ); ~Implementation(); /** Here the panels are created that are shown in the task pane. */ void Setup( ToolPanelViewShell& i_rViewShell, ToolPanelDeck& i_rPanelDeck ); + /** clean up the instance + */ + void Cleanup( ToolPanelDeck& i_rPanelDeck ); size_t GetPanelCount() const { @@ -155,7 +158,7 @@ public: const PanelDescriptor& GetPanel( const size_t i_nLogicalPanelIndex ) const { - return maPanels[ i_nLogicalPanelIndex ]; + return m_aPanels[ i_nLogicalPanelIndex ]; } void TogglePanelVisibility( const size_t i_nLogicalPanelIndex, ToolPanelDeck& i_rPanelDeck ); @@ -181,7 +184,8 @@ private: void RegisterPanel( size_t i_nPosition, PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ); typedef ::std::vector< PanelDescriptor > PanelDescriptors; - PanelDescriptors maPanels; + PanelDescriptors m_aPanels; + ToolPanelViewShell& m_rPanelViewShell; }; // ===================================================================================================================== @@ -307,6 +311,15 @@ void ToolPanelViewShell::Implementation::Setup( ToolPanelViewShell& i_rViewShell // activate default panel i_rPanelDeck.ActivatePanelResource( nPanelPosToActivate ); + + // add as listener to the panel deck + i_rPanelDeck.AddListener( *this ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Implementation::Cleanup( ToolPanelDeck& i_rPanelDeck ) +{ + i_rPanelDeck.RemoveListener( *this ); } // --------------------------------------------------------------------------------------------------------------------- @@ -324,7 +337,7 @@ void ToolPanelViewShell::Initialize() ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, FrameView* pFrameViewArgument ) :ViewShell(pFrame, pParentWindow, rViewShellBase) - ,mpImpl( new Implementation ) + ,mpImpl( new Implementation( *this ) ) ,mpPanelDeck( new ToolPanelDeck( *mpContentWindow.get(), *this ) ) ,mbIsInitialized(false) ,mpSubShellManager() @@ -382,6 +395,11 @@ ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rVi // --------------------------------------------------------------------------------------------------------------------- ToolPanelViewShell::~ToolPanelViewShell() { + if ( mbIsInitialized ) + { + mpImpl->Cleanup( *mpPanelDeck ); + } + // reset our impl before destroying the panel deck, to ensure the hidden panels are properly // disposed/destroyed, too mpImpl.reset(); @@ -687,8 +705,9 @@ void ToolPanelViewShell::ActivatePanel( const PanelId i_ePanelId ) // = ToolPanelViewShell:Implementation - implementation // ===================================================================================================================== // --------------------------------------------------------------------------------------------------------------------- -ToolPanelViewShell::Implementation::Implementation() - :maPanels( PanelDescriptors::size_type( PID__END ) ) +ToolPanelViewShell::Implementation::Implementation( ToolPanelViewShell& i_rPanelViewShell ) + :m_aPanels( PanelDescriptors::size_type( PID__END ) ) + ,m_rPanelViewShell( i_rPanelViewShell ) { } @@ -700,18 +719,18 @@ ToolPanelViewShell::Implementation::~Implementation() // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell::Implementation::TogglePanelVisibility( const size_t i_nLogicalPanelIndex, ToolPanelDeck& i_rPanelDeck ) { - ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < maPanels.size(), "illegal index" ); + ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < m_aPanels.size(), "illegal index" ); // get the actual panel index, within the deck size_t nActualPanelIndex(0); for ( size_t i=0; i < i_nLogicalPanelIndex; ++i ) { - if ( !maPanels[i].bHidden ) + if ( !m_aPanels[i].bHidden ) ++nActualPanelIndex; } - if ( maPanels[ i_nLogicalPanelIndex ].bHidden ) + if ( m_aPanels[ i_nLogicalPanelIndex ].bHidden ) { - OSL_VERIFY( i_rPanelDeck.InsertPanel( maPanels[ i_nLogicalPanelIndex ].pPanel, nActualPanelIndex ) == nActualPanelIndex ); + OSL_VERIFY( i_rPanelDeck.InsertPanel( m_aPanels[ i_nLogicalPanelIndex ].pPanel, nActualPanelIndex ) == nActualPanelIndex ); // if there has not been an active panel before, activate the newly inserted one ::boost::optional< size_t > aActivePanel( i_rPanelDeck.GetActivePanel() ); if ( !aActivePanel ) @@ -719,17 +738,17 @@ void ToolPanelViewShell::Implementation::TogglePanelVisibility( const size_t i_n } else { - OSL_VERIFY( i_rPanelDeck.RemovePanel( nActualPanelIndex ).get() == maPanels[ i_nLogicalPanelIndex ].pPanel.get() ); + OSL_VERIFY( i_rPanelDeck.RemovePanel( nActualPanelIndex ).get() == m_aPanels[ i_nLogicalPanelIndex ].pPanel.get() ); } - maPanels[ i_nLogicalPanelIndex ].bHidden = !maPanels[ i_nLogicalPanelIndex ].bHidden; + m_aPanels[ i_nLogicalPanelIndex ].bHidden = !m_aPanels[ i_nLogicalPanelIndex ].bHidden; } // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell::Implementation::DeactivatePanelDirectly( const PanelId i_nPanelId, ToolPanelDeck& i_rPanelDeck ) { - for ( size_t i=0; i() ); @@ -742,16 +761,16 @@ void ToolPanelViewShell::Implementation::DeactivatePanelDirectly( const PanelId void ToolPanelViewShell::Implementation::ActivatePanelDirectly( const PanelId i_nPanelId, ToolPanelDeck& i_rPanelDeck ) { size_t nActualPanelIndex(0); - for ( size_t i=0; i& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) +{ + (void)i_rOldActive; + PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( m_rPanelViewShell.GetDockingWindow() ); + ENSURE_OR_RETURN_VOID( pDockingWindow, "ToolPanelViewShell::Implementation::ActivePanelChanged: no PaneDockingWindow!?" ); + if ( !i_rNewActive ) + pDockingWindow->SetTitle( String( SdResId( STR_RIGHT_PANE_TITLE ) ) ); + else + { + size_t nNewActive( *i_rNewActive ); + for ( size_t i=0; i < m_aPanels.size(); ++i ) + { + if ( m_aPanels[i].bHidden ) + continue; + + if ( !nNewActive ) + { + pDockingWindow->SetTitle( m_aPanels[i].pPanel->GetDisplayName() ); + break; + } + --nNewActive; + } + } +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Implementation::Dying() +{ } } } // end of namespace ::sd::toolpanel -- cgit v1.2.3 From 216761f3e898c236cffe0928fb7d9b103fcc840f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 16 Mar 2010 23:44:33 +0100 Subject: slidecopy: add a IDeckLayouter implementation which mimics the old task panel look/behavior. In non-release builds, allow to switch between this old and the new (not yet polished) tab layout via the task pane's menu --- sd/source/ui/inc/taskpane/TitleBar.hxx | 10 +- sd/source/ui/inc/taskpane/ToolPanel.hxx | 13 +- sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx | 1 - sd/source/ui/toolpanel/TitleBar.cxx | 39 ---- sd/source/ui/toolpanel/ToolPanel.cxx | 49 ++++- sd/source/ui/toolpanel/ToolPanelDeck.cxx | 15 +- sd/source/ui/toolpanel/ToolPanelDeck.hxx | 7 + sd/source/ui/toolpanel/ToolPanelDrawer.cxx | 214 +++++++++++++++++++ sd/source/ui/toolpanel/ToolPanelDrawer.hxx | 93 +++++++++ sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 253 ++++++++++++++++------- sd/source/ui/toolpanel/makefile.mk | 1 + 11 files changed, 571 insertions(+), 124 deletions(-) create mode 100644 sd/source/ui/toolpanel/ToolPanelDrawer.cxx create mode 100644 sd/source/ui/toolpanel/ToolPanelDrawer.hxx diff --git a/sd/source/ui/inc/taskpane/TitleBar.hxx b/sd/source/ui/inc/taskpane/TitleBar.hxx index 64669be9d..e396a7cbf 100644 --- a/sd/source/ui/inc/taskpane/TitleBar.hxx +++ b/sd/source/ui/inc/taskpane/TitleBar.hxx @@ -50,16 +50,12 @@ namespace sd { namespace toolpanel { TBT_SUB_CONTROL_HEADLINE both show a expansion indicator in front of the title string that shows whether the associated control is visible (expanded) or not. - A title bar with TBT_WINDOW_TITLE is typically used only once as the - title bar of the whole task pane. -

The title bar shows three kinds of indicators: 1) Expansion is +

The title bar shows two kinds of indicators: 1) Expansion is displayed by two sets of two bitmaps, a triangle pointing to the right resp. a minus in a square indicates that the control is collapsed, a triangle pointing down resp. a plus in a square stands for an expanded - control. 2) Keyboard focus is indicated by a dotted rectangle. 3) An - underlined title string is a mouse over indicator for a - selectable/expandable control.

+ control. 2) Keyboard focus is indicated by a dotted rectangle. */ class TitleBar : public ::Window, @@ -67,7 +63,6 @@ class TitleBar { public: enum TitleBarType { - TBT_WINDOW_TITLE, TBT_CONTROL_TITLE, TBT_SUB_CONTROL_HEADLINE }; @@ -162,7 +157,6 @@ private: const Rectangle& rTextBox, int nTitleBarWidth); - void PaintWindowTitleBar (void); void PaintPanelControlTitle (void); void PaintSubPanelHeadLineBar (void); diff --git a/sd/source/ui/inc/taskpane/ToolPanel.hxx b/sd/source/ui/inc/taskpane/ToolPanel.hxx index 301fba6bb..62993b78f 100644 --- a/sd/source/ui/inc/taskpane/ToolPanel.hxx +++ b/sd/source/ui/inc/taskpane/ToolPanel.hxx @@ -42,6 +42,7 @@ class Window; namespace sd { namespace toolpanel { class TaskPaneViewShell; +class ToolPanelViewShell; class ControlFactory; /** This control is basically a layout manager for the vertical @@ -64,6 +65,10 @@ public: ::Window* pParentWindow, TaskPaneViewShell& rViewShell); + ToolPanel ( + ::Window* pParentWindow, + ToolPanelViewShell& rViewShell); + virtual ~ToolPanel (void); /** Append the given control to the end of the list of controls that are @@ -85,6 +90,11 @@ public: ULONG nHelpId, const TitledControl::ClickHandler& rClickHandler); + /** returns the area occupied by the content of the active control (i.e. the area of the active control, + minus the are for its title) + */ + Rectangle GetActiveControlContentArea() const; + virtual void Resize (void); virtual Size GetPreferredSize (void); @@ -110,7 +120,8 @@ protected: void ListHasChanged (void); private: - TaskPaneViewShell& mrViewShell; + TaskPaneViewShell* mpTaskPaneViewShell; + ToolPanelViewShell* mpToolPanelViewShell; /// Guard against recursive calls or Rearrange(). bool mbRearrangeActive; diff --git a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx index 933f10737..4ccf3a731 100644 --- a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx +++ b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx @@ -128,7 +128,6 @@ public: private: class Implementation; ::boost::scoped_ptr< Implementation > mpImpl; - ::boost::scoped_ptr< ToolPanelDeck > mpPanelDeck; bool mbIsInitialized; diff --git a/sd/source/ui/toolpanel/TitleBar.cxx b/sd/source/ui/toolpanel/TitleBar.cxx index d53336709..5384474c5 100644 --- a/sd/source/ui/toolpanel/TitleBar.cxx +++ b/sd/source/ui/toolpanel/TitleBar.cxx @@ -80,9 +80,6 @@ TitleBar::TitleBar ( ::Window* pParent, const String& rsTitle, TitleBarType eTyp // Change the mouse pointer shape so that it acts as a mouse over effect. switch (meType) { - case TBT_WINDOW_TITLE: - break; - case TBT_CONTROL_TITLE: case TBT_SUB_CONTROL_HEADLINE: if (mbIsExpandable) @@ -173,10 +170,6 @@ void TitleBar::Paint (const Rectangle& rBoundingBox) switch (meType) { - case TBT_WINDOW_TITLE: - PaintWindowTitleBar (); - break; - case TBT_CONTROL_TITLE: PaintPanelControlTitle (); break; @@ -258,11 +251,6 @@ bool TitleBar::HasExpansionIndicator (void) const case TBT_SUB_CONTROL_HEADLINE: bHasExpansionIndicator = true; break; - - default: - case TBT_WINDOW_TITLE: - // bHasExpansionIndicator remains false - break; } } return bHasExpansionIndicator; @@ -309,11 +297,6 @@ Image TitleBar::GetExpansionIndicator (void) const aIndicator = IconCache::Instance().GetIcon(nResourceId); break; - - default: - case TBT_WINDOW_TITLE: - // aIndicator remains empty Image. - break; } } @@ -339,19 +322,6 @@ void TitleBar::PaintPanelControlTitle (void) -void TitleBar::PaintWindowTitleBar (void) -{ - Rectangle aTextBox (CalculateTextBoundingBox ( - GetOutputSizePixel().Width(), - true)); - - PaintText (aTextBox); - PaintFocusIndicator (aTextBox); -} - - - - void TitleBar::PaintSubPanelHeadLineBar (void) { int nWidth (GetOutputSizePixel().Width()); @@ -537,10 +507,6 @@ void TitleBar::PaintBackground (const Rectangle& rTitleBarBox) Point(rTitleBarBox.Right(), rTitleBarBox.Bottom())); } break; - - default: - case TBT_WINDOW_TITLE: - break; } } @@ -591,11 +557,6 @@ Rectangle TitleBar::CalculateTitleBarBox ( switch (meType) { - case TBT_WINDOW_TITLE: - aTitleBarBox.Bottom() += aTitleBarBox.Top(); - aTitleBarBox.Top() = 0; - break; - case TBT_CONTROL_TITLE: aTitleBarBox.Bottom() += aTitleBarBox.Top(); aTitleBarBox.Top() = 0; diff --git a/sd/source/ui/toolpanel/ToolPanel.cxx b/sd/source/ui/toolpanel/ToolPanel.cxx index 291e48eaa..c4d0e0912 100644 --- a/sd/source/ui/toolpanel/ToolPanel.cxx +++ b/sd/source/ui/toolpanel/ToolPanel.cxx @@ -38,6 +38,7 @@ #include "taskpane/TitledControl.hxx" #include "taskpane/ControlContainer.hxx" #include "TaskPaneViewShell.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "taskpane/TaskPaneControlFactory.hxx" #include "AccessibleTaskPane.hxx" @@ -46,6 +47,7 @@ #include #include #include +#include namespace sd { namespace toolpanel { @@ -59,7 +61,23 @@ ToolPanel::ToolPanel ( TaskPaneViewShell& rViewShell) : Control (pParentWindow, WB_DIALOGCONTROL), TreeNode (NULL), - mrViewShell(rViewShell), + mpTaskPaneViewShell( &rViewShell ), + mpToolPanelViewShell( NULL ), + mbRearrangeActive(false) +{ + SetBackground (Wallpaper ()); +} + + + + +ToolPanel::ToolPanel ( + Window* pParentWindow, + ToolPanelViewShell& rViewShell) + : Control (pParentWindow, WB_DIALOGCONTROL), + TreeNode (NULL), + mpTaskPaneViewShell( NULL ), + mpToolPanelViewShell( &rViewShell ), mbRearrangeActive(false) { SetBackground (Wallpaper ()); @@ -128,6 +146,29 @@ sal_uInt32 ToolPanel::AddControl ( +Rectangle ToolPanel::GetActiveControlContentArea() const +{ + const Rectangle aAllRect( Point(), GetOutputSizePixel() ); + + const sal_uInt32 nActiveControlIndex( mpControlContainer->GetActiveControlIndex() ); + if ( nActiveControlIndex >= mpControlContainer->GetControlCount() ) + return aAllRect; + + TreeNode* pChild = mpControlContainer->GetControl( nActiveControlIndex ); + TitledControl* pTitledControl = dynamic_cast< TitledControl* >( pChild ); + ENSURE_OR_RETURN( pTitledControl, "invalid active child", aAllRect ); + + TreeNode* pActiveControl( pTitledControl->GetControl() ); + ENSURE_OR_RETURN( pActiveControl, "invalid active control", aAllRect ); + + return Rectangle( + ScreenToOutputPixel( pActiveControl->GetWindow()->OutputToScreenPixel( Point( 0, 0 ) ) ), + pActiveControl->GetWindow()->GetOutputSizePixel() + ); +} + + + void ToolPanel::ListHasChanged (void) { mpControlContainer->ListHasChanged (); @@ -271,7 +312,11 @@ bool ToolPanel::IsResizable (void) TaskPaneShellManager* ToolPanel::GetShellManager (void) { - return &mrViewShell.GetSubShellManager(); + if ( mpTaskPaneViewShell != NULL ) + return &mpTaskPaneViewShell->GetSubShellManager(); + if ( mpToolPanelViewShell != NULL ) + return &mpToolPanelViewShell->GetSubShellManager(); + return TreeNode::GetShellManager(); } diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.cxx b/sd/source/ui/toolpanel/ToolPanelDeck.cxx index 688532f30..af3095d77 100644 --- a/sd/source/ui/toolpanel/ToolPanelDeck.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDeck.cxx @@ -28,6 +28,7 @@ #include "ToolPanelDeck.hxx" #include "taskpane/ToolPanelViewShell.hxx" +#include "ToolPanelDrawer.hxx" #include "taskpane/ControlContainer.hxx" #include "framework/FrameworkHelper.hxx" #include "TaskPaneToolPanel.hxx" @@ -69,7 +70,7 @@ namespace sd { namespace toolpanel :ToolPanelDeck_Base( i_rParent, 0 ) ,m_rViewShell( i_rViewShell ) { - SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY ); + SetDrawersLayout(); } //------------------------------------------------------------------------------------------------------------------ @@ -77,6 +78,17 @@ namespace sd { namespace toolpanel { } + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDeck::SetDrawersLayout() + { + const ::svt::PDeckLayouter pLayouter( GetLayouter() ); + const ToolPanelDrawer* pDrawerLayouter = dynamic_cast< const ToolPanelDrawer* >( pLayouter.get() ); + if ( pDrawerLayouter != NULL ) + // already have the proper layout + return; + SetLayouter( new ToolPanelDrawer( *this, *this ) ); + } + //------------------------------------------------------------------------------------------------------------------ void ToolPanelDeck::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ) { @@ -86,6 +98,7 @@ namespace sd { namespace toolpanel && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) && ( pTabLayouter->GetTabItemContent() == i_eTabContent ) ) + // already have the requested layout return; if ( pTabLayouter && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) ) diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.hxx b/sd/source/ui/toolpanel/ToolPanelDeck.hxx index 0022ad967..ba66e77c5 100644 --- a/sd/source/ui/toolpanel/ToolPanelDeck.hxx +++ b/sd/source/ui/toolpanel/ToolPanelDeck.hxx @@ -67,8 +67,15 @@ namespace sd { namespace toolpanel const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPanelResourceId ); + /** activates a layout where the active panel is selected via tabs at the right/left/top/bottom (depending on + the given TabAlignment value). + */ void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ); + /** activates the "classical" layout with the panels being represneted by stacked drawers + */ + void SetDrawersLayout(); + /** directly activates the given panel, without re-routing the activation request through the drawing framework's configuration controller. */ diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx new file mode 100644 index 000000000..6655ba196 --- /dev/null +++ b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx @@ -0,0 +1,214 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_sd.hxx" + +#include "ToolPanelDrawer.hxx" +#include "taskpane/ToolPanel.hxx" +#include "taskpane/TitleBar.hxx" + +#include + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + //================================================================================================================== + //= ToolPanelDrawer + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ToolPanelDrawer::ToolPanelDrawer( ::Window& i_rParentWindow, ::svt::IToolPanelDeck& i_rPanels ) + :m_rParentWindow( i_rParentWindow ) + ,m_rPanelDeck( i_rPanels ) + ,m_aDrawers() + { + m_rPanelDeck.AddListener( *this ); + + // simulate PanelInserted events for the panels which are already there + for ( size_t i=0; i aActivePanel( m_rPanelDeck.GetActivePanel() ); + + // arrange the title bars which are *above* the active panel (or *all* if there is no active panel), plus + // the title bar of the active panel itself + Point aUpperDrawerPos( i_rDeckPlayground.TopLeft() ); + const size_t nUpperBound = !!aActivePanel ? *aActivePanel : nPanelCount - 1; + for ( size_t i=0; i<=nUpperBound; ++i ) + { + sal_uInt32 nDrawerHeight = m_aDrawers[i]->GetPreferredHeight( nWidth ); + m_aDrawers[i]->GetWindow()->SetPosSizePixel( + aUpperDrawerPos, Size( nWidth, nDrawerHeight ) ); + aUpperDrawerPos.Move( 0, nDrawerHeight ); + } + + // arrange title bars which are below the active panel (or *none* if there is no active panel) + Point aLowerDrawerPos( i_rDeckPlayground.BottomLeft() ); + for ( size_t j = nPanelCount - 1; j > nUpperBound; --j ) + { + sal_uInt32 nDrawerHeight = m_aDrawers[j]->GetPreferredHeight( nWidth ); + m_aDrawers[j]->GetWindow()->SetPosSizePixel( + Point( aLowerDrawerPos.X(), aLowerDrawerPos.Y() - nDrawerHeight + 1 ), + Size( nWidth, nDrawerHeight ) + ); + aLowerDrawerPos.Move( 0, -nDrawerHeight ); + } + + // fincally calculate the rectangle for the active panel + return Rectangle( + aUpperDrawerPos, + Size( nWidth, aLowerDrawerPos.Y() - aUpperDrawerPos.Y() + 1 ) + ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::Destroy() + { + while ( !m_aDrawers.empty() ) + impl_removeTitleBar( 0 ); + m_rPanelDeck.RemoveListener( *this ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::SetFocusToPanelSelector() + { + // TODO + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) + { + OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "ToolPanelDrawer::PanelInserted: inconsistency!" ); + + ::boost::shared_ptr< TitleBar > pTitleBar( new TitleBar( &m_rParentWindow, i_pPanel->GetDisplayName(), TitleBar::TBT_CONTROL_TITLE, true ) ); + pTitleBar->GetWindow()->Show(); + pTitleBar->GetWindow()->AddEventListener( LINK( this, ToolPanelDrawer, OnWindowEvent ) ); + m_aDrawers.insert( m_aDrawers.begin() + i_nPosition, pTitleBar ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::PanelRemoved( const size_t i_nPosition ) + { + impl_removeTitleBar( i_nPosition ); + impl_triggerRearrange(); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::impl_triggerRearrange() const + { + // this is somewhat hacky, it assumes that the parent of our panels is a tool panel deck, which, in its + // Resize implementation, rearrances all elements. + m_rParentWindow.Resize(); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) + { + impl_triggerRearrange(); + + if ( !!i_rOldActive ) + { + OSL_ENSURE( *i_rOldActive < m_aDrawers.size(), "ToolPanelDrawer::ActivePanelChanged: illegal old index!" ); + m_aDrawers[ *i_rOldActive ]->Expand( false ); + } + + if ( !!i_rNewActive ) + { + OSL_ENSURE( *i_rNewActive < m_aDrawers.size(), "ToolPanelDrawer::ActivePanelChanged: illegal new index!" ); + m_aDrawers[ *i_rNewActive ]->Expand( true ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + size_t ToolPanelDrawer::impl_getPanelPositionFromWindow( const Window* i_pTitleBarWindow ) const + { + for ( ::std::vector< PTitleBar >::const_iterator drawerPos = m_aDrawers.begin(); + drawerPos != m_aDrawers.end(); + ++drawerPos + ) + { + if ( (*drawerPos)->GetWindow() == i_pTitleBarWindow ) + return drawerPos - m_aDrawers.begin(); + } + return m_aDrawers.size(); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::impl_removeTitleBar( const size_t i_nPosition ) + { + OSL_PRECOND( i_nPosition < m_aDrawers.size(), "ToolPanelDrawer::impl_removeTitleBar: invalid panel position!" ); + m_aDrawers[ i_nPosition ]->GetWindow()->RemoveEventListener( LINK( this, ToolPanelDrawer, OnWindowEvent ) ); + OSL_ENSURE( m_aDrawers[ i_nPosition ].unique(), "ToolPanelDrawer::impl_removeTitleBar: somebody else is still holding a reference!" ); + m_aDrawers.erase( m_aDrawers.begin() + i_nPosition ); + } + + //------------------------------------------------------------------------------------------------------------------ + IMPL_LINK( ToolPanelDrawer, OnWindowEvent, VclSimpleEvent*, i_pEvent ) + { + const VclWindowEvent* pWindowEvent = PTR_CAST( VclWindowEvent, i_pEvent ); + if ( !pWindowEvent ) + return 0L; + + switch ( pWindowEvent->GetId() ) + { + case VCLEVENT_WINDOW_MOUSEBUTTONUP: + { + const size_t nPanelPos = impl_getPanelPositionFromWindow( pWindowEvent->GetWindow() ); + m_rPanelDeck.ActivatePanel( nPanelPos ); + return 1L; + } + break; + } + return 0L; + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::Dying() + { + Destroy(); + } + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.hxx b/sd/source/ui/toolpanel/ToolPanelDrawer.hxx new file mode 100644 index 000000000..bd3e30edc --- /dev/null +++ b/sd/source/ui/toolpanel/ToolPanelDrawer.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SD_TOOLPANEL_TOOLPANELDRAWER_HXX +#define SD_TOOLPANEL_TOOLPANELDRAWER_HXX + +#include +#include +#include + +#include + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + class ToolPanelViewShell; + class TitleBar; + typedef ::boost::shared_ptr< TitleBar > PTitleBar; + + //================================================================================================================== + //= ToolPanelDrawer + //================================================================================================================== + /** a class which implements a tool panel selector in the form of the classical drawers + */ + class ToolPanelDrawer :public ::svt::RefBase + ,public ::svt::IDeckLayouter + ,public ::svt::IToolPanelDeckListener + { + public: + ToolPanelDrawer( + ::Window& i_rParentWindow, + ::svt::IToolPanelDeck& i_rPanels + ); + ~ToolPanelDrawer(); + + // IReference + DECLARE_IREFERENCE() + + // IDeckLayouter + virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); + virtual void Destroy(); + virtual void SetFocusToPanelSelector(); + + // IToolPanelDeckListener + virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void PanelRemoved( const size_t i_nPosition ); + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void Dying(); + + private: + // triggers a re-arrance of the panel deck elements + void impl_triggerRearrange() const; + size_t impl_getPanelPositionFromWindow( const Window* i_pTitleBarWindow ) const; + void impl_removeTitleBar( const size_t i_nPosition ); + + DECL_LINK( OnWindowEvent, VclSimpleEvent* ); + +private: + Window& m_rParentWindow; + ::svt::IToolPanelDeck& m_rPanelDeck; + ::std::vector< PTitleBar > m_aDrawers; + }; + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... + +#endif // SD_TOOLPANEL_TOOLPANELDRAWER_HXX diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index a243978c3..85646d355 100644 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -131,6 +131,18 @@ struct PanelDescriptor } }; +// ===================================================================================================================== +// = PanelSelectorLayout +// ===================================================================================================================== +enum PanelSelectorLayout +{ + LAYOUT_DRAWERS, + LAYOUT_TABS_RIGHT, + LAYOUT_TABS_LEFT, + LAYOUT_TABS_TOP, + LAYOUT_TABS_BOTTOM +}; + // ===================================================================================================================== // = ToolPanelViewShell::Implementation - declaration // ===================================================================================================================== @@ -141,16 +153,34 @@ class ToolPanelViewShell::Implementation : public ::svt::IToolPanelDeckListener public: static const size_t mnInvalidId = static_cast< size_t >( -1 ); - Implementation( ToolPanelViewShell& i_rPanelViewShell ); + Implementation( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent ); ~Implementation(); /** Here the panels are created that are shown in the task pane. */ - void Setup( ToolPanelViewShell& i_rViewShell, ToolPanelDeck& i_rPanelDeck ); + void Setup(); + /** clean up the instance */ - void Cleanup( ToolPanelDeck& i_rPanelDeck ); + void Cleanup(); + + /** sets the given layout for the panel selector + */ + void SetLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce = false ); + /** returns the current layout + */ + PanelSelectorLayout + GetLayout() const { return m_eCurrentLayout; } + + /** provides access to the the VCL window of the panel deck + */ + ::Window& GetPanelDeck() { return *m_pPanelDeck.get(); } + const ::Window& GetPanelDeck() const { return *m_pPanelDeck.get(); } + + /** returns the logical number of panels. This is greater than or equal to the number of panels displayed in the + panel deck + */ size_t GetPanelCount() const { return size_t( PID__END ); @@ -161,17 +191,17 @@ public: return m_aPanels[ i_nLogicalPanelIndex ]; } - void TogglePanelVisibility( const size_t i_nLogicalPanelIndex, ToolPanelDeck& i_rPanelDeck ); + void TogglePanelVisibility( const size_t i_nLogicalPanelIndex ); /** ensures the panel with the given ID is visible, and directly activates it, bypassing the configuration controller */ - void ActivatePanelDirectly( const PanelId i_nPanelId, ToolPanelDeck& i_rPanelDeck ); + void ActivatePanelDirectly( const PanelId i_nPanelId ); /** de-activates the panel given by ID, bypassing the configuration controller If the panel is not active currently, nothing happens. */ - void DeactivatePanelDirectly( const PanelId i_nPanelId, ToolPanelDeck& i_rPanelDeck ); + void DeactivatePanelDirectly( const PanelId i_nPanelId ); protected: // IToolPanelDeckListener overridables @@ -182,10 +212,13 @@ protected: private: void RegisterPanel( size_t i_nPosition, PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ); + void UpdateDockingWindowTitle(); typedef ::std::vector< PanelDescriptor > PanelDescriptors; - PanelDescriptors m_aPanels; - ToolPanelViewShell& m_rPanelViewShell; + PanelDescriptors m_aPanels; + ToolPanelViewShell& m_rPanelViewShell; + ::boost::scoped_ptr< ToolPanelDeck > m_pPanelDeck; + PanelSelectorLayout m_eCurrentLayout; }; // ===================================================================================================================== @@ -197,7 +230,9 @@ namespace { enum MenuId { MID_UNLOCK_TASK_PANEL = 1, MID_LOCK_TASK_PANEL = 2, - MID_FIRST_PANEL = 3 + MID_LAYOUT_TABS = 3, + MID_LAYOUT_DRAWERS = 4, + MID_FIRST_PANEL = 5 }; } // end of anonymouse namespace @@ -214,7 +249,7 @@ SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL)) TYPEINIT1(ToolPanelViewShell, ViewShell); // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::Setup( ToolPanelViewShell& i_rViewShell, ToolPanelDeck& i_rPanelDeck ) +void ToolPanelViewShell::Implementation::Setup() { typedef std::auto_ptr (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell ); @@ -272,7 +307,7 @@ void ToolPanelViewShell::Implementation::Setup( ToolPanelViewShell& i_rViewShell }; // compose the resource ID for the ToolPanel view - ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( i_rViewShell.GetViewShellBase() ) ); + ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) ); const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msToolPanelViewURL, FrameworkHelper::msToolPanelPaneURL ) ); // want to activate the "Layout" panel later on, need to translate its PanelId to an actual position @@ -280,8 +315,8 @@ void ToolPanelViewShell::Implementation::Setup( ToolPanelViewShell& i_rViewShell size_t nPanelPosToActivate = size_t( -1 ); // create the panels - Reference< XFrame > xFrame( i_rViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ); - const BOOL bHiContrast( i_rPanelDeck.GetSettings().GetStyleSettings().GetHighContrastMode() ); + Reference< XFrame > xFrame( m_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ); + const BOOL bHiContrast( m_pPanelDeck->GetSettings().GetStyleSettings().GetHighContrastMode() ); for ( size_t i=0; i < sizeof( aPanels ) / sizeof( aPanels[0] ); ++i ) { // compose the command name, and obtain the image for it @@ -294,8 +329,8 @@ void ToolPanelViewShell::Implementation::Setup( ToolPanelViewShell& i_rViewShell const Reference< XResourceId > xPanelId( pFrameworkHelper->CreateResourceId( aPanels[i].sResourceURL, xToolPanelId ) ); // create and insert the panel - size_t nPanelPos = i_rPanelDeck.CreateAndInsertPanel( - (*aPanels[i].pFactory)( i_rViewShell ), + size_t nPanelPos = m_pPanelDeck->CreateAndInsertPanel( + (*aPanels[i].pFactory)( m_rPanelViewShell ), aPanelImage, aPanels[i].nTitleResourceID, aPanels[i].nHelpID, @@ -303,23 +338,57 @@ void ToolPanelViewShell::Implementation::Setup( ToolPanelViewShell& i_rViewShell ); // remember it - RegisterPanel( nPanelPos, aPanels[i].nPanelID, i_rPanelDeck.GetPanel( nPanelPos ) ); + RegisterPanel( nPanelPos, aPanels[i].nPanelID, m_pPanelDeck->GetPanel( nPanelPos ) ); if ( nPanelIdToActivate == aPanels[i].nPanelID ) nPanelPosToActivate = nPanelPos; } // activate default panel - i_rPanelDeck.ActivatePanelResource( nPanelPosToActivate ); + m_pPanelDeck->ActivatePanelResource( nPanelPosToActivate ); // add as listener to the panel deck - i_rPanelDeck.AddListener( *this ); + m_pPanelDeck->AddListener( *this ); + + // initialize panel selector + SetLayout( LAYOUT_DRAWERS, true ); + + m_pPanelDeck->Show(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Implementation::SetLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce ) +{ + if ( !i_bForce && ( m_eCurrentLayout == i_eLayout ) ) + return; + + switch ( i_eLayout ) + { + case LAYOUT_DRAWERS: + m_pPanelDeck->SetDrawersLayout(); + break; + case LAYOUT_TABS_TOP: + m_pPanelDeck->SetTabsLayout( ::svt::TABS_TOP, ::svt::TABITEM_IMAGE_ONLY ); + break; + case LAYOUT_TABS_BOTTOM: + m_pPanelDeck->SetTabsLayout( ::svt::TABS_BOTTOM, ::svt::TABITEM_IMAGE_ONLY ); + break; + case LAYOUT_TABS_LEFT: + m_pPanelDeck->SetTabsLayout( ::svt::TABS_LEFT, ::svt::TABITEM_IMAGE_ONLY ); + break; + case LAYOUT_TABS_RIGHT: + m_pPanelDeck->SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY ); + break; + } + m_eCurrentLayout = i_eLayout; + UpdateDockingWindowTitle(); } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::Cleanup( ToolPanelDeck& i_rPanelDeck ) +void ToolPanelViewShell::Implementation::Cleanup() { - i_rPanelDeck.RemoveListener( *this ); + m_pPanelDeck->RemoveListener( *this ); + m_pPanelDeck.reset(); } // --------------------------------------------------------------------------------------------------------------------- @@ -328,8 +397,7 @@ void ToolPanelViewShell::Initialize() if ( !mbIsInitialized ) { mbIsInitialized = true; - mpImpl->Setup( *this, *mpPanelDeck ); - mpPanelDeck->Show(); + mpImpl->Setup(); } } @@ -337,8 +405,7 @@ void ToolPanelViewShell::Initialize() ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, FrameView* pFrameViewArgument ) :ViewShell(pFrame, pParentWindow, rViewShellBase) - ,mpImpl( new Implementation( *this ) ) - ,mpPanelDeck( new ToolPanelDeck( *mpContentWindow.get(), *this ) ) + ,mpImpl( new Implementation( *this, *mpContentWindow.get() ) ) ,mbIsInitialized(false) ,mpSubShellManager() ,mnMenuId(0) @@ -397,13 +464,12 @@ ToolPanelViewShell::~ToolPanelViewShell() { if ( mbIsInitialized ) { - mpImpl->Cleanup( *mpPanelDeck ); + mpImpl->Cleanup(); } // reset our impl before destroying the panel deck, to ensure the hidden panels are properly // disposed/destroyed, too mpImpl.reset(); - mpPanelDeck.reset(); GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager); } @@ -423,7 +489,7 @@ void ToolPanelViewShell::ArrangeGUIElements() Initialize(); - mpPanelDeck->SetPosSizePixel( Point(), maViewSize ); + mpImpl->GetPanelDeck().SetPosSizePixel( Point(), maViewSize ); } // --------------------------------------------------------------------------------------------------------------------- @@ -444,36 +510,41 @@ void ToolPanelViewShell::KeyInput( const KeyEvent& i_rKeyEvent ) const KeyCode nCode = i_rKeyEvent.GetKeyCode(); if ( nCode == KEY_RETURN ) { - if ( !mpPanelDeck->HasChildPathFocus() ) - mpPanelDeck->GrabFocus(); + if ( !mpImpl->GetPanelDeck().HasChildPathFocus() ) + mpImpl->GetPanelDeck().GrabFocus(); } else ViewShell::KeyInput( i_rKeyEvent, NULL ); } // --------------------------------------------------------------------------------------------------------------------- -IMPL_LINK( ToolPanelViewShell, DockingChanged, PaneDockingWindow*, i_pDockingWindow ) +namespace { - ENSURE_OR_RETURN( i_pDockingWindow == dynamic_cast< PaneDockingWindow* >( GetDockingWindow() ), "unknown source", 0 ); - switch ( i_pDockingWindow->GetAlignment() ) + PanelSelectorLayout lcl_getTabLayoutFromAlignment( const SfxChildAlignment i_eAlignment ) { - case SFX_ALIGN_LEFT: - mpPanelDeck->SetTabsLayout( ::svt::TABS_LEFT, ::svt::TABITEM_IMAGE_ONLY ); - break; - case SFX_ALIGN_RIGHT: - case SFX_ALIGN_NOALIGNMENT: - mpPanelDeck->SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY ); - break; - case SFX_ALIGN_TOP: - mpPanelDeck->SetTabsLayout( ::svt::TABS_TOP, ::svt::TABITEM_IMAGE_ONLY ); - break; - case SFX_ALIGN_BOTTOM: - mpPanelDeck->SetTabsLayout( ::svt::TABS_BOTTOM, ::svt::TABITEM_IMAGE_ONLY ); - break; - default: - OSL_ENSURE( false, "ToolPanelViewShell::DockingChanged: unexpected alignment!" ); - break; + switch ( i_eAlignment ) + { + case SFX_ALIGN_LEFT: + return LAYOUT_TABS_LEFT; + case SFX_ALIGN_TOP: + return LAYOUT_TABS_TOP; + case SFX_ALIGN_BOTTOM: + return LAYOUT_TABS_BOTTOM; + default: + return LAYOUT_TABS_RIGHT; + } } +} + +// --------------------------------------------------------------------------------------------------------------------- +IMPL_LINK( ToolPanelViewShell, DockingChanged, PaneDockingWindow*, i_pDockingWindow ) +{ + ENSURE_OR_RETURN( i_pDockingWindow == dynamic_cast< PaneDockingWindow* >( GetDockingWindow() ), "unknown source", 0 ); + + if ( mpImpl->GetLayout() == LAYOUT_DRAWERS ) + return 0L; + + mpImpl->SetLayout( lcl_getTabLayoutFromAlignment( i_pDockingWindow->GetAlignment() ) ); return 0L; } @@ -523,10 +594,23 @@ IMPL_LINK(ToolPanelViewShell, MenuSelectHandler, Menu*, pMenu) } break; + case MID_LAYOUT_DRAWERS: + mpImpl->SetLayout( LAYOUT_DRAWERS ); + break; + + case MID_LAYOUT_TABS: + { + PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( GetDockingWindow() ); + OSL_ENSURE( pDockingWindow != NULL, "ToolPanelViewShell::MenuSelectHandler: unknown docking window type!" ); + if ( pDockingWindow ) + mpImpl->SetLayout( lcl_getTabLayoutFromAlignment( pDockingWindow->GetAlignment() ) ); + } + break; + default: { size_t nPanelIndex = size_t( pMenu->GetCurItemId() - MID_FIRST_PANEL ); - mpImpl->TogglePanelVisibility( nPanelIndex, *mpPanelDeck ); + mpImpl->TogglePanelVisibility( nPanelIndex ); } break; } @@ -558,7 +642,16 @@ IMPL_LINK(ToolPanelViewShell, MenuSelectHandler, Menu*, pMenu) pMenu->SetUserValue( nIndex, rPanelDesc.nId ); pMenu->CheckItem( nIndex, !rPanelDesc.bHidden ); } - pMenu->InsertSeparator (); + pMenu->InsertSeparator(); + +#if OSL_DEBUG_LEVEL > 0 + pMenu->InsertItem( MID_LAYOUT_TABS, String::CreateFromAscii( "Tab-Layout" ), MIB_CHECKABLE ); + pMenu->CheckItem( MID_LAYOUT_TABS, mpImpl->GetLayout() != LAYOUT_DRAWERS ); + pMenu->InsertItem( MID_LAYOUT_DRAWERS, String::CreateFromAscii( "Drawer-Layout" ), MIB_CHECKABLE ); + pMenu->CheckItem( MID_LAYOUT_DRAWERS, mpImpl->GetLayout() == LAYOUT_DRAWERS ); + + pMenu->InsertSeparator(); +#endif // Add entry for docking or un-docking the tool panel. if (bIsDocking) @@ -569,6 +662,7 @@ IMPL_LINK(ToolPanelViewShell, MenuSelectHandler, Menu*, pMenu) pMenu->InsertItem ( MID_LOCK_TASK_PANEL, String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_LOCK))); + pMenu->RemoveDisabledEntries (FALSE, FALSE); return pMenu; @@ -663,15 +757,15 @@ void ToolPanelViewShell::ConnectToDockingWindow() // Tell the focus manager that we want to pass the focus to our // child. - FocusManager::Instance().RegisterDownLink( GetParentWindow(), mpPanelDeck.get() ); + FocusManager::Instance().RegisterDownLink( GetParentWindow(), &mpImpl->GetPanelDeck() ); } // --------------------------------------------------------------------------------------------------------------------- bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow ) { ::Window* pOldParentWindow = GetParentWindow(); - FocusManager::Instance().RemoveLinks( pOldParentWindow, mpPanelDeck.get() ); - FocusManager::Instance().RemoveLinks( mpPanelDeck.get(), pOldParentWindow ); + FocusManager::Instance().RemoveLinks( pOldParentWindow, &mpImpl->GetPanelDeck() ); + FocusManager::Instance().RemoveLinks( &mpImpl->GetPanelDeck(), pOldParentWindow ); PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( GetDockingWindow() ); if ( pDockingWindow != NULL ) @@ -691,13 +785,13 @@ bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow ) // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell::DeactivatePanel( const PanelId i_ePanelId ) { - mpImpl->DeactivatePanelDirectly( i_ePanelId, *mpPanelDeck ); + mpImpl->DeactivatePanelDirectly( i_ePanelId ); } // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell::ActivatePanel( const PanelId i_ePanelId ) { - mpImpl->ActivatePanelDirectly( i_ePanelId, *mpPanelDeck ); + mpImpl->ActivatePanelDirectly( i_ePanelId ); } @@ -705,9 +799,11 @@ void ToolPanelViewShell::ActivatePanel( const PanelId i_ePanelId ) // = ToolPanelViewShell:Implementation - implementation // ===================================================================================================================== // --------------------------------------------------------------------------------------------------------------------- -ToolPanelViewShell::Implementation::Implementation( ToolPanelViewShell& i_rPanelViewShell ) +ToolPanelViewShell::Implementation::Implementation( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent ) :m_aPanels( PanelDescriptors::size_type( PID__END ) ) ,m_rPanelViewShell( i_rPanelViewShell ) + ,m_pPanelDeck( new ToolPanelDeck( i_rPanelDeckParent, i_rPanelViewShell ) ) + ,m_eCurrentLayout( LAYOUT_DRAWERS ) { } @@ -717,7 +813,7 @@ ToolPanelViewShell::Implementation::~Implementation() } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::TogglePanelVisibility( const size_t i_nLogicalPanelIndex, ToolPanelDeck& i_rPanelDeck ) +void ToolPanelViewShell::Implementation::TogglePanelVisibility( const size_t i_nLogicalPanelIndex ) { ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < m_aPanels.size(), "illegal index" ); @@ -730,35 +826,35 @@ void ToolPanelViewShell::Implementation::TogglePanelVisibility( const size_t i_n } if ( m_aPanels[ i_nLogicalPanelIndex ].bHidden ) { - OSL_VERIFY( i_rPanelDeck.InsertPanel( m_aPanels[ i_nLogicalPanelIndex ].pPanel, nActualPanelIndex ) == nActualPanelIndex ); + OSL_VERIFY( m_pPanelDeck->InsertPanel( m_aPanels[ i_nLogicalPanelIndex ].pPanel, nActualPanelIndex ) == nActualPanelIndex ); // if there has not been an active panel before, activate the newly inserted one - ::boost::optional< size_t > aActivePanel( i_rPanelDeck.GetActivePanel() ); + ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() ); if ( !aActivePanel ) - i_rPanelDeck.ActivatePanelResource( nActualPanelIndex ); + m_pPanelDeck->ActivatePanelResource( nActualPanelIndex ); } else { - OSL_VERIFY( i_rPanelDeck.RemovePanel( nActualPanelIndex ).get() == m_aPanels[ i_nLogicalPanelIndex ].pPanel.get() ); + OSL_VERIFY( m_pPanelDeck->RemovePanel( nActualPanelIndex ).get() == m_aPanels[ i_nLogicalPanelIndex ].pPanel.get() ); } m_aPanels[ i_nLogicalPanelIndex ].bHidden = !m_aPanels[ i_nLogicalPanelIndex ].bHidden; } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::DeactivatePanelDirectly( const PanelId i_nPanelId, ToolPanelDeck& i_rPanelDeck ) +void ToolPanelViewShell::Implementation::DeactivatePanelDirectly( const PanelId i_nPanelId ) { for ( size_t i=0; i() ); + if ( m_pPanelDeck->GetActivePanel() == i ) + m_pPanelDeck->ActivatePanelDirectly( ::boost::optional< size_t >() ); return; } } } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::ActivatePanelDirectly( const PanelId i_nPanelId, ToolPanelDeck& i_rPanelDeck ) +void ToolPanelViewShell::Implementation::ActivatePanelDirectly( const PanelId i_nPanelId ) { size_t nActualPanelIndex(0); for ( size_t i=0; iActivatePanelDirectly( nActualPanelIndex ); return; } if ( !m_aPanels[i].bHidden ) @@ -798,16 +894,17 @@ void ToolPanelViewShell::Implementation::PanelRemoved( const size_t i_nPosition } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) +void ToolPanelViewShell::Implementation::UpdateDockingWindowTitle() { - (void)i_rOldActive; PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( m_rPanelViewShell.GetDockingWindow() ); - ENSURE_OR_RETURN_VOID( pDockingWindow, "ToolPanelViewShell::Implementation::ActivePanelChanged: no PaneDockingWindow!?" ); - if ( !i_rNewActive ) + ENSURE_OR_RETURN_VOID( pDockingWindow, "ToolPanelViewShell::Implementation::UpdateDockingWindowTitle: no PaneDockingWindow!?" ); + + ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() ); + if ( !aActivePanel || ( GetLayout() == LAYOUT_DRAWERS ) ) pDockingWindow->SetTitle( String( SdResId( STR_RIGHT_PANE_TITLE ) ) ); else { - size_t nNewActive( *i_rNewActive ); + size_t nNewActive( *aActivePanel ); for ( size_t i=0; i < m_aPanels.size(); ++i ) { if ( m_aPanels[i].bHidden ) @@ -823,6 +920,18 @@ void ToolPanelViewShell::Implementation::ActivePanelChanged( const ::boost::opti } } +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Implementation::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) +{ + if ( GetLayout() == LAYOUT_DRAWERS ) + // no adjustment of the title when we use the classical "drawers" layout + return; + + UpdateDockingWindowTitle( ); + (void)i_rOldActive; + (void)i_rNewActive; +} + // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell::Implementation::Dying() { diff --git a/sd/source/ui/toolpanel/makefile.mk b/sd/source/ui/toolpanel/makefile.mk index 4ba8968bd..775ff3515 100644 --- a/sd/source/ui/toolpanel/makefile.mk +++ b/sd/source/ui/toolpanel/makefile.mk @@ -62,6 +62,7 @@ SLOFILES = \ $(SLO)$/TaskPaneViewShell.obj \ $(SLO)$/ToolPanelViewShell.obj \ $(SLO)$/ToolPanelDeck.obj \ + $(SLO)$/ToolPanelDrawer.obj \ $(SLO)$/TaskPaneToolPanel.obj \ \ $(SLO)$/EmptyWindow.obj \ -- cgit v1.2.3 From a7622c14055e041511ea4d181fbfdcd85ba7b7a7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 17 Mar 2010 09:21:56 +0100 Subject: slidecopy: keyboard accessibility for the ToolPanelDrawer implementation --- sd/source/ui/inc/taskpane/TitleBar.hxx | 4 +-- sd/source/ui/inc/taskpane/TitledControl.hxx | 1 - sd/source/ui/toolpanel/TitleBar.cxx | 19 ++++++++++--- sd/source/ui/toolpanel/TitledControl.cxx | 12 +------- sd/source/ui/toolpanel/ToolPanelDeck.cxx | 2 +- sd/source/ui/toolpanel/ToolPanelDrawer.cxx | 44 +++++++++++++++++++++++------ 6 files changed, 55 insertions(+), 27 deletions(-) diff --git a/sd/source/ui/inc/taskpane/TitleBar.hxx b/sd/source/ui/inc/taskpane/TitleBar.hxx index e396a7cbf..64dd5eee4 100644 --- a/sd/source/ui/inc/taskpane/TitleBar.hxx +++ b/sd/source/ui/inc/taskpane/TitleBar.hxx @@ -88,8 +88,8 @@ public: virtual bool Expand (bool bFlag = true); virtual bool IsExpanded (void) const; virtual void SetEnabledState(bool bFlag); - - void SetFocus (bool bFlag); + virtual void GetFocus (void); + virtual void LoseFocus (void); virtual void MouseMove(const MouseEvent& rEvent); /** Empty implementation prevents forwarding to docking window. diff --git a/sd/source/ui/inc/taskpane/TitledControl.hxx b/sd/source/ui/inc/taskpane/TitledControl.hxx index a299abcf0..4d002349b 100644 --- a/sd/source/ui/inc/taskpane/TitledControl.hxx +++ b/sd/source/ui/inc/taskpane/TitledControl.hxx @@ -101,7 +101,6 @@ public: virtual void Resize (void); virtual void GetFocus (void); - virtual void LoseFocus (void); virtual void KeyInput (const KeyEvent& rEvent); // void Select (bool bExpansionState); diff --git a/sd/source/ui/toolpanel/TitleBar.cxx b/sd/source/ui/toolpanel/TitleBar.cxx index 5384474c5..4cd5ab138 100644 --- a/sd/source/ui/toolpanel/TitleBar.cxx +++ b/sd/source/ui/toolpanel/TitleBar.cxx @@ -63,7 +63,7 @@ namespace sd { namespace toolpanel { const int TitleBar::snIndentationWidth = 16; TitleBar::TitleBar ( ::Window* pParent, const String& rsTitle, TitleBarType eType, bool bIsExpandable) -: ::Window (pParent) +: ::Window (pParent, WB_TABSTOP) , TreeNode(this) , meType(eType) , msTitle(rsTitle) @@ -219,10 +219,21 @@ void TitleBar::SetEnabledState(bool bFlag) } -void TitleBar::SetFocus (bool bFlag) + + +void TitleBar::GetFocus() { - mbFocused = bFlag; - Invalidate (); + mbFocused = true; + Invalidate(); +} + + + + +void TitleBar::LoseFocus() +{ + mbFocused = false; + Invalidate(); } diff --git a/sd/source/ui/toolpanel/TitledControl.cxx b/sd/source/ui/toolpanel/TitledControl.cxx index 371857eab..f87bf05a4 100644 --- a/sd/source/ui/toolpanel/TitledControl.cxx +++ b/sd/source/ui/toolpanel/TitledControl.cxx @@ -222,17 +222,7 @@ void TitledControl::GetFocus (void) { ::Window::GetFocus(); if (GetTitleBar() != NULL) - GetTitleBar()->SetFocus (true); -} - - - - -void TitledControl::LoseFocus (void) -{ - ::Window::LoseFocus(); - if (GetTitleBar() != NULL) - GetTitleBar()->SetFocus (false); + GetTitleBar()->GrabFocus(); } diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.cxx b/sd/source/ui/toolpanel/ToolPanelDeck.cxx index af3095d77..f12416e7a 100644 --- a/sd/source/ui/toolpanel/ToolPanelDeck.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDeck.cxx @@ -67,7 +67,7 @@ namespace sd { namespace toolpanel //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ ToolPanelDeck::ToolPanelDeck( Window& i_rParent, ToolPanelViewShell& i_rViewShell ) - :ToolPanelDeck_Base( i_rParent, 0 ) + :ToolPanelDeck_Base( i_rParent, WB_DIALOGCONTROL ) ,m_rViewShell( i_rViewShell ) { SetDrawersLayout(); diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx index 6655ba196..f79551129 100644 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx @@ -113,7 +113,15 @@ namespace sd { namespace toolpanel //------------------------------------------------------------------------------------------------------------------ void ToolPanelDrawer::SetFocusToPanelSelector() { - // TODO + const size_t nPanelCount( m_rPanelDeck.GetPanelCount() ); + if ( !nPanelCount ) + // nothing to focus + return; + ::boost::optional< size_t > aActivePanel( m_rPanelDeck.GetActivePanel() ); + if ( !aActivePanel ) + aActivePanel = 0; + ENSURE_OR_RETURN_VOID( *aActivePanel < m_aDrawers.size(), "ToolPanelDrawer::SetFocusToPanelSelector: invalid active panel, or inconsistent drawers!" ); + m_aDrawers[ *aActivePanel ]->GetWindow()->GrabFocus(); } //------------------------------------------------------------------------------------------------------------------ @@ -145,8 +153,6 @@ namespace sd { namespace toolpanel //------------------------------------------------------------------------------------------------------------------ void ToolPanelDrawer::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) { - impl_triggerRearrange(); - if ( !!i_rOldActive ) { OSL_ENSURE( *i_rOldActive < m_aDrawers.size(), "ToolPanelDrawer::ActivePanelChanged: illegal old index!" ); @@ -158,6 +164,8 @@ namespace sd { namespace toolpanel OSL_ENSURE( *i_rNewActive < m_aDrawers.size(), "ToolPanelDrawer::ActivePanelChanged: illegal new index!" ); m_aDrawers[ *i_rNewActive ]->Expand( true ); } + + impl_triggerRearrange(); } //------------------------------------------------------------------------------------------------------------------ @@ -187,18 +195,38 @@ namespace sd { namespace toolpanel IMPL_LINK( ToolPanelDrawer, OnWindowEvent, VclSimpleEvent*, i_pEvent ) { const VclWindowEvent* pWindowEvent = PTR_CAST( VclWindowEvent, i_pEvent ); - if ( !pWindowEvent ) - return 0L; + ENSURE_OR_RETURN( pWindowEvent, "no WindowEvent", 0L ); + bool bActivatePanel = false; switch ( pWindowEvent->GetId() ) { case VCLEVENT_WINDOW_MOUSEBUTTONUP: { - const size_t nPanelPos = impl_getPanelPositionFromWindow( pWindowEvent->GetWindow() ); - m_rPanelDeck.ActivatePanel( nPanelPos ); - return 1L; + const MouseEvent* pMouseEvent = static_cast< const MouseEvent* >( pWindowEvent->GetData() ); + ENSURE_OR_RETURN( pMouseEvent, "no mouse event with MouseButtonUp", 0L ); + if ( pMouseEvent->GetButtons() == MOUSE_LEFT ) + { + bActivatePanel = true; + } } break; + case VCLEVENT_WINDOW_KEYINPUT: + { + const KeyEvent* pKeyEvent = static_cast< const KeyEvent* >( pWindowEvent->GetData() ); + ENSURE_OR_RETURN( pKeyEvent, "no key event with KeyInput", 0L ); + const KeyCode& rKeyCode( pKeyEvent->GetKeyCode() ); + if ( ( rKeyCode.GetModifier() == 0 ) && ( rKeyCode.GetCode() == KEY_RETURN ) ) + { + bActivatePanel = true; + } + } + break; + } + if ( bActivatePanel ) + { + const size_t nPanelPos = impl_getPanelPositionFromWindow( pWindowEvent->GetWindow() ); + m_rPanelDeck.ActivatePanel( nPanelPos ); + return 1L; } return 0L; } -- cgit v1.2.3 From f04aa7242357f390b1577d31f44056b92d11e0ec Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 17 Mar 2010 10:48:49 +0100 Subject: slidecopy: removed the old TaskPane implementation, now completely superseded by the new one carrying both implementations was only temporary, to be able to easily compare both. The new implementation still has not A11Y API implementation, that's on the TODO list. --- sd/inc/app.hrc | 2 - sd/sdi/TaskPaneViewShell.sdi | 311 -------- sd/sdi/ToolPanelViewShell.sdi | 277 +++++++ sd/sdi/ViewShellBase.sdi | 31 - sd/sdi/makefile.mk | 2 - sd/sdi/sdslots.sdi | 1 - sd/source/ui/accessibility/AccessibleTaskPane.cxx | 97 --- sd/source/ui/accessibility/makefile.mk | 1 - sd/source/ui/app/sddll1.cxx | 2 - sd/source/ui/app/sddll2.cxx | 1 - sd/source/ui/app/sdmod1.cxx | 1 - sd/source/ui/dlg/PaneChildWindows.cxx | 22 +- sd/source/ui/dlg/PaneShells.cxx | 33 - .../ui/framework/factories/BasicPaneFactory.cxx | 14 +- .../ui/framework/factories/BasicViewFactory.cxx | 13 - .../ui/framework/factories/TaskPanelFactory.cxx | 32 +- sd/source/ui/framework/module/ImpressModule.cxx | 2 - sd/source/ui/framework/module/TaskPaneModule.cxx | 165 ---- sd/source/ui/framework/module/TaskPaneModule.hxx | 53 -- sd/source/ui/framework/module/ToolPanelModule.cxx | 4 +- sd/source/ui/framework/module/ToolPanelModule.hxx | 8 +- sd/source/ui/framework/module/makefile.mk | 1 - sd/source/ui/framework/tools/FrameworkHelper.cxx | 6 - sd/source/ui/inc/AccessibleTaskPane.hxx | 73 -- sd/source/ui/inc/PaneChildWindows.hxx | 10 - sd/source/ui/inc/PaneShells.hxx | 11 - sd/source/ui/inc/TaskPaneViewShell.hxx | 190 ----- sd/source/ui/inc/ViewShell.hxx | 3 +- sd/source/ui/inc/framework/FrameworkHelper.hxx | 2 - sd/source/ui/inc/taskpane/ILayoutableWindow.hxx | 2 +- sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx | 8 +- sd/source/ui/inc/taskpane/ToolPanel.hxx | 139 ---- .../ui/slidesorter/controller/SlsSlotManager.cxx | 1 - sd/source/ui/toolpanel/LayoutMenu.cxx | 1 - sd/source/ui/toolpanel/TaskPaneShellManager.hxx | 2 +- sd/source/ui/toolpanel/TaskPaneViewShell.cxx | 849 --------------------- sd/source/ui/toolpanel/ToolPanel.cxx | 337 -------- sd/source/ui/toolpanel/ToolPanelDrawer.cxx | 1 - sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 4 +- sd/source/ui/toolpanel/makefile.mk | 2 - sd/source/ui/view/GraphicViewShellBase.cxx | 1 - sd/source/ui/view/ToolBarManager.cxx | 1 - sd/source/ui/view/ViewShellBase.cxx | 14 +- sd/source/ui/view/ViewShellImplementation.cxx | 3 +- sd/source/ui/view/drviews6.cxx | 1 - sd/source/ui/view/viewshe3.cxx | 4 +- sd/uiconfig/simpress/menubar/menubar.xml | 1 - 47 files changed, 301 insertions(+), 2438 deletions(-) delete mode 100644 sd/sdi/TaskPaneViewShell.sdi delete mode 100644 sd/source/ui/accessibility/AccessibleTaskPane.cxx delete mode 100644 sd/source/ui/framework/module/TaskPaneModule.cxx delete mode 100644 sd/source/ui/framework/module/TaskPaneModule.hxx delete mode 100644 sd/source/ui/inc/AccessibleTaskPane.hxx delete mode 100644 sd/source/ui/inc/TaskPaneViewShell.hxx delete mode 100644 sd/source/ui/inc/taskpane/ToolPanel.hxx delete mode 100644 sd/source/ui/toolpanel/TaskPaneViewShell.cxx delete mode 100644 sd/source/ui/toolpanel/ToolPanel.cxx diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index 328795c7a..e83ccbbb7 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -466,6 +466,4 @@ #define SID_ADD_MOTION_PATH (SID_SD_START+441) #define SID_TABLE_TOOLBOX (SID_SD_START+442) -#define SID_TOOL_PANEL_PANE (SID_SD_START+443) - #endif diff --git a/sd/sdi/TaskPaneViewShell.sdi b/sd/sdi/TaskPaneViewShell.sdi deleted file mode 100644 index 2e3c64f4b..000000000 --- a/sd/sdi/TaskPaneViewShell.sdi +++ /dev/null @@ -1,311 +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: TaskPaneViewShell.sdi,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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -SfxVoidItem TaskPaneApplyToAllSlides SID_TP_APPLY_TO_ALL_SLIDES -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_VIEW; -] - -SfxVoidItem TaskPaneApplyToSelectedSlides SID_TP_APPLY_TO_SELECTED_SLIDES -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_VIEW; -] - -SfxVoidItem TaskPaneUseForNewPresentations SID_TP_USE_FOR_NEW_PRESENTATIONS -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_VIEW; -] - -SfxVoidItem TaskPaneShowSmallPreview SID_TP_SHOW_SMALL_PREVIEW -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_VIEW; -] - - -SfxVoidItem TaskPaneShowLargePreview SID_TP_SHOW_LARGE_PREVIEW -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_VIEW; -] - -SfxVoidItem TaskPaneEditMaster SID_TP_EDIT_MASTER -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_VIEW; -] - -SfxVoidItem TaskPaneInsertPage SID_INSERTPAGE_LAYOUT_MENU -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = TRUE, - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_INSERT; -] - - -interface MasterPagesSelectorInterface -{ - SID_TP_APPLY_TO_ALL_SLIDES - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - SID_TP_APPLY_TO_SELECTED_SLIDES - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - SID_TP_USE_FOR_NEW_PRESENTATIONS - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - SID_TP_SHOW_SMALL_PREVIEW - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - SID_TP_SHOW_LARGE_PREVIEW - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - - SID_TP_EDIT_MASTER - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - - // The copy and paste slots are included here so that they later can be - // disabled in order to remove them from context menus. - SID_CUT - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - SID_COPY - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - SID_PASTE - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - SID_DELETE_MASTER_PAGE - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] -} - -interface TaskPaneLayoutMenuInterface -{ - SID_TP_APPLY_TO_SELECTED_SLIDES - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - SID_INSERTPAGE_LAYOUT_MENU - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - - // The copy and paste slots are included here so that they later can be - // disabled in order to remove them from context menus. - SID_CUT - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - SID_COPY - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - SID_PASTE - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] -} - -shell MasterPagesSelector -{ - import MasterPagesSelectorInterface[Automation]; -} - -shell LayoutMenu -{ - import TaskPaneLayoutMenuInterface[Automation]; -} - -shell TaskPaneViewShell -{ -} - diff --git a/sd/sdi/ToolPanelViewShell.sdi b/sd/sdi/ToolPanelViewShell.sdi index fdbbc9d25..c954a6312 100644 --- a/sd/sdi/ToolPanelViewShell.sdi +++ b/sd/sdi/ToolPanelViewShell.sdi @@ -24,6 +24,283 @@ * ************************************************************************/ +SfxVoidItem TaskPaneApplyToAllSlides SID_TP_APPLY_TO_ALL_SLIDES +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_VIEW; +] + +SfxVoidItem TaskPaneApplyToSelectedSlides SID_TP_APPLY_TO_SELECTED_SLIDES +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_VIEW; +] + +SfxVoidItem TaskPaneUseForNewPresentations SID_TP_USE_FOR_NEW_PRESENTATIONS +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_VIEW; +] + +SfxVoidItem TaskPaneShowSmallPreview SID_TP_SHOW_SMALL_PREVIEW +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_VIEW; +] + + +SfxVoidItem TaskPaneShowLargePreview SID_TP_SHOW_LARGE_PREVIEW +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_VIEW; +] + +SfxVoidItem TaskPaneEditMaster SID_TP_EDIT_MASTER +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_VIEW; +] + +SfxVoidItem TaskPaneInsertPage SID_INSERTPAGE_LAYOUT_MENU +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = TRUE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_INSERT; +] + + +interface MasterPagesSelectorInterface +{ + SID_TP_APPLY_TO_ALL_SLIDES + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + SID_TP_APPLY_TO_SELECTED_SLIDES + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + SID_TP_USE_FOR_NEW_PRESENTATIONS + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + SID_TP_SHOW_SMALL_PREVIEW + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + SID_TP_SHOW_LARGE_PREVIEW + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + + SID_TP_EDIT_MASTER + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + + // The copy and paste slots are included here so that they later can be + // disabled in order to remove them from context menus. + SID_CUT + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + SID_COPY + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + SID_PASTE + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + SID_DELETE_MASTER_PAGE + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] +} + +interface TaskPaneLayoutMenuInterface +{ + SID_TP_APPLY_TO_SELECTED_SLIDES + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + SID_INSERTPAGE_LAYOUT_MENU + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + + // The copy and paste slots are included here so that they later can be + // disabled in order to remove them from context menus. + SID_CUT + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + SID_COPY + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + SID_PASTE + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] +} + +shell MasterPagesSelector +{ + import MasterPagesSelectorInterface[Automation]; +} + +shell LayoutMenu +{ + import TaskPaneLayoutMenuInterface[Automation]; +} + shell ToolPanelViewShell { } diff --git a/sd/sdi/ViewShellBase.sdi b/sd/sdi/ViewShellBase.sdi index 226bd38cb..67d9cfb1e 100644 --- a/sd/sdi/ViewShellBase.sdi +++ b/sd/sdi/ViewShellBase.sdi @@ -164,32 +164,6 @@ SfxBoolItem RightPane SID_RIGHT_PANE GroupId = GID_MODIFY; ] -SfxBoolItem ToolPanel SID_TOOL_PANEL_PANE - -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_MODIFY; -] - SfxVoidItem NotesChildWindow SID_NOTES_WINDOW [ @@ -314,11 +288,6 @@ interface ViewShellBaseView ExecMethod = Execute; StateMethod = GetState; ] - SID_TOOL_PANEL_PANE - [ - ExecMethod = Execute; - StateMethod = GetState; - ] SID_NOTES_WINDOW [ ExecMethod = Execute; diff --git a/sd/sdi/makefile.mk b/sd/sdi/makefile.mk index dbe86abd7..7205134b1 100644 --- a/sd/sdi/makefile.mk +++ b/sd/sdi/makefile.mk @@ -70,7 +70,6 @@ SVSDI1DEPEND= \ outlnvsh.sdi \ SlideSorterController.sdi \ ViewShellBase.sdi \ - TaskPaneViewShell.sdi \ ToolPanelViewShell.sdi \ sdslots.hrc \ $(PRJ)$/inc$/app.hrc @@ -93,7 +92,6 @@ SVSDI2DEPEND= \ mediaob.sdi \ outlnvsh.sdi \ ViewShellBase.sdi \ - TaskPaneViewShell.sdi \ ToolPanelViewShell.sdi \ sdslots.hrc \ $(PRJ)$/inc$/app.hrc diff --git a/sd/sdi/sdslots.sdi b/sd/sdi/sdslots.sdi index 49350f821..667b2f9ff 100644 --- a/sd/sdi/sdslots.sdi +++ b/sd/sdi/sdslots.sdi @@ -107,6 +107,5 @@ ModulePrefix( "Sd" ) include "ViewShellBase.sdi" include "mediaob.sdi" include "tables.sdi" - include "TaskPaneViewShell.sdi" include "ToolPanelViewShell.sdi" } diff --git a/sd/source/ui/accessibility/AccessibleTaskPane.cxx b/sd/source/ui/accessibility/AccessibleTaskPane.cxx deleted file mode 100644 index 7612d3133..000000000 --- a/sd/source/ui/accessibility/AccessibleTaskPane.cxx +++ /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: AccessibleTaskPane.cxx,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "AccessibleTaskPane.hxx" - -#include "AccessibleTreeNode.hxx" - -#include "taskpane/ToolPanel.hxx" -#include "taskpane/ControlContainer.hxx" -#include "taskpane/TitledControl.hxx" -#include - -#include -#include - -using namespace ::rtl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::accessibility; -using namespace ::com::sun::star::uno; - -namespace accessibility { - -AccessibleTaskPane::AccessibleTaskPane ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> & rxParent, - const OUString& rsName, - const OUString& rsDescription, - ::sd::toolpanel::ToolPanel& rTaskPane) - : AccessibleTreeNode( - rxParent, - rTaskPane, - rsName, - rsDescription, - AccessibleRole::PANEL) -{ -} - - - - -AccessibleTaskPane::~AccessibleTaskPane (void) -{ -} - - - - -//===== XServiceInfo ======================================================== - -OUString SAL_CALL - AccessibleTaskPane::getImplementationName (void) - throw (RuntimeException) -{ - return OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleTaskPane")); -} - - - - -void AccessibleTaskPane::UpdateStateSet (void) -{ - // The task pane itself can not be focused. - UpdateState(AccessibleStateType::FOCUSED, false); -} - - -} // end of namespace accessibility diff --git a/sd/source/ui/accessibility/makefile.mk b/sd/source/ui/accessibility/makefile.mk index f92202149..58f522512 100755 --- a/sd/source/ui/accessibility/makefile.mk +++ b/sd/source/ui/accessibility/makefile.mk @@ -60,7 +60,6 @@ SLOFILES = \ $(SLO)$/AccessibleScrollPanel.obj \ $(SLO)$/AccessibleSlideSorterView.obj \ $(SLO)$/AccessibleSlideSorterObject.obj \ - $(SLO)$/AccessibleTaskPane.obj \ $(SLO)$/AccessibleTreeNode.obj \ $(SLO)$/SdShapeTypes.obj diff --git a/sd/source/ui/app/sddll1.cxx b/sd/source/ui/app/sddll1.cxx index 00810fd53..ec5c067a6 100644 --- a/sd/source/ui/app/sddll1.cxx +++ b/sd/source/ui/app/sddll1.cxx @@ -53,7 +53,6 @@ #include "GraphicDocShell.hxx" #include "SlideSorterViewShell.hxx" #include "taskpane/ToolPanelViewShell.hxx" -#include "TaskPaneViewShell.hxx" #include "FactoryIds.hxx" #include "sdmod.hxx" #include "app.hrc" @@ -131,7 +130,6 @@ void SdDLL::RegisterInterfaces() // View shells for the side panes. ::sd::slidesorter::SlideSorterViewShell::RegisterInterface (pMod); - ::sd::toolpanel::TaskPaneViewShell::RegisterInterface(pMod); ::sd::toolpanel::ToolPanelViewShell::RegisterInterface(pMod); // Tell the tool panel view shell to register the interfaces of its // controls. diff --git a/sd/source/ui/app/sddll2.cxx b/sd/source/ui/app/sddll2.cxx index 6796ba1be..e418cc296 100644 --- a/sd/source/ui/app/sddll2.cxx +++ b/sd/source/ui/app/sddll2.cxx @@ -158,7 +158,6 @@ void SdDLL::RegisterControllers() ::avmedia::MediaPlayer::RegisterChildWindow(0, pMod); ::sd::LeftPaneImpressChildWindow::RegisterChildWindow(0, pMod); ::sd::LeftPaneDrawChildWindow::RegisterChildWindow(0, pMod); - ::sd::RightPaneChildWindow::RegisterChildWindow(0, pMod); ::sd::ToolPanelChildWindow::RegisterChildWindow(0, pMod); SvxFillToolBoxControl::RegisterControl(0, pMod); diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index c6c4026af..152821294 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -71,7 +71,6 @@ #include "sdresid.hxx" #include "OutlineViewShell.hxx" #include "ViewShellBase.hxx" -#include "TaskPaneViewShell.hxx" #ifndef SD_FRAMW_VIEW_HXX #include "FrameView.hxx" #endif diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx index c6d6a8550..2f34ff2ab 100644 --- a/sd/source/ui/dlg/PaneChildWindows.cxx +++ b/sd/source/ui/dlg/PaneChildWindows.cxx @@ -48,8 +48,7 @@ namespace sd { SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS) SFX_IMPL_DOCKINGWINDOW(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW) -SFX_IMPL_DOCKINGWINDOW(RightPaneChildWindow, SID_RIGHT_PANE) -SFX_IMPL_DOCKINGWINDOW( ToolPanelChildWindow, SID_TOOL_PANEL_PANE ) +SFX_IMPL_DOCKINGWINDOW( ToolPanelChildWindow, SID_RIGHT_PANE) //===== PaneChildWindow ======================================================= @@ -141,25 +140,6 @@ LeftPaneDrawChildWindow::LeftPaneDrawChildWindow ( -//===== RightPaneChildWindow ================================================== - -RightPaneChildWindow::RightPaneChildWindow ( - ::Window* pParentWindow, - USHORT nId, - SfxBindings* pBindings, - SfxChildWinInfo* pInfo) - : PaneChildWindow( - pParentWindow, - nId, - pBindings, - pInfo, - FLT_RIGHT_PANE_DOCKING_WINDOW, - STR_RIGHT_PANE_TITLE, - SFX_ALIGN_RIGHT) -{ -} - - //====================================================================================================================== //= ToolPanelChildWindow //====================================================================================================================== diff --git a/sd/source/ui/dlg/PaneShells.cxx b/sd/source/ui/dlg/PaneShells.cxx index 1d2092dd6..45878bb0e 100644 --- a/sd/source/ui/dlg/PaneShells.cxx +++ b/sd/source/ui/dlg/PaneShells.cxx @@ -112,39 +112,6 @@ LeftDrawPaneShell::~LeftDrawPaneShell (void) -//===== RightPaneShell ======================================================== - -#undef ShellClass -#define ShellClass RightPaneShell - -SFX_SLOTMAP(RightPaneShell) -{ - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } -}; - -SFX_IMPL_INTERFACE(RightPaneShell, SfxShell, SdResId(STR_RIGHT_PANE_SHELL)) -{ - SFX_CHILDWINDOW_REGISTRATION( - ::sd::RightPaneChildWindow::GetChildWindowId()); -} - -TYPEINIT1(RightPaneShell, SfxShell); - - - -RightPaneShell::RightPaneShell (void) - : SfxShell() -{ - SetName(rtl::OUString::createFromAscii("RightPane")); -} - - - - -RightPaneShell::~RightPaneShell (void) -{ -} - //===== ToolPanelPaneShell ======================================================== #undef ShellClass diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx index 9ba4dd41e..627173304 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx @@ -59,8 +59,7 @@ namespace { FullScreenPaneId, LeftImpressPaneId, LeftDrawPaneId, - RightPaneId, - ToolPanelPaneId + RightPaneId }; static const sal_Int32 gnConfigurationUpdateStartEvent(0); @@ -244,11 +243,6 @@ void SAL_CALL BasicPaneFactory::initialize (const Sequence& aArguments) aDescriptor.mePaneId = RightPaneId; mpPaneContainer->push_back(aDescriptor); xCC->addResourceFactory(aDescriptor.msPaneURL, this); - - aDescriptor.msPaneURL = FrameworkHelper::msToolPanelPaneURL; - aDescriptor.mePaneId = ToolPanelPaneId; - mpPaneContainer->push_back(aDescriptor); - xCC->addResourceFactory(aDescriptor.msPaneURL, this); } // Register as configuration change listener. @@ -318,7 +312,6 @@ Reference SAL_CALL BasicPaneFactory::createResource ( case LeftImpressPaneId: case LeftDrawPaneId: case RightPaneId: - case ToolPanelPaneId: xPane = CreateChildWindowPane( rxPaneId, *iDescriptor); @@ -539,11 +532,6 @@ Reference BasicPaneFactory::CreateChildWindowPane ( break; case RightPaneId: - pShell.reset(new RightPaneShell()); - nChildWindowId = ::sd::RightPaneChildWindow::GetChildWindowId(); - break; - - case ToolPanelPaneId: pShell.reset(new ToolPanelPaneShell()); nChildWindowId = ::sd::ToolPanelChildWindow::GetChildWindowId(); break; diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 94ba56a3d..518821f4b 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -46,7 +46,6 @@ #include "DrawViewShell.hxx" #include "GraphicViewShell.hxx" #include "OutlineViewShell.hxx" -#include "TaskPaneViewShell.hxx" #include "taskpane/ToolPanelViewShell.hxx" #include "PresentationViewShell.hxx" #include "SlideSorterViewShell.hxx" @@ -335,7 +334,6 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence& aArguments) mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msTaskPaneURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msToolPanelViewURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this); } catch (RuntimeException&) @@ -453,15 +451,6 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence& aArguments) pFrameView)); } else if (rsViewURL.equals(FrameworkHelper::msTaskPaneURL)) - { - pViewShell.reset( - new ::sd::toolpanel::TaskPaneViewShell ( - &rFrame, - *mpBase, - &rWindow, - pFrameView)); - } - else if (rsViewURL.equals(FrameworkHelper::msToolPanelViewURL)) { pViewShell.reset( new ::sd::toolpanel::ToolPanelViewShell( @@ -546,8 +535,6 @@ bool BasicViewFactory::IsCacheable (const ::boost::shared_ptr& r FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftImpressPaneURL)); maCacheableResources.push_back(pHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL)); - maCacheableResources.push_back(pHelper->CreateResourceId( - FrameworkHelper::msToolPanelViewURL, FrameworkHelper::msToolPanelPaneURL)); } ::std::vector >::const_iterator iId; diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/sd/source/ui/framework/factories/TaskPanelFactory.cxx index a28980504..6f8c7b8bd 100644 --- a/sd/source/ui/framework/factories/TaskPanelFactory.cxx +++ b/sd/source/ui/framework/factories/TaskPanelFactory.cxx @@ -31,7 +31,6 @@ #include "precompiled_sd.hxx" #include "TaskPanelFactory.hxx" -#include "TaskPaneViewShell.hxx" #include "taskpane/ToolPanelViewShell.hxx" #include "DrawController.hxx" #include "framework/FrameworkHelper.hxx" @@ -44,7 +43,6 @@ using namespace ::com::sun::star::drawing::framework; using ::rtl::OUString; using ::sd::framework::FrameworkHelper; -using ::sd::toolpanel::TaskPaneViewShell; namespace sd { namespace framework { @@ -265,21 +263,11 @@ Reference SAL_CALL TaskPanelFactory::createResource ( const ::rtl::OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ]; const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) ); - toolpanel::TaskPaneViewShell* pTaskPane = dynamic_cast< toolpanel::TaskPaneViewShell* >( pPaneViewShell.get() ); - if ( pTaskPane != NULL ) + toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() ); + if ( pToolPanel != NULL ) { xResource = new TaskPanelResource( rxResourceId ); - pTaskPane->ShowPanel(ePanelId); - pTaskPane->ExpandPanel(ePanelId); - } - else - { - toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() ); - if ( pToolPanel != NULL ) - { - xResource = new TaskPanelResource( rxResourceId ); - pToolPanel->ActivatePanel( ePanelId ); - } + pToolPanel->ActivatePanel( ePanelId ); } OSL_POSTCOND( xResource.is(), "TaskPanelFactory::createResource: did not find the given resource!" ); @@ -312,23 +300,13 @@ void SAL_CALL TaskPanelFactory::releaseResource ( if ( pPaneViewShell != NULL ) { toolpanel::PanelId ePanelId( lcl_getPanelId( xResourceId->getResourceURL() ) ); - toolpanel::TaskPaneViewShell* pTaskPane( dynamic_cast< toolpanel::TaskPaneViewShell* >( pPaneViewShell.get() ) ); toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() ); if ( ( ePanelId != toolpanel::PID_UNKNOWN ) - && ( ( pTaskPane != NULL ) - || ( pToolPanel != NULL ) - ) + && ( pToolPanel != NULL ) ) { - if ( pTaskPane != NULL ) - { - pTaskPane->CollapsePanel( ePanelId ); - } - if ( pToolPanel != NULL ) - { - pToolPanel->DeactivatePanel( ePanelId ); - } + pToolPanel->DeactivatePanel( ePanelId ); } else { diff --git a/sd/source/ui/framework/module/ImpressModule.cxx b/sd/source/ui/framework/module/ImpressModule.cxx index 1c0b1a758..beb7aa914 100644 --- a/sd/source/ui/framework/module/ImpressModule.cxx +++ b/sd/source/ui/framework/module/ImpressModule.cxx @@ -36,7 +36,6 @@ #include "ViewTabBarModule.hxx" #include "CenterViewFocusModule.hxx" #include "SlideSorterModule.hxx" -#include "TaskPaneModule.hxx" #include "ToolPanelModule.hxx" #include "ToolBarModule.hxx" #include "ShellStackGuard.hxx" @@ -58,7 +57,6 @@ void ImpressModule::Initialize (Reference& 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/TaskPaneModule.cxx b/sd/source/ui/framework/module/TaskPaneModule.cxx deleted file mode 100644 index d4c42318d..000000000 --- a/sd/source/ui/framework/module/TaskPaneModule.cxx +++ /dev/null @@ -1,165 +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: TaskPaneModule.cxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_sd.hxx" - -#include "TaskPaneModule.hxx" -#include "ReadOnlyModeObserver.hxx" -#include "framework/FrameworkHelper.hxx" - -#include -#include - -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::drawing::framework; -using ::rtl::OUString; -using ::sd::framework::FrameworkHelper; - - -namespace sd { namespace framework { - -namespace { - -typedef ::cppu::WeakComponentImplHelper1 < - ::com::sun::star::frame::XStatusListener - > LocalReadOnlyModeObserverInterfaceBase; - -/** This local class enables or disables the ResourceManager of a - TaskPaneModule. 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 - between the ResourceManager and the ReadOnlyModeObserver is removed and - the ReadOnlyModeObserver typically looses its last reference and is - destroyed. -*/ -class LocalReadOnlyModeObserver - : private MutexOwner, - public LocalReadOnlyModeObserverInterfaceBase -{ -public: - LocalReadOnlyModeObserver ( - const Reference& rxController, - const ::rtl::Reference& rpResourceManager) - : MutexOwner(), - LocalReadOnlyModeObserverInterfaceBase(maMutex), - mpResourceManager(rpResourceManager), - mpObserver(new ReadOnlyModeObserver(rxController)) - { - mpObserver->AddStatusListener(this); - - Reference xComponent ( - static_cast(mpResourceManager.get()), UNO_QUERY); - if (xComponent.is()) - xComponent->addEventListener(this); - } - - ~LocalReadOnlyModeObserver (void) - { - } - - virtual void SAL_CALL disposing (void) - { - Reference xComponent (static_cast(mpObserver.get()), UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); - - xComponent = Reference( - static_cast(mpResourceManager.get()), UNO_QUERY); - if (xComponent.is()) - xComponent->removeEventListener(this); - - } - - virtual void SAL_CALL disposing (const com::sun::star::lang::EventObject& rEvent) - throw(RuntimeException) - { - if (rEvent.Source == Reference(static_cast(mpObserver.get()))) - { - mpObserver = NULL; - } - else if (rEvent.Source == Reference( - static_cast(mpResourceManager.get()))) - { - mpResourceManager = NULL; - } - dispose(); - } - - virtual void SAL_CALL statusChanged (const com::sun::star::frame::FeatureStateEvent& rEvent) - throw(RuntimeException) - { - bool bReadWrite (true); - if (rEvent.IsEnabled) - rEvent.State >>= bReadWrite; - - if (bReadWrite) - mpResourceManager->Enable(); - else - mpResourceManager->Disable(); - } - -private: - ::rtl::Reference mpResourceManager; - ::rtl::Reference mpObserver; - -}; -} - - - - -//===== TaskPaneModule ==================================================== - -void TaskPaneModule::Initialize (const Reference& rxController) -{ - ::rtl::Reference pResourceManager ( - new ResourceManager( - rxController, - FrameworkHelper::CreateResourceId( - FrameworkHelper::msTaskPaneURL, - FrameworkHelper::msRightPaneURL))); - pResourceManager->AddActiveMainView(FrameworkHelper::msImpressViewURL); - pResourceManager->AddActiveMainView(FrameworkHelper::msNotesViewURL); - pResourceManager->AddActiveMainView(FrameworkHelper::msHandoutViewURL); - pResourceManager->AddActiveMainView(FrameworkHelper::msSlideSorterURL); - - new LocalReadOnlyModeObserver(rxController, pResourceManager); -} - - - - -} } // end of namespace sd::framework diff --git a/sd/source/ui/framework/module/TaskPaneModule.hxx b/sd/source/ui/framework/module/TaskPaneModule.hxx deleted file mode 100644 index 6db499770..000000000 --- a/sd/source/ui/framework/module/TaskPaneModule.hxx +++ /dev/null @@ -1,53 +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: TaskPaneModule.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SD_FRAMEWORK_TASK_PANE_MODULE_HXX -#define SD_FRAMEWORK_TASK_PANE_MODULE_HXX - -#include "ResourceManager.hxx" - -#include - -namespace sd { namespace framework { - -class ReadOnlyModeObserver; - -/** This module is responsible for showing the task pane. -*/ -class TaskPaneModule -{ -public: - static void Initialize ( - const ::com::sun::star::uno::Reference& rxController); -}; - -} } // end of namespace sd::framework - -#endif diff --git a/sd/source/ui/framework/module/ToolPanelModule.cxx b/sd/source/ui/framework/module/ToolPanelModule.cxx index 53f9cbe01..ed9447efa 100644 --- a/sd/source/ui/framework/module/ToolPanelModule.cxx +++ b/sd/source/ui/framework/module/ToolPanelModule.cxx @@ -149,8 +149,8 @@ void ToolPanelModule::Initialize (const Reference& rxControl new ResourceManager( rxController, FrameworkHelper::CreateResourceId( - FrameworkHelper::msToolPanelViewURL, - FrameworkHelper::msToolPanelPaneURL))); + FrameworkHelper::msTaskPaneURL, + FrameworkHelper::msRightPaneURL))); pResourceManager->AddActiveMainView(FrameworkHelper::msImpressViewURL); pResourceManager->AddActiveMainView(FrameworkHelper::msNotesViewURL); pResourceManager->AddActiveMainView(FrameworkHelper::msHandoutViewURL); diff --git a/sd/source/ui/framework/module/ToolPanelModule.hxx b/sd/source/ui/framework/module/ToolPanelModule.hxx index 7697f2a0f..34b0ecf42 100644 --- a/sd/source/ui/framework/module/ToolPanelModule.hxx +++ b/sd/source/ui/framework/module/ToolPanelModule.hxx @@ -1,14 +1,10 @@ /************************************************************************* - * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TaskPaneModule.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -26,7 +22,7 @@ * * for a copy of the LGPLv3 License. * - ************************************************************************/ +************************************************************************/ #ifndef SD_FRAMEWORK_TOOL_PANEL_MODULE_HXX #define SD_FRAMEWORK_TOOL_PANEL_MODULE_HXX diff --git a/sd/source/ui/framework/module/makefile.mk b/sd/source/ui/framework/module/makefile.mk index 78c9e0038..82da23ba2 100644 --- a/sd/source/ui/framework/module/makefile.mk +++ b/sd/source/ui/framework/module/makefile.mk @@ -56,7 +56,6 @@ 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 122ab528d..fcc2ddc7c 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -187,8 +187,6 @@ const OUString FrameworkHelper::msLeftDrawPaneURL( msPaneURLPrefix + OUString::createFromAscii("LeftDrawPane")); const OUString FrameworkHelper::msRightPaneURL( msPaneURLPrefix + OUString::createFromAscii("RightPane")); -const OUString FrameworkHelper::msToolPanelPaneURL( - msPaneURLPrefix + OUString::createFromAscii("ToolPanel")); // View URLs. @@ -211,8 +209,6 @@ const OUString FrameworkHelper::msPresentationViewURL( msViewURLPrefix + OUString::createFromAscii("PresentationView")); const OUString FrameworkHelper::msTaskPaneURL( msViewURLPrefix + OUString::createFromAscii("TaskPane")); -const OUString FrameworkHelper::msToolPanelViewURL( - msViewURLPrefix + OUString::createFromAscii("ToolPanelPane")); // Tool bar URLs. @@ -594,7 +590,6 @@ ViewShell::ShellType FrameworkHelper::GetViewId (const rtl::OUString& rsViewURL) (*mpViewURLMap)[msSlideSorterURL] = ViewShell::ST_SLIDE_SORTER; (*mpViewURLMap)[msPresentationViewURL] = ViewShell::ST_PRESENTATION; (*mpViewURLMap)[msTaskPaneURL] = ViewShell::ST_TASK_PANE; - (*mpViewURLMap)[msToolPanelViewURL] = ViewShell::ST_TOOL_PANEL; } ViewURLMap::const_iterator iView (mpViewURLMap->find(rsViewURL)); if (iView != mpViewURLMap->end()) @@ -618,7 +613,6 @@ ViewShell::ShellType FrameworkHelper::GetViewId (const rtl::OUString& rsViewURL) case ViewShell::ST_SLIDE_SORTER : return msSlideSorterURL; case ViewShell::ST_PRESENTATION : return msPresentationViewURL; case ViewShell::ST_TASK_PANE : return msTaskPaneURL; - case ViewShell::ST_TOOL_PANEL: return msToolPanelViewURL; default: return OUString(); } diff --git a/sd/source/ui/inc/AccessibleTaskPane.hxx b/sd/source/ui/inc/AccessibleTaskPane.hxx deleted file mode 100644 index 9913869c3..000000000 --- a/sd/source/ui/inc/AccessibleTaskPane.hxx +++ /dev/null @@ -1,73 +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: AccessibleTaskPane.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SD_ACCESSIBILITY_ACCESSIBLE_TASK_PANE_HXX -#define SD_ACCESSIBILITY_ACCESSIBLE_TASK_PANE_HXX - -#include "AccessibleTreeNode.hxx" - -namespace sd { namespace toolpanel { -class ToolPanel; -} } - - -namespace accessibility { - -/** Make the task pane as implemented by sd::toolpanel::ToolPanel - accessible. - This derived class exists in order to disable the FOCUSED state. -*/ -class AccessibleTaskPane - : public AccessibleTreeNode -{ -public: - AccessibleTaskPane ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> & rxParent, - const ::rtl::OUString& rsName, - const ::rtl::OUString& rsDescription, - ::sd::toolpanel::ToolPanel& rTaskPane); - ~AccessibleTaskPane (void); - - //===== XServiceInfo ==================================================== - - /** Returns an identifier for the implementation of this object. - */ - virtual ::rtl::OUString SAL_CALL - getImplementationName (void) - throw (::com::sun::star::uno::RuntimeException); - -protected: - virtual void UpdateStateSet (void); -}; - -} // end of namespace accessibility - -#endif diff --git a/sd/source/ui/inc/PaneChildWindows.hxx b/sd/source/ui/inc/PaneChildWindows.hxx index e8fa8ac93..0e6e035fc 100644 --- a/sd/source/ui/inc/PaneChildWindows.hxx +++ b/sd/source/ui/inc/PaneChildWindows.hxx @@ -77,16 +77,6 @@ public: -class RightPaneChildWindow - : public PaneChildWindow -{ -public: - RightPaneChildWindow (::Window*, USHORT, SfxBindings*, SfxChildWinInfo*); - - SFX_DECL_CHILDWINDOW(RightPaneChildWindow); -}; - - //====================================================================================================================== //= ToolPanelChildWindow //====================================================================================================================== diff --git a/sd/source/ui/inc/PaneShells.hxx b/sd/source/ui/inc/PaneShells.hxx index 77d182a49..864fbc293 100644 --- a/sd/source/ui/inc/PaneShells.hxx +++ b/sd/source/ui/inc/PaneShells.hxx @@ -78,17 +78,6 @@ public: /** Shell that displays the right pane for both Impress and Draw. The shell does not do anything else and has especially no slots. */ -class RightPaneShell - : public SfxShell -{ -public: - TYPEINFO(); - SFX_DECL_INTERFACE(SD_IF_SDRIGHTPANESHELL) - - RightPaneShell (void); - virtual ~RightPaneShell (void); -}; - class ToolPanelPaneShell : public SfxShell { public: diff --git a/sd/source/ui/inc/TaskPaneViewShell.hxx b/sd/source/ui/inc/TaskPaneViewShell.hxx deleted file mode 100644 index d52361afa..000000000 --- a/sd/source/ui/inc/TaskPaneViewShell.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: TaskPaneViewShell.hxx,v $ - * $Revision: 1.12 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SD_TOOLPANEL_TASK_PANE_VIEW_SHELL_HXX -#define SD_TOOLPANEL_TASK_PANE_VIEW_SHELL_HXX - -#include "ViewShell.hxx" -#include "glob.hxx" -#include "framework/FrameworkHelper.hxx" -#include "taskpane/PanelId.hxx" -#include -#include -#include -#include - -#include -#include - -class PopupMenu; - -namespace sd { namespace toolpanel { - -class TaskPaneShellManager; -class TitleToolBox; -class TitleBar; -class TitledControl; -class ToolPanel; - -/** The tool panel is a view shell for some very specific reasons: - - It fits better into the concept of panes being docking windows whose - content, a view shell, can be exchanged on runtime. - - A control in the tool panel that wants to show a context menu has to - do that over the dispatcher of a shell. These shells, usually - implemented by the controls themselves, have to be managed by someone. - If interpreted as object bars this can be handled by the - ObjectBarManager of the ViewShell. -*/ -class TaskPaneViewShell - : public ViewShell -{ -public: - TYPEINFO(); - SFX_DECL_INTERFACE(SD_IF_SDTASKPANEVIEWSHELL) - - TaskPaneViewShell ( - SfxViewFrame* pFrame, - ViewShellBase& rViewShellBase, - ::Window* pParentWindow, - FrameView* pFrameView); - virtual ~TaskPaneViewShell (void); - - virtual void GetFocus (void); - virtual void LoseFocus (void); - virtual void KeyInput (const KeyEvent& rEvent); - using sd::ViewShell::KeyInput; - - virtual SdPage* GetActualPage (void); - virtual SdPage* getCurrentPage (void) const; - - void Execute (SfxRequest& rRequest); - void GetState (SfxItemSet& rItemSet); - - virtual void ArrangeGUIElements (void); - - TaskPaneShellManager& GetSubShellManager (void) const; - - /** Called when a mouse button has been pressed but not yet - released, this handler is used to show the popup menu of the - title bar. - */ - DECL_LINK(ToolboxClickHandler, ToolBox*); - DECL_LINK(MenuSelectHandler, Menu*); - - /** Make the specified panel visible and expand it. - @param nId - The id of the panel that is to be made visible. - */ - void ShowPanel (const PanelId nId); - - /** Hide and collapse the specified panel. - @param nId - The id of the panel that is to hide. - */ - void HidePanel (const PanelId nId); - - /** Expand the specified panel. Its visibility state is not modified. - @param nId - The id of the panel that is to expand. - */ - void ExpandPanel (const PanelId nId); - - /** Collapse the specified panel. Its visibility state is not - modified. - @param nId - The id of the panel that is to collapse. - */ - void CollapsePanel (const PanelId nId); - - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> - CreateAccessibleDocumentView (::sd::Window* pWindow); - - virtual css::uno::Reference CreateSubController (void); - - /** Relocate all toplevel controls to the given parent window. - */ - virtual bool RelocateToParentWindow (::Window* pParentWindow); - -private: - class Implementation; - ::std::auto_ptr mpImpl; - - ::std::auto_ptr mpTaskPane; - - bool mbIsInitialized; - - ::boost::shared_ptr mpSubShellManager; - - /** The id of the menu in the menu bar/tool box of the parent docking - window. - */ - USHORT mnMenuId; - - /** Create a popup menu. it contains three sections, one for - docking or un-docking the tool panel, one for toggling the - visibility state of the tool panel items, and one for bringing - up a customization dialog. - @param bIsDocking - According to this flag one of the lock/unlock entries is - made disabled. - */ - ::std::auto_ptr CreatePopupMenu (bool bIsDocking); - - - /** Make sure that as long as there is at least one visible - control there is exactly one expanded control. - If the currently expanded control is being hidden then try to - expand the control after the hidden one or if that does not - exist expand the one before. - */ - void EnsureExpandedControl (TitledControl* pHiddenControl); - - /** Return a pointer to the docking window that is the parent or a - predecessor of the content window. - @return - When the view shell is not placed in a docking window, e.g. when - shown in the center pane, then is returned. - */ - DockingWindow* GetDockingWindow (void); - - /** Initialize the task pane view shell if that has not yet been done - before. If mbIsInitialized is already set to then this - method returns immediately. - */ - void Initialize (void); -}; - - - - -} } // end of namespace ::sd::toolpanel - -#endif diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index b86c5b1a5..004b26bb4 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -118,8 +118,7 @@ public: ST_OUTLINE, ST_SLIDE_SORTER, ST_PRESENTATION, - ST_TASK_PANE, - ST_TOOL_PANEL + ST_TASK_PANE }; static const int MAX_HSPLIT_CNT = 1; static const int MAX_VSPLIT_CNT = 1; diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx index 700a2ea81..3e06aac50 100644 --- a/sd/source/ui/inc/framework/FrameworkHelper.hxx +++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx @@ -80,7 +80,6 @@ public: static const ::rtl::OUString msLeftImpressPaneURL; static const ::rtl::OUString msLeftDrawPaneURL; static const ::rtl::OUString msRightPaneURL; - static const ::rtl::OUString msToolPanelPaneURL; // URLs of frequently used views. static const ::rtl::OUString msViewURLPrefix; @@ -92,7 +91,6 @@ public: static const ::rtl::OUString msSlideSorterURL; static const ::rtl::OUString msPresentationViewURL; static const ::rtl::OUString msTaskPaneURL; - static const ::rtl::OUString msToolPanelViewURL; // URLs of frequently used tool bars. static const ::rtl::OUString msToolBarURLPrefix; diff --git a/sd/source/ui/inc/taskpane/ILayoutableWindow.hxx b/sd/source/ui/inc/taskpane/ILayoutableWindow.hxx index a535063d2..247b92504 100644 --- a/sd/source/ui/inc/taskpane/ILayoutableWindow.hxx +++ b/sd/source/ui/inc/taskpane/ILayoutableWindow.hxx @@ -51,7 +51,7 @@ public: /** This interface has to be implemented by windows that want to be - layouted by a ToolPanel, SubToolPanel, or ScrollablePanel object. + layouted by a SubToolPanel or ScrollablePanel object. */ class ILayoutableWindow { diff --git a/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx b/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx index 7a68bd0fb..188eeb883 100644 --- a/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx +++ b/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx @@ -56,9 +56,9 @@ enum TreeNodeStateChangeEventId { /** Base class for all members of the object hierarchy that makes up the - tool panel. There are usually at least three levels. At the top level - is the ToolPanel with one instance: the root of the tree. At the - middle level there are SubToolPanels and Window/Control objects. At the + tool panel. In the task pane, there are multiple hierarchies of such nodes, + with every panel having an own tree. The pane node is the root of the tree, below + that there are SubToolPanels and Window/Control objects. At the lowest level there are only Window or Control objects. This class provides the means of communication between objects on @@ -146,7 +146,7 @@ public: ControlContainer& GetControlContainer (void); /** Give each node access to a shell manage. This usually is the shell - manager of the TaskPaneViewShell. + manager of the ToolPanelViewShell. At least the root node has to overwrite this method since the default implementation simply returns the shell manager of its diff --git a/sd/source/ui/inc/taskpane/ToolPanel.hxx b/sd/source/ui/inc/taskpane/ToolPanel.hxx deleted file mode 100644 index 62993b78f..000000000 --- a/sd/source/ui/inc/taskpane/ToolPanel.hxx +++ /dev/null @@ -1,139 +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: ToolPanel.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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SD_TOOL_PANEL_HXX -#define SD_TOOL_PANEL_HXX - -#include "taskpane/TaskPaneTreeNode.hxx" -#include "taskpane/TitledControl.hxx" -#include - -#include -#include - -class Window; - -namespace sd { namespace toolpanel { - -class TaskPaneViewShell; -class ToolPanelViewShell; -class ControlFactory; - -/** This control is basically a layout manager for the vertical - stacking of controls. At any one time there is exactly one of - them visible. For the others only their title bar is shown. - -

Each control is independant of both other controls and the tool - panel itself. To be usable by the tool panel they only have to be - derived from the vcl Window class.

-*/ -class ToolPanel - : public Control, - public TreeNode -{ -public: - /** Create a new tool panel with the given window as its parent. - This will usually be a child window. - */ - ToolPanel ( - ::Window* pParentWindow, - TaskPaneViewShell& rViewShell); - - ToolPanel ( - ::Window* pParentWindow, - ToolPanelViewShell& rViewShell); - - virtual ~ToolPanel (void); - - /** Append the given control to the end of the list of controls that are - managed by the tool panel. - @param pControlFactory - Factory that provides the control on demand, typically when it - is expanded the first time. - @param rTitle - The string that is displayed in the title bar above the control. - @param nHelpId - The help id is set at the title bar not the actual control. - @param rClickHandler - The click handler typically expands a control when the user has - clicked on its title. - */ - sal_uInt32 AddControl ( - ::std::auto_ptr pControlFactory, - const String& rTitle, - ULONG nHelpId, - const TitledControl::ClickHandler& rClickHandler); - - /** returns the area occupied by the content of the active control (i.e. the area of the active control, - minus the are for its title) - */ - Rectangle GetActiveControlContentArea() const; - - virtual void Resize (void); - - virtual Size GetPreferredSize (void); - virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight); - virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); - virtual bool IsResizable (void); - virtual ::Window* GetWindow (void); - - virtual void RequestResize (void); - - virtual TaskPaneShellManager* GetShellManager (void); - - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> CreateAccessibleObject ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible>& rxParent); - - using Window::GetWindow; - -protected: - /** Initiate a rearrangement of the controls. - */ - void ListHasChanged (void); - -private: - TaskPaneViewShell* mpTaskPaneViewShell; - ToolPanelViewShell* mpToolPanelViewShell; - - /// Guard against recursive calls or Rearrange(). - bool mbRearrangeActive; - - /** Calculate position, size, and visibility of the controls. - Call this method after the list of controls has changed. - */ - void Rearrange (void); -}; - - - -} } // end of namespace ::sd::toolpanel - -#endif diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index ac41e4454..f9b870e4a 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -68,7 +68,6 @@ #include "ViewShellBase.hxx" #include "ViewShellImplementation.hxx" #include "sdattr.hxx" -#include "TaskPaneViewShell.hxx" #include "FrameView.hxx" #include "zoomlist.hxx" #include "sdpage.hxx" diff --git a/sd/source/ui/toolpanel/LayoutMenu.cxx b/sd/source/ui/toolpanel/LayoutMenu.cxx index 46dea1531..4e70cfb39 100644 --- a/sd/source/ui/toolpanel/LayoutMenu.cxx +++ b/sd/source/ui/toolpanel/LayoutMenu.cxx @@ -509,7 +509,6 @@ void LayoutMenu::UpdateEnabledState (const MasterMode eMode) case ViewShell::ST_OUTLINE: case ViewShell::ST_PRESENTATION: case ViewShell::ST_TASK_PANE: - case ViewShell::ST_TOOL_PANEL: // The complete task pane is disabled for these values or // not even visible. Disabling the LayoutMenu would be // logical but unnecessary. The main disadvantage is that diff --git a/sd/source/ui/toolpanel/TaskPaneShellManager.hxx b/sd/source/ui/toolpanel/TaskPaneShellManager.hxx index 93cb88548..04d595b6c 100644 --- a/sd/source/ui/toolpanel/TaskPaneShellManager.hxx +++ b/sd/source/ui/toolpanel/TaskPaneShellManager.hxx @@ -49,7 +49,7 @@ namespace sd { namespace toolpanel { /** The TaskPaneShellManager implements the ViewShellManager::ShellFactory interface. However, it does not create or delete shells. It only gives the ViewShellManager access to the sub shells of the - TaskPaneViewShell. Life time control of the sub shells is managed by + ToolPanelViewShell. Life time control of the sub shells is managed by the sub shells themselves. */ class TaskPaneShellManager diff --git a/sd/source/ui/toolpanel/TaskPaneViewShell.cxx b/sd/source/ui/toolpanel/TaskPaneViewShell.cxx deleted file mode 100644 index 07b09cd4b..000000000 --- a/sd/source/ui/toolpanel/TaskPaneViewShell.cxx +++ /dev/null @@ -1,849 +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: TaskPaneViewShell.cxx,v $ - * $Revision: 1.21 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "TaskPaneViewShell.hxx" - -#include "TaskPaneShellManager.hxx" -#include "taskpane/SlideSorterCacheDisplay.hxx" -#include "taskpane/ToolPanel.hxx" -#include "taskpane/TitledControl.hxx" -#include "LayoutMenu.hxx" -#include "TaskPaneFocusManager.hxx" -#include "taskpane/SubToolPanel.hxx" -#include "taskpane/ScrollPanel.hxx" -#include "taskpane/TaskPaneControlFactory.hxx" -#include "controls/MasterPagesPanel.hxx" -#include "controls/MasterPagesSelector.hxx" -#include "controls/TableDesignPanel.hxx" -#include "controls/CustomAnimationPanel.hxx" -#include "controls/SlideTransitionPanel.hxx" -#include "TitleToolBox.hxx" -#include "taskpane/ControlContainer.hxx" -#include "FrameView.hxx" -#include "Window.hxx" -#include "PaneDockingWindow.hxx" -#include "AccessibleTaskPane.hxx" -#include "DrawSubController.hxx" -#include "sdmod.hxx" -#include "app.hrc" -#include "glob.hrc" -#include "res_bmp.hrc" -#include "helpids.h" -#include "strings.hrc" -#include "sdresid.hxx" -#include "framework/FrameworkHelper.hxx" -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "sdtreelb.hxx" -#include "DrawViewShell.hxx" -#include "drawdoc.hxx" -#include "ViewShellBase.hxx" -#include -#include - -//#define SHOW_TEST_PANEL -#ifdef SHOW_TEST_PANEL -#include "TestPanel.hxx" -#endif -//#define SHOW_COLOR_MENU -#ifdef SHOW_COLOR_MENU -#include "TestMenu.hxx" -#endif - -#include -#include - -using namespace ::sd::toolpanel; - -#define TaskPaneViewShell -#include "sdslots.hxx" - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using ::sd::framework::FrameworkHelper; - -namespace sd { namespace toolpanel { - -SFX_IMPL_INTERFACE(TaskPaneViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL)) -{ -} - - -TYPEINIT1(TaskPaneViewShell, ViewShell); - - -/** Inner implementation class of TaskPaneViewShell. -*/ -class TaskPaneViewShell::Implementation -{ -public: - static const sal_uInt32 mnInvalidId = 0xffffffff; - - Implementation (void); - ~Implementation (void); - - /** Here the panels are created that are shown in the task pane. - */ - void Setup (ToolPanel* pToolPanel, ViewShellBase& rBase); - - /** Make a new panel known to the translation table that translates - between internal indices as returned by - ControlContainer::AddControl() and public indices defined by - PanelId. - */ - void AddPanel (sal_uInt32 nInternalId, PanelId nPublicId); - - /** Return the public id for the given internal one. - @return - When the given public id is not known then PID_UNKNOWN is - returned. - */ - PanelId GetPublicId (sal_uInt32 nInternalId) const; - - /** Return the internal id for the given public one. - @return - When the given public id is not known then mnInvalidId is - returned. - */ - sal_uInt32 GetInternalId (PanelId nPublicId) const; - -private: - /** This map translates between internal indices returned by - ControlContainer::AddControl() and public indices defined by - PanelId. - */ - typedef ::std::vector InternalIdToPanelIdMap; - InternalIdToPanelIdMap maIndexMap; -}; - - - - -namespace { - -enum MenuId { - MID_UNLOCK_TASK_PANEL = 1, - MID_LOCK_TASK_PANEL = 2, - MID_CUSTOMIZE = 3, - MID_FIRST_CONTROL = 4 -}; - -/** This control is used for extracting the title string from the resource - of some dialogs that are displayed in the task pane. With this the - actual controls can be created on demand. This class only loads (a part - of) their resource. -*/ -class DummyControl : public Control -{ -public: - DummyControl (::Window* pParent, const ResId& rResId) - : Control(pParent,rResId) - { - FreeResource(); - } -}; - -class ResourceActivationClickHandler -{ -public: - ResourceActivationClickHandler ( - const ::boost::shared_ptr& rpFrameworkHelper, - const Reference& rxResourceId, - ControlContainer& rControlContainer); - void operator () (TitledControl& rTitledControl); - -private: - ::boost::shared_ptr mpFrameworkHelper; - Reference mxResourceId; - ControlContainer& mrControlContainer; -}; - -} // end of anonymouse namespace - - - - - -void TaskPaneViewShell::Implementation::Setup ( - ToolPanel* pToolPanel, - ViewShellBase& rBase) -{ - SdDrawDocument* pDocument = rBase.GetDocument(); - sal_uInt32 nId; - sal_uInt32 nIdOfControlToExpand; - - ::boost::shared_ptr pFrameworkHelper (FrameworkHelper::Instance(rBase)); - Reference xTaskPaneId (pFrameworkHelper->CreateResourceId( - FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL)); - - // The master page controls. - nId = pToolPanel->AddControl ( - controls::MasterPagesPanel::CreateControlFactory(rBase), - SdResId(STR_TASKPANEL_MASTER_PAGE_TITLE), - HID_SD_SLIDE_DESIGNS, - ResourceActivationClickHandler( - pFrameworkHelper, - pFrameworkHelper->CreateResourceId( - FrameworkHelper::msMasterPagesTaskPanelURL, xTaskPaneId), - pToolPanel->GetControlContainer())); - AddPanel (nId, PID_MASTER_PAGES); - - // Layout Menu. - nId = pToolPanel->AddControl ( - LayoutMenu::CreateControlFactory(rBase, *pDocument->GetDocSh()), - SdResId(STR_TASKPANEL_LAYOUT_MENU_TITLE), - HID_SD_SLIDE_LAYOUTS, - ResourceActivationClickHandler( - pFrameworkHelper, - pFrameworkHelper->CreateResourceId( - FrameworkHelper::msLayoutTaskPanelURL, xTaskPaneId), - pToolPanel->GetControlContainer())); - AddPanel (nId, PID_LAYOUT); - nIdOfControlToExpand = nId; - - { - DummyControl aControl (pToolPanel, SdResId(DLG_TABLEDESIGNPANE)); - - // TableDesignPanel - nId = pToolPanel->AddControl ( - controls::TableDesignPanel::CreateControlFactory(rBase), - aControl.GetText(), - HID_SD_TABLE_DESIGN, - ResourceActivationClickHandler( - pFrameworkHelper, - pFrameworkHelper->CreateResourceId( - FrameworkHelper::msTableDesignPanelURL, xTaskPaneId), - pToolPanel->GetControlContainer())); - AddPanel (nId, PID_TABLE_DESIGN); - } - - // CustomAnimationPanel - nId = pToolPanel->AddControl ( - controls::CustomAnimationPanel::CreateControlFactory(rBase), - SdResId( STR_CUSTOMANIMATIONPANE ), - HID_SD_CUSTOM_ANIMATIONS, - ResourceActivationClickHandler( - pFrameworkHelper, - pFrameworkHelper->CreateResourceId( - FrameworkHelper::msCustomAnimationTaskPanelURL, xTaskPaneId), - pToolPanel->GetControlContainer())); - AddPanel (nId, PID_CUSTOM_ANIMATION); - - // SlideTransitionPanel - nId = pToolPanel->AddControl ( - controls::SlideTransitionPanel::CreateControlFactory(rBase), - SdResId( STR_SLIDE_TRANSITION_PANE ), - HID_SD_SLIDE_TRANSITIONS, - ResourceActivationClickHandler( - pFrameworkHelper, - pFrameworkHelper->CreateResourceId( - FrameworkHelper::msSlideTransitionTaskPanelURL, xTaskPaneId), - pToolPanel->GetControlContainer())); - AddPanel (nId, PID_SLIDE_TRANSITION); - -#ifdef SHOW_COLOR_MENU - // Test Menu. - pToolPanel->AddControl ( - ColorMenu::CreateControlFactory(), - String::CreateFromAscii ("Color Test Menu"), - 0); -#endif - -#ifdef SHOW_TEST_PANEL - // Test Panel. - pToolPanel->AddControl ( - TestPanel::CreateControlFactory(), - String::CreateFromAscii ("Test Panel"), - 0); -#endif - -#ifdef USE_SLIDE_SORTER_CACHE_DISPLAY - pToolPanel->AddControl ( - SlideSorterCacheDisplay::CreateControlFactory(pDocument), - String::CreateFromAscii("Slide Sorter Cache Status"), - 0); -#endif - - // Expand the layout menu. - pToolPanel->GetControlContainer().SetExpansionState ( - nIdOfControlToExpand, - ControlContainer::ES_EXPAND); - - pToolPanel->GetWindow()->Show(); -} - - - - -void TaskPaneViewShell::Initialize (void) -{ - if ( ! mbIsInitialized) - { - mbIsInitialized = true; - mpImpl->Setup (mpTaskPane.get(), GetViewShellBase()); - } -} - - - - -TaskPaneViewShell::TaskPaneViewShell ( - SfxViewFrame* pFrame, - ViewShellBase& rViewShellBase, - ::Window* pParentWindow, - FrameView* pFrameViewArgument) - : ViewShell (pFrame, pParentWindow, rViewShellBase), - mpImpl(NULL), - mpTaskPane(NULL), - mbIsInitialized(false), - mpSubShellManager(), - mnMenuId(0) -{ - meShellType = ST_TASK_PANE; - - mpImpl.reset (new Implementation()); - - mpContentWindow->SetCenterAllowed (false); - pParentWindow->SetStyle(pParentWindow->GetStyle() | WB_DIALOGCONTROL); - - mpTaskPane = ::std::auto_ptr(new ToolPanel ( - mpContentWindow.get(), *this)); - - GetParentWindow()->SetBackground(Wallpaper()); - mpContentWindow->SetBackground(Wallpaper()); - - GetParentWindow()->SetHelpId(HID_SD_TASK_PANE); - - PaneDockingWindow* pDockingWindow = dynamic_cast(GetDockingWindow()); - if (pDockingWindow != NULL) - { - pDockingWindow->InitializeTitleToolBox(); - mnMenuId = pDockingWindow->AddMenu ( - String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_TITLE)), - HID_SD_TASK_PANE_VIEW_MENU, - LINK(this, TaskPaneViewShell, ToolboxClickHandler)); - } - - // Tell the focus manager that we want to pass the focus to our - // child. - FocusManager::Instance().RegisterDownLink(pParentWindow, mpTaskPane.get()); - - SetPool (&GetDoc()->GetPool()); - - if (pFrameViewArgument != NULL) - mpFrameView = pFrameViewArgument; - else - mpFrameView = new FrameView(GetDoc()); - GetFrameView()->Connect(); - - // Hide or delete unused controls that we have inherited from the - // ViewShell base class. - mpHorizontalScrollBar.reset(); - mpVerticalScrollBar.reset(); - mpScrollBarBox.reset(); - mpHorizontalRuler.reset(); - mpVerticalRuler.reset(); - - SetName (String (RTL_CONSTASCII_USTRINGPARAM("TaskPaneViewShell"))); - - // For accessibility we have to shortly hide the content window. This - // triggers the construction of a new accessibility object for the new - // view shell. (One is created earlier while the construtor of the base - // class is executed. At that time the correct accessibility object can - // not be constructed.) - if (mpContentWindow.get() !=NULL) - { - mpContentWindow->Hide(); - mpContentWindow->Show(); - } - - // Register the shell manager as factory at the ViewShellManager. - mpSubShellManager.reset (new TaskPaneShellManager( - GetViewShellBase().GetViewShellManager(), - *this)); - GetViewShellBase().GetViewShellManager()->AddSubShellFactory(this, mpSubShellManager); -} - - - - -TaskPaneViewShell::~TaskPaneViewShell (void) -{ - GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager); -} - - - -void TaskPaneViewShell::ArrangeGUIElements (void) -{ - ViewShell::ArrangeGUIElements(); - - Point aOrigin (maViewPos); - Size aSize (maViewSize); - - Initialize(); - - // Place the task pane. - if (mpTaskPane.get() != NULL) - mpTaskPane->SetPosSizePixel (Point(0,0), aSize); -} - - - - -void TaskPaneViewShell::GetFocus (void) -{ - Invalidate (); -} - - - - -void TaskPaneViewShell::LoseFocus (void) -{ - Invalidate (); -} - - - - -void TaskPaneViewShell::KeyInput (const KeyEvent& rEvent) -{ - KeyCode nCode = rEvent.GetKeyCode(); - if (nCode == KEY_RETURN) - { - mpTaskPane->GrabFocus(); - } - else - ViewShell::KeyInput (rEvent, NULL); -} - - - - -IMPL_LINK(TaskPaneViewShell, ToolboxClickHandler, ToolBox*, pToolBox) -{ - if (pToolBox->GetCurItemId() == mnMenuId) - { - pToolBox->EndSelection(); - - DockingWindow* pDockingWindow = GetDockingWindow(); - ::std::auto_ptr pMenu = CreatePopupMenu ( - pDockingWindow!=NULL && !pDockingWindow->IsFloatingMode()); - pMenu->SetSelectHdl ( - LINK(this, TaskPaneViewShell, MenuSelectHandler)); - - // pass toolbox button rect so the menu can stay open on button up - Rectangle aRect = pToolBox->GetItemRect(mnMenuId); - aRect.SetPos(pToolBox->GetPosPixel() ); - pMenu->Execute (pDockingWindow, aRect, POPUPMENU_EXECUTE_DOWN); - } - - return 0; -} - - - - -IMPL_LINK(TaskPaneViewShell, MenuSelectHandler, Menu*, pMenu) -{ - if (pMenu) - { - pMenu->Deactivate(); - switch (pMenu->GetCurItemId()) - { - case MID_UNLOCK_TASK_PANEL: - { - DockingWindow* pDockingWindow = GetDockingWindow(); - if (pDockingWindow != NULL) - pDockingWindow->SetFloatingMode (TRUE); - } - break; - - case MID_LOCK_TASK_PANEL: - { - DockingWindow* pDockingWindow = GetDockingWindow(); - if (pDockingWindow != NULL) - pDockingWindow->SetFloatingMode (FALSE); - } - break; - - case MID_CUSTOMIZE: - DBG_ASSERT (0, "Customization not yet implemented"); - break; - - default: - { - sal_uInt32 nIndex (pMenu->GetUserValue(pMenu->GetCurItemId())); - mpTaskPane->GetControlContainer().SetVisibilityState ( - nIndex, - ControlContainer::VS_TOGGLE); - // mpTaskPane->Resize(); - // mpTaskPane->Invalidate(); - } - break; - } - } - - return 0; -} - - - - -::std::auto_ptr TaskPaneViewShell::CreatePopupMenu ( - bool bIsDocking) -{ - ::std::auto_ptr pMenu (new PopupMenu ()); - FloatingWindow* pFloat = static_cast(pMenu->GetWindow()); - if (pFloat != NULL) - { - pFloat->SetPopupModeFlags ( - pFloat->GetPopupModeFlags() - | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE); - } - - // warning free code changes: - // FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE is 0x10000, so cast to USHORT is 0 - // so why was this used anyway? - pMenu->SetMenuFlags ( - pMenu->GetMenuFlags() /* | (USHORT)FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE */ ); - - // Add one entry for every tool panel element to individually make - // them visible or hide them. - USHORT nIndex = MID_FIRST_CONTROL; - sal_uInt32 nControlIndex; - ControlContainer& rContainer (mpTaskPane->GetControlContainer()); - for (nControlIndex=0; - nControlIndex(pChild->GetWindow()); - pMenu->InsertItem (nIndex, - pControl->GetTitle(), - MIB_CHECKABLE); - pMenu->SetUserValue (nIndex, nControlIndex); - if (pControl->IsVisible()) - pMenu->CheckItem (nIndex, TRUE); - nIndex++; - } - - pMenu->InsertSeparator (); - - // Add entry for docking or un-docking the tool panel. - if (bIsDocking) - pMenu->InsertItem ( - MID_UNLOCK_TASK_PANEL, - String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_UNLOCK))); - else - pMenu->InsertItem ( - MID_LOCK_TASK_PANEL, - String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_LOCK))); - pMenu->RemoveDisabledEntries (FALSE, FALSE); - - return pMenu; -} - - - - -SdPage* TaskPaneViewShell::GetActualPage (void) -{ - return NULL; -} - -SdPage* TaskPaneViewShell::getCurrentPage(void) const -{ - return NULL; -} - - - -void TaskPaneViewShell::Execute (SfxRequest& ) -{ -} - - - - -void TaskPaneViewShell::GetState (SfxItemSet& rItemSet) -{ - (void)rItemSet; -} - - - - -TaskPaneShellManager& TaskPaneViewShell::GetSubShellManager (void) const -{ - return *mpSubShellManager.get(); -} - - - - -DockingWindow* TaskPaneViewShell::GetDockingWindow (void) -{ - ::Window* pParentWindow = GetParentWindow(); - DockingWindow* pDockingWindow = NULL; - while (pParentWindow!=NULL && pDockingWindow==NULL) - { - pDockingWindow = dynamic_cast(pParentWindow); - pParentWindow = pParentWindow->GetParent(); - } - return pDockingWindow; -} - - - - -void TaskPaneViewShell::ShowPanel (const PanelId nPublicId) -{ - Initialize(); - sal_uInt32 nId (mpImpl->GetInternalId(nPublicId)); - if (nId != Implementation::mnInvalidId) - { - mpTaskPane->GetControlContainer().SetVisibilityState ( - nId, - ControlContainer::VS_SHOW); - } -} - - - - -void TaskPaneViewShell::HidePanel (const PanelId nPublicId) -{ - Initialize(); - sal_uInt32 nId (mpImpl->GetInternalId(nPublicId)); - if (nId != Implementation::mnInvalidId) - { - mpTaskPane->GetControlContainer().SetVisibilityState ( - nId, - ControlContainer::VS_HIDE); - } -} - - - - -void TaskPaneViewShell::ExpandPanel (const PanelId nPublicId) -{ - Initialize(); - sal_uInt32 nId (mpImpl->GetInternalId(nPublicId)); - if (nId != Implementation::mnInvalidId) - { - mpTaskPane->GetControlContainer().SetExpansionState ( - nId, - ControlContainer::ES_EXPAND); - } -} - - - - -void TaskPaneViewShell::CollapsePanel (const PanelId nPublicId) -{ - Initialize(); - sal_uInt32 nId (mpImpl->GetInternalId(nPublicId)); - if (nId != Implementation::mnInvalidId) - { - mpTaskPane->GetControlContainer().SetExpansionState ( - nId, - ControlContainer::ES_COLLAPSE); - } -} - - - - -::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> - TaskPaneViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow) -{ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> xAccessible; - - if (mpTaskPane.get()!=NULL && pWindow!=NULL) - { - // We have to call CreateAccessible directly so that we can specify - // the correct accessible parent. - ::Window* pParentWindow = pWindow->GetAccessibleParentWindow(); - if (pParentWindow != NULL) - xAccessible = mpTaskPane->CreateAccessibleObject( - pParentWindow->GetAccessible()); - } - - return xAccessible; -} - - - - -Reference TaskPaneViewShell::CreateSubController (void) -{ - // This view shell is not designed to be the main view shell and thus - // does not support a UNO sub controller. - return Reference(); -} - - - - -bool TaskPaneViewShell::RelocateToParentWindow (::Window* pParentWindow) -{ - ::Window* pOldParentWindow = GetParentWindow(); - FocusManager::Instance().RemoveLinks(pOldParentWindow, mpTaskPane.get()); - FocusManager::Instance().RemoveLinks(mpTaskPane.get(), pOldParentWindow); - - ViewShell::RelocateToParentWindow(pParentWindow); - - PaneDockingWindow* pDockingWindow = dynamic_cast(GetDockingWindow()); - if (pDockingWindow != NULL) - { - pDockingWindow->InitializeTitleToolBox(); - mnMenuId = pDockingWindow->AddMenu ( - String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_TITLE)), - HID_SD_TASK_PANE_VIEW_MENU, - LINK(this, TaskPaneViewShell, ToolboxClickHandler)); - } - FocusManager::Instance().RegisterDownLink(pParentWindow, mpTaskPane.get()); - - Resize(); - - return true; -} - - - - -//===== TaskPaneViewShell::Implementation ===================================== - -TaskPaneViewShell::Implementation::Implementation (void) - : maIndexMap( - (InternalIdToPanelIdMap::size_type)PID__END, - PID_UNKNOWN) -{ -} - - - - -TaskPaneViewShell::Implementation::~Implementation (void) -{ -} - - - - -void TaskPaneViewShell::Implementation::AddPanel ( - sal_uInt32 nInternalId, - PanelId nPublicId) -{ - maIndexMap[nInternalId] = nPublicId; -} - - - - -PanelId - TaskPaneViewShell::Implementation::GetPublicId ( - sal_uInt32 nInternalId) const -{ - if (nInternalId < maIndexMap.size()) - return maIndexMap[nInternalId]; - else - return PID_UNKNOWN; -} - - - - -sal_uInt32 - TaskPaneViewShell::Implementation::GetInternalId ( - PanelId nPublicId) const -{ - sal_uInt32 nId = mnInvalidId; - for (sal_uInt32 nI=0; nI& rpFrameworkHelper, - const Reference& rxResourceId, - ControlContainer& rControlContainer) - : mpFrameworkHelper(rpFrameworkHelper), - mxResourceId(rxResourceId), - mrControlContainer(rControlContainer) -{ -} - - - - -void ResourceActivationClickHandler::operator () (TitledControl& rTitledControl) -{ - mrControlContainer.SetExpansionState ( - &rTitledControl, - ControlContainer::ES_EXPAND); - mpFrameworkHelper->GetConfigurationController()->requestResourceActivation( - mxResourceId, drawing::framework::ResourceActivationMode_REPLACE); -} - - -} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/ToolPanel.cxx b/sd/source/ui/toolpanel/ToolPanel.cxx deleted file mode 100644 index c4d0e0912..000000000 --- a/sd/source/ui/toolpanel/ToolPanel.cxx +++ /dev/null @@ -1,337 +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: ToolPanel.cxx,v $ - * $Revision: 1.14 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "taskpane/ToolPanel.hxx" - -#include "TaskPaneFocusManager.hxx" -#include "taskpane/TitleBar.hxx" -#include "taskpane/TitledControl.hxx" -#include "taskpane/ControlContainer.hxx" -#include "TaskPaneViewShell.hxx" -#include "taskpane/ToolPanelViewShell.hxx" -#include "taskpane/TaskPaneControlFactory.hxx" -#include "AccessibleTaskPane.hxx" - -#include "strings.hrc" -#include "sdresid.hxx" -#include -#include -#include -#include - -namespace sd { namespace toolpanel { - - -/** Use WB_DIALOGCONTROL as argument for the Control constructor to - let VCL handle focus traveling. In addition the control - descriptors have to use WB_TABSTOP. -*/ -ToolPanel::ToolPanel ( - Window* pParentWindow, - TaskPaneViewShell& rViewShell) - : Control (pParentWindow, WB_DIALOGCONTROL), - TreeNode (NULL), - mpTaskPaneViewShell( &rViewShell ), - mpToolPanelViewShell( NULL ), - mbRearrangeActive(false) -{ - SetBackground (Wallpaper ()); -} - - - - -ToolPanel::ToolPanel ( - Window* pParentWindow, - ToolPanelViewShell& rViewShell) - : Control (pParentWindow, WB_DIALOGCONTROL), - TreeNode (NULL), - mpTaskPaneViewShell( NULL ), - mpToolPanelViewShell( &rViewShell ), - mbRearrangeActive(false) -{ - SetBackground (Wallpaper ()); -} - - - - -ToolPanel::~ToolPanel (void) -{ -} - - - - -sal_uInt32 ToolPanel::AddControl ( - ::std::auto_ptr pControlFactory, - const String& rTitle, - ULONG nHelpId, - const TitledControl::ClickHandler& rClickHandler) -{ - TitledControl* pTitledControl = new TitledControl ( - this, - pControlFactory, - rTitle, - rClickHandler, - TitleBar::TBT_CONTROL_TITLE); - ::std::auto_ptr pChild (pTitledControl); - - // Get the (grand) parent window which is focus-wise our parent. - Window* pParent = GetParent(); - if (pParent != NULL) - pParent = pParent->GetParent(); - - FocusManager& rFocusManager (FocusManager::Instance()); - int nControlCount (mpControlContainer->GetControlCount()); - - // Add a link up from every control to the parent. A down link is added - // only for the first control so that when entering the sub tool panel - // the focus is set to the first control. - if (pParent != NULL) - { - if (nControlCount == 1) - rFocusManager.RegisterDownLink(pParent, pChild->GetWindow()); - rFocusManager.RegisterUpLink(pChild->GetWindow(), pParent); - } - - // Replace the old links for cycling between first and last child by - // current ones. - if (nControlCount > 0) - { - ::Window* pFirst = mpControlContainer->GetControl(0)->GetWindow(); - ::Window* pLast = mpControlContainer->GetControl(nControlCount-1)->GetWindow(); - rFocusManager.RemoveLinks(pFirst,pLast); - rFocusManager.RemoveLinks(pLast,pFirst); - - rFocusManager.RegisterLink(pFirst,pChild->GetWindow(), KEY_UP); - rFocusManager.RegisterLink(pChild->GetWindow(),pFirst, KEY_DOWN); - } - - pTitledControl->GetWindow()->SetHelpId(nHelpId); - - return mpControlContainer->AddControl (pChild); -} - - - - -Rectangle ToolPanel::GetActiveControlContentArea() const -{ - const Rectangle aAllRect( Point(), GetOutputSizePixel() ); - - const sal_uInt32 nActiveControlIndex( mpControlContainer->GetActiveControlIndex() ); - if ( nActiveControlIndex >= mpControlContainer->GetControlCount() ) - return aAllRect; - - TreeNode* pChild = mpControlContainer->GetControl( nActiveControlIndex ); - TitledControl* pTitledControl = dynamic_cast< TitledControl* >( pChild ); - ENSURE_OR_RETURN( pTitledControl, "invalid active child", aAllRect ); - - TreeNode* pActiveControl( pTitledControl->GetControl() ); - ENSURE_OR_RETURN( pActiveControl, "invalid active control", aAllRect ); - - return Rectangle( - ScreenToOutputPixel( pActiveControl->GetWindow()->OutputToScreenPixel( Point( 0, 0 ) ) ), - pActiveControl->GetWindow()->GetOutputSizePixel() - ); -} - - - -void ToolPanel::ListHasChanged (void) -{ - mpControlContainer->ListHasChanged (); - Rearrange (); -} - - - - -void ToolPanel::Resize (void) -{ - Control::Resize(); - Rearrange (); -} - - - - -void ToolPanel::RequestResize (void) -{ - Invalidate(); - Rearrange (); -} - - - - -/** Subtract the space for the title bars from the available space and - give the remaining space to the active control. -*/ -void ToolPanel::Rearrange (void) -{ - // Prevent recursive calls. - if ( ! mbRearrangeActive && mpControlContainer->GetVisibleControlCount()>0) - { - mbRearrangeActive = true; - - SetBackground (Wallpaper ()); - - // Make the area that is covered by the children a little bit - // smaller so that a frame is visible arround them. - Rectangle aAvailableArea (Point(0,0), GetOutputSizePixel()); - - int nWidth = aAvailableArea.GetWidth(); - sal_uInt32 nControlCount (mpControlContainer->GetControlCount()); - sal_uInt32 nActiveControlIndex ( - mpControlContainer->GetActiveControlIndex()); - - // Place title bars of controls above the active control and thereby - // determine the top of the active control. - sal_uInt32 nIndex; - for (nIndex=mpControlContainer->GetFirstIndex(); - nIndexGetNextIndex(nIndex)) - { - TreeNode* pChild = mpControlContainer->GetControl(nIndex); - if (pChild != NULL) - { - sal_uInt32 nHeight = pChild->GetPreferredHeight (nWidth); - pChild->GetWindow()->SetPosSizePixel ( - aAvailableArea.TopLeft(), - Size(nWidth, nHeight)); - aAvailableArea.Top() += nHeight; - } - } - - // Place title bars of controls below the active control and thereby - // determine the bottom of the active control. - for (nIndex=mpControlContainer->GetLastIndex(); - nIndexGetPreviousIndex(nIndex)) - { - TreeNode* pChild = mpControlContainer->GetControl(nIndex); - if (pChild != NULL) - { - sal_uInt32 nHeight = pChild->GetPreferredHeight (nWidth); - pChild->GetWindow()->SetPosSizePixel ( - Point(aAvailableArea.Left(), - aAvailableArea.Bottom()-nHeight+1), - Size(nWidth, nHeight)); - aAvailableArea.Bottom() -= nHeight; - } - } - - // Finally place the active control. - TreeNode* pChild = mpControlContainer->GetControl(nActiveControlIndex); - if (pChild != NULL) - pChild->GetWindow()->SetPosSizePixel ( - aAvailableArea.TopLeft(), - aAvailableArea.GetSize()); - - mbRearrangeActive = false; - } - else - SetBackground ( - Application::GetSettings().GetStyleSettings().GetDialogColor()); -} - - - - -Size ToolPanel::GetPreferredSize (void) -{ - return Size(300,300); -} - - - - -sal_Int32 ToolPanel::GetPreferredWidth (sal_Int32 ) -{ - return 300; -} - - - - -sal_Int32 ToolPanel::GetPreferredHeight (sal_Int32 ) -{ - return 300; -} - - - - -bool ToolPanel::IsResizable (void) -{ - return true; -} - - - - -::Window* ToolPanel::GetWindow (void) -{ - return this; -} - - - - -TaskPaneShellManager* ToolPanel::GetShellManager (void) -{ - if ( mpTaskPaneViewShell != NULL ) - return &mpTaskPaneViewShell->GetSubShellManager(); - if ( mpToolPanelViewShell != NULL ) - return &mpToolPanelViewShell->GetSubShellManager(); - return TreeNode::GetShellManager(); -} - - - - -::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> ToolPanel::CreateAccessibleObject ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible>& rxParent) -{ - return new ::accessibility::AccessibleTaskPane ( - rxParent, - String(SdResId(STR_RIGHT_PANE_TITLE)), - String(SdResId(STR_RIGHT_PANE_TITLE)), - *this); -} - -} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx index f79551129..26eb0bfdd 100644 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx @@ -27,7 +27,6 @@ #include "precompiled_sd.hxx" #include "ToolPanelDrawer.hxx" -#include "taskpane/ToolPanel.hxx" #include "taskpane/TitleBar.hxx" #include diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 85646d355..02dfc3ce1 100644 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -308,7 +308,7 @@ void ToolPanelViewShell::Implementation::Setup() // compose the resource ID for the ToolPanel view ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) ); - const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msToolPanelViewURL, FrameworkHelper::msToolPanelPaneURL ) ); + const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ) ); // want to activate the "Layout" panel later on, need to translate its PanelId to an actual position const PanelId nPanelIdToActivate = PID_LAYOUT; @@ -410,7 +410,7 @@ ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rVi ,mpSubShellManager() ,mnMenuId(0) { - meShellType = ST_TOOL_PANEL; + meShellType = ST_TASK_PANE; mpContentWindow->SetCenterAllowed( false ); pParentWindow->SetStyle( pParentWindow->GetStyle() | WB_DIALOGCONTROL ); diff --git a/sd/source/ui/toolpanel/makefile.mk b/sd/source/ui/toolpanel/makefile.mk index 775ff3515..d364b74ea 100644 --- a/sd/source/ui/toolpanel/makefile.mk +++ b/sd/source/ui/toolpanel/makefile.mk @@ -54,12 +54,10 @@ SLOFILES = \ $(SLO)$/TitleBar.obj \ $(SLO)$/TitleToolBox.obj \ $(SLO)$/TitledControl.obj \ - $(SLO)$/ToolPanel.obj \ $(SLO)$/TaskPaneControlFactory.obj \ $(SLO)$/TaskPaneFocusManager.obj \ $(SLO)$/TaskPaneShellManager.obj \ $(SLO)$/TaskPaneTreeNode.obj \ - $(SLO)$/TaskPaneViewShell.obj \ $(SLO)$/ToolPanelViewShell.obj \ $(SLO)$/ToolPanelDeck.obj \ $(SLO)$/ToolPanelDrawer.obj \ diff --git a/sd/source/ui/view/GraphicViewShellBase.cxx b/sd/source/ui/view/GraphicViewShellBase.cxx index da342cc3e..f0f541d2d 100644 --- a/sd/source/ui/view/GraphicViewShellBase.cxx +++ b/sd/source/ui/view/GraphicViewShellBase.cxx @@ -104,7 +104,6 @@ void GraphicViewShellBase::Execute (SfxRequest& rRequest) switch (nSlotId) { case SID_RIGHT_PANE: - case SID_TOOL_PANEL_PANE: case SID_NOTES_WINDOW: case SID_SLIDE_SORTER_MULTI_PANE_GUI: case SID_DIAMODE: diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index 1d36d990d..82b32c3ea 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -1310,7 +1310,6 @@ void ToolBarRules::MainViewShellChanged (ViewShell::ShellType nShellType) case ViewShell::ST_NONE: case ViewShell::ST_PRESENTATION: case ViewShell::ST_TASK_PANE: - case ViewShell::ST_TOOL_PANEL: default: break; } diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 560bfd295..1705d8207 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -67,9 +67,9 @@ #include "OutlineViewShell.hxx" #include "SlideSorterViewShell.hxx" #include "PresentationViewShell.hxx" -#include "TaskPaneViewShell.hxx" #include "FormShellManager.hxx" #include "ToolBarManager.hxx" +#include "taskpane/PanelId.hxx" #include "Window.hxx" #include "framework/ConfigurationController.hxx" #include "DocumentRenderer.hxx" @@ -823,13 +823,6 @@ void ViewShellBase::Execute (SfxRequest& rRequest) framework::FrameworkHelper::msTaskPaneURL); break; - case SID_TOOL_PANEL_PANE: - mpImpl->SetPaneVisibility( - rRequest, - framework::FrameworkHelper::msToolPanelPaneURL, - framework::FrameworkHelper::msToolPanelViewURL); - break; - case SID_NORMAL_MULTI_PANE_GUI: case SID_SLIDE_SORTER_MULTI_PANE_GUI: case SID_DRAWINGMODE: @@ -1554,11 +1547,6 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet) xContext, FrameworkHelper::msRightPaneURL); break; - case SID_TOOL_PANEL_PANE: - xResourceId = ResourceId::create( - xContext, FrameworkHelper::msToolPanelPaneURL); - break; - case SID_NORMAL_MULTI_PANE_GUI: xResourceId = ResourceId::createWithAnchorURL( xContext, diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index d6dfc11d3..d2a7492f7 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -50,11 +50,11 @@ #include "DrawController.hxx" #include "FactoryIds.hxx" #include "slideshow.hxx" -#include "TaskPaneViewShell.hxx" #include "ViewShellBase.hxx" #include "FrameView.hxx" #include "DrawViewShell.hxx" #include "ViewShellHint.hxx" +#include "taskpane/PanelId.hxx" #include "framework/FrameworkHelper.hxx" #include @@ -376,7 +376,6 @@ sal_uInt16 ViewShell::Implementation::GetViewId (void) // and there is not (yet) a proper ViewShellBase sub class for the // remaining types we chose the Impress factory as a fall back. case ViewShell::ST_TASK_PANE: - case ViewShell::ST_TOOL_PANEL: case ViewShell::ST_NONE: default: return IMPRESS_FACTORY_ID; diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx index e8bd90493..5ddfb6e8f 100644 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -84,7 +84,6 @@ #include "FrameView.hxx" #include "Window.hxx" #include "DrawDocShell.hxx" -#include "TaskPaneViewShell.hxx" #include "framework/FrameworkHelper.hxx" namespace sd { diff --git a/sd/source/ui/view/viewshe3.cxx b/sd/source/ui/view/viewshe3.cxx index 7f0a63ee1..c930abb6d 100644 --- a/sd/source/ui/view/viewshe3.cxx +++ b/sd/source/ui/view/viewshe3.cxx @@ -72,7 +72,6 @@ #endif #include "DrawViewShell.hxx" #include "OutlineViewShell.hxx" -#include "TaskPaneViewShell.hxx" #include "drawview.hxx" #include "sdattr.hxx" @@ -83,6 +82,7 @@ #include "Window.hxx" #include "DrawDocShell.hxx" #include "FrameView.hxx" +#include "framework/FrameworkHelper.hxx" #include "optsitem.hxx" #include "sdresid.hxx" @@ -256,7 +256,7 @@ SdPage* ViewShell::CreateOrDuplicatePage ( && rBase.GetMainViewShell()->GetShellType()!=ViewShell::ST_DRAW) { framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel( - framework::FrameworkHelper::msLayoutTaskPanelURL); + framework::FrameworkHelper::msLayoutTaskPanelURL); } // AutoLayouts muessen fertig sein diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml index be0035c51..5b79fdd1f 100644 --- a/sd/uiconfig/simpress/menubar/menubar.xml +++ b/sd/uiconfig/simpress/menubar/menubar.xml @@ -100,7 +100,6 @@ - -- cgit v1.2.3 From 154db4b4a0aaeb3c9f9065b936176d1997428a6d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 18 Mar 2010 14:37:10 +0100 Subject: slidecopy: use DBG_UNHANDLED_EXCEPTION instead of OSL_ASSERT, as the former will also print you the exception type and message --- sd/source/ui/dlg/sdtreelb.cxx | 3 ++- .../configuration/ConfigurationControllerBroadcaster.cxx | 7 +++---- .../ConfigurationControllerResourceManager.cxx | 7 ++++--- .../ui/framework/configuration/ConfigurationUpdater.cxx | 6 +++--- sd/source/ui/framework/factories/PresentationFactory.cxx | 5 +++-- sd/source/ui/framework/module/ModuleController.cxx | 4 +++- sd/source/ui/framework/tools/FrameworkHelper.cxx | 9 +++++---- sd/source/ui/slideshow/PaneHider.cxx | 4 +++- sd/source/ui/slidesorter/controller/SlsListener.cxx | 15 +++++---------- sd/source/ui/slidesorter/model/SlideSorterModel.cxx | 10 ++++------ .../slidesorter/view/SlsPageObjectViewObjectContact.cxx | 3 ++- sd/source/ui/toolpanel/controls/DocumentHelper.cxx | 5 ++--- .../toolpanel/controls/MasterPageContainerProviders.cxx | 3 ++- sd/source/ui/tools/ConfigurationAccess.cxx | 7 +++---- sd/source/ui/tools/PreviewRenderer.cxx | 7 ++++--- sd/source/ui/view/Outliner.cxx | 3 ++- sd/source/ui/view/ViewShellBase.cxx | 2 +- sd/source/ui/view/ViewTabBar.cxx | 3 ++- sd/source/ui/view/drviews3.cxx | 3 ++- 19 files changed, 55 insertions(+), 51 deletions(-) diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 48fcfe792..faf31379d 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -59,6 +59,7 @@ #include #include +#include #include using namespace com::sun::star; @@ -1271,7 +1272,7 @@ sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt ) } catch (com::sun::star::uno::Exception&) { - OSL_ASSERT(false); + DBG_UNHANDLED_EXCEPTION(); } if (nRet == DND_ACTION_NONE) diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx index 6677c435e..3f29434c1 100644 --- a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx @@ -34,6 +34,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -126,8 +127,7 @@ void ConfigurationControllerBroadcaster::NotifyListeners ( } catch(RuntimeException&) { - DBG_ASSERT(false, - "ConfigurationController: caught exception while notifying listeners"); + DBG_UNHANDLED_EXCEPTION(); } } } @@ -215,8 +215,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 0fc28de8e..c40e41af2 100644 --- a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx @@ -36,6 +36,7 @@ #include "ResourceFactoryManager.hxx" #include "framework/FrameworkHelper.hxx" #include +#include #include #include @@ -172,7 +173,7 @@ void ConfigurationControllerResourceManager::ActivateResource ( } catch(Exception&) { - OSL_ENSURE(false, "caught exception while activating resource"); + DBG_UNHANDLED_EXCEPTION(); } if (xResource.is()) @@ -201,7 +202,7 @@ void ConfigurationControllerResourceManager::ActivateResource ( } catch (RuntimeException&) { - OSL_ASSERT(false); + DBG_UNHANDLED_EXCEPTION(); } } @@ -261,7 +262,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/ConfigurationUpdater.cxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx index dc2432792..470d302ef 100644 --- a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx @@ -38,6 +38,7 @@ #include "framework/FrameworkHelper.hxx" #include +#include #include @@ -247,8 +248,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 @@ -343,7 +343,7 @@ void ConfigurationUpdater::UpdateCore (const ConfigurationClassifier& rClassifie } catch(RuntimeException) { - OSL_ASSERT(false); + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/sd/source/ui/framework/factories/PresentationFactory.cxx b/sd/source/ui/framework/factories/PresentationFactory.cxx index a1714c719..5fc475b10 100644 --- a/sd/source/ui/framework/factories/PresentationFactory.cxx +++ b/sd/source/ui/framework/factories/PresentationFactory.cxx @@ -38,6 +38,7 @@ #include "ViewShellBase.hxx" #include #include +#include #include "slideshow.hxx" using namespace ::com::sun::star; @@ -158,7 +159,7 @@ PresentationFactory::PresentationFactory ( } catch (RuntimeException&) { - OSL_ASSERT(false); + DBG_UNHANDLED_EXCEPTION(); } } @@ -312,7 +313,7 @@ void SAL_CALL PresentationFactoryProvider::initialize( } catch (RuntimeException&) { - OSL_ASSERT(false); + DBG_UNHANDLED_EXCEPTION(); } } } diff --git a/sd/source/ui/framework/module/ModuleController.cxx b/sd/source/ui/framework/module/ModuleController.cxx index 571cdaa3a..d310038ad 100644 --- a/sd/source/ui/framework/module/ModuleController.cxx +++ b/sd/source/ui/framework/module/ModuleController.cxx @@ -38,6 +38,8 @@ #include #include +#include + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; @@ -171,7 +173,7 @@ void ModuleController::LoadFactories (const Reference& rxCont } catch (Exception&) { - OSL_TRACE("ERROR in ModuleController::LoadFactories"); + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index fcc2ddc7c..a1ba587d3 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -55,6 +55,7 @@ #include "vcl/svapp.hxx" #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -720,7 +721,7 @@ void FrameworkHelper::HandleModeChangeSlot ( } catch (RuntimeException&) { - OSL_TRACE("HandleModeChangeSlot: caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } @@ -855,7 +856,7 @@ void FrameworkHelper::UpdateConfiguration (void) } catch (RuntimeException&) { - DBG_ASSERT(false, "FrameworkHelper::UpdateConfiguration: caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } } @@ -1056,7 +1057,7 @@ CallbackCaller::CallbackCaller ( } catch (RuntimeException&) { - DBG_ASSERT(false,"ConfigurationUpdateGuard: caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } @@ -1083,7 +1084,7 @@ void CallbackCaller::disposing (void) } catch (RuntimeException&) { - DBG_ASSERT(false,"~ConfigurationUpdateGuard: caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/sd/source/ui/slideshow/PaneHider.cxx b/sd/source/ui/slideshow/PaneHider.cxx index bd0eb4e99..507972c50 100644 --- a/sd/source/ui/slideshow/PaneHider.cxx +++ b/sd/source/ui/slideshow/PaneHider.cxx @@ -45,6 +45,8 @@ #include #include +#include + using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; using ::sd::framework::FrameworkHelper; @@ -91,7 +93,7 @@ PaneHider::PaneHider (const ViewShell& rViewShell, SlideshowImpl* pSlideShow) } catch (RuntimeException&) { - DBG_ASSERT(false, "caught exception in PaneHider constructor"); + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx index dd8af4a4d..5420efe83 100644 --- a/sd/source/ui/slidesorter/controller/SlsListener.cxx +++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx @@ -52,6 +52,7 @@ #include #include #include +#include using namespace ::com::sun::star::accessibility; @@ -231,8 +232,7 @@ void Listener::ConnectToController (void) } catch (beans::UnknownPropertyException aEvent) { - OSL_TRACE ("caught exception in SlideSorterController::SetupListeners: %s", - ::rtl::OUStringToOString(aEvent.Message, RTL_TEXTENCODING_UTF8).getStr()); + DBG_UNHANDLED_EXCEPTION(); } try { @@ -240,8 +240,7 @@ void Listener::ConnectToController (void) } catch (beans::UnknownPropertyException aEvent) { - OSL_TRACE ("caught exception in SlideSorterController::SetupListeners: %s", - ::rtl::OUStringToOString(aEvent.Message, RTL_TEXTENCODING_UTF8).getStr()); + DBG_UNHANDLED_EXCEPTION(); } } @@ -289,9 +288,7 @@ void Listener::DisconnectFromController (void) } catch (beans::UnknownPropertyException aEvent) { - OSL_TRACE ("caught exception in destructor of SlideSorterController: %s", - ::rtl::OUStringToOString(aEvent.Message, - RTL_TEXTENCODING_UTF8).getStr()); + DBG_UNHANDLED_EXCEPTION(); } mbListeningToController = false; @@ -491,9 +488,7 @@ void SAL_CALL Listener::propertyChange ( } catch (beans::UnknownPropertyException aEvent) { - OSL_TRACE ("caught exception while accessing the page number of a slide: %s", - ::rtl::OUStringToOString(aEvent.Message, - RTL_TEXTENCODING_UTF8).getStr()); + DBG_UNHANDLED_EXCEPTION(); } catch (lang::DisposedException&) { diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx index cb4dd25aa..671675995 100644 --- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx +++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx @@ -53,6 +53,8 @@ #include "sdpage.hxx" #include "FrameView.hxx" +#include + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -228,13 +230,9 @@ sal_Int32 SlideSorterModel::GetIndex (const Reference& rxSli return nNumber; } } - catch (beans::UnknownPropertyException&) - { - OSL_ASSERT(false); - } - catch (lang::DisposedException&) + catch (uno::Exception&) { - OSL_ASSERT(false); + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx index bdbdbca8b..29b6d3c9d 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx @@ -64,6 +64,7 @@ #include #include #include +#include using namespace ::sdr::contact; using namespace ::sd::slidesorter::model; @@ -1169,7 +1170,7 @@ BitmapEx PageObjectViewObjectContact::GetPreview ( } catch (const ::com::sun::star::uno::Exception&) { - OSL_TRACE("PageObjectViewObjectContact::GetPreview: caught exception"); + DBG_UNHANDLED_EXCEPTION(); } return aBitmap; diff --git a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx b/sd/source/ui/toolpanel/controls/DocumentHelper.cxx index a503fa6fe..640a7e0e9 100644 --- a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx +++ b/sd/source/ui/toolpanel/controls/DocumentHelper.cxx @@ -46,6 +46,7 @@ #include #include #include "stlpool.hxx" +#include using namespace ::com::sun::star; @@ -248,9 +249,7 @@ SdPage* DocumentHelper::AddMasterPage ( catch (uno::Exception& rException) { pClonedMasterPage = NULL; - OSL_TRACE("caught exception while adding master page: %s", - ::rtl::OUStringToOString(rException.Message, - RTL_TEXTENCODING_UTF8).getStr()); + DBG_UNHANDLED_EXCEPTION(); } catch (::std::exception rException) { diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx b/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx index f8f786648..9d6a0adf4 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx +++ b/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx @@ -43,6 +43,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -294,7 +295,7 @@ SdPage* TemplatePageObjectProvider::operator() (SdDrawDocument* pContainerDocume } catch (uno::RuntimeException) { - OSL_TRACE ("caught exception while loading page from template file"); + DBG_UNHANDLED_EXCEPTION(); pPage = NULL; } diff --git a/sd/source/ui/tools/ConfigurationAccess.cxx b/sd/source/ui/tools/ConfigurationAccess.cxx index 7d794e8a1..8a74400d7 100644 --- a/sd/source/ui/tools/ConfigurationAccess.cxx +++ b/sd/source/ui/tools/ConfigurationAccess.cxx @@ -36,6 +36,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -116,11 +117,9 @@ void ConfigurationAccess::Initialize ( sAccessService, aCreationArguments); } - catch (Exception& rException) + catch (Exception&) { - OSL_TRACE ("caught exception while opening configuration: %s", - ::rtl::OUStringToOString(rException.Message, - RTL_TEXTENCODING_UTF8).getStr()); + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx index cee7400f9..6b0ed6944 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -45,6 +45,7 @@ #include #include #include +#include namespace sd { @@ -134,7 +135,7 @@ Image PreviewRenderer::RenderPage ( } catch (const com::sun::star::uno::Exception&) { - OSL_TRACE("PreviewRenderer::RenderPage: caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } @@ -196,7 +197,7 @@ Image PreviewRenderer::RenderSubstitution ( } catch (const com::sun::star::uno::Exception&) { - OSL_TRACE("PreviewRenderer::RenderPage: caught exception"); + DBG_UNHANDLED_EXCEPTION(); } return aPreview; @@ -305,7 +306,7 @@ void PreviewRenderer::PaintPage (const SdPage* pPage) } catch (const ::com::sun::star::uno::Exception&) { - OSL_TRACE("PreviewRenderer::PaintPage: caught exception"); + DBG_UNHANDLED_EXCEPTION(); } // Restore the previous online spelling and redlining states. diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 1c0846e6a..4d4ce0369 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -61,6 +61,7 @@ #include #include #include +#include #include "strings.hrc" #include "sdstring.hrc" @@ -977,7 +978,7 @@ void Outliner::ProvideNextTextObject (void) } catch (::com::sun::star::uno::Exception e) { - OSL_TRACE ("Outliner %p: caught exception while ending text edit mode", this); + DBG_UNHANDLED_EXCEPTION(); } SetUpdateMode(FALSE); OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 1705d8207..a9af1a09a 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -1633,7 +1633,7 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet) } catch (RuntimeException&) { - DBG_ASSERT(false, "ViewShellBase::Implementation::GetSlotState(): caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index 10ede3835..eb2c16c32 100644 --- a/sd/source/ui/view/ViewTabBar.cxx +++ b/sd/source/ui/view/ViewTabBar.cxx @@ -57,6 +57,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -475,7 +476,7 @@ bool ViewTabBar::ActivatePage (void) } catch (RuntimeException&) { - DBG_ASSERT(false,"ViewTabBar::ActivatePage(): caught exception"); + DBG_UNHANDLED_EXCEPTION(); } return false; diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index a409412a2..eff6e16a3 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -93,6 +93,7 @@ #include "DrawDocShell.hxx" #include "sdabstdlg.hxx" #include +#include #include "ViewShellBase.hxx" #include "FormShellManager.hxx" #include "LayerTabBar.hxx" @@ -417,7 +418,7 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) } catch (RuntimeException&) { - DBG_ASSERT(false, "caught exception while handline SID_RELOAD"); + DBG_UNHANDLED_EXCEPTION(); } // We have to return immediately to avoid accessing this object. -- cgit v1.2.3 From c212c1b928d079c415b1bd9a96d8751cc67174b1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 18 Mar 2010 15:25:13 +0100 Subject: slidecopy: initial implementation for custom tool panels The idea is to allow third-party components to plug additional tool panels into the task pane, by using the drawing framework (http://wiki.services.openoffice.org/wiki/Drawing_framework). This first step is not finished at all, it just adds a configuration scheme/data for such custom tool panels, and implements basic functionality in the ToolPanelDeck to respect this config data. Additionally, the first version of an example extension for a custom tool panel is implemented in sd/workben/custompanel. Still, except showing a drawer in the tool panel deck, representing the custom panel, nothing works. More to come :) --- sd/prj/build.lst | 1 + sd/source/ui/inc/taskpane/PanelId.hxx | 16 +- sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx | 2 - sd/source/ui/toolpanel/CustomToolPanel.cxx | 184 ++++++++++++++++++++++ sd/source/ui/toolpanel/CustomToolPanel.hxx | 95 ++++++++++++ sd/source/ui/toolpanel/StandardToolPanel.cxx | 111 ++++++++++++++ sd/source/ui/toolpanel/StandardToolPanel.hxx | 76 +++++++++ sd/source/ui/toolpanel/TaskPaneToolPanel.cxx | 57 +++---- sd/source/ui/toolpanel/TaskPaneToolPanel.hxx | 32 ++-- sd/source/ui/toolpanel/ToolPanelDeck.cxx | 14 -- sd/source/ui/toolpanel/ToolPanelDeck.hxx | 9 -- sd/source/ui/toolpanel/ToolPanelDrawer.cxx | 1 + sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 119 ++++++++++++--- sd/source/ui/toolpanel/makefile.mk | 2 + sd/workben/custompanel/Impress.xcu | 34 +++++ sd/workben/custompanel/colorpanel.map | 8 + sd/workben/custompanel/ctp_factory.cxx | 187 +++++++++++++++++++++++ sd/workben/custompanel/ctp_factory.hxx | 114 ++++++++++++++ sd/workben/custompanel/ctp_panel.cxx | 90 +++++++++++ sd/workben/custompanel/ctp_panel.hxx | 79 ++++++++++ sd/workben/custompanel/ctp_services.cxx | 92 +++++++++++ sd/workben/custompanel/delzip | 0 sd/workben/custompanel/description.xml | 16 ++ sd/workben/custompanel/makefile.mk | 102 +++++++++++++ sd/workben/custompanel/manifest.xml | 8 + 25 files changed, 1340 insertions(+), 109 deletions(-) mode change 100755 => 100644 sd/prj/build.lst create mode 100644 sd/source/ui/toolpanel/CustomToolPanel.cxx create mode 100644 sd/source/ui/toolpanel/CustomToolPanel.hxx create mode 100644 sd/source/ui/toolpanel/StandardToolPanel.cxx create mode 100644 sd/source/ui/toolpanel/StandardToolPanel.hxx create mode 100644 sd/workben/custompanel/Impress.xcu create mode 100644 sd/workben/custompanel/colorpanel.map create mode 100644 sd/workben/custompanel/ctp_factory.cxx create mode 100644 sd/workben/custompanel/ctp_factory.hxx create mode 100644 sd/workben/custompanel/ctp_panel.cxx create mode 100644 sd/workben/custompanel/ctp_panel.hxx create mode 100644 sd/workben/custompanel/ctp_services.cxx create mode 100644 sd/workben/custompanel/delzip create mode 100644 sd/workben/custompanel/description.xml create mode 100644 sd/workben/custompanel/makefile.mk create mode 100644 sd/workben/custompanel/manifest.xml diff --git a/sd/prj/build.lst b/sd/prj/build.lst old mode 100755 new mode 100644 index bc8bf923f..1b565ac71 --- a/sd/prj/build.lst +++ b/sd/prj/build.lst @@ -44,3 +44,4 @@ sd sd\source\ui\framework\factories nmake - all sd_framework_factories sd sd sd\source\ui\framework\tools nmake - all sd_framework_tools sd_inc NULL sd sd\source\ui\annotations nmake - all sd_uiannotations sd_inc NULL sd sd\util nmake - all sd_util sd_app sd_cgm sd_core sd_dlg sd_docsh sd_eppt sd_filt sd_func sd_grf sd_unid sd_view sd_xml sd_html sd_ppt sd_accessibility sd_animations sd_toolpanel sd_toolpanel_controls sd_tools sd_slsshell sd_slsmodel sd_slsview sd_slscontroller sd_slscache sd_notes sd_table sd_slideshow sd_presenter sd_undo sd_helper sd_framework_configuration sd_framework_module sd_framework_tools sd_framework_factories sd_text sd_annotations sd_uiannotations NULL +sd sd\workben\custompanel nmake - all sd_workben_panel sd_inc NULL diff --git a/sd/source/ui/inc/taskpane/PanelId.hxx b/sd/source/ui/inc/taskpane/PanelId.hxx index af9ceade6..8e097375d 100644 --- a/sd/source/ui/inc/taskpane/PanelId.hxx +++ b/sd/source/ui/inc/taskpane/PanelId.hxx @@ -39,14 +39,14 @@ namespace sd { namespace toolpanel */ enum PanelId { - PID__START = 0, - PID_UNKNOWN = PID__START, - PID_MASTER_PAGES, - PID_LAYOUT, - PID_TABLE_DESIGN, - PID_CUSTOM_ANIMATION, - PID_SLIDE_TRANSITION, - PID__END = PID_SLIDE_TRANSITION + PID_UNKNOWN = 0, + PID_MASTER_PAGES = 1, + PID_LAYOUT = 2, + PID_TABLE_DESIGN = 3, + PID_CUSTOM_ANIMATION = 4, + PID_SLIDE_TRANSITION = 5, + + PID_FIRST_CUSTOM_PANEL = 6 }; //...................................................................................................................... diff --git a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx index 4ccf3a731..827522b49 100644 --- a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx +++ b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx @@ -129,8 +129,6 @@ private: class Implementation; ::boost::scoped_ptr< Implementation > mpImpl; - bool mbIsInitialized; - ::boost::shared_ptr mpSubShellManager; /** The id of the menu in the menu bar/tool box of the parent docking diff --git a/sd/source/ui/toolpanel/CustomToolPanel.cxx b/sd/source/ui/toolpanel/CustomToolPanel.cxx new file mode 100644 index 000000000..38ed034a8 --- /dev/null +++ b/sd/source/ui/toolpanel/CustomToolPanel.cxx @@ -0,0 +1,184 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_sd.hxx" + +#include "CustomToolPanel.hxx" +#include "framework/FrameworkHelper.hxx" + +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + +#include +#include +#include + +#if OSL_DEBUG_LEVEL > 0 +#include +#endif + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::drawing::framework::XConfigurationController; + using ::com::sun::star::drawing::framework::XResourceId; + using ::com::sun::star::drawing::framework::ResourceId; + using ::com::sun::star::drawing::framework::XResource; + /** === end UNO using === **/ + + //================================================================================================================== + //= helper + //================================================================================================================== + namespace + { + ::rtl::OUString lcl_getPanelConfig( const ::utl::OConfigurationNode& i_rPanelConfig, const sal_Char* i_pAsciiPropName ) + { + ::rtl::OUString sConfigValue; + OSL_VERIFY( i_rPanelConfig.getNodeValue( i_pAsciiPropName ) >>= sConfigValue ); + if ( sConfigValue.getLength() == 0 ) + { +#if OSL_DEBUG_LEVEL > 0 + ::rtl::OStringBuffer aMessage; + aMessage.append( "lcl_getPanelConfig: invalid config value (" ); + aMessage.append( i_pAsciiPropName ); + aMessage.append( ") for panel config '" ); + aMessage.append( ::rtl::OUStringToOString( i_rPanelConfig.getLocalName(), RTL_TEXTENCODING_UTF8 ) ); + aMessage.append( "'" ); + OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() ); +#endif + } + return sConfigValue; + } + } + + //================================================================================================================== + //= CustomToolPanel + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + CustomToolPanel::CustomToolPanel( ToolPanelDeck& i_rPanelDeck, const ::utl::OConfigurationNode& i_rPanelConfig, + const Reference< XResourceId >& i_rPaneResourceId, const ::boost::shared_ptr< framework::FrameworkHelper >& i_pFrameworkHelper ) + :TaskPaneToolPanel( i_rPanelDeck, lcl_getPanelConfig( i_rPanelConfig, "DisplayTitle" ), Image() /* TODO */, SmartId() /* TODO */ ) + ,m_pFrameworkHelper( i_pFrameworkHelper ) + ,m_xPanelResourceId() + ,m_xPanel() + ,m_bAttemptedPanelCreation( false ) + { + ENSURE_OR_THROW( m_pFrameworkHelper.get() != NULL, "invalid framework helper" ); + ENSURE_OR_THROW( i_rPaneResourceId.is(), "invalid pane resource id" ); + try + { + ::rtl::OUString sPanelResourceURL( lcl_getPanelConfig( i_rPanelConfig, "ResourceURL" ) ); + m_xPanelResourceId.set( + ResourceId::createWithAnchor( + ::comphelper::getProcessComponentContext(), + sPanelResourceURL, + i_rPaneResourceId ), + UNO_SET_THROW + ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + CustomToolPanel::~CustomToolPanel() + { + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::Dispose() + { + if ( m_xPanel.is() ) + { + try + { + // TODO: obtain the factory for our panel, and invoke its destroyResource method + } + catch ( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + TaskPaneToolPanel::Dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + const Reference< XResourceId >& CustomToolPanel::getResourceId() const + { + return m_xPanelResourceId; + } + + //------------------------------------------------------------------------------------------------------------------ + ::Window* CustomToolPanel::getPanelWindow() const + { + ENSURE_OR_RETURN( impl_ensurePanel(), "could not create the panel", NULL ); + // TODO + return NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + bool CustomToolPanel::impl_ensurePanel() const + { + ENSURE_OR_RETURN_FALSE( !isDisposed(), "already disposed" ); + + if ( !m_bAttemptedPanelCreation ) + { + const_cast< CustomToolPanel* >( this )->m_bAttemptedPanelCreation = true; + + try + { + Reference< XConfigurationController > xConfigController( m_pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW ); + Reference< XResource > xToolPanelResource( xConfigController->getResource( m_xPanelResourceId ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + return m_xPanel.is(); + } + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... + diff --git a/sd/source/ui/toolpanel/CustomToolPanel.hxx b/sd/source/ui/toolpanel/CustomToolPanel.hxx new file mode 100644 index 000000000..7c143ccef --- /dev/null +++ b/sd/source/ui/toolpanel/CustomToolPanel.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SD_TOOLPANEL_CUSTOMTOOLPANEL_HXX +#define SD_TOOLPANEL_CUSTOMTOOLPANEL_HXX + +#include "TaskPaneToolPanel.hxx" + +/** === begin UNO includes === **/ +#include +#include +/** === end UNO includes === **/ + +#include + +namespace utl +{ + class OConfigurationNode; +} + +namespace sd { namespace framework +{ + class FrameworkHelper; +} } + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + class ToolPanelDeck; + + //================================================================================================================== + //= CustomToolPanel + //================================================================================================================== + /** is a ::svt::IToolPanel implementation for custom tool panels, i.e. those defined in the configuration, and + implemented by external components. + */ + class CustomToolPanel : public TaskPaneToolPanel + { + public: + CustomToolPanel( + ToolPanelDeck& i_rPanelDeck, + const ::utl::OConfigurationNode& i_rPanelConfig, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPaneResourceId, + const ::boost::shared_ptr< framework::FrameworkHelper >& i_pFrameworkHelper + ); + ~CustomToolPanel(); + + // IToolPanel overridables + virtual void Dispose(); + + protected: + // TaskPaneToolPanel overridables + virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const; + virtual ::Window* getPanelWindow() const; + + private: + bool impl_ensurePanel() const; + + private: + ::boost::shared_ptr< framework::FrameworkHelper > m_pFrameworkHelper; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > m_xPanelResourceId; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XPane2 > m_xPanel; + bool m_bAttemptedPanelCreation; + }; + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... + +#endif // SD_TOOLPANEL_CUSTOMTOOLPANEL_HXX diff --git a/sd/source/ui/toolpanel/StandardToolPanel.cxx b/sd/source/ui/toolpanel/StandardToolPanel.cxx new file mode 100644 index 000000000..e483cf028 --- /dev/null +++ b/sd/source/ui/toolpanel/StandardToolPanel.cxx @@ -0,0 +1,111 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_sd.hxx" + +#include "StandardToolPanel.hxx" +#include "ToolPanelDeck.hxx" +#include "sdresid.hxx" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::drawing::framework::XResourceId; + /** === end UNO using === **/ + + //================================================================================================================== + //= StandardToolPanel + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + StandardToolPanel::StandardToolPanel( ToolPanelDeck& i_rPanelDeck, ::std::auto_ptr< ControlFactory >& i_rControlFactory, + const USHORT i_nTitleResId, const Image& i_rImage, const ULONG i_nHelpId, + const Reference< XResourceId >& i_rPanelResourceId ) + :TaskPaneToolPanel( i_rPanelDeck, SdResId( i_nTitleResId ), i_rImage, SmartId( i_nHelpId ) ) + ,m_pControlFactory( i_rControlFactory ) + ,m_xPanelResourceId( i_rPanelResourceId ) + { + ENSURE_OR_THROW( m_pControlFactory.get(), "illegal control factory" ); + } + + //------------------------------------------------------------------------------------------------------------------ + StandardToolPanel::~StandardToolPanel() + { + m_pControl.reset(); + } + + //------------------------------------------------------------------------------------------------------------------ + void StandardToolPanel::Dispose() + { + m_pControl.reset(); + TaskPaneToolPanel::Dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + const Reference< XResourceId >& StandardToolPanel::getResourceId() const + { + return m_xPanelResourceId; + } + + //------------------------------------------------------------------------------------------------------------------ + ::Window* StandardToolPanel::getPanelWindow() const + { + ENSURE_OR_RETURN( const_cast< StandardToolPanel* >( this )->impl_ensureControl(), "StandardToolPanel::getPanelWindow: no control!", NULL ); + return m_pControl->GetWindow(); + } + + //------------------------------------------------------------------------------------------------------------------ + bool StandardToolPanel::impl_ensureControl() + { + if ( m_pControl.get() ) + return true; + if ( isDisposed() ) + return false; + m_pControl = m_pControlFactory->CreateRootControl( getPanelDeck() ); + return ( m_pControl.get() != NULL ); + } + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/StandardToolPanel.hxx b/sd/source/ui/toolpanel/StandardToolPanel.hxx new file mode 100644 index 000000000..5844a75ea --- /dev/null +++ b/sd/source/ui/toolpanel/StandardToolPanel.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SD_TOOLPANEL_STANDARDTOOLPANEL_HXX +#define SD_TOOLPANEL_STANDARDTOOLPANEL_HXX + +#include "TaskPaneToolPanel.hxx" + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + //================================================================================================================== + //= StandardToolPanel + //================================================================================================================== + /** an IToolPanel implementation for one of the standard (aka built-in) tool panels + */ + class StandardToolPanel : public TaskPaneToolPanel + { + public: + StandardToolPanel( + ToolPanelDeck& i_rPanelDeck, + ::std::auto_ptr< ControlFactory >& i_rControlFactory, + const USHORT i_nTitleResId, + const Image& i_rImage, + const ULONG i_nHelpId, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPanelResourceId + ); + ~StandardToolPanel(); + + // IToolPanel overridables + virtual void Dispose(); + + // TaskPaneToolPanel overridables + virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const; + virtual ::Window* getPanelWindow() const; + + private: + bool impl_ensureControl(); + + private: + ::std::auto_ptr< ControlFactory > m_pControlFactory; + ::std::auto_ptr< TreeNode > m_pControl; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > + m_xPanelResourceId; + }; + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... + +#endif // SD_TOOLPANEL_STANDARDTOOLPANEL_HXX diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx index 95ffb6aca..5aad4b0f9 100644 --- a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx @@ -28,7 +28,6 @@ #include "TaskPaneToolPanel.hxx" #include "ToolPanelDeck.hxx" -#include "sdresid.hxx" #include #include @@ -57,91 +56,79 @@ namespace sd { namespace toolpanel //= TaskPaneToolPanel //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - TaskPaneToolPanel::TaskPaneToolPanel( ToolPanelDeck& i_rPanelDeck, ::std::auto_ptr< ControlFactory >& i_rControlFactory, - const Image& i_rImage, const USHORT i_nTitleResId, const ULONG i_nHelpId, const Reference< XResourceId >& i_rPanelResourceId ) + TaskPaneToolPanel::TaskPaneToolPanel( ToolPanelDeck& i_rPanelDeck, const String& i_rPanelName, const Image& i_rImage, + const SmartId& i_rHelpId ) :m_pPanelDeck( &i_rPanelDeck ) - ,m_pControlFactory( i_rControlFactory ) - ,m_pControl() - ,m_aImage( i_rImage ) - ,m_sTitle( SdResId( i_nTitleResId ) ) - ,m_aHelpId( i_nHelpId ) - ,m_xPanelResourceId( i_rPanelResourceId ) + ,m_aPanelImage( i_rImage ) + ,m_sPanelName( i_rPanelName ) + ,m_aHelpId( i_rHelpId ) { - ENSURE_OR_THROW( m_pControlFactory.get(), "illegal control factory" ); } //------------------------------------------------------------------------------------------------------------------ TaskPaneToolPanel::~TaskPaneToolPanel() { - m_pControl.reset(); } //------------------------------------------------------------------------------------------------------------------ ::rtl::OUString TaskPaneToolPanel::GetDisplayName() const { - return m_sTitle; + return m_sPanelName; } //------------------------------------------------------------------------------------------------------------------ Image TaskPaneToolPanel::GetImage() const { - return m_aImage; + return m_aPanelImage; } //------------------------------------------------------------------------------------------------------------------ void TaskPaneToolPanel::Show() { - ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to show" ); - m_pControl->GetWindow()->Show(); + Window* pPanelWindow( getPanelWindow() ); + ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to show" ); + pPanelWindow->Show(); } //------------------------------------------------------------------------------------------------------------------ void TaskPaneToolPanel::Hide() { - ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to hide" ); - m_pControl->GetWindow()->Hide(); + Window* pPanelWindow( getPanelWindow() ); + ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to hide" ); + pPanelWindow->Hide(); } //------------------------------------------------------------------------------------------------------------------ void TaskPaneToolPanel::SetPosSizePixel( const Rectangle& i_rPanelPlayground ) { - ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to position" ); - m_pControl->GetWindow()->SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() ); + Window* pPanelWindow( getPanelWindow() ); + ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to position" ); + pPanelWindow->SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() ); } //------------------------------------------------------------------------------------------------------------------ void TaskPaneToolPanel::GrabFocus() { - ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to focus" ); - m_pControl->GetWindow()->GrabFocus(); + Window* pPanelWindow( getPanelWindow() ); + ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to focus" ); + pPanelWindow->GrabFocus(); } //------------------------------------------------------------------------------------------------------------------ bool TaskPaneToolPanel::HasFocus() const { - ENSURE_OR_RETURN_FALSE( const_cast< TaskPaneToolPanel* >( this )->impl_ensureControl(), "no control to ask" ); - return m_pControl->GetWindow()->HasChildPathFocus(); + Window* pPanelWindow( getPanelWindow() ); + ENSURE_OR_RETURN_FALSE( pPanelWindow, "no window to ask" ); + return pPanelWindow->HasChildPathFocus(); } //------------------------------------------------------------------------------------------------------------------ void TaskPaneToolPanel::Dispose() { ENSURE_OR_RETURN_VOID( m_pPanelDeck, "disposed twice" ); - m_pControl.reset(); m_pPanelDeck = NULL; } - //------------------------------------------------------------------------------------------------------------------ - bool TaskPaneToolPanel::impl_ensureControl() - { - if ( m_pControl.get() ) - return true; - if ( !m_pPanelDeck ) - return false; - m_pControl = m_pControlFactory->CreateRootControl( *m_pPanelDeck ); - return ( m_pControl.get() != NULL ); - } - //...................................................................................................................... } } // namespace sd::toolpanel //...................................................................................................................... diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx index ea589441b..d7d9b0246 100644 --- a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx @@ -52,17 +52,16 @@ namespace sd { namespace toolpanel //================================================================================================================== class TaskPaneToolPanel : public ::svt::ToolPanelBase { - public: + protected: TaskPaneToolPanel( ToolPanelDeck& i_rPanelDeck, - ::std::auto_ptr< ControlFactory >& i_rControlFactory, + const String& i_rPanelName, const Image& i_rImage, - const USHORT i_nTitleResId, - const ULONG i_nHelpId, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPanelResourceId + const SmartId& i_rHelpId ); ~TaskPaneToolPanel(); + public: // IToolPanel overridables virtual ::rtl::OUString GetDisplayName() const; virtual Image GetImage() const; @@ -73,22 +72,19 @@ namespace sd { namespace toolpanel virtual bool HasFocus() const; virtual void Dispose(); - // own attributes - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& - getResourceId() const { return m_xPanelResourceId; } + // own overridables + virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const = 0; + virtual ::Window* getPanelWindow() const = 0; - private: - bool impl_ensureControl(); + protected: + bool isDisposed() const { return m_pPanelDeck == NULL; } + ToolPanelDeck& getPanelDeck() { OSL_ENSURE( !isDisposed(), "already disposed!" ); return *m_pPanelDeck; } private: - ToolPanelDeck* m_pPanelDeck; - ::std::auto_ptr< ControlFactory > m_pControlFactory; - ::std::auto_ptr< TreeNode > m_pControl; - const Image m_aImage; - const String m_sTitle; - const SmartId m_aHelpId; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > - m_xPanelResourceId; + ToolPanelDeck* m_pPanelDeck; + const Image m_aPanelImage; + const String m_sPanelName; + const SmartId m_aHelpId; }; //...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.cxx b/sd/source/ui/toolpanel/ToolPanelDeck.cxx index f12416e7a..d26bb4305 100644 --- a/sd/source/ui/toolpanel/ToolPanelDeck.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDeck.cxx @@ -111,20 +111,6 @@ namespace sd { namespace toolpanel SetLayouter( new ::svt::TabDeckLayouter( *this, *this, i_eTabAlignment, i_eTabContent ) ); } - //------------------------------------------------------------------------------------------------------------------ - size_t ToolPanelDeck::CreateAndInsertPanel( ::std::auto_ptr< ControlFactory >& i_rControlFactory, - const Image& i_rImage, const USHORT i_nTitleResId, const ULONG i_nHelpId, const Reference< XResourceId >& i_rPanelResourceId ) - { - // create panel - ::svt::PToolPanel pNewPanel( new TaskPaneToolPanel( - *this, i_rControlFactory, - i_rImage, i_nTitleResId, i_nHelpId, - i_rPanelResourceId - ) ); - // insert as new panel - return InsertPanel( pNewPanel, GetPanelCount() ); - } - //------------------------------------------------------------------------------------------------------------------ void ToolPanelDeck::ActivatePanelDirectly( const ::boost::optional< size_t >& i_rPanel ) { diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.hxx b/sd/source/ui/toolpanel/ToolPanelDeck.hxx index ba66e77c5..3be9e024b 100644 --- a/sd/source/ui/toolpanel/ToolPanelDeck.hxx +++ b/sd/source/ui/toolpanel/ToolPanelDeck.hxx @@ -58,15 +58,6 @@ namespace sd { namespace toolpanel ); ~ToolPanelDeck(); - // panel maintenance - size_t CreateAndInsertPanel( - ::std::auto_ptr< ControlFactory >& i_rControlFactory, - const Image& i_rImage, - const USHORT i_nTitleResId, - const ULONG i_nHelpId, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPanelResourceId - ); - /** activates a layout where the active panel is selected via tabs at the right/left/top/bottom (depending on the given TabAlignment value). */ diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx index 26eb0bfdd..5181e489b 100644 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx @@ -132,6 +132,7 @@ namespace sd { namespace toolpanel pTitleBar->GetWindow()->Show(); pTitleBar->GetWindow()->AddEventListener( LINK( this, ToolPanelDrawer, OnWindowEvent ) ); m_aDrawers.insert( m_aDrawers.begin() + i_nPosition, pTitleBar ); + impl_triggerRearrange(); } //------------------------------------------------------------------------------------------------------------------ diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 02dfc3ce1..4984852f9 100644 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -31,6 +31,8 @@ #include "TaskPaneShellManager.hxx" #include "TaskPaneFocusManager.hxx" +#include "StandardToolPanel.hxx" +#include "CustomToolPanel.hxx" #include "controls/MasterPagesPanel.hxx" #include "LayoutMenu.hxx" #include "controls/TableDesignPanel.hxx" @@ -74,6 +76,9 @@ #include #include #include +#include +#include +#include #include @@ -183,7 +188,7 @@ public: */ size_t GetPanelCount() const { - return size_t( PID__END ); + return m_aPanels.size(); } const PanelDescriptor& GetPanel( const size_t i_nLogicalPanelIndex ) const @@ -214,11 +219,20 @@ private: void RegisterPanel( size_t i_nPosition, PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ); void UpdateDockingWindowTitle(); + /** creates the built-in panels, returns the position of the panel to activate initially + */ + size_t SetupDefaultPanels(); + + /** creates the custom panels + */ + void SetupCustomPanels(); + typedef ::std::vector< PanelDescriptor > PanelDescriptors; - PanelDescriptors m_aPanels; - ToolPanelViewShell& m_rPanelViewShell; - ::boost::scoped_ptr< ToolPanelDeck > m_pPanelDeck; - PanelSelectorLayout m_eCurrentLayout; + PanelDescriptors m_aPanels; + ToolPanelViewShell& m_rPanelViewShell; + ::boost::scoped_ptr< ToolPanelDeck > m_pPanelDeck; + PanelSelectorLayout m_eCurrentLayout; + bool m_bInitialized; }; // ===================================================================================================================== @@ -249,7 +263,7 @@ SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL)) TYPEINIT1(ToolPanelViewShell, ViewShell); // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::Setup() +size_t ToolPanelViewShell::Implementation::SetupDefaultPanels() { typedef std::auto_ptr (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell ); @@ -263,7 +277,8 @@ void ToolPanelViewShell::Implementation::Setup() ::rtl::OUString sResourceURL; }; - PanelDescriptor aPanels[] = { + PanelDescriptor aPanels[] = + { // "Master Pages" { &controls::MasterPagesPanel::CreateControlFactory, "PresentationLayout", @@ -329,21 +344,70 @@ void ToolPanelViewShell::Implementation::Setup() const Reference< XResourceId > xPanelId( pFrameworkHelper->CreateResourceId( aPanels[i].sResourceURL, xToolPanelId ) ); // create and insert the panel - size_t nPanelPos = m_pPanelDeck->CreateAndInsertPanel( + ::svt::PToolPanel pNewPanel( new StandardToolPanel( + *m_pPanelDeck, (*aPanels[i].pFactory)( m_rPanelViewShell ), - aPanelImage, aPanels[i].nTitleResourceID, + aPanelImage, aPanels[i].nHelpID, xPanelId - ); + ) ); + const size_t nPanelPos = m_pPanelDeck->InsertPanel( pNewPanel, m_pPanelDeck->GetPanelCount() ); // remember it - RegisterPanel( nPanelPos, aPanels[i].nPanelID, m_pPanelDeck->GetPanel( nPanelPos ) ); + RegisterPanel( nPanelPos, aPanels[i].nPanelID, pNewPanel ); if ( nPanelIdToActivate == aPanels[i].nPanelID ) nPanelPosToActivate = nPanelPos; } + return nPanelPosToActivate; +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Implementation::SetupCustomPanels() +{ + // compose the resource ID for the ToolPanel view + ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) ); + const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ) ); + + // get the config node holding the custom tool panel descriptions + ::utl::OConfigurationTreeRoot aConfig( ::comphelper::ComponentContext( ::comphelper::getProcessServiceFactory() ), + "/org.openoffice.Office.Impress/MultiPaneGUI/ToolPanel/CustomPanels", false ); + const Sequence< ::rtl::OUString > aCustomPanelDescs( aConfig.getNodeNames() ); + + // create panels + size_t nCustomPanelNo = 0; + for ( const ::rtl::OUString* panelNodeName = aCustomPanelDescs.getConstArray(); + panelNodeName != aCustomPanelDescs.getConstArray() + aCustomPanelDescs.getLength(); + ++panelNodeName + ) + { + ::utl::OConfigurationNode aPanelDesc( aConfig.openNode( *panelNodeName ) ); + + // create and insert the panel + ::svt::PToolPanel pNewPanel( new CustomToolPanel( *m_pPanelDeck, aPanelDesc, xToolPanelId, pFrameworkHelper ) ); + const size_t nPanelPos = m_pPanelDeck->InsertPanel( pNewPanel, m_pPanelDeck->GetPanelCount() ); + + // remember it + RegisterPanel( nPanelPos, PanelId( PID_FIRST_CUSTOM_PANEL + nCustomPanelNo ), pNewPanel ); + ++nCustomPanelNo; + } +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Implementation::Setup() +{ + if ( m_bInitialized ) + return; + m_bInitialized = true; + + // standard (built-in) panels + const size_t nPanelPosToActivate = SetupDefaultPanels(); + + // custom panels + SetupCustomPanels(); + // activate default panel m_pPanelDeck->ActivatePanelResource( nPanelPosToActivate ); @@ -387,18 +451,27 @@ void ToolPanelViewShell::Implementation::SetLayout( const PanelSelectorLayout i_ // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell::Implementation::Cleanup() { - m_pPanelDeck->RemoveListener( *this ); + if ( !m_bInitialized ) + { + m_pPanelDeck->RemoveListener( *this ); + // remove the panels which are not under the control of the panel deck currently + for ( PanelDescriptors::iterator panelPos = m_aPanels.begin(); + panelPos != m_aPanels.end(); + ++panelPos + ) + { + if ( panelPos->bHidden ) + panelPos->pPanel->Dispose(); + } + m_aPanels.clear(); + } m_pPanelDeck.reset(); } // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell::Initialize() { - if ( !mbIsInitialized ) - { - mbIsInitialized = true; - mpImpl->Setup(); - } + mpImpl->Setup(); } // --------------------------------------------------------------------------------------------------------------------- @@ -406,7 +479,6 @@ ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rVi FrameView* pFrameViewArgument ) :ViewShell(pFrame, pParentWindow, rViewShellBase) ,mpImpl( new Implementation( *this, *mpContentWindow.get() ) ) - ,mbIsInitialized(false) ,mpSubShellManager() ,mnMenuId(0) { @@ -462,10 +534,7 @@ ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rVi // --------------------------------------------------------------------------------------------------------------------- ToolPanelViewShell::~ToolPanelViewShell() { - if ( mbIsInitialized ) - { - mpImpl->Cleanup(); - } + mpImpl->Cleanup(); // reset our impl before destroying the panel deck, to ensure the hidden panels are properly // disposed/destroyed, too @@ -800,10 +869,11 @@ void ToolPanelViewShell::ActivatePanel( const PanelId i_ePanelId ) // ===================================================================================================================== // --------------------------------------------------------------------------------------------------------------------- ToolPanelViewShell::Implementation::Implementation( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent ) - :m_aPanels( PanelDescriptors::size_type( PID__END ) ) + :m_aPanels() ,m_rPanelViewShell( i_rPanelViewShell ) ,m_pPanelDeck( new ToolPanelDeck( i_rPanelDeckParent, i_rPanelViewShell ) ) ,m_eCurrentLayout( LAYOUT_DRAWERS ) + ,m_bInitialized( false ) { } @@ -875,6 +945,9 @@ void ToolPanelViewShell::Implementation::ActivatePanelDirectly( const PanelId i_ // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell::Implementation::RegisterPanel( size_t i_nPosition, PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ) { + if ( i_nPosition >= m_aPanels.size() ) + m_aPanels.resize( i_nPosition + 1 ); + OSL_PRECOND( m_aPanels[ i_nPosition ].nId == PID_UNKNOWN, "ToolPanelViewShell::Implementation::RegisterPanel: " "already registered a panel for this ID!" ); m_aPanels[ i_nPosition ] = PanelDescriptor( i_nPanelId, i_rPanel ); diff --git a/sd/source/ui/toolpanel/makefile.mk b/sd/source/ui/toolpanel/makefile.mk index d364b74ea..837ffb710 100644 --- a/sd/source/ui/toolpanel/makefile.mk +++ b/sd/source/ui/toolpanel/makefile.mk @@ -62,6 +62,8 @@ SLOFILES = \ $(SLO)$/ToolPanelDeck.obj \ $(SLO)$/ToolPanelDrawer.obj \ $(SLO)$/TaskPaneToolPanel.obj \ + $(SLO)$/CustomToolPanel.obj \ + $(SLO)$/StandardToolPanel.obj \ \ $(SLO)$/EmptyWindow.obj \ $(SLO)$/LayoutMenu.obj \ diff --git a/sd/workben/custompanel/Impress.xcu b/sd/workben/custompanel/Impress.xcu new file mode 100644 index 000000000..1c7bb5f6b --- /dev/null +++ b/sd/workben/custompanel/Impress.xcu @@ -0,0 +1,34 @@ + + + + + + + + + private:resource/view/SingleColorView + + + Single Color Panel + + + + + + + + + org.openoffice.example.colorpanel.ResourceFactory + + + + + private:resource/view/SingleColorView + + + + + + + + diff --git a/sd/workben/custompanel/colorpanel.map b/sd/workben/custompanel/colorpanel.map new file mode 100644 index 000000000..f4ed78b9e --- /dev/null +++ b/sd/workben/custompanel/colorpanel.map @@ -0,0 +1,8 @@ +UDK_3_0_0 { + global: + component_getImplementationEnvironment; + component_writeInfo; + component_getFactory; + local: + *; +}; diff --git a/sd/workben/custompanel/ctp_factory.cxx b/sd/workben/custompanel/ctp_factory.cxx new file mode 100644 index 000000000..45ad3dab3 --- /dev/null +++ b/sd/workben/custompanel/ctp_factory.cxx @@ -0,0 +1,187 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_sd.hxx" + +#include "ctp_factory.hxx" +#include "ctp_panel.hxx" + +/** === begin UNO includes === **/ +#include +#include +#include +/** === end UNO includes === **/ + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::XComponentContext; + using ::com::sun::star::drawing::framework::XResourceId; + using ::com::sun::star::drawing::framework::XResource; + using ::com::sun::star::lang::NotInitializedException; + using ::com::sun::star::lang::IllegalArgumentException; + using ::com::sun::star::drawing::framework::XResourceFactoryManager; + /** === end UNO using === **/ + + //================================================================================================================== + //= helper + //================================================================================================================== + namespace + { + const ::rtl::OUString& lcl_getSingleColorViewURL() + { + static ::rtl::OUString s_sSingleColorViewURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/view/SingleColorView" ) ); + return s_sSingleColorViewURL; + } + } + + //================================================================================================================== + //= ResourceFactory + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ResourceFactory::ResourceFactory( const Reference< XComponentContext >& i_rContext ) + :m_xContext( i_rContext ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + ResourceFactory::~ResourceFactory() + { + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XResource > SAL_CALL ResourceFactory::createResource( const Reference< XResourceId >& i_rResourceId ) throw (RuntimeException) + { + FactoryGuard aGuard( *this ); + if ( !i_rResourceId.is() ) + // TODO: the API should allow me to throw an IllegalArgumentException here + throw NULL; + + const ::rtl::OUString sResourceURL( i_rResourceId->getResourceURL() ); + if ( sResourceURL != lcl_getSingleColorViewURL() ) + return NULL; + + return new SingleColorPanel( m_xContext, m_xControllerManager->getConfigurationController(), i_rResourceId ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL ResourceFactory::releaseResource( const Reference< XResource >& i_rResource ) throw (RuntimeException) + { + FactoryGuard aGuard( *this ); + // TODO: place your code here + (void)i_rResource; + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL ResourceFactory::getImplementationName( ) throw (RuntimeException) + { + return getImplementationName_static(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL ResourceFactory::getImplementationName_static( ) throw (RuntimeException) + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.example.colorpanel.ResourceFactory" ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Bool SAL_CALL ResourceFactory::supportsService( const ::rtl::OUString& i_rServiceName ) throw (RuntimeException) + { + const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() ); + for ( const ::rtl::OUString* serviceName = aServiceNames.getConstArray(); + serviceName != aServiceNames.getConstArray() + aServiceNames.getLength(); + ++serviceName + ) + { + if ( i_rServiceName == *serviceName ) + return sal_True; + } + return sal_False; + } + + //------------------------------------------------------------------------------------------------------------------ + Sequence< ::rtl::OUString > SAL_CALL ResourceFactory::getSupportedServiceNames() throw (RuntimeException) + { + return getSupportedServiceNames_static(); + } + + //------------------------------------------------------------------------------------------------------------------ + Sequence< ::rtl::OUString > SAL_CALL ResourceFactory::getSupportedServiceNames_static() throw (RuntimeException) + { + Sequence< ::rtl::OUString > aServiceNames(1); + aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.example.colorpanel.ResourceFactory" ) ); + return aServiceNames; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XInterface > SAL_CALL ResourceFactory::Create( const Reference< XComponentContext >& i_rContext ) throw (RuntimeException) + { + return *( new ResourceFactory( i_rContext ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ResourceFactory::checkInitialized( GuardAccess ) const + { + if ( !m_xControllerManager.is() ) + throw NotInitializedException( ::rtl::OUString(), *const_cast< ResourceFactory* >( this ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ResourceFactory::checkDisposed( GuardAccess ) const + { + // cannot be disposed currently ... + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL ResourceFactory::initialize( const Sequence< Any >& i_rArguments ) throw (Exception, RuntimeException) + { + if ( !i_rArguments.getLength() ) + throw IllegalArgumentException(); + + FactoryGuard aGuard( *this, false ); + m_xControllerManager.set( i_rArguments[0], UNO_QUERY_THROW ); + + Reference< XResourceFactoryManager > xFactoryManager( m_xControllerManager->getConfigurationController(), UNO_QUERY_THROW ); + xFactoryManager->addResourceFactory( lcl_getSingleColorViewURL(), this ); + } + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... diff --git a/sd/workben/custompanel/ctp_factory.hxx b/sd/workben/custompanel/ctp_factory.hxx new file mode 100644 index 000000000..5b071d72f --- /dev/null +++ b/sd/workben/custompanel/ctp_factory.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SD_WORKBENCH_CTP_FACTORY_HXX +#define SD_WORKBENCH_CTP_FACTORY_HXX + +/** === begin UNO includes === **/ +#include +#include +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + class FactoryGuard; + + //================================================================================================================== + //= ResourceFactory + //================================================================================================================== + typedef ::cppu::WeakImplHelper3 < ::com::sun::star::drawing::framework::XResourceFactory + , ::com::sun::star::lang::XServiceInfo + , ::com::sun::star::lang::XInitialization + > ResourceFactory_Base; + class ResourceFactory :public ::cppu::BaseMutex + ,public ResourceFactory_Base + { + public: + ResourceFactory( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext + ); + ~ResourceFactory(); + + // XResourceFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResource > SAL_CALL createResource( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& xResourceId ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL releaseResource( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResource >& xResource ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo - static versions + static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext ) 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); + + public: + struct GuardAccess { friend class FactoryGuard; private: GuardAccess() { } }; + + void checkInitialized( GuardAccess ) const; + void checkDisposed( GuardAccess ) const; + ::osl::Mutex& getMutex( GuardAccess ) { return m_aMutex; } + + private: + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XControllerManager > + m_xControllerManager; + }; + + class FactoryGuard + { + public: + FactoryGuard( ResourceFactory& i_rFactory, const bool i_bNeedInit = true ) + :m_aGuard( i_rFactory.getMutex( ResourceFactory::GuardAccess() ) ) + { + i_rFactory.checkDisposed( ResourceFactory::GuardAccess() ); + if ( i_bNeedInit ) + i_rFactory.checkInitialized( ResourceFactory::GuardAccess() ); + } + + protected: + ::osl::MutexGuard m_aGuard; + }; + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... + +#endif // SD_WORKBENCH_CTP_FACTORY_HXX diff --git a/sd/workben/custompanel/ctp_panel.cxx b/sd/workben/custompanel/ctp_panel.cxx new file mode 100644 index 000000000..dbda31812 --- /dev/null +++ b/sd/workben/custompanel/ctp_panel.cxx @@ -0,0 +1,90 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_sd.hxx" + +#include "ctp_panel.hxx" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::drawing::framework::XConfigurationController; + using ::com::sun::star::drawing::framework::XResourceId; + using ::com::sun::star::uno::XComponentContext; + /** === end UNO using === **/ + + //================================================================================================================== + //= class SingleColorPanel + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + SingleColorPanel::SingleColorPanel( const Reference< XComponentContext >& i_rContext, + const Reference< XConfigurationController >& i_rConfigController, const Reference< XResourceId >& i_rResourceId ) + :m_xContext( i_rContext ) + ,m_xResourceId( i_rResourceId ) + { + // TODO: retrieve the resource object for the anchor, ask it for its XPane interface, retrieve the window + // associated with it, create our own window as child of the pane's window + (void)i_rConfigController; + } + + //------------------------------------------------------------------------------------------------------------------ + SingleColorPanel::~SingleColorPanel() + { + } + + //-------------------------------------------------------------------- + Reference< XResourceId > SAL_CALL SingleColorPanel::getResourceId( ) throw (RuntimeException) + { + return m_xResourceId; + } + + //-------------------------------------------------------------------- + ::sal_Bool SAL_CALL SingleColorPanel::isAnchorOnly( ) throw (RuntimeException) + { + return sal_False; + } + + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... diff --git a/sd/workben/custompanel/ctp_panel.hxx b/sd/workben/custompanel/ctp_panel.hxx new file mode 100644 index 000000000..bf4a0654b --- /dev/null +++ b/sd/workben/custompanel/ctp_panel.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SD_WORKBENCH_CTP_PANEL_HXX +#define SD_WORKBENCH_CTP_PANEL_HXX + +/** === begin UNO includes === **/ +#include +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + //================================================================================================================== + //= class SingleColorPanel + //================================================================================================================== + typedef ::cppu::WeakImplHelper1 < ::com::sun::star::drawing::framework::XView + > SingleColorPanel_Base; + class SingleColorPanel :public ::cppu::BaseMutex + ,public SingleColorPanel_Base + { + public: + SingleColorPanel( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XConfigurationController >& i_rConfigController, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rResourceId + ); + + // XView + // (no methods) + + // XResource + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > SAL_CALL getResourceId( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isAnchorOnly( ) throw (::com::sun::star::uno::RuntimeException); + + protected: + ~SingleColorPanel(); + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > m_xResourceId; + }; + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... + +#endif // SD_WORKBENCH_CTP_PANEL_HXX diff --git a/sd/workben/custompanel/ctp_services.cxx b/sd/workben/custompanel/ctp_services.cxx new file mode 100644 index 000000000..eccdb867e --- /dev/null +++ b/sd/workben/custompanel/ctp_services.cxx @@ -0,0 +1,92 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_sd.hxx" + +#include "ctp_factory.hxx" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + /** === end UNO using === **/ + + //================================================================================================================== + //= descriptors for the services implemented in this component + //================================================================================================================== + static struct ::cppu::ImplementationEntry s_aServiceEntries[] = + { + { + ResourceFactory::Create, + ResourceFactory::getImplementationName_static, + ResourceFactory::getSupportedServiceNames_static, + ::cppu::createSingleComponentFactory, NULL, 0 + }, + { 0, 0, 0, 0, 0, 0 } + }; + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... + +extern "C" +{ + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) + { + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey ) + { + return ::cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, ::sd::colortoolpanel::s_aServiceEntries ); + } + + //------------------------------------------------------------------------------------------------------------------ + void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) + { + return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , ::sd::colortoolpanel::s_aServiceEntries ); + } +} diff --git a/sd/workben/custompanel/delzip b/sd/workben/custompanel/delzip new file mode 100644 index 000000000..e69de29bb diff --git a/sd/workben/custompanel/description.xml b/sd/workben/custompanel/description.xml new file mode 100644 index 000000000..a1dbdf4f1 --- /dev/null +++ b/sd/workben/custompanel/description.xml @@ -0,0 +1,16 @@ + + + + + + + + Custom Tool Panel Example + + + + + diff --git a/sd/workben/custompanel/makefile.mk b/sd/workben/custompanel/makefile.mk new file mode 100644 index 000000000..7703b7163 --- /dev/null +++ b/sd/workben/custompanel/makefile.mk @@ -0,0 +1,102 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=../.. +PRJNAME=sd + +TARGET=colorpanel +ENABLE_EXCEPTIONS=TRUE +LIBTARGET=NO +EXTENSIONNAME:=colored-tool-panel + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +#------------------------------------------------------------------- + +#---- extension version +EXTENSION_VERSION_BASE=0.1 +.IF ( "$(CWS_WORK_STAMP)" == "" ) || ( "$(UPDATER)" == "YES" ) + EXTENSION_VERSION=$(EXTENSION_VERSION_BASE) +.ELSE + EXTENSION_VERSION=$(EXTENSION_VERSION_BASE).cws.$(CWS_WORK_STAMP) +.ENDIF + +#---- extension title package name +EXTENSION_TITLE=Custom Tool Panel Example +EXTENSION_ZIPNAME=$(EXTENSIONNAME)-$(EXTENSION_VERSION_BASE)-$(RTL_OS:l)-$(RTL_ARCH:l) + +#-------------------------------------------------- + +SHL1DLLPRE= +SHL1TARGET=$(TARGET).uno +LIB1TARGET=$(SLB)/$(SHL1TARGET).lib +LIB1OBJFILES= \ + $(SLO)/ctp_factory.obj \ + $(SLO)/ctp_services.obj \ + $(SLO)/ctp_panel.obj + +SHL1STDLIBS= \ + $(CPPULIB) \ + $(SALLIB) \ + $(SALHELPERLIB) \ + $(CPPUHELPERLIB) + +SHL1VERSIONMAP=$(TARGET).map +SHL1LIBS= $(LIB1TARGET) +SHL1DEF= $(MISC)/$(SHL1TARGET).def +SHL1RPATH= OXT +DEF1NAME= $(SHL1TARGET) + +# create Extension ----------------------------- + +COMPONENT_CONFIGDEST=. + +COMPONENT_XCU = \ + $(EXTENSIONDIR)/Impress.xcu + +COMPONENT_LIBRARIES = \ + $(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST) + +# ........ dependencies for packaging the extension ........ +EXTENSION_PACKDEPS=makefile.mk + +# --- Targets ------------------------------------------------------ +.INCLUDE : extension_pre.mk +.INCLUDE : target.mk +.INCLUDE : extension_post.mk + +# xcu files: copy + +#$(COMPONENT_XCU) : ./Impress.xcu +# @-$(MKDIRHIER) $(@:d) +# $(COPY) $< $@ + +#$(COMPONENT_LIBRARY) : $(BIN)/$(SHL1TARGET)$(DLLPOST) +# @@-$(MKDIRHIER) $(@:d) +# @$(COPY) $< $@ diff --git a/sd/workben/custompanel/manifest.xml b/sd/workben/custompanel/manifest.xml new file mode 100644 index 000000000..96f62afe4 --- /dev/null +++ b/sd/workben/custompanel/manifest.xml @@ -0,0 +1,8 @@ + + + + + + -- cgit v1.2.3 From d1dd06bf1bd9c5092df8570fd1d082d29a2b17bf Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 19 Mar 2010 10:28:04 +0100 Subject: slidecopy: reworked the ToolPanelDeck to have a dedicated anchor window for the panel's windows. This will ease some later changes --- sd/source/ui/toolpanel/StandardToolPanel.cxx | 2 +- sd/source/ui/toolpanel/TaskPaneToolPanel.cxx | 26 +++++++++++++------------- sd/source/ui/toolpanel/TaskPaneToolPanel.hxx | 9 ++++----- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/sd/source/ui/toolpanel/StandardToolPanel.cxx b/sd/source/ui/toolpanel/StandardToolPanel.cxx index e483cf028..c8f460114 100644 --- a/sd/source/ui/toolpanel/StandardToolPanel.cxx +++ b/sd/source/ui/toolpanel/StandardToolPanel.cxx @@ -102,7 +102,7 @@ namespace sd { namespace toolpanel return true; if ( isDisposed() ) return false; - m_pControl = m_pControlFactory->CreateRootControl( getPanelDeck() ); + m_pControl = m_pControlFactory->CreateRootControl( getPanelWindowAnchor() ); return ( m_pControl.get() != NULL ); } diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx index 5aad4b0f9..63a5a77b9 100644 --- a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx @@ -70,6 +70,13 @@ namespace sd { namespace toolpanel { } + //------------------------------------------------------------------------------------------------------------------ + Window& TaskPaneToolPanel::getPanelWindowAnchor() + { + OSL_ENSURE( !isDisposed(), "already disposed!" ); + return m_pPanelDeck->GetPanelWindowAnchor(); + } + //------------------------------------------------------------------------------------------------------------------ ::rtl::OUString TaskPaneToolPanel::GetDisplayName() const { @@ -83,15 +90,16 @@ namespace sd { namespace toolpanel } //------------------------------------------------------------------------------------------------------------------ - void TaskPaneToolPanel::Show() + void TaskPaneToolPanel::Activate( ::Window& i_rParentWindow ) { Window* pPanelWindow( getPanelWindow() ); ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to show" ); + pPanelWindow->SetPosSizePixel( Point(), i_rParentWindow.GetSizePixel() ); pPanelWindow->Show(); } //------------------------------------------------------------------------------------------------------------------ - void TaskPaneToolPanel::Hide() + void TaskPaneToolPanel::Deactivate() { Window* pPanelWindow( getPanelWindow() ); ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to hide" ); @@ -99,11 +107,11 @@ namespace sd { namespace toolpanel } //------------------------------------------------------------------------------------------------------------------ - void TaskPaneToolPanel::SetPosSizePixel( const Rectangle& i_rPanelPlayground ) + void TaskPaneToolPanel::SetSizePixel( const Size& i_rPanelWindowSize ) { Window* pPanelWindow( getPanelWindow() ); - ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to position" ); - pPanelWindow->SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() ); + ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to resize" ); + pPanelWindow->SetSizePixel( i_rPanelWindowSize ); } //------------------------------------------------------------------------------------------------------------------ @@ -114,14 +122,6 @@ namespace sd { namespace toolpanel pPanelWindow->GrabFocus(); } - //------------------------------------------------------------------------------------------------------------------ - bool TaskPaneToolPanel::HasFocus() const - { - Window* pPanelWindow( getPanelWindow() ); - ENSURE_OR_RETURN_FALSE( pPanelWindow, "no window to ask" ); - return pPanelWindow->HasChildPathFocus(); - } - //------------------------------------------------------------------------------------------------------------------ void TaskPaneToolPanel::Dispose() { diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx index d7d9b0246..92361fa3d 100644 --- a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx @@ -65,11 +65,10 @@ namespace sd { namespace toolpanel // IToolPanel overridables virtual ::rtl::OUString GetDisplayName() const; virtual Image GetImage() const; - virtual void Show(); - virtual void Hide(); - virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); + virtual void Activate( ::Window& i_rParentWindow ); + virtual void Deactivate(); + virtual void SetSizePixel( const Size& i_rPanelWindowSize ); virtual void GrabFocus(); - virtual bool HasFocus() const; virtual void Dispose(); // own overridables @@ -78,7 +77,7 @@ namespace sd { namespace toolpanel protected: bool isDisposed() const { return m_pPanelDeck == NULL; } - ToolPanelDeck& getPanelDeck() { OSL_ENSURE( !isDisposed(), "already disposed!" ); return *m_pPanelDeck; } + Window& getPanelWindowAnchor(); private: ToolPanelDeck* m_pPanelDeck; -- cgit v1.2.3 From 9fe67027d269829cfc27fc84d430d3538477662b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 19 Mar 2010 11:16:52 +0100 Subject: slidecopy: XResourceFactory::createResource now allows to raise IllegalArgument/WrappedTargetException --- sd/source/ui/framework/factories/BasicPaneFactory.cxx | 3 ++- sd/source/ui/framework/factories/BasicPaneFactory.hxx | 2 +- sd/source/ui/framework/factories/BasicToolBarFactory.cxx | 3 ++- sd/source/ui/framework/factories/BasicToolBarFactory.hxx | 2 +- sd/source/ui/framework/factories/BasicViewFactory.cxx | 3 ++- sd/source/ui/framework/factories/BasicViewFactory.hxx | 2 +- sd/source/ui/framework/factories/PresentationFactory.cxx | 3 ++- sd/source/ui/framework/factories/TaskPanelFactory.cxx | 3 ++- sd/source/ui/framework/factories/TaskPanelFactory.hxx | 2 +- sd/source/ui/inc/framework/PresentationFactory.hxx | 2 +- sd/workben/custompanel/ctp_factory.cxx | 8 ++++---- sd/workben/custompanel/ctp_factory.hxx | 2 +- 12 files changed, 20 insertions(+), 15 deletions(-) diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx index 627173304..6dcd8d05a 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx @@ -48,6 +48,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; @@ -274,7 +275,7 @@ void SAL_CALL BasicPaneFactory::initialize (const Sequence& aArguments) Reference SAL_CALL BasicPaneFactory::createResource ( const Reference& rxPaneId) - throw (RuntimeException) + throw (RuntimeException, IllegalArgumentException, WrappedTargetException) { ThrowIfDisposed(); diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.hxx b/sd/source/ui/framework/factories/BasicPaneFactory.hxx index 89d58a252..2ca0f24c8 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.hxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.hxx @@ -103,7 +103,7 @@ public: virtual css::uno::Reference SAL_CALL createResource ( const css::uno::Reference& 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 51b77dd38..3618e5c4f 100644 --- a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx +++ b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx @@ -42,6 +42,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 { @@ -195,7 +196,7 @@ void SAL_CALL BasicToolBarFactory::disposing ( Reference SAL_CALL BasicToolBarFactory::createResource ( const Reference& 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 95f2c103b..5a7fda0c6 100644 --- a/sd/source/ui/framework/factories/BasicToolBarFactory.hxx +++ b/sd/source/ui/framework/factories/BasicToolBarFactory.hxx @@ -84,7 +84,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 518821f4b..977092c2a 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -59,6 +59,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; @@ -193,7 +194,7 @@ void SAL_CALL BasicViewFactory::disposing (void) Reference SAL_CALL BasicViewFactory::createResource ( const Reference& rxViewId) - throw(RuntimeException) + throw(RuntimeException, IllegalArgumentException, WrappedTargetException) { Reference xView; const bool bIsCenterPane ( diff --git a/sd/source/ui/framework/factories/BasicViewFactory.hxx b/sd/source/ui/framework/factories/BasicViewFactory.hxx index 3499232e5..c10d09fe8 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.hxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.hxx @@ -100,7 +100,7 @@ public: virtual css::uno::Reference SAL_CALL createResource ( const css::uno::Reference& rxViewId) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException); virtual void SAL_CALL releaseResource ( const css::uno::Reference& xView) diff --git a/sd/source/ui/framework/factories/PresentationFactory.cxx b/sd/source/ui/framework/factories/PresentationFactory.cxx index 5fc475b10..9239933f6 100644 --- a/sd/source/ui/framework/factories/PresentationFactory.cxx +++ b/sd/source/ui/framework/factories/PresentationFactory.cxx @@ -43,6 +43,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; @@ -185,7 +186,7 @@ void SAL_CALL PresentationFactory::disposing (void) Reference SAL_CALL PresentationFactory::createResource ( const Reference& rxViewId) - throw (RuntimeException) + throw (RuntimeException, IllegalArgumentException, WrappedTargetException) { ThrowIfDisposed(); diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/sd/source/ui/framework/factories/TaskPanelFactory.cxx index 6f8c7b8bd..757bcfcae 100644 --- a/sd/source/ui/framework/factories/TaskPanelFactory.cxx +++ b/sd/source/ui/framework/factories/TaskPanelFactory.cxx @@ -39,6 +39,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; @@ -239,7 +240,7 @@ namespace Reference SAL_CALL TaskPanelFactory::createResource ( const Reference& rxResourceId) - throw (RuntimeException) + throw (RuntimeException, IllegalArgumentException, WrappedTargetException) { Reference xResource; diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.hxx b/sd/source/ui/framework/factories/TaskPanelFactory.hxx index c2a27f148..872a30ca7 100644 --- a/sd/source/ui/framework/factories/TaskPanelFactory.hxx +++ b/sd/source/ui/framework/factories/TaskPanelFactory.hxx @@ -84,7 +84,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/inc/framework/PresentationFactory.hxx b/sd/source/ui/inc/framework/PresentationFactory.hxx index 8ee8b462e..258f8a6d3 100644 --- a/sd/source/ui/inc/framework/PresentationFactory.hxx +++ b/sd/source/ui/inc/framework/PresentationFactory.hxx @@ -86,7 +86,7 @@ public: 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& xView) diff --git a/sd/workben/custompanel/ctp_factory.cxx b/sd/workben/custompanel/ctp_factory.cxx index 45ad3dab3..2e6d162e6 100644 --- a/sd/workben/custompanel/ctp_factory.cxx +++ b/sd/workben/custompanel/ctp_factory.cxx @@ -58,6 +58,7 @@ namespace sd { namespace colortoolpanel using ::com::sun::star::lang::NotInitializedException; using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::drawing::framework::XResourceFactoryManager; + using ::com::sun::star::lang::WrappedTargetException; /** === end UNO using === **/ //================================================================================================================== @@ -87,16 +88,15 @@ namespace sd { namespace colortoolpanel } //------------------------------------------------------------------------------------------------------------------ - Reference< XResource > SAL_CALL ResourceFactory::createResource( const Reference< XResourceId >& i_rResourceId ) throw (RuntimeException) + Reference< XResource > SAL_CALL ResourceFactory::createResource( const Reference< XResourceId >& i_rResourceId ) throw (RuntimeException, IllegalArgumentException, WrappedTargetException) { FactoryGuard aGuard( *this ); if ( !i_rResourceId.is() ) - // TODO: the API should allow me to throw an IllegalArgumentException here - throw NULL; + throw IllegalArgumentException( ::rtl::OUString::createFromAscii( "illegal resource ID" ), *this, 1 ); const ::rtl::OUString sResourceURL( i_rResourceId->getResourceURL() ); if ( sResourceURL != lcl_getSingleColorViewURL() ) - return NULL; + throw IllegalArgumentException( ::rtl::OUString::createFromAscii( "unsupported resource URL" ), *this, 1 ); return new SingleColorPanel( m_xContext, m_xControllerManager->getConfigurationController(), i_rResourceId ); } diff --git a/sd/workben/custompanel/ctp_factory.hxx b/sd/workben/custompanel/ctp_factory.hxx index 5b071d72f..ca0ed0ab3 100644 --- a/sd/workben/custompanel/ctp_factory.hxx +++ b/sd/workben/custompanel/ctp_factory.hxx @@ -62,7 +62,7 @@ namespace sd { namespace colortoolpanel ~ResourceFactory(); // XResourceFactory - virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResource > SAL_CALL createResource( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& xResourceId ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResource > SAL_CALL createResource( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& xResourceId ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException); virtual void SAL_CALL releaseResource( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResource >& xResource ) throw (::com::sun::star::uno::RuntimeException); // XServiceInfo -- cgit v1.2.3 From 217cbd30ff8fa9acc987bde69fba6c7a2478dad0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 22 Mar 2010 12:09:10 +0100 Subject: slidecopy: allow custom tool panels in the task pane to be implemented as extensions --- .../ui/framework/factories/BasicViewFactory.cxx | 2 +- .../ui/framework/factories/TaskPanelFactory.cxx | 3 - .../ui/framework/factories/ViewShellWrapper.cxx | 100 ++++++++- sd/source/ui/framework/tools/FrameworkHelper.cxx | 85 +++++--- sd/source/ui/inc/framework/ViewShellWrapper.hxx | 63 +++--- sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx | 25 ++- sd/source/ui/toolpanel/CustomToolPanel.cxx | 116 ++++++++--- sd/source/ui/toolpanel/CustomToolPanel.hxx | 22 +- sd/source/ui/toolpanel/StandardToolPanel.cxx | 40 +++- sd/source/ui/toolpanel/StandardToolPanel.hxx | 8 +- sd/source/ui/toolpanel/TaskPaneToolPanel.cxx | 33 --- sd/source/ui/toolpanel/TaskPaneToolPanel.hxx | 10 +- sd/source/ui/toolpanel/ToolPanelDrawer.cxx | 5 +- sd/source/ui/toolpanel/ToolPanelDrawer.hxx | 1 + sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 226 ++++++++++++++++++--- sd/workben/custompanel/Impress.xcu | 4 +- sd/workben/custompanel/ctp_factory.cxx | 14 +- sd/workben/custompanel/ctp_panel.cxx | 161 ++++++++++++++- sd/workben/custompanel/ctp_panel.hxx | 25 ++- sd/workben/custompanel/makefile.mk | 7 +- 20 files changed, 759 insertions(+), 191 deletions(-) diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 977092c2a..adfb8e48a 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -377,7 +377,7 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence& aArguments) pDescriptor->mpViewShell, rxViewId, rxPane->getWindow()); - pDescriptor->mxView = Reference(pDescriptor->mpWrapper); + pDescriptor->mxView.set( pDescriptor->mpWrapper->queryInterface( XResource::static_type() ), UNO_QUERY_THROW ); } return pDescriptor; diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/sd/source/ui/framework/factories/TaskPanelFactory.cxx index 757bcfcae..bb9ae8f79 100644 --- a/sd/source/ui/framework/factories/TaskPanelFactory.cxx +++ b/sd/source/ui/framework/factories/TaskPanelFactory.cxx @@ -266,10 +266,7 @@ Reference SAL_CALL TaskPanelFactory::createResource ( toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() ); if ( pToolPanel != NULL ) - { xResource = new TaskPanelResource( rxResourceId ); - pToolPanel->ActivatePanel( ePanelId ); - } OSL_POSTCOND( xResource.is(), "TaskPanelFactory::createResource: did not find the given resource!" ); } diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx index aff7b2c04..02b5b599e 100644 --- a/sd/source/ui/framework/factories/ViewShellWrapper.cxx +++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx @@ -33,22 +33,32 @@ #include "framework/ViewShellWrapper.hxx" #include "framework/Pane.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "ViewShell.hxx" #include "Window.hxx" #include +#include #include #include +#include +#include #include #include +#include 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 { @@ -59,7 +69,8 @@ ViewShellWrapper::ViewShellWrapper ( : ViewShellWrapperInterfaceBase(MutexOwner::maMutex), mpViewShell(pViewShell), mxViewId(rxViewId), - mxWindow(rxWindow) + mxWindow(rxWindow), + mbIsPane( pViewShell == NULL ? false : ( pViewShell->GetShellType() == ViewShell::ST_TASK_PANE ) ) { if (rxWindow.is()) { @@ -83,6 +94,8 @@ ViewShellWrapper::~ViewShellWrapper (void) void SAL_CALL ViewShellWrapper::disposing (void) { + ::osl::MutexGuard aGuard( maMutex ); + OSL_TRACE("disposing ViewShellWrapper %x", this); Reference xWindow (mxWindow); if (xWindow.is()) @@ -105,13 +118,92 @@ void SAL_CALL ViewShellWrapper::disposing (void) -bool ViewShellWrapper::IsUnique (void) +//----- XInterface ------------------------------------------------------------ + +Any SAL_CALL ViewShellWrapper::queryInterface( const Type& i_rType ) throw (RuntimeException) { - return m_refCount==1; + Any aInterface( ViewShellWrapperInterfaceBase::queryInterface( i_rType ) ); + if ( !aInterface.hasValue() ) + { + if ( mbIsPane ) + aInterface = ViewShellWrapper_PaneBase::queryInterface( i_rType ); + else + aInterface = ViewShellWrapper_ViewBase::queryInterface( i_rType ); + } + return aInterface; } +void SAL_CALL ViewShellWrapper::acquire() throw () +{ + ViewShellWrapperInterfaceBase::acquire(); +} +void SAL_CALL ViewShellWrapper::release() throw () +{ + ViewShellWrapperInterfaceBase::release(); +} +//----- XTypeProvider --------------------------------------------------------- + +Sequence< Type > SAL_CALL ViewShellWrapper::getTypes( ) throw (RuntimeException) +{ + const Sequence< Type > aCommonTypes( ViewShellWrapperInterfaceBase::getTypes() ); + const Sequence< Type > aSpecialTypes( + mbIsPane + ? ViewShellWrapper_PaneBase::getTypes() + : ViewShellWrapper_ViewBase::getTypes() + ); + return ::comphelper::concatSequences( aCommonTypes, aSpecialTypes ); +} + +Sequence< ::sal_Int8 > SAL_CALL ViewShellWrapper::getImplementationId( ) throw (RuntimeException) +{ + static ::cppu::OImplementationId* pViewId = NULL; + static ::cppu::OImplementationId* pPaneId = NULL; + if ( !pViewId ) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if ( !pViewId ) + { + static ::cppu::OImplementationId aViewId; + static ::cppu::OImplementationId aPaneId; + pViewId = &aViewId; + pPaneId = &aPaneId; + } + } + + return ( mbIsPane ? pPaneId : pViewId )->getImplementationId(); +} + +//----- XPane ----------------------------------------------------------------- + +Reference< XInterface > ViewShellWrapper::impl_getPaneWindowOrCanvas( const bool i_bWindow ) +{ + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( maMutex ); + if ( !mpViewShell.get() ) + throw DisposedException( ::rtl::OUString(), *this ); + + ToolPanelViewShell* pToolPanelShell = dynamic_cast< ToolPanelViewShell* >( mpViewShell.get() ); + ENSURE_OR_RETURN( pToolPanelShell != NULL, "XPane should be accessible for a ToolPanelViewShell only", NULL ); + + ::Window* pPaneWindow = pToolPanelShell->GetToolPanelParentWindow(); + ENSURE_OR_RETURN( pPaneWindow, "shell is not able to provide a panel parent", NULL ); + + if ( i_bWindow ) + return VCLUnoHelper::GetInterface( pPaneWindow ); + return pPaneWindow->GetCanvas(); +} + +Reference< XWindow > SAL_CALL ViewShellWrapper::getWindow() throw (RuntimeException) +{ + return Reference< XWindow >( impl_getPaneWindowOrCanvas( true ), UNO_QUERY ); +} + +Reference< XCanvas > SAL_CALL ViewShellWrapper::getCanvas() throw (RuntimeException) +{ + return Reference< XCanvas >( impl_getPaneWindowOrCanvas( false ), UNO_QUERY ); +} //----- XResource ------------------------------------------------------------- @@ -181,7 +273,7 @@ const Sequence& ViewShellWrapper::getUnoTunnelId (void) static Sequence* 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 aSequence (16); diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index a1ba587d3..d04cde395 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -222,7 +222,7 @@ const OUString FrameworkHelper::msViewTabBarURL( // Task panel URLs. const ::rtl::OUString FrameworkHelper::msTaskPanelURLPrefix( - OUString::createFromAscii("private:resource/taskpanel/")); + OUString::createFromAscii("private:resource/toolpanel/")); const ::rtl::OUString FrameworkHelper::msMasterPagesTaskPanelURL( msTaskPanelURLPrefix + OUString::createFromAscii("MasterPages")); const ::rtl::OUString FrameworkHelper::msLayoutTaskPanelURL( @@ -256,6 +256,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 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 ------------------------------------------- @@ -442,8 +482,11 @@ bool FrameworkHelper::IsValid (void) ::boost::shared_ptr FrameworkHelper::GetViewShell (const OUString& rsPaneURL) { - Reference xPaneId (CreateResourceId(rsPaneURL)); - return GetViewShell(GetView(xPaneId)); + if ( !mxConfigurationController.is() ) + return ::boost::shared_ptr(); + + Reference xPaneId( CreateResourceId( rsPaneURL ) ); + return lcl_getViewShell( lcl_getFirstViewInPane( mxConfigurationController, xPaneId ) ); } @@ -451,22 +494,7 @@ bool FrameworkHelper::IsValid (void) ::boost::shared_ptr FrameworkHelper::GetViewShell (const Reference& rxView) { - ::boost::shared_ptr pViewShell; - - try - { - Reference xViewTunnel (rxView, UNO_QUERY); - if (xViewTunnel.is()) - { - pViewShell = reinterpret_cast(xViewTunnel->getSomething( - ViewShellWrapper::getUnoTunnelId()))->GetViewShell(); - } - } - catch (RuntimeException&) - { - } - - return pViewShell; + return lcl_getViewShell( rxView.get() ); } @@ -483,21 +511,11 @@ Reference FrameworkHelper::GetView (const Reference& rxPaneO { if (rxPaneOrViewId->getResourceURL().match(msViewURLPrefix)) { - xView = Reference( - mxConfigurationController->getResource(rxPaneOrViewId), UNO_QUERY); + xView.set( mxConfigurationController->getResource( rxPaneOrViewId ), UNO_QUERY ); } else { - Reference xConfiguration ( - mxConfigurationController->getRequestedConfiguration()); - if (xConfiguration.is()) - { - Sequence > aViewIds (xConfiguration->getResources( - rxPaneOrViewId, msViewURLPrefix, AnchorBindingMode_DIRECT)); - if (aViewIds.getLength() >= 1) - xView = Reference( - mxConfigurationController->getResource(aViewIds[0]), UNO_QUERY); - } + xView.set( lcl_getFirstViewInPane( mxConfigurationController, rxPaneOrViewId ), UNO_QUERY ); } } catch (lang::DisposedException&) @@ -505,7 +523,8 @@ Reference FrameworkHelper::GetView (const Reference& rxPaneO Dispose(); } catch (RuntimeException&) - {} + { + } return xView; } @@ -804,7 +823,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; } } diff --git a/sd/source/ui/inc/framework/ViewShellWrapper.hxx b/sd/source/ui/inc/framework/ViewShellWrapper.hxx index b0b045bc2..0d049b4ce 100644 --- a/sd/source/ui/inc/framework/ViewShellWrapper.hxx +++ b/sd/source/ui/inc/framework/ViewShellWrapper.hxx @@ -33,22 +33,26 @@ #include "MutexOwner.hxx" #include +#include #include #include #include #include -#include +#include +#include #include namespace { -typedef ::cppu::WeakComponentImplHelper4 < - ::com::sun::star::drawing::framework::XView, - ::com::sun::star::lang::XUnoTunnel, - ::com::sun::star::awt::XWindowListener, - ::com::sun::star::drawing::framework::XRelocatableResource - > ViewShellWrapperInterfaceBase; +typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::lang::XUnoTunnel + , ::com::sun::star::awt::XWindowListener + , ::com::sun::star::drawing::framework::XRelocatableResource + > ViewShellWrapperInterfaceBase; +typedef ::cppu::ImplHelper1 < ::com::sun::star::drawing::framework::XView + > ViewShellWrapper_ViewBase; +typedef ::cppu::ImplHelper1 < ::com::sun::star::drawing::framework::XPane + > ViewShellWrapper_PaneBase; } // end of anonymous namespace. @@ -60,9 +64,10 @@ namespace sd { namespace framework { Most importantly it provides a tunnel to the ViewShell implementation. Then it forwards size changes of the pane window to the view shell. */ -class ViewShellWrapper - : private sd::MutexOwner, - public ViewShellWrapperInterfaceBase +class ViewShellWrapper :private sd::MutexOwner + ,public ViewShellWrapperInterfaceBase + ,public ViewShellWrapper_ViewBase + ,public ViewShellWrapper_PaneBase { public: /** Create a new ViewShellWrapper object that wraps the given ViewShell @@ -93,22 +98,26 @@ public: */ ::boost::shared_ptr GetViewShell (void); - /** Returns whether there is exactly one reference to the called - ViewShellWrapper object (the number of references to the wrapped - ViewShell object is not taken into account). This method is - typically used by the owner of a ViewShellWrapper object to verify - that, at the end of the ViewShellWrapper object's lifetime, the - owner holds the last reference and by releasing it will destroy the - object. - */ - bool IsUnique (void); - - // XUnoTunnel virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence& rId) throw (com::sun::star::uno::RuntimeException); + // 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 (); + + // 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); + + // XPane + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > SAL_CALL getCanvas( ) throw (::com::sun::star::uno::RuntimeException); // XResource @@ -154,10 +163,14 @@ public: throw (com::sun::star::uno::RuntimeException); private: - ::boost::shared_ptr mpViewShell; - const ::com::sun::star::uno::Reference< - com::sun::star::drawing::framework::XResourceId> mxViewId; - ::com::sun::star::uno::Reference mxWindow; + ::boost::shared_ptr< ViewShell > mpViewShell; + const ::com::sun::star::uno::Reference< com::sun::star::drawing::framework::XResourceId > mxViewId; + ::com::sun::star::uno::Reference mxWindow; + const bool mbIsPane; + +private: + // only to be called when mbIsPane is + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > impl_getPaneWindowOrCanvas( const bool i_bWindow ); }; } } // end of namespace sd::framework diff --git a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx index 827522b49..6f35893a8 100644 --- a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx +++ b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx @@ -54,7 +54,7 @@ class TitleToolBox; class TitleBar; class TitledControl; class ToolPanelDeck; - +class ToolPanelViewShell_Impl; /** The tool panel is a view shell for some very specific reasons: - It fits better into the concept of panes being docking windows whose content, a view shell, can be exchanged on runtime. @@ -99,6 +99,10 @@ public: TaskPaneShellManager& GetSubShellManager (void) const; + /** returns the window which should be used as parent for tool panel windows + */ + ::Window* GetToolPanelParentWindow(); + /** activates the given panel, bypassing the configuration controller, deactivates the previously active one. */ void ActivatePanel( const PanelId i_ePanelId ); @@ -107,6 +111,14 @@ public: */ void DeactivatePanel( const PanelId i_ePanelId ); + /** Return a pointer to the docking window that is the parent or a + predecessor of the content window. + @return + When the view shell is not placed in a docking window, e.g. when + shown in the center pane, then is returned. + */ + DockingWindow* GetDockingWindow (void); + /** Called when a mouse button has been pressed but not yet released, this handler is used to show the popup menu of the title bar. @@ -126,8 +138,7 @@ public: virtual bool RelocateToParentWindow (::Window* pParentWindow); private: - class Implementation; - ::boost::scoped_ptr< Implementation > mpImpl; + ::boost::scoped_ptr< ToolPanelViewShell_Impl > mpImpl; ::boost::shared_ptr mpSubShellManager; @@ -146,14 +157,6 @@ private: ::std::auto_ptr CreatePopupMenu (bool bIsDocking); - /** Return a pointer to the docking window that is the parent or a - predecessor of the content window. - @return - When the view shell is not placed in a docking window, e.g. when - shown in the center pane, then is returned. - */ - DockingWindow* GetDockingWindow (void); - /** connects to a (new) (Pane)DockingWindow */ void ConnectToDockingWindow(); diff --git a/sd/source/ui/toolpanel/CustomToolPanel.cxx b/sd/source/ui/toolpanel/CustomToolPanel.cxx index 38ed034a8..2910642f0 100644 --- a/sd/source/ui/toolpanel/CustomToolPanel.cxx +++ b/sd/source/ui/toolpanel/CustomToolPanel.cxx @@ -31,6 +31,7 @@ /** === begin UNO includes === **/ #include +#include /** === end UNO includes === **/ #include @@ -62,7 +63,9 @@ namespace sd { namespace toolpanel using ::com::sun::star::drawing::framework::XResourceId; using ::com::sun::star::drawing::framework::ResourceId; using ::com::sun::star::drawing::framework::XResource; + using ::com::sun::star::awt::XWindow; /** === end UNO using === **/ + namespace PosSize = ::com::sun::star::awt::PosSize; //================================================================================================================== //= helper @@ -98,8 +101,10 @@ namespace sd { namespace toolpanel :TaskPaneToolPanel( i_rPanelDeck, lcl_getPanelConfig( i_rPanelConfig, "DisplayTitle" ), Image() /* TODO */, SmartId() /* TODO */ ) ,m_pFrameworkHelper( i_pFrameworkHelper ) ,m_xPanelResourceId() - ,m_xPanel() + ,m_xResource() + ,m_xToolPanel() ,m_bAttemptedPanelCreation( false ) + ,m_nResourceAccessLock( 0 ) { ENSURE_OR_THROW( m_pFrameworkHelper.get() != NULL, "invalid framework helper" ); ENSURE_OR_THROW( i_rPaneResourceId.is(), "invalid pane resource id" ); @@ -126,56 +131,121 @@ namespace sd { namespace toolpanel } //------------------------------------------------------------------------------------------------------------------ - void CustomToolPanel::Dispose() + void CustomToolPanel::Activate( ::Window& i_rParentWindow ) + { + OSL_ENSURE( &getPanelWindowAnchor() == &i_rParentWindow, + "CustomToolPanel::Activate: invalid new parent window" ); + // getPanelWindowAnchor() is what is returned in the TaskPane's XPane::getWindow method. So, + // any custom panel which is loaded into the TaskPane will use this window as parent window. + // Consequently, this is the window which shall be passed here, since this method is intended to + // re-create the panel with the given parent. + + // we do not need to do anything here. The XResourceFactory::createResource method of the custom + // tool panel already created and showed the window. + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::Deactivate() + { + // When a certain tool panel is activated, this is routed through the drawing framework, which ensures + // that the resource associated with the previously active panel is deactivated, which calls the + // XResourceFactory::destroyResource at our custom panel's factory. + + // So, we do not have to do anything here - except forgetting the XResource, at it might (or might not, + // if cached by the factory) be re-created next time. + m_xResource.clear(); + m_xToolPanel.clear(); + m_bAttemptedPanelCreation = false; + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::SetSizePixel( const Size& i_rPanelWindowSize ) { - if ( m_xPanel.is() ) + impl_ensurePanel(); + if ( !m_xToolPanel.is() ) + // if the custom panel does not support XPanel, this just means it is its own responsibility + // to resize/layout everything within the pane window. + return; + + try { - try - { - // TODO: obtain the factory for our panel, and invoke its destroyResource method - } - catch ( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } + Reference< XWindow > xPanelWindow( m_xToolPanel->getWindow(), UNO_SET_THROW ); + xPanelWindow->setPosSize( 0, 0, i_rPanelWindowSize.Width(), i_rPanelWindowSize.Height(), + PosSize::POSSIZE ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::GrabFocus() + { + impl_ensurePanel(); + if ( !m_xToolPanel.is() ) + // if the custom panel does not support XPanel, this just means it is its own responsibility + // to care for focus handling + return; + + try + { + Reference< XWindow > xPanelWindow( m_xToolPanel->getWindow(), UNO_SET_THROW ); + xPanelWindow->setFocus(); } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::Dispose() + { + // nothing to do here. Lifetime handling of the XResource which this panel represents is done by + // the drawing framework, we ourself do not have resources to release. TaskPaneToolPanel::Dispose(); } //------------------------------------------------------------------------------------------------------------------ - const Reference< XResourceId >& CustomToolPanel::getResourceId() const + void CustomToolPanel::LockResourceAccess() { - return m_xPanelResourceId; + ++m_nResourceAccessLock; } //------------------------------------------------------------------------------------------------------------------ - ::Window* CustomToolPanel::getPanelWindow() const + void CustomToolPanel::UnlockResourceAccess() { - ENSURE_OR_RETURN( impl_ensurePanel(), "could not create the panel", NULL ); - // TODO - return NULL; + OSL_ENSURE( m_nResourceAccessLock > 0, "CustomToolPanel::UnlockResourceAccess: not locked!" ); + --m_nResourceAccessLock; + } + + //------------------------------------------------------------------------------------------------------------------ + const Reference< XResourceId >& CustomToolPanel::getResourceId() const + { + return m_xPanelResourceId; } //------------------------------------------------------------------------------------------------------------------ - bool CustomToolPanel::impl_ensurePanel() const + void CustomToolPanel::impl_ensurePanel() { - ENSURE_OR_RETURN_FALSE( !isDisposed(), "already disposed" ); + ENSURE_OR_RETURN_VOID( !isDisposed(), "already disposed" ); - if ( !m_bAttemptedPanelCreation ) + if ( ( m_nResourceAccessLock == 0 ) && !m_bAttemptedPanelCreation ) { - const_cast< CustomToolPanel* >( this )->m_bAttemptedPanelCreation = true; + m_bAttemptedPanelCreation = true; try { Reference< XConfigurationController > xConfigController( m_pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW ); - Reference< XResource > xToolPanelResource( xConfigController->getResource( m_xPanelResourceId ) ); + m_xResource.set( xConfigController->getResource( m_xPanelResourceId ), UNO_QUERY_THROW ); + m_xToolPanel.set( m_xResource, UNO_QUERY ); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } } - return m_xPanel.is(); } //...................................................................................................................... diff --git a/sd/source/ui/toolpanel/CustomToolPanel.hxx b/sd/source/ui/toolpanel/CustomToolPanel.hxx index 7c143ccef..1bec07f8b 100644 --- a/sd/source/ui/toolpanel/CustomToolPanel.hxx +++ b/sd/source/ui/toolpanel/CustomToolPanel.hxx @@ -30,8 +30,10 @@ #include "TaskPaneToolPanel.hxx" /** === begin UNO includes === **/ -#include +#include #include +#include +#include /** === end UNO includes === **/ #include @@ -71,21 +73,33 @@ namespace sd { namespace toolpanel ~CustomToolPanel(); // IToolPanel overridables + virtual void Activate( ::Window& i_rParentWindow ); + virtual void Deactivate(); + virtual void SetSizePixel( const Size& i_rPanelWindowSize ); + virtual void GrabFocus(); virtual void Dispose(); + /** locks (aka prevents) the access to the associated XResource object + */ + void LockResourceAccess(); + /** unlocks (aka allows) the access to the associated XResource object + */ + void UnlockResourceAccess(); + protected: // TaskPaneToolPanel overridables virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const; - virtual ::Window* getPanelWindow() const; private: - bool impl_ensurePanel() const; + void impl_ensurePanel(); private: ::boost::shared_ptr< framework::FrameworkHelper > m_pFrameworkHelper; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > m_xPanelResourceId; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XPane2 > m_xPanel; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResource > m_xResource; + ::com::sun::star::uno::Reference< ::com::sun::star::view::XToolPanel > m_xToolPanel; bool m_bAttemptedPanelCreation; + sal_uInt32 m_nResourceAccessLock; }; //...................................................................................................................... diff --git a/sd/source/ui/toolpanel/StandardToolPanel.cxx b/sd/source/ui/toolpanel/StandardToolPanel.cxx index c8f460114..ec2582384 100644 --- a/sd/source/ui/toolpanel/StandardToolPanel.cxx +++ b/sd/source/ui/toolpanel/StandardToolPanel.cxx @@ -75,6 +75,39 @@ namespace sd { namespace toolpanel m_pControl.reset(); } + //------------------------------------------------------------------------------------------------------------------ + void StandardToolPanel::Activate( ::Window& i_rParentWindow ) + { + Window* pPanelWindow( impl_getPanelWindow() ); + ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to show" ); + pPanelWindow->SetPosSizePixel( Point(), i_rParentWindow.GetSizePixel() ); + pPanelWindow->Show(); + } + + //------------------------------------------------------------------------------------------------------------------ + void StandardToolPanel::Deactivate() + { + Window* pPanelWindow( impl_getPanelWindow() ); + ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to hide" ); + pPanelWindow->Hide(); + } + + //------------------------------------------------------------------------------------------------------------------ + void StandardToolPanel::SetSizePixel( const Size& i_rPanelWindowSize ) + { + Window* pPanelWindow( impl_getPanelWindow() ); + ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to resize" ); + pPanelWindow->SetSizePixel( i_rPanelWindowSize ); + } + + //------------------------------------------------------------------------------------------------------------------ + void StandardToolPanel::GrabFocus() + { + Window* pPanelWindow( impl_getPanelWindow() ); + ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to focus" ); + pPanelWindow->GrabFocus(); + } + //------------------------------------------------------------------------------------------------------------------ void StandardToolPanel::Dispose() { @@ -89,10 +122,11 @@ namespace sd { namespace toolpanel } //------------------------------------------------------------------------------------------------------------------ - ::Window* StandardToolPanel::getPanelWindow() const + ::Window* StandardToolPanel::impl_getPanelWindow() const { - ENSURE_OR_RETURN( const_cast< StandardToolPanel* >( this )->impl_ensureControl(), "StandardToolPanel::getPanelWindow: no control!", NULL ); - return m_pControl->GetWindow(); + if ( const_cast< StandardToolPanel* >( this )->impl_ensureControl() ) + return m_pControl->GetWindow(); + return NULL; } //------------------------------------------------------------------------------------------------------------------ diff --git a/sd/source/ui/toolpanel/StandardToolPanel.hxx b/sd/source/ui/toolpanel/StandardToolPanel.hxx index 5844a75ea..990337204 100644 --- a/sd/source/ui/toolpanel/StandardToolPanel.hxx +++ b/sd/source/ui/toolpanel/StandardToolPanel.hxx @@ -53,14 +53,18 @@ namespace sd { namespace toolpanel ~StandardToolPanel(); // IToolPanel overridables + virtual void Activate( ::Window& i_rParentWindow ); + virtual void Deactivate(); + virtual void SetSizePixel( const Size& i_rPanelWindowSize ); + virtual void GrabFocus(); virtual void Dispose(); // TaskPaneToolPanel overridables virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const; - virtual ::Window* getPanelWindow() const; private: - bool impl_ensureControl(); + bool impl_ensureControl(); + ::Window* impl_getPanelWindow() const; private: ::std::auto_ptr< ControlFactory > m_pControlFactory; diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx index 63a5a77b9..254518bfc 100644 --- a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx @@ -89,39 +89,6 @@ namespace sd { namespace toolpanel return m_aPanelImage; } - //------------------------------------------------------------------------------------------------------------------ - void TaskPaneToolPanel::Activate( ::Window& i_rParentWindow ) - { - Window* pPanelWindow( getPanelWindow() ); - ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to show" ); - pPanelWindow->SetPosSizePixel( Point(), i_rParentWindow.GetSizePixel() ); - pPanelWindow->Show(); - } - - //------------------------------------------------------------------------------------------------------------------ - void TaskPaneToolPanel::Deactivate() - { - Window* pPanelWindow( getPanelWindow() ); - ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to hide" ); - pPanelWindow->Hide(); - } - - //------------------------------------------------------------------------------------------------------------------ - void TaskPaneToolPanel::SetSizePixel( const Size& i_rPanelWindowSize ) - { - Window* pPanelWindow( getPanelWindow() ); - ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to resize" ); - pPanelWindow->SetSizePixel( i_rPanelWindowSize ); - } - - //------------------------------------------------------------------------------------------------------------------ - void TaskPaneToolPanel::GrabFocus() - { - Window* pPanelWindow( getPanelWindow() ); - ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to focus" ); - pPanelWindow->GrabFocus(); - } - //------------------------------------------------------------------------------------------------------------------ void TaskPaneToolPanel::Dispose() { diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx index 92361fa3d..6e84d0d96 100644 --- a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx @@ -65,15 +65,15 @@ namespace sd { namespace toolpanel // IToolPanel overridables virtual ::rtl::OUString GetDisplayName() const; virtual Image GetImage() const; - virtual void Activate( ::Window& i_rParentWindow ); - virtual void Deactivate(); - virtual void SetSizePixel( const Size& i_rPanelWindowSize ); - virtual void GrabFocus(); virtual void Dispose(); + // those are still abstract, and waiting to be overloaded + virtual void Activate( ::Window& i_rParentWindow ) = 0; + virtual void Deactivate() = 0; + virtual void SetSizePixel( const Size& i_rPanelWindowSize ) = 0; + virtual void GrabFocus() = 0; // own overridables virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const = 0; - virtual ::Window* getPanelWindow() const = 0; protected: bool isDisposed() const { return m_pPanelDeck == NULL; } diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx index 5181e489b..052322212 100644 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx @@ -44,6 +44,7 @@ namespace sd { namespace toolpanel :m_rParentWindow( i_rParentWindow ) ,m_rPanelDeck( i_rPanels ) ,m_aDrawers() + ,m_aLastKnownActivePanel() { m_rPanelDeck.AddListener( *this ); @@ -68,7 +69,9 @@ namespace sd { namespace toolpanel return i_rDeckPlayground; const int nWidth( i_rDeckPlayground.GetWidth() ); - const ::boost::optional< size_t > aActivePanel( m_rPanelDeck.GetActivePanel() ); + ::boost::optional< size_t > aActivePanel( m_rPanelDeck.GetActivePanel() ); + if ( !aActivePanel ) + aActivePanel = m_aLastKnownActivePanel; // arrange the title bars which are *above* the active panel (or *all* if there is no active panel), plus // the title bar of the active panel itself diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.hxx b/sd/source/ui/toolpanel/ToolPanelDrawer.hxx index bd3e30edc..db6196fa4 100644 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.hxx +++ b/sd/source/ui/toolpanel/ToolPanelDrawer.hxx @@ -84,6 +84,7 @@ private: Window& m_rParentWindow; ::svt::IToolPanelDeck& m_rPanelDeck; ::std::vector< PTitleBar > m_aDrawers; + ::boost::optional< size_t > m_aLastKnownActivePanel; }; //...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 4984852f9..99c2940c4 100644 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -79,6 +79,8 @@ #include #include #include +#include +#include #include @@ -103,6 +105,11 @@ using ::com::sun::star::accessibility::XAccessible; using ::com::sun::star::drawing::XDrawSubController; using ::com::sun::star::frame::XFrame; using ::com::sun::star::drawing::framework::XResourceId; +using ::com::sun::star::drawing::framework::XConfigurationChangeListener; +using ::com::sun::star::drawing::framework::ConfigurationChangeEvent; +using ::com::sun::star::lang::EventObject; +using ::com::sun::star::lang::DisposedException; +using ::com::sun::star::drawing::framework::XConfigurationControllerBroadcaster; /** === end UNO using === **/ using ::sd::framework::FrameworkHelper; @@ -112,7 +119,7 @@ namespace sd { namespace toolpanel { // ===================================================================================================================== // = PanelDescriptor // ===================================================================================================================== -/** is a helper class for ToolPanelViewShell::Implementation, holding the details about a single panel which is not +/** is a helper class for ToolPanelViewShell_Impl, holding the details about a single panel which is not contained in the IToolPanel implementation itself. */ struct PanelDescriptor @@ -149,17 +156,53 @@ enum PanelSelectorLayout }; // ===================================================================================================================== -// = ToolPanelViewShell::Implementation - declaration +// = ConfigurationListener - declaration +// ===================================================================================================================== +typedef ::cppu::WeakImplHelper1 < XConfigurationChangeListener + > ConfigurationListener_Base; + +class ConfigurationListener :public ::cppu::BaseMutex + ,public ConfigurationListener_Base +{ +public: + ConfigurationListener( ToolPanelViewShell_Impl& i_rShellImpl ); + + // XConfigurationChangeListener + virtual void SAL_CALL notifyConfigurationChange( const ConfigurationChangeEvent& aEvent ) throw (RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException); + + // XComponent equivalents (not available per UNO interface) + void dispose(); + +protected: + ~ConfigurationListener(); + + void impl_checkDisposed_throw() + { + if ( !m_pShellImpl ) + throw DisposedException( ::rtl::OUString(), *this ); + } + +private: + ToolPanelViewShell_Impl* m_pShellImpl; +}; + +// ===================================================================================================================== +// = ToolPanelViewShell_Impl - declaration // ===================================================================================================================== /** Inner implementation class of ToolPanelViewShell. */ -class ToolPanelViewShell::Implementation : public ::svt::IToolPanelDeckListener +class ToolPanelViewShell_Impl : public ::svt::IToolPanelDeckListener { public: static const size_t mnInvalidId = static_cast< size_t >( -1 ); - Implementation( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent ); - ~Implementation(); + ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent ); + ~ToolPanelViewShell_Impl(); + + ToolPanelViewShell& GetAntiImpl() { return m_rPanelViewShell; } /** Here the panels are created that are shown in the task pane. */ @@ -178,11 +221,17 @@ public: PanelSelectorLayout GetLayout() const { return m_eCurrentLayout; } + /** called by our configuration controller listener when the request to activate a tool panel has been observed. + */ + void OnToolPanelActivationRequest( const ::rtl::OUString& i_rResourceURL ); + /** provides access to the the VCL window of the panel deck */ ::Window& GetPanelDeck() { return *m_pPanelDeck.get(); } const ::Window& GetPanelDeck() const { return *m_pPanelDeck.get(); } + ::Window* GetToolPanelParentWindow() { return m_pPanelDeck.get() ? &m_pPanelDeck->GetPanelWindowAnchor() : NULL; } + /** returns the logical number of panels. This is greater than or equal to the number of panels displayed in the panel deck */ @@ -231,10 +280,88 @@ private: PanelDescriptors m_aPanels; ToolPanelViewShell& m_rPanelViewShell; ::boost::scoped_ptr< ToolPanelDeck > m_pPanelDeck; + ::rtl::Reference< ConfigurationListener > m_pConfigListener; PanelSelectorLayout m_eCurrentLayout; bool m_bInitialized; }; +// ===================================================================================================================== +// = ConfigurationListener - implementation +// ===================================================================================================================== +// --------------------------------------------------------------------------------------------------------------------- +ConfigurationListener::ConfigurationListener( ToolPanelViewShell_Impl& i_rShellImpl ) + :m_pShellImpl( &i_rShellImpl ) +{ + ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( i_rShellImpl.GetAntiImpl().GetViewShellBase() ) ); + Reference< XConfigurationControllerBroadcaster > xBroadcaster; + if ( pFrameworkHelper.get() ) + xBroadcaster.set( pFrameworkHelper->GetConfigurationController().get() ); + ENSURE_OR_THROW( pFrameworkHelper.get(), "no access to the config controller" ); + + osl_incrementInterlockedCount( &m_refCount ); + { + xBroadcaster->addConfigurationChangeListener( this, ::rtl::OUString(), Any() ); + } + osl_decrementInterlockedCount( &m_refCount ); +} + +// --------------------------------------------------------------------------------------------------------------------- +ConfigurationListener::~ConfigurationListener() +{ +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL ConfigurationListener::notifyConfigurationChange( const ConfigurationChangeEvent& i_rEvent ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + impl_checkDisposed_throw(); + +// if ( i_rEvent.Type == FrameworkHelper::msConfigurationUpdateStartEvent ) +// { +// m_pShellImpl->GetPanelDeck().SetUpdateMode( FALSE ); +// return; +// } +// if ( i_rEvent.Type == FrameworkHelper::msConfigurationUpdateEndEvent ) +// { +// m_pShellImpl->GetPanelDeck().SetUpdateMode( TRUE ); +// return; +// } +// + // is this an event we're interested in? + if ( i_rEvent.Type != FrameworkHelper::msResourceActivationEvent ) + return; + + // is this a resource we're interested in? Must be anchored in the task pane ... + Reference< XResourceId > xAnchorId; + if ( i_rEvent.ResourceId.is() ) + xAnchorId = i_rEvent.ResourceId->getAnchor(); + if ( !xAnchorId.is() ) + return; + const ::rtl::OUString sAnchorURL( xAnchorId->getResourceURL() ); + if ( sAnchorURL != FrameworkHelper::msTaskPaneURL ) + return; + + m_pShellImpl->OnToolPanelActivationRequest( i_rEvent.ResourceId->getResourceURL() ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL ConfigurationListener::disposing( const EventObject& i_rEvent ) throw (RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + impl_checkDisposed_throw(); + } + + dispose(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ConfigurationListener::dispose() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + m_pShellImpl = NULL; +} + // ===================================================================================================================== // = helpers // ===================================================================================================================== @@ -263,7 +390,7 @@ SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL)) TYPEINIT1(ToolPanelViewShell, ViewShell); // --------------------------------------------------------------------------------------------------------------------- -size_t ToolPanelViewShell::Implementation::SetupDefaultPanels() +size_t ToolPanelViewShell_Impl::SetupDefaultPanels() { typedef std::auto_ptr (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell ); @@ -365,7 +492,7 @@ size_t ToolPanelViewShell::Implementation::SetupDefaultPanels() } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::SetupCustomPanels() +void ToolPanelViewShell_Impl::SetupCustomPanels() { // compose the resource ID for the ToolPanel view ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) ); @@ -396,7 +523,7 @@ void ToolPanelViewShell::Implementation::SetupCustomPanels() } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::Setup() +void ToolPanelViewShell_Impl::Setup() { if ( m_bInitialized ) return; @@ -417,11 +544,14 @@ void ToolPanelViewShell::Implementation::Setup() // initialize panel selector SetLayout( LAYOUT_DRAWERS, true ); + // listen at the configuration + m_pConfigListener.set( new ConfigurationListener( *this ) ); + m_pPanelDeck->Show(); } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::SetLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce ) +void ToolPanelViewShell_Impl::SetLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce ) { if ( !i_bForce && ( m_eCurrentLayout == i_eLayout ) ) return; @@ -449,9 +579,9 @@ void ToolPanelViewShell::Implementation::SetLayout( const PanelSelectorLayout i_ } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::Cleanup() +void ToolPanelViewShell_Impl::Cleanup() { - if ( !m_bInitialized ) + if ( m_bInitialized ) { m_pPanelDeck->RemoveListener( *this ); // remove the panels which are not under the control of the panel deck currently @@ -464,10 +594,48 @@ void ToolPanelViewShell::Implementation::Cleanup() panelPos->pPanel->Dispose(); } m_aPanels.clear(); + + if ( m_pConfigListener.is() ) + m_pConfigListener->dispose(); } m_pPanelDeck.reset(); } +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell_Impl::OnToolPanelActivationRequest( const ::rtl::OUString& i_rResourceURL ) +{ + // look up the panel which belongs to the given resource + for ( size_t i=0; i( rPanel.pPanel.get() ) ); + ENSURE_OR_CONTINUE( pPanel != NULL, "ToolPanelViewShell::OnToolPanelActivationRequest: illegal panel implementation!" ); + + Reference< XResourceId > xPanelId( pPanel->getResourceId() ); + ::rtl::OUString sPanelURL( xPanelId.is() ? xPanelId->getResourceURL() : ::rtl::OUString() ); + ENSURE_OR_CONTINUE( sPanelURL.getLength(), "illegal panel resource!" ); + + if ( sPanelURL == i_rResourceURL ) + { + CustomToolPanel* pCustomPanel = dynamic_cast< CustomToolPanel* >( rPanel.pPanel.get() ); + OSL_ENSURE( ( pCustomPanel != NULL ) == ( rPanel.nId >= PID_FIRST_CUSTOM_PANEL ), + "ToolPanelViewShell::OnToolPanelActivationRequest: inconsistency!" ); + if ( pCustomPanel != NULL ) + { + // if that's a custom tool panel, then temporarily disable the access of the tool panel implementation + // to the XPane object. Otherwise, it would request this resource from the configuration controller during + // the below ActivatePanelDirectly call, which would fail, since the resource is just to be created. + pCustomPanel->LockResourceAccess(); + } + ActivatePanelDirectly( rPanel.nId ); + if ( pCustomPanel != NULL ) + { + pCustomPanel->UnlockResourceAccess(); + } + } + } +} + // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell::Initialize() { @@ -478,7 +646,7 @@ void ToolPanelViewShell::Initialize() ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, FrameView* pFrameViewArgument ) :ViewShell(pFrame, pParentWindow, rViewShellBase) - ,mpImpl( new Implementation( *this, *mpContentWindow.get() ) ) + ,mpImpl( new ToolPanelViewShell_Impl( *this, *mpContentWindow.get() ) ) ,mpSubShellManager() ,mnMenuId(0) { @@ -852,6 +1020,12 @@ bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow ) } // --------------------------------------------------------------------------------------------------------------------- +::Window* ToolPanelViewShell::GetToolPanelParentWindow() +{ + return mpImpl->GetToolPanelParentWindow(); +} + +//--------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell::DeactivatePanel( const PanelId i_ePanelId ) { mpImpl->DeactivatePanelDirectly( i_ePanelId ); @@ -865,10 +1039,10 @@ void ToolPanelViewShell::ActivatePanel( const PanelId i_ePanelId ) // ===================================================================================================================== -// = ToolPanelViewShell:Implementation - implementation +// = ToolPanelViewShell_Impl - implementation // ===================================================================================================================== // --------------------------------------------------------------------------------------------------------------------- -ToolPanelViewShell::Implementation::Implementation( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent ) +ToolPanelViewShell_Impl::ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent ) :m_aPanels() ,m_rPanelViewShell( i_rPanelViewShell ) ,m_pPanelDeck( new ToolPanelDeck( i_rPanelDeckParent, i_rPanelViewShell ) ) @@ -878,12 +1052,12 @@ ToolPanelViewShell::Implementation::Implementation( ToolPanelViewShell& i_rPanel } // --------------------------------------------------------------------------------------------------------------------- -ToolPanelViewShell::Implementation::~Implementation() +ToolPanelViewShell_Impl::~ToolPanelViewShell_Impl() { } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::TogglePanelVisibility( const size_t i_nLogicalPanelIndex ) +void ToolPanelViewShell_Impl::TogglePanelVisibility( const size_t i_nLogicalPanelIndex ) { ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < m_aPanels.size(), "illegal index" ); @@ -910,7 +1084,7 @@ void ToolPanelViewShell::Implementation::TogglePanelVisibility( const size_t i_n } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::DeactivatePanelDirectly( const PanelId i_nPanelId ) +void ToolPanelViewShell_Impl::DeactivatePanelDirectly( const PanelId i_nPanelId ) { for ( size_t i=0; i= m_aPanels.size() ) m_aPanels.resize( i_nPosition + 1 ); - OSL_PRECOND( m_aPanels[ i_nPosition ].nId == PID_UNKNOWN, "ToolPanelViewShell::Implementation::RegisterPanel: " + OSL_PRECOND( m_aPanels[ i_nPosition ].nId == PID_UNKNOWN, "ToolPanelViewShell_Impl::RegisterPanel: " "already registered a panel for this ID!" ); m_aPanels[ i_nPosition ] = PanelDescriptor( i_nPanelId, i_rPanel ); } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) +void ToolPanelViewShell_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) { (void)i_pPanel; (void)i_nPosition; } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::PanelRemoved( const size_t i_nPosition ) +void ToolPanelViewShell_Impl::PanelRemoved( const size_t i_nPosition ) { (void)i_nPosition; } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::UpdateDockingWindowTitle() +void ToolPanelViewShell_Impl::UpdateDockingWindowTitle() { PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( m_rPanelViewShell.GetDockingWindow() ); - ENSURE_OR_RETURN_VOID( pDockingWindow, "ToolPanelViewShell::Implementation::UpdateDockingWindowTitle: no PaneDockingWindow!?" ); + ENSURE_OR_RETURN_VOID( pDockingWindow, "ToolPanelViewShell_Impl::UpdateDockingWindowTitle: no PaneDockingWindow!?" ); ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() ); if ( !aActivePanel || ( GetLayout() == LAYOUT_DRAWERS ) ) @@ -994,7 +1168,7 @@ void ToolPanelViewShell::Implementation::UpdateDockingWindowTitle() } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) +void ToolPanelViewShell_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) { if ( GetLayout() == LAYOUT_DRAWERS ) // no adjustment of the title when we use the classical "drawers" layout @@ -1006,7 +1180,7 @@ void ToolPanelViewShell::Implementation::ActivePanelChanged( const ::boost::opti } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Implementation::Dying() +void ToolPanelViewShell_Impl::Dying() { } diff --git a/sd/workben/custompanel/Impress.xcu b/sd/workben/custompanel/Impress.xcu index 1c7bb5f6b..6f8ced492 100644 --- a/sd/workben/custompanel/Impress.xcu +++ b/sd/workben/custompanel/Impress.xcu @@ -6,7 +6,7 @@ - private:resource/view/SingleColorView + private:resource/toolpanel/SingleColorView Single Color Panel @@ -23,7 +23,7 @@ - private:resource/view/SingleColorView + private:resource/toolpanel/SingleColorView diff --git a/sd/workben/custompanel/ctp_factory.cxx b/sd/workben/custompanel/ctp_factory.cxx index 2e6d162e6..e38b23392 100644 --- a/sd/workben/custompanel/ctp_factory.cxx +++ b/sd/workben/custompanel/ctp_factory.cxx @@ -33,6 +33,7 @@ #include #include #include +#include /** === end UNO includes === **/ //...................................................................................................................... @@ -59,6 +60,7 @@ namespace sd { namespace colortoolpanel using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::drawing::framework::XResourceFactoryManager; using ::com::sun::star::lang::WrappedTargetException; + using ::com::sun::star::lang::XComponent; /** === end UNO using === **/ //================================================================================================================== @@ -68,7 +70,7 @@ namespace sd { namespace colortoolpanel { const ::rtl::OUString& lcl_getSingleColorViewURL() { - static ::rtl::OUString s_sSingleColorViewURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/view/SingleColorView" ) ); + static ::rtl::OUString s_sSingleColorViewURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolpanel/SingleColorView" ) ); return s_sSingleColorViewURL; } } @@ -105,8 +107,14 @@ namespace sd { namespace colortoolpanel void SAL_CALL ResourceFactory::releaseResource( const Reference< XResource >& i_rResource ) throw (RuntimeException) { FactoryGuard aGuard( *this ); - // TODO: place your code here - (void)i_rResource; + + // here, we could decide to actually not destroy the resource, but cache it. In this case, we would need + // to re-parent the VCL window to another, temporary window, or *at least* hide it. + + // However, for the simplicity of this example, we will simply dispose the component here, which will destroy + // all associated resources, including the VCL window. + Reference< XComponent > xComponent( i_rResource, UNO_QUERY_THROW ); + xComponent->dispose(); } //------------------------------------------------------------------------------------------------------------------ diff --git a/sd/workben/custompanel/ctp_panel.cxx b/sd/workben/custompanel/ctp_panel.cxx index dbda31812..1aa0772c3 100644 --- a/sd/workben/custompanel/ctp_panel.cxx +++ b/sd/workben/custompanel/ctp_panel.cxx @@ -29,8 +29,19 @@ #include "ctp_panel.hxx" /** === begin UNO includes === **/ +#include +#include +#include +#include +#include +#include +#include +#include +#include /** === end UNO includes === **/ +#include + //...................................................................................................................... namespace sd { namespace colortoolpanel { @@ -51,20 +62,98 @@ namespace sd { namespace colortoolpanel using ::com::sun::star::drawing::framework::XConfigurationController; using ::com::sun::star::drawing::framework::XResourceId; using ::com::sun::star::uno::XComponentContext; + using ::com::sun::star::drawing::framework::XPane; + using ::com::sun::star::awt::XWindow; + using ::com::sun::star::rendering::XCanvas; + using ::com::sun::star::lang::DisposedException; + using ::com::sun::star::awt::XWindowPeer; + using ::com::sun::star::lang::XMultiComponentFactory; + using ::com::sun::star::awt::XToolkit; + using ::com::sun::star::awt::WindowDescriptor; + using ::com::sun::star::awt::WindowClass_SIMPLE; + using ::com::sun::star::awt::Rectangle; + using ::com::sun::star::awt::PaintEvent; + using ::com::sun::star::lang::EventObject; + using ::com::sun::star::awt::XDevice; + using ::com::sun::star::awt::XGraphics; /** === end UNO using === **/ + namespace WindowAttribute = ::com::sun::star::awt::WindowAttribute; + namespace PosSize = ::com::sun::star::awt::PosSize; + //================================================================================================================== + //= helpers + //================================================================================================================== + namespace + { + Reference< XWindow > lcl_createPlainWindow_nothrow( const Reference< XComponentContext >& i_rContext, + const Reference< XWindowPeer >& i_rParentWindow ) + { + try + { + ENSURE_OR_THROW( i_rContext.is(), "illegal component context" ); + Reference< XMultiComponentFactory > xFactory( i_rContext->getServiceManager(), UNO_SET_THROW ); + Reference< XToolkit > xToolkit( xFactory->createInstanceWithContext( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ), + i_rContext + ), UNO_QUERY_THROW ); + + WindowDescriptor aWindow; + aWindow.Type = WindowClass_SIMPLE; + aWindow.WindowServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "window" ) ); + aWindow.Parent = i_rParentWindow; + aWindow.WindowAttributes = WindowAttribute::BORDER; + + Reference< XWindowPeer > xWindow( xToolkit->createWindow( aWindow ), UNO_SET_THROW ); + return Reference< XWindow >( xWindow, UNO_QUERY_THROW ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; + } + } //================================================================================================================== //= class SingleColorPanel //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ SingleColorPanel::SingleColorPanel( const Reference< XComponentContext >& i_rContext, const Reference< XConfigurationController >& i_rConfigController, const Reference< XResourceId >& i_rResourceId ) - :m_xContext( i_rContext ) + :SingleColorPanel_Base( m_aMutex ) + ,m_xContext( i_rContext ) ,m_xResourceId( i_rResourceId ) + ,m_xWindow() { - // TODO: retrieve the resource object for the anchor, ask it for its XPane interface, retrieve the window - // associated with it, create our own window as child of the pane's window - (void)i_rConfigController; + ENSURE_OR_THROW( i_rConfigController.is(), "invalid configuration controller" ); + ENSURE_OR_THROW( m_xResourceId.is(), "invalid resource id" ); + + // retrieve the parent window for our to-be-created pane window + Reference< XWindow > xParentWindow; + Reference< XWindowPeer > xParentPeer; + try + { + Reference< XResource > xAnchor( i_rConfigController->getResource( m_xResourceId->getAnchor() ), UNO_SET_THROW ); + Reference< XPane > xAnchorPane( xAnchor, UNO_QUERY_THROW ); + xParentWindow.set( xAnchorPane->getWindow(), UNO_SET_THROW ); + xParentPeer.set( xParentWindow, UNO_QUERY_THROW ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + osl_incrementInterlockedCount( &m_refCount ); + if ( xParentWindow.is() ) + { + m_xWindow = lcl_createPlainWindow_nothrow( m_xContext, xParentPeer ); + m_xWindow->addPaintListener( this ); + if ( m_xWindow.is() ) + { + const Rectangle aPanelAnchorSize( xParentWindow->getPosSize() ); + m_xWindow->setPosSize( 0, 0, aPanelAnchorSize.Width, aPanelAnchorSize.Height, PosSize::POSSIZE ); + m_xWindow->setVisible( sal_True ); + } + } + osl_decrementInterlockedCount( &m_refCount ); } //------------------------------------------------------------------------------------------------------------------ @@ -72,18 +161,78 @@ namespace sd { namespace colortoolpanel { } - //-------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ + Reference< XWindow > SAL_CALL SingleColorPanel::getWindow( ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xWindow.get() ) + throw DisposedException( ::rtl::OUString(), *this ); + return m_xWindow; + } + + //------------------------------------------------------------------------------------------------------------------ Reference< XResourceId > SAL_CALL SingleColorPanel::getResourceId( ) throw (RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xWindow.is() ) + throw DisposedException( ::rtl::OUString(), *this ); return m_xResourceId; } - //-------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ ::sal_Bool SAL_CALL SingleColorPanel::isAnchorOnly( ) throw (RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xWindow.is() ) + throw DisposedException( ::rtl::OUString(), *this ); return sal_False; } + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL SingleColorPanel::windowPaint( const PaintEvent& i_rEvent ) throw (RuntimeException) + { + try + { + const Reference< XDevice > xDevice( i_rEvent.Source, UNO_QUERY_THROW ); + const Reference< XGraphics > xGraphics( xDevice->createGraphics(), UNO_SET_THROW ); + xGraphics->setFillColor( 0x80 << 8 ); + xGraphics->setLineColor( 0x80 << 16 ); + + const Reference< XWindow > xWindow( i_rEvent.Source, UNO_QUERY_THROW ); + const Rectangle aWindowRect( xWindow->getPosSize() ); + xGraphics->drawRect( 0, 0, aWindowRect.Width - 1, aWindowRect.Height - 1 ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL SingleColorPanel::disposing( const EventObject& i_rSource ) throw (RuntimeException) + { + (void)i_rSource; + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL SingleColorPanel::disposing() + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xWindow.is() ) + // already disposed + return; + m_xWindow->removePaintListener( this ); + try + { + Reference< XComponent > xWindowComp( m_xWindow, UNO_QUERY_THROW ); + xWindowComp->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + m_xWindow.clear(); + } //...................................................................................................................... } } // namespace sd::colortoolpanel diff --git a/sd/workben/custompanel/ctp_panel.hxx b/sd/workben/custompanel/ctp_panel.hxx index bf4a0654b..ee6bf16bc 100644 --- a/sd/workben/custompanel/ctp_panel.hxx +++ b/sd/workben/custompanel/ctp_panel.hxx @@ -29,14 +29,18 @@ /** === begin UNO includes === **/ #include +#include #include #include #include +#include /** === end UNO includes === **/ -#include +#include #include +#include + //...................................................................................................................... namespace sd { namespace colortoolpanel { @@ -45,8 +49,10 @@ namespace sd { namespace colortoolpanel //================================================================================================================== //= class SingleColorPanel //================================================================================================================== - typedef ::cppu::WeakImplHelper1 < ::com::sun::star::drawing::framework::XView - > SingleColorPanel_Base; + typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::drawing::framework::XView + , ::com::sun::star::view::XToolPanel + , ::com::sun::star::awt::XPaintListener + > SingleColorPanel_Base; class SingleColorPanel :public ::cppu::BaseMutex ,public SingleColorPanel_Base { @@ -57,6 +63,9 @@ namespace sd { namespace colortoolpanel const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rResourceId ); + // XToolPanel + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow( ) throw (::com::sun::star::uno::RuntimeException); + // XView // (no methods) @@ -64,12 +73,22 @@ namespace sd { namespace colortoolpanel virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > SAL_CALL getResourceId( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isAnchorOnly( ) throw (::com::sun::star::uno::RuntimeException); + // XPaintListener + virtual void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) 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); + + // XComponent equivalents + virtual void SAL_CALL disposing(); + protected: ~SingleColorPanel(); private: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > m_xResourceId; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow; }; //...................................................................................................................... diff --git a/sd/workben/custompanel/makefile.mk b/sd/workben/custompanel/makefile.mk index 7703b7163..6c20c5a4d 100644 --- a/sd/workben/custompanel/makefile.mk +++ b/sd/workben/custompanel/makefile.mk @@ -62,9 +62,10 @@ LIB1OBJFILES= \ $(SLO)/ctp_panel.obj SHL1STDLIBS= \ - $(CPPULIB) \ - $(SALLIB) \ - $(SALHELPERLIB) \ + $(TOOLSLIB) \ + $(CPPULIB) \ + $(SALLIB) \ + $(SALHELPERLIB) \ $(CPPUHELPERLIB) SHL1VERSIONMAP=$(TARGET).map -- cgit v1.2.3 From 2a66db8c65a4ae6f28b82881ea21ae8a6d11c76a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 22 Mar 2010 13:19:00 +0100 Subject: slidecopy: removed the remaints of the old task panel implementation - in particular, creating tool panels as non-roots of a control tree is not needed anymore by now --- .../ui/inc/taskpane/SlideSorterCacheDisplay.hxx | 2 - .../ui/inc/taskpane/TaskPaneControlFactory.hxx | 54 +-------------- sd/source/ui/inc/taskpane/TitledControl.hxx | 12 +--- sd/source/ui/toolpanel/LayoutMenu.cxx | 79 +--------------------- sd/source/ui/toolpanel/LayoutMenu.hxx | 25 ++----- sd/source/ui/toolpanel/ScrollPanel.cxx | 2 +- sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx | 41 ----------- sd/source/ui/toolpanel/StandardToolPanel.cxx | 2 +- sd/source/ui/toolpanel/TaskPaneControlFactory.cxx | 13 +--- sd/source/ui/toolpanel/TestMenu.cxx | 17 ++--- sd/source/ui/toolpanel/TestMenu.hxx | 2 +- sd/source/ui/toolpanel/TestPanel.cxx | 13 ++-- sd/source/ui/toolpanel/TestPanel.hxx | 2 +- sd/source/ui/toolpanel/TitledControl.cxx | 76 ++++----------------- .../ui/toolpanel/controls/CustomAnimationPanel.cxx | 14 ---- .../ui/toolpanel/controls/CustomAnimationPanel.hxx | 4 -- .../ui/toolpanel/controls/MasterPagesPanel.cxx | 14 ---- .../ui/toolpanel/controls/MasterPagesPanel.hxx | 4 -- .../ui/toolpanel/controls/SlideTransitionPanel.cxx | 15 ---- .../ui/toolpanel/controls/SlideTransitionPanel.hxx | 4 -- .../ui/toolpanel/controls/TableDesignPanel.cxx | 14 ---- .../ui/toolpanel/controls/TableDesignPanel.hxx | 4 -- 22 files changed, 40 insertions(+), 373 deletions(-) diff --git a/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx b/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx index 794235049..aa0a110a0 100644 --- a/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx +++ b/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx @@ -74,8 +74,6 @@ public: virtual void Paint (const Rectangle& rBoundingBox); virtual void Resize (void); - static std::auto_ptr CreateControlFactory (const SdDrawDocument* pDocument); - static SlideSorterCacheDisplay* Instance (const SdDrawDocument* pDocument); void SetPageCount (sal_Int32 nPageCount); diff --git a/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx b/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx index 17a1fa840..a099b8d14 100644 --- a/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx +++ b/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx @@ -61,60 +61,18 @@ public: ControlFactory (void); virtual ~ControlFactory (void); - /** Derived classes should overload InternalCreateControl(), not this - method. - */ - ::std::auto_ptr CreateControl (TreeNode* pTreeNode); - /** creates a tree node which acts as root of an own tree - An implementation is allowed to return NULL here, but must return non-NULL then in the other - factory method. Derived classes should overload InternalCreateControl. */ - ::std::auto_ptr CreateRootControl( ::Window& i_rParent ); + ::std::auto_ptr CreateControl( ::Window& i_rParent ); protected: - /** This is the internal hook for derived classes to overload in order - to provide a new control instance. - */ - virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) = 0; - - virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) = 0; + virtual TreeNode* InternalCreateControl( ::Window& i_rParent ) = 0; }; -/** A simple helper class that realizes a ControlFactory that provides its - newly created controls with one additional argument (additional to the - parent TreeNode). -*/ -template -class ControlFactoryWithArgs1 - : public ControlFactory -{ -public: - ControlFactoryWithArgs1 (ArgumentType& rArgument) - : mrArgument(rArgument) - {} - -protected: - virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) - { - return new ControlType(pTreeNode, mrArgument); - } - - virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) - { - OSL_ENSURE( false, "ControlFactoryWithArgs1::InternalCreateRootControl: not implemented!" ); - return NULL; - } - -private: - ArgumentType& mrArgument; -}; - - /** A simple helper class that realizes a ControlFactory that is able to create root controls, providing the to-be-created control with an additional parameter. */ @@ -128,13 +86,7 @@ public: {} protected: - virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) - { - OSL_ENSURE( false, "ControlFactoryWithArgs1::InternalCreateControl: not implemented!" ); - return NULL; - } - - virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) + virtual TreeNode* InternalCreateControl( ::Window& i_rParent ) { return new ControlType( i_rParent, mrArgument ); } diff --git a/sd/source/ui/inc/taskpane/TitledControl.hxx b/sd/source/ui/inc/taskpane/TitledControl.hxx index 4d002349b..4876dc46e 100644 --- a/sd/source/ui/inc/taskpane/TitledControl.hxx +++ b/sd/source/ui/inc/taskpane/TitledControl.hxx @@ -83,13 +83,6 @@ public: const ClickHandler& rClickHandler, TitleBar::TitleBarType eType); - TitledControl ( - TreeNode* pParent, - ::std::auto_ptr pControlFactory, - const String& rTitle, - const ClickHandler& rClickHandler, - TitleBar::TitleBarType eType); - virtual ~TitledControl (void); @@ -110,8 +103,8 @@ public: the control has not yet been created and the given flag is then the control is created. */ - TreeNode* GetControl (bool bCreate=true); - const TreeNode* GetConstControl (bool bCreate=true) const; + TreeNode* GetControl (void); + const TreeNode* GetConstControl () const; const String& GetTitle (void) const; @@ -158,7 +151,6 @@ private: String msTitle; bool mbVisible; void* mpUserData; - ::std::auto_ptr mpControlFactory; ::std::auto_ptr mpClickHandler; /** Remember whether to toggle (true) the expansion state when the title diff --git a/sd/source/ui/toolpanel/LayoutMenu.cxx b/sd/source/ui/toolpanel/LayoutMenu.cxx index 4e70cfb39..636dda361 100644 --- a/sd/source/ui/toolpanel/LayoutMenu.cxx +++ b/sd/source/ui/toolpanel/LayoutMenu.cxx @@ -88,45 +88,6 @@ using ::sd::framework::FrameworkHelper; namespace sd { namespace toolpanel { -/** This factory class stores references to ViewShellBase and DrawDocShell - and passes them to new LayoutMenu objects. -*/ -class LayoutMenuFactory - : public ControlFactory -{ -public: - LayoutMenuFactory (ViewShellBase& rBase, DrawDocShell& rDocShell) - : mrBase(rBase), - mrDocShell(rDocShell) - {} - -protected: - virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) - { - ScrollPanel* pScrollPanel = new ScrollPanel (pTreeNode); - ::std::auto_ptr pMenu ( - new LayoutMenu ( - pScrollPanel, - mrDocShell, - mrBase, - false)); - pScrollPanel->AddControl(pMenu); - return pScrollPanel; - } - - virtual TreeNode* InternalCreateRootControl( ::Window& /*i_rParent*/ ) - { - OSL_ENSURE( false, "LayoutMenuFactory::InternalCreateRootControl: not implemented!" ); - return NULL; - } - -private: - ViewShellBase& mrBase; - DrawDocShell& mrDocShell; -}; - - - class LayoutMenuRootFactory : public ControlFactory { @@ -137,13 +98,7 @@ public: } protected: - virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) - { - OSL_ENSURE( false, "LayoutMenuRootFactory::InternalCreateControl: not implemented!" ); - return NULL; - } - - virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) + virtual TreeNode* InternalCreateControl( ::Window& i_rParent ) { ScrollPanel* pScrollPanel = new ScrollPanel (i_rParent); ::std::auto_ptr pMenu ( @@ -263,28 +218,6 @@ static snewfoil_value_info standard[] = -LayoutMenu::LayoutMenu ( - TreeNode* pParent, - DrawDocShell& rDocumentShell, - ViewShellBase& rViewShellBase, - bool bUseOwnScrollBar) - : ValueSet (pParent->GetWindow()), - TreeNode(pParent), - DragSourceHelper(this), - DropTargetHelper(this), - mrBase (rViewShellBase), - mpShellManager (NULL), - mbUseOwnScrollBar (bUseOwnScrollBar), - mnPreferredColumnCount(3), - mxListener(NULL), - mbSelectionUpdatePending(true), - mbIsMainViewChangePending(false) -{ - ImplConstruct( rDocumentShell ); -} - - - LayoutMenu::LayoutMenu( TreeNode* pParent, ToolPanelViewShell& i_rPanelViewShell ) : ValueSet (pParent->GetWindow()), TreeNode(pParent), @@ -364,16 +297,6 @@ LayoutMenu::~LayoutMenu (void) -::std::auto_ptr LayoutMenu::CreateControlFactory ( - ViewShellBase& rBase, - DrawDocShell& rDocShell) -{ - return ::std::auto_ptr(new LayoutMenuFactory(rBase, rDocShell)); -} - - - - ::std::auto_ptr LayoutMenu::CreateControlFactory ( ToolPanelViewShell& i_rPanelViewShell ) { diff --git a/sd/source/ui/toolpanel/LayoutMenu.hxx b/sd/source/ui/toolpanel/LayoutMenu.hxx index 9355cce1f..6325cb2cf 100644 --- a/sd/source/ui/toolpanel/LayoutMenu.hxx +++ b/sd/source/ui/toolpanel/LayoutMenu.hxx @@ -80,31 +80,16 @@ public: /** Create a new layout menu. Depending on the given flag it displays its own scroll bar or lets a surrounding window handle that. - @param rDocumentShell - Used to determine writing direction. - @param rViewShellBase - Gives access to the view shell at whose active page the - layout will be set. - @param bUseOwnScrollBar - When then we will show our own scroll bar when not - all icons can be displayed in the visible window area. - When then rely on an outer scroll bar. In this - case we will set the height of the window so that all - icons are visible. + @param i_pParent + the parent node in the control tree + @param i_rPanelViewShell + the view shell of the task pane. */ LayoutMenu ( - TreeNode* pParent, - DrawDocShell& rDocumentShell, - ViewShellBase& rViewShellBase, - bool bUseOwnScrollBar); - LayoutMenu ( - TreeNode* pParent, + TreeNode* i_pParent, ToolPanelViewShell& i_rPanelViewShell); virtual ~LayoutMenu (void); - static std::auto_ptr CreateControlFactory ( - ViewShellBase& rBase, - DrawDocShell& rDocShell); static std::auto_ptr CreateControlFactory ( ToolPanelViewShell& i_rPanelViewShell ); diff --git a/sd/source/ui/toolpanel/ScrollPanel.cxx b/sd/source/ui/toolpanel/ScrollPanel.cxx index 658dcb8ce..a9f0f5e1f 100644 --- a/sd/source/ui/toolpanel/ScrollPanel.cxx +++ b/sd/source/ui/toolpanel/ScrollPanel.cxx @@ -122,7 +122,7 @@ ScrollPanel::~ScrollPanel (void) // control instead of pNode directly. TitledControl* pTitledControl = static_cast(pNode); if (pTitledControl != NULL) - pControl = pTitledControl->GetControl(false); + pControl = pTitledControl->GetControl(); // Remove this object as listener from the control. if (pControl != NULL && pControl->GetWindow()!=NULL) diff --git a/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx b/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx index bc5d74cfe..bf398948b 100644 --- a/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx +++ b/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx @@ -74,38 +74,6 @@ namespace sd { namespace toolpanel { ::std::map SlideSorterCacheDisplay::maDisplays; -/** This factory class is used to create instances of TestPanel. It can be - extended so that its constructor stores arguments that later are passed - to new TestPanel objects. -*/ -class SlideSorterCacheDisplayFactory - : public ControlFactory -{ -public: - SlideSorterCacheDisplayFactory (const SdDrawDocument* pDocument) - : mpDocument(pDocument) - { - } - -protected: - virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) - { - SlideSorterCacheDisplay* pDisplay = SlideSorterCacheDisplay::Instance(mpDocument); - pDisplay->SetParentWindow(pTreeNode->GetWindow()); - pDisplay->SetParentNode(pTreeNode); - return pDisplay; - } - -private: - const SdDrawDocument* mpDocument; -}; - - - - - - - SlideSorterCacheDisplay::SlideSorterCacheDisplay (const SdDrawDocument* pDocument) : TreeNode(NULL), mpWindow(NULL), @@ -140,15 +108,6 @@ void SlideSorterCacheDisplay::SetParentWindow (::Window* pParentWindow) -std::auto_ptr SlideSorterCacheDisplay::CreateControlFactory ( - const SdDrawDocument* pDocument) -{ - return std::auto_ptr(new SlideSorterCacheDisplayFactory(pDocument)); -} - - - - void SlideSorterCacheDisplay::Paint (const Rectangle& rBoundingBox) { if (maCellSize.Width()>0 && maCellSize.Height()>0 && mpWindow!=NULL) diff --git a/sd/source/ui/toolpanel/StandardToolPanel.cxx b/sd/source/ui/toolpanel/StandardToolPanel.cxx index ec2582384..16d4c5f6c 100644 --- a/sd/source/ui/toolpanel/StandardToolPanel.cxx +++ b/sd/source/ui/toolpanel/StandardToolPanel.cxx @@ -136,7 +136,7 @@ namespace sd { namespace toolpanel return true; if ( isDisposed() ) return false; - m_pControl = m_pControlFactory->CreateRootControl( getPanelWindowAnchor() ); + m_pControl = m_pControlFactory->CreateControl( getPanelWindowAnchor() ); return ( m_pControl.get() != NULL ); } diff --git a/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx b/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx index 827a63f5c..115f2bbb6 100644 --- a/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx +++ b/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx @@ -51,18 +51,9 @@ ControlFactory::~ControlFactory (void) -::std::auto_ptr ControlFactory::CreateControl (TreeNode* pTreeNode) +::std::auto_ptr ControlFactory::CreateControl( ::Window& i_rParent ) { - // Create a new control by using the protected virtual hook. - TreeNode* pNewNode = InternalCreateControl(pTreeNode); - - return ::std::auto_ptr(pNewNode); -} - - -::std::auto_ptr ControlFactory::CreateRootControl( ::Window& i_rParent ) -{ - TreeNode* pNewNode = InternalCreateRootControl( i_rParent ); + TreeNode* pNewNode = InternalCreateControl( i_rParent ); return ::std::auto_ptr( pNewNode ); } diff --git a/sd/source/ui/toolpanel/TestMenu.cxx b/sd/source/ui/toolpanel/TestMenu.cxx index f5b851a01..d94344547 100644 --- a/sd/source/ui/toolpanel/TestMenu.cxx +++ b/sd/source/ui/toolpanel/TestMenu.cxx @@ -48,21 +48,16 @@ class ColorMenuFactory : public ControlFactory { protected: - virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) + virtual TreeNode* InternalCreateControl( ::Window& i_rParent ) { - return new ColorMenu (pTreeNode); - } - virtual TreeNode* InternalCreateRootControl( ::Window& /*i_rParent*/ ) - { - OSL_ENSURE( false, "ColorMenuFactory::InternalCreateRootControl: not implemented!" ); - return NULL; + return new ColorMenu (&i_rParent); } }; -ColorMenu::ColorMenu (TreeNode* pParent) - : Window (pParent->GetWindow()), - TreeNode(pParent), +ColorMenu::ColorMenu (::Window* i_pParent) + : Window (i_pParent), + TreeNode(NULL), maSet (this), mnPreferredColumnCount(2) { @@ -79,7 +74,7 @@ ColorMenu::ColorMenu (TreeNode* pParent) Fill (); maSet.Show(); - pParent->RequestResize(); + i_pParent->Resize(); } diff --git a/sd/source/ui/toolpanel/TestMenu.hxx b/sd/source/ui/toolpanel/TestMenu.hxx index 5a4d88a5a..e394296fc 100644 --- a/sd/source/ui/toolpanel/TestMenu.hxx +++ b/sd/source/ui/toolpanel/TestMenu.hxx @@ -50,7 +50,7 @@ class ColorMenu public TreeNode { public: - ColorMenu (TreeNode* pParent); + ColorMenu (::Window* i_pParent); virtual ~ColorMenu (void); static ::std::auto_ptr CreateControlFactory (void); diff --git a/sd/source/ui/toolpanel/TestPanel.cxx b/sd/source/ui/toolpanel/TestPanel.cxx index 21e2e35b1..e87d4102a 100644 --- a/sd/source/ui/toolpanel/TestPanel.cxx +++ b/sd/source/ui/toolpanel/TestPanel.cxx @@ -48,14 +48,9 @@ class TestPanelFactory : public ControlFactory { protected: - virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) + virtual TreeNode* InternalCreateControl( ::Window& i_rParent ) { - return new TestPanel (pTreeNode); - } - virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) - { - OSL_ENSURE( false, "TestPanelFactory::InternalCreateRootControl: not implemented!" ); - return NULL; + return new TestPanel (i_rParent); } }; @@ -117,8 +112,8 @@ private: }; -TestPanel::TestPanel (TreeNode* pParent) - : SubToolPanel (pParent) +TestPanel::TestPanel (::Window& i_rParent) + : SubToolPanel (i_rParent) { // Create a scrollable panel with two list boxes. ScrollPanel* pScrollPanel = new ScrollPanel (this); diff --git a/sd/source/ui/toolpanel/TestPanel.hxx b/sd/source/ui/toolpanel/TestPanel.hxx index 39147c0fc..f3acdde4a 100644 --- a/sd/source/ui/toolpanel/TestPanel.hxx +++ b/sd/source/ui/toolpanel/TestPanel.hxx @@ -45,7 +45,7 @@ class TestPanel : public SubToolPanel { public: - TestPanel (TreeNode* pParent); + TestPanel (::Window& i_rParent); virtual ~TestPanel (void); static std::auto_ptr CreateControlFactory (void); diff --git a/sd/source/ui/toolpanel/TitledControl.cxx b/sd/source/ui/toolpanel/TitledControl.cxx index f87bf05a4..7551d4e0a 100644 --- a/sd/source/ui/toolpanel/TitledControl.cxx +++ b/sd/source/ui/toolpanel/TitledControl.cxx @@ -55,7 +55,6 @@ TitledControl::TitledControl ( msTitle(rTitle), mbVisible(true), mpUserData(NULL), - mpControlFactory(NULL), mpClickHandler(new ClickHandler(rClickHandler)), mbExpansionModeIsToggle(eType!=TitleBar::TBT_CONTROL_TITLE) { @@ -82,39 +81,6 @@ TitledControl::TitledControl ( -TitledControl::TitledControl ( - TreeNode* pParent, - ::std::auto_ptr pControlFactory, - const String& rTitle, - const ClickHandler& rClickHandler, - TitleBar::TitleBarType eType) - : ::Window (pParent->GetWindow(), WB_TABSTOP), - TreeNode(pParent), - msTitle (rTitle), - mbVisible (true), - mpUserData (NULL), - mpControlFactory(pControlFactory), - mpClickHandler(new ClickHandler(rClickHandler)), - mbExpansionModeIsToggle(eType!=TitleBar::TBT_CONTROL_TITLE) -{ - mpControlContainer->AddControl (::std::auto_ptr ( - new TitleBar (this, rTitle, eType, true))); - - // The second control is created on demand, i.e. when GetControl(true) - // is called the first time. - - SetBackground (Wallpaper()); - - GetTitleBar()->GetWindow()->Show (); - GetTitleBar()->GetWindow()->AddEventListener ( - LINK(this,TitledControl,WindowEventListener)); - - UpdateStates (); -} - - - - TitledControl::~TitledControl (void) { GetTitleBar()->GetWindow()->RemoveEventListener ( @@ -127,7 +93,7 @@ TitledControl::~TitledControl (void) Size TitledControl::GetPreferredSize (void) { Size aPreferredSize; - if (GetControl(false) != NULL) + if (GetControl() != NULL) { aPreferredSize = GetControl()->GetPreferredSize(); if ( ! IsExpanded()) @@ -149,7 +115,7 @@ Size TitledControl::GetPreferredSize (void) sal_Int32 TitledControl::GetPreferredWidth (sal_Int32 nHeight) { int nPreferredWidth = 0; - if (GetControl(false) != NULL) + if (GetControl() != NULL) nPreferredWidth = GetControl()->GetPreferredWidth( nHeight - GetTitleBar()->GetWindow()->GetSizePixel().Height()); else @@ -166,7 +132,7 @@ sal_Int32 TitledControl::GetPreferredWidth (sal_Int32 nHeight) sal_Int32 TitledControl::GetPreferredHeight (sal_Int32 nWidth) { int nPreferredHeight = 0; - if (IsExpanded() && GetControl(false)!=NULL) + if (IsExpanded() && GetControl()!=NULL) nPreferredHeight = GetControl()->GetPreferredHeight(nWidth); nPreferredHeight += GetTitleBar()->GetPreferredHeight(nWidth); @@ -204,7 +170,7 @@ void TitledControl::Resize (void) Size (aWindowSize.Width(), nTitleBarHeight)); - TreeNode* pControl = GetControl(false); + TreeNode* pControl = GetControl(); if (pControl != NULL && pControl->GetWindow() != NULL && pControl->GetWindow()->IsVisible()) @@ -251,7 +217,7 @@ void TitledControl::KeyInput (const KeyEvent& rEvent) if ( ! FocusManager::Instance().TransferFocus(this,nCode)) { // When already expanded then put focus on first child. - TreeNode* pControl = GetControl(false); + TreeNode* pControl = GetControl(); if (pControl!=NULL && IsExpanded()) if (pControl->GetWindow() != NULL) pControl->GetWindow()->GrabFocus(); @@ -289,7 +255,7 @@ bool TitledControl::Expand (bool bExpanded) // Get the control. Use the bExpanded parameter as argument to // indicate that a control is created via its factory only when it // is to be expanded. When it is collapsed this is not necessary. - TreeNode* pControl = GetControl(bExpanded); + TreeNode* pControl = GetControl(); if (pControl != NULL && GetControl()->IsExpanded() != bExpanded) { @@ -307,7 +273,7 @@ bool TitledControl::Expand (bool bExpanded) bool TitledControl::IsExpandable (void) const { - const TreeNode* pControl = GetConstControl(false); + const TreeNode* pControl = GetConstControl(); if (pControl != NULL) return pControl->IsExpandable(); else @@ -321,7 +287,7 @@ bool TitledControl::IsExpandable (void) const bool TitledControl::IsExpanded (void) const { - const TreeNode* pControl = GetConstControl(false); + const TreeNode* pControl = GetConstControl(); if (pControl != NULL) return pControl->IsExpanded(); else @@ -395,7 +361,7 @@ void TitledControl::UpdateStates (void) else GetWindow()->Hide(); - TreeNode* pControl = GetControl(false); + TreeNode* pControl = GetControl(); if (pControl!=NULL && pControl->GetWindow() != NULL) { if (IsVisible() && IsExpanded()) @@ -428,33 +394,17 @@ IMPL_LINK(TitledControl, WindowEventListener, -TreeNode* TitledControl::GetControl (bool bCreate) +TreeNode* TitledControl::GetControl (void) { - TreeNode* pNode = mpControlContainer->GetControl(1); - if (pNode==NULL && mpControlFactory.get()!=NULL && bCreate) - { - // We have to create the control with the factory object. - ::std::auto_ptr pControl (mpControlFactory->CreateControl(this));//GetParentNode())); - if (pControl.get() != NULL) - { - pControl->SetParentNode(this); - mpControlContainer->AddControl(pControl); - - pNode = mpControlContainer->GetControl(1); - FocusManager::Instance().RegisterDownLink(this, pNode->GetWindow()); - FocusManager::Instance().RegisterUpLink(pNode->GetWindow(), this); - } - } - - return pNode; + return mpControlContainer->GetControl(1); } -const TreeNode* TitledControl::GetConstControl (bool bCreate) const +const TreeNode* TitledControl::GetConstControl () const { - return const_cast(this)->GetControl(bCreate); + return const_cast(this)->GetControl(); } diff --git a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx index 35673e61b..68621be36 100644 --- a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx +++ b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx @@ -48,14 +48,6 @@ namespace sd namespace toolpanel { namespace controls { -CustomAnimationPanel::CustomAnimationPanel(TreeNode* pParent, ViewShellBase& rBase) - : SubToolPanel (pParent) - , m_pPanelViewShell (NULL) -{ - mpWrappedControl = createCustomAnimationPanel( pParent->GetWindow(), rBase ); - mpWrappedControl->Show(); -} - CustomAnimationPanel::CustomAnimationPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell) :SubToolPanel( i_rParentWindow ) ,m_pPanelViewShell( &i_rPanelViewShell ) @@ -69,12 +61,6 @@ CustomAnimationPanel::~CustomAnimationPanel() delete mpWrappedControl; } -std::auto_ptr CustomAnimationPanel::CreateControlFactory (ViewShellBase& rBase) -{ - return std::auto_ptr( - new ControlFactoryWithArgs1(rBase)); -} - std::auto_ptr< ControlFactory > CustomAnimationPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) { return std::auto_ptr< ControlFactory >( diff --git a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx index 2f0eb4ed7..1b5eb8b67 100644 --- a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx +++ b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx @@ -49,15 +49,11 @@ class CustomAnimationPanel : public SubToolPanel { public: - CustomAnimationPanel ( - TreeNode* pParent, - ViewShellBase& rBase); CustomAnimationPanel ( Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell); virtual ~CustomAnimationPanel (void); - static std::auto_ptr CreateControlFactory (ViewShellBase& rBase); static std::auto_ptr CreateControlFactory (ToolPanelViewShell& i_rPanelViewShell); // TreeNode overridables diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx index 5ea3a7836..fa58285cd 100644 --- a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx +++ b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx @@ -52,13 +52,6 @@ namespace sd { namespace toolpanel { namespace controls { -MasterPagesPanel::MasterPagesPanel (TreeNode* pParent, ViewShellBase& rBase) - : ScrollPanel (pParent) - , m_pPanelViewShell (NULL) -{ - impl_construct( rBase ); -} - MasterPagesPanel::MasterPagesPanel (::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell) :ScrollPanel (i_rParentWindow) ,m_pPanelViewShell( &i_rPanelViewShell ) @@ -158,13 +151,6 @@ TaskPaneShellManager* MasterPagesPanel::GetShellManager() -std::auto_ptr MasterPagesPanel::CreateControlFactory (ViewShellBase& rBase) -{ - return std::auto_ptr( - new ControlFactoryWithArgs1(rBase)); -} - - std::auto_ptr< ControlFactory > MasterPagesPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) { return std::auto_ptr< ControlFactory >( diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx index 3475e2a5f..9f1bb1670 100644 --- a/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx +++ b/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx @@ -53,9 +53,6 @@ class MasterPagesPanel : public ScrollPanel { public: - MasterPagesPanel ( - TreeNode* pParent, - ViewShellBase& rBase); MasterPagesPanel ( ::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell); @@ -64,7 +61,6 @@ public: // TreeNode overridables virtual TaskPaneShellManager* GetShellManager (void); - static std::auto_ptr CreateControlFactory (ViewShellBase& rBase); static std::auto_ptr CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell); private: diff --git a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx index b333e3d3d..1cff99c57 100644 --- a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx +++ b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx @@ -49,15 +49,6 @@ namespace toolpanel { namespace controls { -SlideTransitionPanel::SlideTransitionPanel(TreeNode* pParent, ViewShellBase& rBase) - : SubToolPanel (pParent), - maPreferredSize( 100, 200 ), - m_pPanelViewShell( NULL ) -{ - mpWrappedControl = createSlideTransitionPanel( pParent->GetWindow(), rBase ); - mpWrappedControl->Show(); -} - SlideTransitionPanel::SlideTransitionPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rToolPanelShell) :SubToolPanel( i_rParentWindow ) ,maPreferredSize( 100, 200 ) @@ -72,12 +63,6 @@ SlideTransitionPanel::~SlideTransitionPanel() delete mpWrappedControl; } -std::auto_ptr SlideTransitionPanel::CreateControlFactory (ViewShellBase& rBase) -{ - return std::auto_ptr( - new ControlFactoryWithArgs1(rBase)); -} - std::auto_ptr< ControlFactory > SlideTransitionPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) { return std::auto_ptr< ControlFactory >( diff --git a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx index 99747c955..2cb1d3560 100644 --- a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx +++ b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx @@ -48,15 +48,11 @@ class SlideTransitionPanel : public SubToolPanel { public: - SlideTransitionPanel ( - TreeNode* pParent, - ViewShellBase& rBase); SlideTransitionPanel ( Window& i_rParentWindow, ToolPanelViewShell& i_rToolPanelShell); virtual ~SlideTransitionPanel (void); - static std::auto_ptr CreateControlFactory (ViewShellBase& rBase); static std::auto_ptr CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell); // TreeNode overridables diff --git a/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx b/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx index 1a5832e47..95da96416 100644 --- a/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx +++ b/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx @@ -48,14 +48,6 @@ namespace sd namespace toolpanel { namespace controls { -TableDesignPanel::TableDesignPanel(TreeNode* pParent, ViewShellBase& rBase) - : SubToolPanel (pParent) - ,m_pPanelViewShell( NULL ) -{ - mpWrappedControl = createTableDesignPanel( pParent->GetWindow(), rBase ); - mpWrappedControl->Show(); -} - TableDesignPanel::TableDesignPanel( ::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell ) :SubToolPanel( i_rParentWindow ) ,m_pPanelViewShell( &i_rPanelViewShell ) @@ -69,12 +61,6 @@ TableDesignPanel::~TableDesignPanel() delete mpWrappedControl; } -std::auto_ptr TableDesignPanel::CreateControlFactory (ViewShellBase& rBase) -{ - return std::auto_ptr( - new ControlFactoryWithArgs1(rBase)); -} - std::auto_ptr< ControlFactory > TableDesignPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) { return std::auto_ptr< ControlFactory >( diff --git a/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx b/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx index 6902029c7..8a556afc8 100644 --- a/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx +++ b/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx @@ -49,15 +49,11 @@ class TableDesignPanel : public SubToolPanel { public: - TableDesignPanel ( - TreeNode* pParent, - ViewShellBase& rBase); TableDesignPanel ( ::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell); virtual ~TableDesignPanel (void); - static std::auto_ptr CreateControlFactory (ViewShellBase& rBase); static std::auto_ptr CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell); // TreeNode overridables -- cgit v1.2.3 From c51f174f9bd7c0dda5d5acc3e3e36fa0326b949b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 23 Mar 2010 10:44:01 +0100 Subject: slidecopy: make compile on unxlngi6 --- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 99c2940c4..6e7800606 100644 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -347,6 +347,7 @@ void SAL_CALL ConfigurationListener::notifyConfigurationChange( const Configurat // --------------------------------------------------------------------------------------------------------------------- void SAL_CALL ConfigurationListener::disposing( const EventObject& i_rEvent ) throw (RuntimeException) { + (void)i_rEvent; { ::osl::MutexGuard aGuard( m_aMutex ); impl_checkDisposed_throw(); @@ -471,9 +472,10 @@ size_t ToolPanelViewShell_Impl::SetupDefaultPanels() const Reference< XResourceId > xPanelId( pFrameworkHelper->CreateResourceId( aPanels[i].sResourceURL, xToolPanelId ) ); // create and insert the panel + ::std::auto_ptr< ControlFactory > pControlFactory( (*aPanels[i].pFactory)( m_rPanelViewShell ) ); ::svt::PToolPanel pNewPanel( new StandardToolPanel( *m_pPanelDeck, - (*aPanels[i].pFactory)( m_rPanelViewShell ), + pControlFactory, aPanels[i].nTitleResourceID, aPanelImage, aPanels[i].nHelpID, @@ -964,6 +966,7 @@ Reference< XAccessible > ToolPanelViewShell::CreateAccessibleDocumentView( ::sd: // xAccessible = mpTaskPane->CreateAccessibleObject( // pParentWindow->GetAccessible()); // } + (void)pWindow; return xAccessible; } -- cgit v1.2.3 From f0fd7c27f42e2d2036ceb6adba2b8a1efddf629c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 23 Mar 2010 12:47:40 +0100 Subject: slidecopy: don't link the example extension against the tools lib, (which is non-URE), this won't work on Mac --- sd/workben/custompanel/makefile.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/sd/workben/custompanel/makefile.mk b/sd/workben/custompanel/makefile.mk index 586d3a43c..6df319089 100644 --- a/sd/workben/custompanel/makefile.mk +++ b/sd/workben/custompanel/makefile.mk @@ -62,7 +62,6 @@ LIB1OBJFILES= \ $(SLO)/ctp_panel.obj SHL1STDLIBS= \ - $(TOOLSLIB) \ $(CPPULIB) \ $(SALLIB) \ $(SALHELPERLIB) \ -- cgit v1.2.3 From 1d7a0b01302e925c1362a6ff5ea3d228a7492dff Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 25 Mar 2010 10:55:53 +0100 Subject: slidecopy: when the ToolPanelViewShell is first created, recognize the fact that the requested configuration already contains a tool panel resource, and properly set up the tool panel deck then --- .../ui/framework/factories/TaskPanelFactory.cxx | 38 +-------- sd/source/ui/inc/taskpane/PanelId.hxx | 2 + sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 99 +++++++++++++++++++--- 3 files changed, 92 insertions(+), 47 deletions(-) diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/sd/source/ui/framework/factories/TaskPanelFactory.cxx index bb9ae8f79..7091c64ab 100644 --- a/sd/source/ui/framework/factories/TaskPanelFactory.cxx +++ b/sd/source/ui/framework/factories/TaskPanelFactory.cxx @@ -202,40 +202,6 @@ namespace sResourceURL = xResourceId->getResourceURL(); } } - - toolpanel::PanelId lcl_getPanelId( const ::rtl::OUString& i_rResourceURL ) - { - toolpanel::PanelId ePanelId( toolpanel::PID_UNKNOWN ); - - // TODO: this translation table PanelId<->PanelResourceURL is used in multiple files, - // perhaps it is worth putting this into a dedicated helper/meta-data class. - if ( i_rResourceURL.equals( FrameworkHelper::msMasterPagesTaskPanelURL ) ) - { - ePanelId = toolpanel::PID_MASTER_PAGES; - } - else if ( i_rResourceURL.equals( FrameworkHelper::msLayoutTaskPanelURL ) ) - { - ePanelId = toolpanel::PID_LAYOUT; - } - else if ( i_rResourceURL.equals( FrameworkHelper::msTableDesignPanelURL ) ) - { - ePanelId = toolpanel::PID_TABLE_DESIGN; - } - else if ( i_rResourceURL.equals( FrameworkHelper::msCustomAnimationTaskPanelURL ) ) - { - ePanelId = toolpanel::PID_CUSTOM_ANIMATION; - } - else if ( i_rResourceURL.equals( FrameworkHelper::msSlideTransitionTaskPanelURL ) ) - { - ePanelId = toolpanel::PID_SLIDE_TRANSITION; - } - else - { - OSL_ENSURE( false, "lcl_getPanelId: cannot translate the given resource URL!" ); - } - - return ePanelId; - } } Reference SAL_CALL TaskPanelFactory::createResource ( @@ -251,7 +217,7 @@ Reference SAL_CALL TaskPanelFactory::createResource ( if ( sResourceURL.match( FrameworkHelper::msTaskPanelURLPrefix ) ) { - toolpanel::PanelId ePanelId( lcl_getPanelId( sResourceURL ) ); + toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sResourceURL ) ); if ( ( ePanelId != toolpanel::PID_UNKNOWN ) && ( mpViewShellBase != NULL ) ) { @@ -297,7 +263,7 @@ void SAL_CALL TaskPanelFactory::releaseResource ( const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) ); if ( pPaneViewShell != NULL ) { - toolpanel::PanelId ePanelId( lcl_getPanelId( xResourceId->getResourceURL() ) ); + toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( xResourceId->getResourceURL() ) ); toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() ); if ( ( ePanelId != toolpanel::PID_UNKNOWN ) diff --git a/sd/source/ui/inc/taskpane/PanelId.hxx b/sd/source/ui/inc/taskpane/PanelId.hxx index 8e097375d..4577f54c3 100644 --- a/sd/source/ui/inc/taskpane/PanelId.hxx +++ b/sd/source/ui/inc/taskpane/PanelId.hxx @@ -49,6 +49,8 @@ namespace sd { namespace toolpanel PID_FIRST_CUSTOM_PANEL = 6 }; + PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL ); + //...................................................................................................................... } } // namespace sd::toolpanel //...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 6e7800606..16d0aa30b 100644 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -55,6 +55,7 @@ /** === begin UNO includes === **/ #include #include +#include #include /** === end UNO includes === **/ @@ -110,6 +111,9 @@ using ::com::sun::star::drawing::framework::ConfigurationChangeEvent; using ::com::sun::star::lang::EventObject; using ::com::sun::star::lang::DisposedException; using ::com::sun::star::drawing::framework::XConfigurationControllerBroadcaster; +using ::com::sun::star::drawing::framework::XConfigurationController; +using ::com::sun::star::drawing::framework::XConfiguration; +using ::com::sun::star::drawing::framework::AnchorBindingMode_DIRECT; /** === end UNO using === **/ using ::sd::framework::FrameworkHelper; @@ -268,9 +272,20 @@ private: void RegisterPanel( size_t i_nPosition, PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ); void UpdateDockingWindowTitle(); - /** creates the built-in panels, returns the position of the panel to activate initially + /** creates the built-in panels, returns the position of the panel to initially activate */ - size_t SetupDefaultPanels(); + struct PanelActivation + { + size_t nPanelPos; + bool bActivateAsResource; + + PanelActivation() + :nPanelPos( size_t( -1 ) ) + ,bActivateAsResource( true ) + { + } + }; + PanelActivation SetupDefaultPanels(); /** creates the custom panels */ @@ -391,7 +406,7 @@ SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL)) TYPEINIT1(ToolPanelViewShell, ViewShell); // --------------------------------------------------------------------------------------------------------------------- -size_t ToolPanelViewShell_Impl::SetupDefaultPanels() +ToolPanelViewShell_Impl::PanelActivation ToolPanelViewShell_Impl::SetupDefaultPanels() { typedef std::auto_ptr (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell ); @@ -453,9 +468,35 @@ size_t ToolPanelViewShell_Impl::SetupDefaultPanels() ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) ); const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ) ); - // want to activate the "Layout" panel later on, need to translate its PanelId to an actual position - const PanelId nPanelIdToActivate = PID_LAYOUT; - size_t nPanelPosToActivate = size_t( -1 ); + // determine which panel should be activated initially. + // Default to PID_LAYOUT, but check whether the requested configuration already contains a tool panel, in this case, + // use that one. + PanelId nPanelToActivate = PID_LAYOUT; + PanelActivation aPanelToActivate; + try + { + ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) ); + Reference< XConfigurationController > xCC( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW ); + Reference< XConfiguration > xConfiguration( xCC->getRequestedConfiguration(), UNO_QUERY_THROW ); + Sequence< Reference< XResourceId > > aViewIds( xConfiguration->getResources( + FrameworkHelper::CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ), + FrameworkHelper::msTaskPanelURLPrefix, AnchorBindingMode_DIRECT ) ); + + if ( aViewIds.getLength() > 0 ) + { + const ::rtl::OUString sResourceURL( aViewIds[0]->getResourceURL() ); + PanelId nRequestedPanel = GetStandardPanelId( sResourceURL ); + if ( nRequestedPanel != PID_UNKNOWN ) + { + nPanelToActivate = nRequestedPanel; + aPanelToActivate.bActivateAsResource = false; + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } // create the panels Reference< XFrame > xFrame( m_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ); @@ -486,11 +527,11 @@ size_t ToolPanelViewShell_Impl::SetupDefaultPanels() // remember it RegisterPanel( nPanelPos, aPanels[i].nPanelID, pNewPanel ); - if ( nPanelIdToActivate == aPanels[i].nPanelID ) - nPanelPosToActivate = nPanelPos; + if ( nPanelToActivate == aPanels[i].nPanelID ) + aPanelToActivate.nPanelPos = nPanelPos; } - return nPanelPosToActivate; + return aPanelToActivate; } // --------------------------------------------------------------------------------------------------------------------- @@ -532,13 +573,16 @@ void ToolPanelViewShell_Impl::Setup() m_bInitialized = true; // standard (built-in) panels - const size_t nPanelPosToActivate = SetupDefaultPanels(); + const PanelActivation aPanelToActivate = SetupDefaultPanels(); // custom panels SetupCustomPanels(); // activate default panel - m_pPanelDeck->ActivatePanelResource( nPanelPosToActivate ); + if ( aPanelToActivate.bActivateAsResource ) + m_pPanelDeck->ActivatePanelResource( aPanelToActivate.nPanelPos ); + else + m_pPanelDeck->ActivatePanelDirectly( aPanelToActivate.nPanelPos ); // add as listener to the panel deck m_pPanelDeck->AddListener( *this ); @@ -1187,4 +1231,37 @@ void ToolPanelViewShell_Impl::Dying() { } +// --------------------------------------------------------------------------------------------------------------------- +PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL ) +{ + PanelId ePanelId( PID_UNKNOWN ); + + if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msMasterPagesTaskPanelURL ) ) + { + ePanelId = PID_MASTER_PAGES; + } + else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msLayoutTaskPanelURL ) ) + { + ePanelId = PID_LAYOUT; + } + else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msTableDesignPanelURL ) ) + { + ePanelId = PID_TABLE_DESIGN; + } + else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msCustomAnimationTaskPanelURL ) ) + { + ePanelId = PID_CUSTOM_ANIMATION; + } + else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msSlideTransitionTaskPanelURL ) ) + { + ePanelId = PID_SLIDE_TRANSITION; + } + else + { + OSL_ENSURE( false, "GetStandardPanelId: cannot translate the given resource URL!" ); + } + + return ePanelId; +} + } } // end of namespace ::sd::toolpanel -- cgit v1.2.3 From 5af4492e87812b6382e216404e9723503e66a38e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 25 Mar 2010 15:08:23 +0100 Subject: slidecopy: removed useless (shadowing) variable --- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 16d0aa30b..806da1d17 100644 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -475,7 +475,6 @@ ToolPanelViewShell_Impl::PanelActivation ToolPanelViewShell_Impl::SetupDefaultPa PanelActivation aPanelToActivate; try { - ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) ); Reference< XConfigurationController > xCC( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW ); Reference< XConfiguration > xConfiguration( xCC->getRequestedConfiguration(), UNO_QUERY_THROW ); Sequence< Reference< XResourceId > > aViewIds( xConfiguration->getResources( -- cgit v1.2.3 From 0f1be5a8925feff8b98e76ca9642507a6f9fb5fd Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 30 Mar 2010 13:46:11 +0200 Subject: slidecopy: A11Y for the ToolPanelDeck VCL control --- sd/source/ui/dlg/PaneChildWindows.cxx | 2 +- sd/source/ui/inc/taskpane/ControlContainer.hxx | 1 - sd/source/ui/toolpanel/ToolPanelDeck.cxx | 8 ++- sd/source/ui/toolpanel/ToolPanelDrawer.cxx | 48 ++++++++++++++++++ sd/source/ui/toolpanel/ToolPanelDrawer.hxx | 8 +++ sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 39 +++++++------- sd/source/ui/view/sdwindow.cxx | 70 +++++++++++++------------- 7 files changed, 121 insertions(+), 55 deletions(-) mode change 100644 => 100755 sd/source/ui/dlg/PaneChildWindows.cxx mode change 100644 => 100755 sd/source/ui/inc/taskpane/ControlContainer.hxx mode change 100644 => 100755 sd/source/ui/toolpanel/ToolPanelDeck.cxx mode change 100644 => 100755 sd/source/ui/toolpanel/ToolPanelDrawer.cxx mode change 100644 => 100755 sd/source/ui/toolpanel/ToolPanelDrawer.hxx mode change 100644 => 100755 sd/source/ui/toolpanel/ToolPanelViewShell.cxx mode change 100644 => 100755 sd/source/ui/view/sdwindow.cxx diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx old mode 100644 new mode 100755 index 2f34ff2ab..866b02c47 --- a/sd/source/ui/dlg/PaneChildWindows.cxx +++ b/sd/source/ui/dlg/PaneChildWindows.cxx @@ -147,7 +147,7 @@ LeftPaneDrawChildWindow::LeftPaneDrawChildWindow ( ToolPanelChildWindow::ToolPanelChildWindow( ::Window* i_pParentWindow, USHORT i_nId, SfxBindings* i_pBindings, SfxChildWinInfo* i_pChildWindowInfo ) :PaneChildWindow( i_pParentWindow, i_nId, i_pBindings, i_pChildWindowInfo, - FLT_TOOL_PANEL_DOCKING_WINDOW, STR_RIGHT_PANE_TITLE, SFX_ALIGN_NOALIGNMENT ) + FLT_TOOL_PANEL_DOCKING_WINDOW, STR_RIGHT_PANE_TITLE, SFX_ALIGN_RIGHT ) { } diff --git a/sd/source/ui/inc/taskpane/ControlContainer.hxx b/sd/source/ui/inc/taskpane/ControlContainer.hxx old mode 100644 new mode 100755 index e26d05867..5442d4eff --- a/sd/source/ui/inc/taskpane/ControlContainer.hxx +++ b/sd/source/ui/inc/taskpane/ControlContainer.hxx @@ -31,7 +31,6 @@ #ifndef SD_TOOLPANEL_CONTROL_CONTAINER_HXX #define SD_TOOLPANEL_CONTROL_CONTAINER_HXX -#include "TitleBar.hxx" #include #include diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.cxx b/sd/source/ui/toolpanel/ToolPanelDeck.cxx old mode 100644 new mode 100755 index d26bb4305..ac3ecc261 --- a/sd/source/ui/toolpanel/ToolPanelDeck.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDeck.cxx @@ -32,6 +32,8 @@ #include "taskpane/ControlContainer.hxx" #include "framework/FrameworkHelper.hxx" #include "TaskPaneToolPanel.hxx" +#include "strings.hrc" +#include "sdresid.hxx" /** === begin UNO includes === **/ #include @@ -71,6 +73,10 @@ namespace sd { namespace toolpanel ,m_rViewShell( i_rViewShell ) { SetDrawersLayout(); + + const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) ); + SetAccessibleName( sPaneTitle ); + SetAccessibleDescription( sPaneTitle ); } //------------------------------------------------------------------------------------------------------------------ @@ -140,7 +146,7 @@ namespace sd { namespace toolpanel // this is a de-activate request. Quite improbable that this really happens: We're within the overloaded // version of IToolPanelDeck::ActivatePanel. The only instance which has access to this IToolPanel // interface is the panel layouter, which is not expected to call us with a NULL panel position. - // All other instances should now have access to this method, as it is protected in this class here. + // All other instances should not have access to this method, as it is protected in this class here. OSL_ENSURE( false, "ToolPanelDeck::ActivatePanel: is this legitimate?" ); // well, handle it nonetheless. ActivatePanelDirectly( i_rPanel ); diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx old mode 100644 new mode 100755 index 052322212..4b6c869a4 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx @@ -36,6 +36,11 @@ namespace sd { namespace toolpanel { //...................................................................................................................... + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::accessibility::XAccessible; + /** === end UNO using === **/ + //================================================================================================================== //= ToolPanelDrawer //================================================================================================================== @@ -126,6 +131,42 @@ namespace sd { namespace toolpanel m_aDrawers[ *aActivePanel ]->GetWindow()->GrabFocus(); } + //------------------------------------------------------------------------------------------------------------------ + ::boost::optional< size_t > ToolPanelDrawer::GetPanelItemFromScreenPos( const ::Point& i_rScreenPos ) + { + for ( ::std::vector< PTitleBar >::const_iterator drawer = m_aDrawers.begin(); + drawer != m_aDrawers.end(); + ++drawer + ) + { + const Rectangle aDrawerBounds( + m_rParentWindow.OutputToScreenPixel( (*drawer)->GetWindow()->GetPosPixel() ), + (*drawer)->GetWindow()->GetSizePixel() + ); + if ( aDrawerBounds.IsInside( i_rScreenPos ) ) + return ::boost::optional< size_t >( drawer - m_aDrawers.begin() ); + } + return ::boost::optional< size_t >(); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > ToolPanelDrawer::GetPanelItemAccessible( const size_t i_nItemPos, const Reference< XAccessible >& i_rParentAccessible ) + { + ENSURE_OR_RETURN( i_nItemPos < m_aDrawers.size(), "illegal index", NULL ); + + const PTitleBar pTitleBar( m_aDrawers[ i_nItemPos ] ); + Window* pItemWindow( pTitleBar->GetWindow() ); + + Reference< XAccessible > xItemAccessible( pItemWindow->GetAccessible( FALSE ) ); + if ( !xItemAccessible.is() ) + { + xItemAccessible = pTitleBar->CreateAccessibleObject( i_rParentAccessible ); + pItemWindow->SetAccessible( xItemAccessible ); + } + + return xItemAccessible; + } + //------------------------------------------------------------------------------------------------------------------ void ToolPanelDrawer::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) { @@ -171,6 +212,13 @@ namespace sd { namespace toolpanel impl_triggerRearrange(); } + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) + { + // not interested in + (void)i_rNewLayouter; + } + //------------------------------------------------------------------------------------------------------------------ size_t ToolPanelDrawer::impl_getPanelPositionFromWindow( const Window* i_pTitleBarWindow ) const { diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.hxx b/sd/source/ui/toolpanel/ToolPanelDrawer.hxx old mode 100644 new mode 100755 index db6196fa4..ad2dc9670 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.hxx +++ b/sd/source/ui/toolpanel/ToolPanelDrawer.hxx @@ -65,11 +65,19 @@ namespace sd { namespace toolpanel virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); virtual void Destroy(); virtual void SetFocusToPanelSelector(); + ::boost::optional< size_t > + GetPanelItemFromScreenPos( const ::Point& i_rScreenPos ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + GetPanelItemAccessible( + const size_t i_nItemPos, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ); // IToolPanelDeckListener virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); virtual void PanelRemoved( const size_t i_nPosition ); virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); virtual void Dying(); private: diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx old mode 100644 new mode 100755 index 806da1d17..ed0feebce --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -260,12 +260,16 @@ public: If the panel is not active currently, nothing happens. */ void DeactivatePanelDirectly( const PanelId i_nPanelId ); + + Reference< XAccessible > + CreateAccessible( ::sd::Window& i_rWindow ); protected: // IToolPanelDeckListener overridables virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); virtual void PanelRemoved( const size_t i_nPosition ); virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); virtual void Dying(); private: @@ -994,24 +998,10 @@ DockingWindow* ToolPanelViewShell::GetDockingWindow() } // --------------------------------------------------------------------------------------------------------------------- -Reference< XAccessible > ToolPanelViewShell::CreateAccessibleDocumentView( ::sd::Window* pWindow ) +Reference< XAccessible > ToolPanelViewShell::CreateAccessibleDocumentView( ::sd::Window* i_pWindow ) { - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> xAccessible; - - OSL_ENSURE( false, "ToolPanelViewShell::CreateAccessibleDocumentView: missing implementation!" ); -// if (mpTaskPane.get()!=NULL && pWindow!=NULL) -// { -// // We have to call CreateAccessible directly so that we can specify -// // the correct accessible parent. -// ::Window* pParentWindow = pWindow->GetAccessibleParentWindow(); -// if (pParentWindow != NULL) -// xAccessible = mpTaskPane->CreateAccessibleObject( -// pParentWindow->GetAccessible()); -// } - (void)pWindow; - - return xAccessible; + ENSURE_OR_RETURN( i_pWindow, "ToolPanelViewShell::CreateAccessibleDocumentView: illegal window!", NULL ); + return mpImpl->CreateAccessible( *i_pWindow ); } // --------------------------------------------------------------------------------------------------------------------- @@ -1225,11 +1215,26 @@ void ToolPanelViewShell_Impl::ActivePanelChanged( const ::boost::optional< size_ (void)i_rNewActive; } +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) +{ + // not interested in + (void)i_rNewLayouter; +} + // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell_Impl::Dying() { } +// --------------------------------------------------------------------------------------------------------------------- +Reference< XAccessible > ToolPanelViewShell_Impl::CreateAccessible( ::sd::Window& i_rWindow ) +{ + ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow(); + m_pPanelDeck->SetAccessibleParentWindow( pAccessibleParent ); + return m_pPanelDeck->GetAccessible(); +} + // --------------------------------------------------------------------------------------------------------------------- PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL ) { diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx old mode 100644 new mode 100755 index 7186b8d1b..abddd4996 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -37,8 +37,8 @@ #include -#include - +#include + #include #include "app.hrc" @@ -1209,38 +1209,38 @@ void Window::DropScroll(const Point& rMousePos) } } -XubString Window::GetSurroundingText() const -{ - if ( mpViewShell->GetShellType() == ViewShell::ST_OUTLINE ) - { - return XubString(); - } - else if ( mpViewShell->GetView()->IsTextEdit() ) - { - OutlinerView *pOLV = mpViewShell->GetView()->GetTextEditOutlinerView(); - return pOLV->GetEditView().GetSurroundingText(); - } - else - { - return XubString(); - } -} - -Selection Window::GetSurroundingTextSelection() const -{ - if ( mpViewShell->GetShellType() == ViewShell::ST_OUTLINE ) - { - return Selection( 0, 0 ); - } - else if ( mpViewShell->GetView()->IsTextEdit() ) - { - OutlinerView *pOLV = mpViewShell->GetView()->GetTextEditOutlinerView(); - return pOLV->GetEditView().GetSurroundingTextSelection(); - } - else - { - return Selection( 0, 0 ); - } -} +XubString Window::GetSurroundingText() const +{ + if ( mpViewShell->GetShellType() == ViewShell::ST_OUTLINE ) + { + return XubString(); + } + else if ( mpViewShell->GetView()->IsTextEdit() ) + { + OutlinerView *pOLV = mpViewShell->GetView()->GetTextEditOutlinerView(); + return pOLV->GetEditView().GetSurroundingText(); + } + else + { + return XubString(); + } +} + +Selection Window::GetSurroundingTextSelection() const +{ + if ( mpViewShell->GetShellType() == ViewShell::ST_OUTLINE ) + { + return Selection( 0, 0 ); + } + else if ( mpViewShell->GetView()->IsTextEdit() ) + { + OutlinerView *pOLV = mpViewShell->GetView()->GetTextEditOutlinerView(); + return pOLV->GetEditView().GetSurroundingTextSelection(); + } + else + { + return Selection( 0, 0 ); + } +} } // end of namespace sd -- cgit v1.2.3 From 1ad4356b10a730102acdba744b042bcee5fd13be Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 30 Mar 2010 16:00:37 +0200 Subject: slidecopy: more A11Y implementations for the ToolPanelDeck --- sd/source/ui/toolpanel/CustomToolPanel.cxx | 35 ++++++++++++++++++++++++++++ sd/source/ui/toolpanel/CustomToolPanel.hxx | 4 ++++ sd/source/ui/toolpanel/StandardToolPanel.cxx | 18 ++++++++++++++ sd/source/ui/toolpanel/StandardToolPanel.hxx | 4 ++++ sd/source/ui/toolpanel/TaskPaneToolPanel.hxx | 4 ++++ sd/source/ui/toolpanel/ToolPanelDrawer.cxx | 1 + 6 files changed, 66 insertions(+) diff --git a/sd/source/ui/toolpanel/CustomToolPanel.cxx b/sd/source/ui/toolpanel/CustomToolPanel.cxx index 2910642f0..dc2f6bb15 100644 --- a/sd/source/ui/toolpanel/CustomToolPanel.cxx +++ b/sd/source/ui/toolpanel/CustomToolPanel.cxx @@ -32,6 +32,7 @@ /** === begin UNO includes === **/ #include #include +#include /** === end UNO includes === **/ #include @@ -64,6 +65,8 @@ namespace sd { namespace toolpanel using ::com::sun::star::drawing::framework::ResourceId; using ::com::sun::star::drawing::framework::XResource; using ::com::sun::star::awt::XWindow; + using ::com::sun::star::accessibility::XAccessible; + using ::com::sun::star::drawing::framework::XPane2; /** === end UNO using === **/ namespace PosSize = ::com::sun::star::awt::PosSize; @@ -207,6 +210,38 @@ namespace sd { namespace toolpanel TaskPaneToolPanel::Dispose(); } + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > CustomToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) + { + ENSURE_OR_RETURN( !isDisposed(), "CustomToolPanel::CreatePanelAccessible: already disposed!", NULL ); + + // an XResource might also be an XPane2, which can provide an XAccessible. Check this first. + const Reference< XPane2 > xPane( m_xResource, UNO_QUERY ); + if ( xPane.is() ) + { + const Reference< XAccessible > xPaneAccessible( xPane->getAccessible() ); + if ( xPaneAccessible.is() ) + return xPaneAccessible; + } + + // if we have an XToolPanel, ask it for its XWindow, and query it + impl_ensurePanel(); + if ( !m_xToolPanel.is() ) + return NULL; + + const Reference< XAccessible > xPanelWindowAccessible( m_xToolPanel->getWindow(), UNO_QUERY ); + if ( xPanelWindowAccessible.is() ) + return xPanelWindowAccessible; + + // maybe the XToolPanel itself can provide an XAccessible? + const Reference< XAccessible > xPanelAccessible( m_xToolPanel, UNO_QUERY ); + if ( xPanelAccessible.is() ) + return xPanelAccessible; + + OSL_ENSURE( false, "CustomToolPanel::CreatePanelAccessible: no XAccessible for the custom panel!" ); + return NULL; + } + //------------------------------------------------------------------------------------------------------------------ void CustomToolPanel::LockResourceAccess() { diff --git a/sd/source/ui/toolpanel/CustomToolPanel.hxx b/sd/source/ui/toolpanel/CustomToolPanel.hxx index 1bec07f8b..60e8030a8 100644 --- a/sd/source/ui/toolpanel/CustomToolPanel.hxx +++ b/sd/source/ui/toolpanel/CustomToolPanel.hxx @@ -78,6 +78,10 @@ namespace sd { namespace toolpanel virtual void SetSizePixel( const Size& i_rPanelWindowSize ); virtual void GrabFocus(); virtual void Dispose(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreatePanelAccessible( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ); /** locks (aka prevents) the access to the associated XResource object */ diff --git a/sd/source/ui/toolpanel/StandardToolPanel.cxx b/sd/source/ui/toolpanel/StandardToolPanel.cxx index 16d4c5f6c..ddf41dcf7 100644 --- a/sd/source/ui/toolpanel/StandardToolPanel.cxx +++ b/sd/source/ui/toolpanel/StandardToolPanel.cxx @@ -53,6 +53,7 @@ namespace sd { namespace toolpanel using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Type; using ::com::sun::star::drawing::framework::XResourceId; + using ::com::sun::star::accessibility::XAccessible; /** === end UNO using === **/ //================================================================================================================== @@ -115,6 +116,23 @@ namespace sd { namespace toolpanel TaskPaneToolPanel::Dispose(); } + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > StandardToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) + { + ENSURE_OR_RETURN( !isDisposed(), "already disposed!", NULL ); + + Window* pControlWindow( m_pControl->GetWindow() ); + + Reference< XAccessible > xControlAccessible( pControlWindow->GetAccessible( FALSE ) ); + if ( !xControlAccessible.is() ) + { + xControlAccessible = m_pControl->CreateAccessibleObject( i_rParentAccessible ); + OSL_ENSURE( xControlAccessible.is(), "StandardToolPanel::CreatePanelAccessible: invalid XAccessible returned by CreateAccessibleObject!" ); + pControlWindow->SetAccessible( xControlAccessible ); + } + return xControlAccessible; + } + //------------------------------------------------------------------------------------------------------------------ const Reference< XResourceId >& StandardToolPanel::getResourceId() const { diff --git a/sd/source/ui/toolpanel/StandardToolPanel.hxx b/sd/source/ui/toolpanel/StandardToolPanel.hxx index 990337204..4ef7979a0 100644 --- a/sd/source/ui/toolpanel/StandardToolPanel.hxx +++ b/sd/source/ui/toolpanel/StandardToolPanel.hxx @@ -58,6 +58,10 @@ namespace sd { namespace toolpanel virtual void SetSizePixel( const Size& i_rPanelWindowSize ); virtual void GrabFocus(); virtual void Dispose(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreatePanelAccessible( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ); // TaskPaneToolPanel overridables virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const; diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx index 6e84d0d96..0be00972f 100644 --- a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx @@ -71,6 +71,10 @@ namespace sd { namespace toolpanel virtual void Deactivate() = 0; virtual void SetSizePixel( const Size& i_rPanelWindowSize ) = 0; virtual void GrabFocus() = 0; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreatePanelAccessible( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ) = 0; // own overridables virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const = 0; diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx index 4b6c869a4..dc874a492 100755 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx @@ -161,6 +161,7 @@ namespace sd { namespace toolpanel if ( !xItemAccessible.is() ) { xItemAccessible = pTitleBar->CreateAccessibleObject( i_rParentAccessible ); + OSL_ENSURE( xItemAccessible.is(), "ToolPanelDrawer::GetPanelItemAccessible: invalid XAccessible returned by CreateAccessibleObject!" ); pItemWindow->SetAccessible( xItemAccessible ); } -- cgit v1.2.3 From 1101e52849f91b12277236a27a49fa4209721487 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 31 Mar 2010 13:21:17 +0200 Subject: slidecopy: mark the Tab-Layout as experimental --- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index ed0feebce..64f75e601 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -931,7 +931,7 @@ IMPL_LINK(ToolPanelViewShell, MenuSelectHandler, Menu*, pMenu) pMenu->InsertSeparator(); #if OSL_DEBUG_LEVEL > 0 - pMenu->InsertItem( MID_LAYOUT_TABS, String::CreateFromAscii( "Tab-Layout" ), MIB_CHECKABLE ); + pMenu->InsertItem( MID_LAYOUT_TABS, String::CreateFromAscii( "Tab-Layout (exp.)" ), MIB_CHECKABLE ); pMenu->CheckItem( MID_LAYOUT_TABS, mpImpl->GetLayout() != LAYOUT_DRAWERS ); pMenu->InsertItem( MID_LAYOUT_DRAWERS, String::CreateFromAscii( "Drawer-Layout" ), MIB_CHECKABLE ); pMenu->CheckItem( MID_LAYOUT_DRAWERS, mpImpl->GetLayout() == LAYOUT_DRAWERS ); -- cgit v1.2.3 From 3af4f59676636e0464eb19e6ea0bcba5aa8c26b9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 1 Apr 2010 09:26:27 +0200 Subject: slidecopy: #i10000# (unxlngi6) --- sd/source/ui/toolpanel/CustomToolPanel.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/sd/source/ui/toolpanel/CustomToolPanel.cxx b/sd/source/ui/toolpanel/CustomToolPanel.cxx index dc2f6bb15..fd48753ab 100644 --- a/sd/source/ui/toolpanel/CustomToolPanel.cxx +++ b/sd/source/ui/toolpanel/CustomToolPanel.cxx @@ -214,6 +214,7 @@ namespace sd { namespace toolpanel Reference< XAccessible > CustomToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) { ENSURE_OR_RETURN( !isDisposed(), "CustomToolPanel::CreatePanelAccessible: already disposed!", NULL ); + (void)i_rParentAccessible; // an XResource might also be an XPane2, which can provide an XAccessible. Check this first. const Reference< XPane2 > xPane( m_xResource, UNO_QUERY ); -- cgit v1.2.3 From 5ef671165ce004b72aa42d8603e04c82a5ea2c74 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 1 Apr 2010 17:52:36 +0200 Subject: slidecopy: improved A11Y API implementations for the ToolPanelDeck items left: - A11Y representation of the scroll buttons of the PanelTabBar - AccessibleToolPanelTabBar event notifications - consolidate AccessibleToolPanelDeck/TabBar/Item? --- sd/source/ui/toolpanel/ToolPanelDrawer.cxx | 24 ++++++------------------ sd/source/ui/toolpanel/ToolPanelDrawer.hxx | 7 +++---- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx index dc874a492..92e7afa2a 100755 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx @@ -132,36 +132,24 @@ namespace sd { namespace toolpanel } //------------------------------------------------------------------------------------------------------------------ - ::boost::optional< size_t > ToolPanelDrawer::GetPanelItemFromScreenPos( const ::Point& i_rScreenPos ) + size_t ToolPanelDrawer::GetAccessibleChildCount() const { - for ( ::std::vector< PTitleBar >::const_iterator drawer = m_aDrawers.begin(); - drawer != m_aDrawers.end(); - ++drawer - ) - { - const Rectangle aDrawerBounds( - m_rParentWindow.OutputToScreenPixel( (*drawer)->GetWindow()->GetPosPixel() ), - (*drawer)->GetWindow()->GetSizePixel() - ); - if ( aDrawerBounds.IsInside( i_rScreenPos ) ) - return ::boost::optional< size_t >( drawer - m_aDrawers.begin() ); - } - return ::boost::optional< size_t >(); + return m_aDrawers.size(); } //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > ToolPanelDrawer::GetPanelItemAccessible( const size_t i_nItemPos, const Reference< XAccessible >& i_rParentAccessible ) + Reference< XAccessible > ToolPanelDrawer::GetAccessibleChild( const size_t i_nChildIndex, const Reference< XAccessible >& i_rParentAccessible ) { - ENSURE_OR_RETURN( i_nItemPos < m_aDrawers.size(), "illegal index", NULL ); + ENSURE_OR_RETURN( i_nChildIndex < m_aDrawers.size(), "illegal index", NULL ); - const PTitleBar pTitleBar( m_aDrawers[ i_nItemPos ] ); + const PTitleBar pTitleBar( m_aDrawers[ i_nChildIndex ] ); Window* pItemWindow( pTitleBar->GetWindow() ); Reference< XAccessible > xItemAccessible( pItemWindow->GetAccessible( FALSE ) ); if ( !xItemAccessible.is() ) { xItemAccessible = pTitleBar->CreateAccessibleObject( i_rParentAccessible ); - OSL_ENSURE( xItemAccessible.is(), "ToolPanelDrawer::GetPanelItemAccessible: invalid XAccessible returned by CreateAccessibleObject!" ); + OSL_ENSURE( xItemAccessible.is(), "ToolPanelDrawer::GetAccessibleChild: invalid XAccessible returned by CreateAccessibleObject!" ); pItemWindow->SetAccessible( xItemAccessible ); } diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.hxx b/sd/source/ui/toolpanel/ToolPanelDrawer.hxx index ad2dc9670..d65429f45 100755 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.hxx +++ b/sd/source/ui/toolpanel/ToolPanelDrawer.hxx @@ -65,11 +65,10 @@ namespace sd { namespace toolpanel virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); virtual void Destroy(); virtual void SetFocusToPanelSelector(); - ::boost::optional< size_t > - GetPanelItemFromScreenPos( const ::Point& i_rScreenPos ); + virtual size_t GetAccessibleChildCount() const; virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - GetPanelItemAccessible( - const size_t i_nItemPos, + GetAccessibleChild( + const size_t i_nChildIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible ); -- cgit v1.2.3 From bba1afc5e50bde4374bab138146141f019d39d11 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:36:24 +0200 Subject: slidecopy: outsourced the TaskPane/ToolPanel's drawer (TitleBar, type TBT_CONTROL_TITLE) from sd to svtools, to be used with generic tool panel decks, not only within sd diff -r b53c58c139b0 -r 348318a2bab4 default_images/sd/res/triangle_down.png Binary file default_images/sd/res/triangle_down.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/sd/res/triangle_down_hc.png Binary file default_images/sd/res/triangle_down_hc.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/sd/res/triangle_right.png Binary file default_images/sd/res/triangle_right.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/sd/res/triangle_right_hc.png Binary file default_images/sd/res/triangle_right_hc.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/svtools/res/triangle_down.png Binary file default_images/svtools/res/triangle_down.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/svtools/res/triangle_down_hc.png Binary file default_images/svtools/res/triangle_down_hc.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/svtools/res/triangle_right.png Binary file default_images/svtools/res/triangle_right.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/svtools/res/triangle_right_hc.png Binary file default_images/svtools/res/triangle_right_hc.png has changed --- sd/source/ui/accessibility/AccessibleTreeNode.cxx | 1 + sd/source/ui/app/res_bmp.src | 16 -- sd/source/ui/inc/res_bmp.hrc | 8 +- sd/source/ui/inc/taskpane/TitleBar.hxx | 24 +- sd/source/ui/inc/taskpane/TitledControl.hxx | 6 - sd/source/ui/toolpanel/TitleBar.cxx | 103 +------- sd/source/ui/toolpanel/TitleToolBox.cxx | 49 ---- sd/source/ui/toolpanel/TitleToolBox.hxx | 18 -- sd/source/ui/toolpanel/TitledControl.cxx | 3 +- sd/source/ui/toolpanel/ToolPanelDeck.cxx | 6 +- sd/source/ui/toolpanel/ToolPanelDrawer.cxx | 282 ---------------------- sd/source/ui/toolpanel/ToolPanelDrawer.hxx | 101 -------- sd/source/ui/toolpanel/makefile.mk | 1 - 13 files changed, 12 insertions(+), 606 deletions(-) delete mode 100755 sd/source/ui/toolpanel/ToolPanelDrawer.cxx delete mode 100755 sd/source/ui/toolpanel/ToolPanelDrawer.hxx diff --git a/sd/source/ui/accessibility/AccessibleTreeNode.cxx b/sd/source/ui/accessibility/AccessibleTreeNode.cxx index cc9681695..076667780 100644 --- a/sd/source/ui/accessibility/AccessibleTreeNode.cxx +++ b/sd/source/ui/accessibility/AccessibleTreeNode.cxx @@ -717,6 +717,7 @@ IMPL_LINK(AccessibleTreeNode, WindowEventListener, VclWindowEvent*, pEvent) case VCLEVENT_WINDOW_GETFOCUS: case VCLEVENT_WINDOW_LOSEFOCUS: UpdateStateSet(); + break; } return 1; } diff --git a/sd/source/ui/app/res_bmp.src b/sd/source/ui/app/res_bmp.src index da5d31551..77152aa63 100644 --- a/sd/source/ui/app/res_bmp.src +++ b/sd/source/ui/app/res_bmp.src @@ -530,22 +530,6 @@ Bitmap BMP_CLOSE_DOC_H { File = "closedochc.bmp"; }; -Bitmap BMP_TRIANGLE_RIGHT -{ - File = "triangle_right.bmp"; -}; -Bitmap BMP_TRIANGLE_RIGHT_H -{ - File = "triangle_right_hc.bmp"; -}; -Bitmap BMP_TRIANGLE_DOWN -{ - File = "triangle_down.bmp"; -}; -Bitmap BMP_TRIANGLE_DOWN_H -{ - File = "triangle_down_hc.bmp"; -}; Bitmap BMP_FADE_EFFECT_INDICATOR { File = "fade_effect_indicator.bmp"; diff --git a/sd/source/ui/inc/res_bmp.hrc b/sd/source/ui/inc/res_bmp.hrc index b27252778..190d9132a 100644 --- a/sd/source/ui/inc/res_bmp.hrc +++ b/sd/source/ui/inc/res_bmp.hrc @@ -224,10 +224,10 @@ #define BMP_CLOSE_DOC RID_SD_START+325 #define BMP_CLOSE_DOC_H RID_SD_START+326 -#define BMP_TRIANGLE_RIGHT RID_SD_START+327 -#define BMP_TRIANGLE_RIGHT_H RID_SD_START+328 -#define BMP_TRIANGLE_DOWN RID_SD_START+329 -#define BMP_TRIANGLE_DOWN_H RID_SD_START+330 + // FREE + // FREE + // FREE + // FREE #define BMP_FADE_EFFECT_INDICATOR RID_SD_START+331 #define BMP_FADE_EFFECT_INDICATOR_H RID_SD_START+332 diff --git a/sd/source/ui/inc/taskpane/TitleBar.hxx b/sd/source/ui/inc/taskpane/TitleBar.hxx index 64dd5eee4..bc49e7ec0 100644 --- a/sd/source/ui/inc/taskpane/TitleBar.hxx +++ b/sd/source/ui/inc/taskpane/TitleBar.hxx @@ -44,12 +44,7 @@ class VirtualDevice; namespace sd { namespace toolpanel { -/** The title bar above a control in a tool panel or sub tool panel. - The way the title bar is displayed depends on the TitleBarType - given to the constructor. TBT_CONTROL_TITLE and - TBT_SUB_CONTROL_HEADLINE both show a expansion indicator in front of - the title string that shows whether the associated control is - visible (expanded) or not. +/** The title bar above a control in a sub tool panel.

The title bar shows two kinds of indicators: 1) Expansion is displayed by two sets of two bitmaps, a triangle pointing to the right @@ -63,9 +58,8 @@ class TitleBar { public: enum TitleBarType { - TBT_CONTROL_TITLE, TBT_SUB_CONTROL_HEADLINE - }; + }; /** Create a new title bar whose content, the given title string, will be formatted according to the given type. @@ -113,17 +107,10 @@ private: String msTitle; bool mbExpanded; bool mbFocused; - bool mbMouseOver; // Size of the bounding box that encloses the title string. - Size maStringBox; ::std::auto_ptr mpDevice; bool mbIsExpandable; - /** Set the mbMouseOver flag to the given value and paint the - title bar accordingly. - */ - void SetMouseOver (bool bFlag); - /** Return whether this TitleBar object has an expansion indicator bitmap. It is safe to call GetExpansionIndicator() when this method returns but unnecessary. @@ -157,7 +144,6 @@ private: const Rectangle& rTextBox, int nTitleBarWidth); - void PaintPanelControlTitle (void); void PaintSubPanelHeadLineBar (void); void PaintBackground (const Rectangle& rTextBox); @@ -165,12 +151,6 @@ private: /// Paint a focus indicator that encloses the given rectangle. void PaintFocusIndicator (const Rectangle& rIndicatorBox); - /** Paint a mouse over indicator. If the mouse is over the title - bar than the text enclosed by the given rectangle is - underlined. - */ - void PaintMouseOverIndicator (const Rectangle& rIndicatorBox); - Rectangle PaintExpansionIndicator (const Rectangle& rTextBox); void PaintText (const Rectangle& rTextBox); diff --git a/sd/source/ui/inc/taskpane/TitledControl.hxx b/sd/source/ui/inc/taskpane/TitledControl.hxx index 4876dc46e..08692a7a7 100644 --- a/sd/source/ui/inc/taskpane/TitledControl.hxx +++ b/sd/source/ui/inc/taskpane/TitledControl.hxx @@ -153,12 +153,6 @@ private: void* mpUserData; ::std::auto_ptr mpClickHandler; - /** Remember whether to toggle (true) the expansion state when the title - bar is clicked on. When set to false then the control is always - expanded. - */ - bool mbExpansionModeIsToggle; - /// Do not use! Assignment operator is not supported. const TitledControl& operator= ( const TitledControl& aDescriptor); diff --git a/sd/source/ui/toolpanel/TitleBar.cxx b/sd/source/ui/toolpanel/TitleBar.cxx index 4cd5ab138..715d72d71 100644 --- a/sd/source/ui/toolpanel/TitleBar.cxx +++ b/sd/source/ui/toolpanel/TitleBar.cxx @@ -69,7 +69,6 @@ TitleBar::TitleBar ( ::Window* pParent, const String& rsTitle, TitleBarType eTyp , msTitle(rsTitle) , mbExpanded(false) , mbFocused(false) -, mbMouseOver(false) , mpDevice(new VirtualDevice (*this)) , mbIsExpandable (bIsExpandable) { @@ -80,7 +79,6 @@ TitleBar::TitleBar ( ::Window* pParent, const String& rsTitle, TitleBarType eTyp // Change the mouse pointer shape so that it acts as a mouse over effect. switch (meType) { - case TBT_CONTROL_TITLE: case TBT_SUB_CONTROL_HEADLINE: if (mbIsExpandable) SetPointer (POINTER_REFHAND); @@ -170,10 +168,6 @@ void TitleBar::Paint (const Rectangle& rBoundingBox) switch (meType) { - case TBT_CONTROL_TITLE: - PaintPanelControlTitle (); - break; - case TBT_SUB_CONTROL_HEADLINE: PaintSubPanelHeadLineBar (); break; @@ -239,18 +233,6 @@ void TitleBar::LoseFocus() -void TitleBar::SetMouseOver (bool bFlag) -{ - if (bFlag != mbMouseOver) - { - mbMouseOver = bFlag; - // Invalidate(); - } -} - - - - bool TitleBar::HasExpansionIndicator (void) const { bool bHasExpansionIndicator (false); @@ -258,7 +240,6 @@ bool TitleBar::HasExpansionIndicator (void) const { switch (meType) { - case TBT_CONTROL_TITLE: case TBT_SUB_CONTROL_HEADLINE: bHasExpansionIndicator = true; break; @@ -279,21 +260,6 @@ Image TitleBar::GetExpansionIndicator (void) const USHORT nResourceId = 0; switch (meType) { - case TBT_CONTROL_TITLE: - if (mbExpanded) - if (bHighContrastMode) - nResourceId = BMP_TRIANGLE_DOWN_H; - else - nResourceId = BMP_TRIANGLE_DOWN; - else - if (bHighContrastMode) - nResourceId = BMP_TRIANGLE_RIGHT_H; - else - nResourceId = BMP_TRIANGLE_RIGHT; - - aIndicator = IconCache::Instance().GetIcon(nResourceId); - break; - case TBT_SUB_CONTROL_HEADLINE: if (mbExpanded) if (bHighContrastMode) @@ -317,22 +283,6 @@ Image TitleBar::GetExpansionIndicator (void) const -void TitleBar::PaintPanelControlTitle (void) -{ - int nWidth (GetOutputSizePixel().Width()); - Rectangle aTextBox (CalculateTextBoundingBox (nWidth, true)); - PaintBackground(CalculateTitleBarBox(aTextBox, nWidth)); - Rectangle aFocusBox (PaintExpansionIndicator (aTextBox)); - PaintText (aTextBox); - aFocusBox.Union (aTextBox); - aFocusBox.Left() += 2; - PaintFocusIndicator (aFocusBox); - PaintMouseOverIndicator (aTextBox); -} - - - - void TitleBar::PaintSubPanelHeadLineBar (void) { int nWidth (GetOutputSizePixel().Width()); @@ -353,7 +303,6 @@ void TitleBar::PaintSubPanelHeadLineBar (void) aFocusBox.Left() -= 2; aFocusBox.Right() += 1; PaintFocusIndicator (aFocusBox); - PaintMouseOverIndicator (aTextBox); } @@ -390,21 +339,6 @@ void TitleBar::PaintFocusIndicator (const Rectangle& rTextBox) -void TitleBar::PaintMouseOverIndicator (const Rectangle& rTextBox) -{ - if (mbMouseOver) - { - Rectangle aBox (rTextBox); - // Show the line below the focus rectangle (which is painted - // after and over the mouse over indicator.) - // aBox.Bottom() += 2; - // DrawLine (aBox.BottomLeft(), aBox.BottomRight()); - } -} - - - - Rectangle TitleBar::PaintExpansionIndicator (const Rectangle& rTextBox) { Rectangle aExpansionIndicatorArea; @@ -466,29 +400,6 @@ void TitleBar::PaintBackground (const Rectangle& rTitleBarBox) switch (meType) { - case TBT_CONTROL_TITLE: - { - mpDevice->SetFillColor ( - GetSettings().GetStyleSettings().GetDialogColor()); - mpDevice->DrawRect(rTitleBarBox); - - mpDevice->SetFillColor(); - mpDevice->SetLineColor ( - GetSettings().GetStyleSettings().GetLightColor()); - mpDevice->DrawLine( - rTitleBarBox.TopLeft(),rTitleBarBox.TopRight()); - mpDevice->DrawLine( - rTitleBarBox.TopLeft(),rTitleBarBox.BottomLeft()); - - mpDevice->SetLineColor ( - GetSettings().GetStyleSettings().GetShadowColor()); - mpDevice-> DrawLine( - rTitleBarBox.BottomLeft(), rTitleBarBox.BottomRight()); - mpDevice->DrawLine( - rTitleBarBox.TopRight(), rTitleBarBox.BottomRight()); - } - break; - case TBT_SUB_CONTROL_HEADLINE: { Color aColor (GetSettings().GetStyleSettings().GetDialogColor()); @@ -568,11 +479,6 @@ Rectangle TitleBar::CalculateTitleBarBox ( switch (meType) { - case TBT_CONTROL_TITLE: - aTitleBarBox.Bottom() += aTitleBarBox.Top(); - aTitleBarBox.Top() = 0; - break; - case TBT_SUB_CONTROL_HEADLINE: aTitleBarBox.Top() -= 3; aTitleBarBox.Bottom() += 3; @@ -589,15 +495,8 @@ Rectangle TitleBar::CalculateTitleBarBox ( -void TitleBar::MouseMove (const MouseEvent& rEvent) +void TitleBar::MouseMove (const MouseEvent& ) { - Point aRelativePosition = rEvent.GetPosPixel() - GetPosPixel(); - Size aSize = GetSizePixel(); - SetMouseOver ( - aRelativePosition.X() >= 0 - && aRelativePosition.Y() >= 0 - && aRelativePosition.X() < aSize.Width() - && aRelativePosition.Y() < aSize.Height()); } diff --git a/sd/source/ui/toolpanel/TitleToolBox.cxx b/sd/source/ui/toolpanel/TitleToolBox.cxx index 75704cb96..d8c317a73 100644 --- a/sd/source/ui/toolpanel/TitleToolBox.cxx +++ b/sd/source/ui/toolpanel/TitleToolBox.cxx @@ -45,18 +45,6 @@ namespace sd { namespace toolpanel { TitleToolBox::TitleToolBox (::Window* pParent, WinBits nStyle ) : ToolBox( pParent, nStyle ) { - lastSize = -1; - - Bitmap aBitmap (SdResId (BMP_CLOSE_DOC)); - Bitmap aBitmapHC (SdResId (BMP_CLOSE_DOC_H)); - Bitmap aTriangleRight (SdResId (BMP_TRIANGLE_RIGHT)); - Bitmap aTriangleDown (SdResId (BMP_TRIANGLE_DOWN)); - - maImage = Image (aBitmap, Color (COL_LIGHTMAGENTA)); - maImageHC = Image (aBitmapHC, Color (BMP_COLOR_HIGHCONTRAST)); - maTriangleRight = Image (aTriangleRight, Color (COL_LIGHTMAGENTA)); - maTriangleDown = Image (aTriangleDown, Color (COL_LIGHTMAGENTA)); - SetOutStyle (TOOLBOX_STYLE_FLAT); SetBackground (Wallpaper ( GetSettings().GetStyleSettings().GetDialogColor())); @@ -65,43 +53,6 @@ TitleToolBox::TitleToolBox (::Window* pParent, WinBits nStyle ) -void TitleToolBox::AddItem (ToolBoxId aId) -{ - switch (aId) - { - case TBID_PANEL_MENU: - InsertItem (TBID_PANEL_MENU, - String::CreateFromAscii ("Panel"), - TIB_DROPDOWN); - break; - - case TBID_DOCUMENT_CLOSE: - InsertItem (TBID_DOCUMENT_CLOSE, - GetSettings().GetStyleSettings().GetHighContrastMode() - ? maImageHC : maImage, 0 ); - break; - - case TBID_TRIANGLE_RIGHT: - InsertItem (TBID_TRIANGLE_RIGHT, - maTriangleRight, 0); - break; - - case TBID_TRIANGLE_DOWN: - InsertItem (TBID_TRIANGLE_DOWN, - maTriangleDown, 0); - break; - - case TBID_TEST: - InsertItem (TBID_TEST, - String::CreateFromAscii ("Test"), - TIB_DROPDOWN); - break; - } -} - - - - void TitleToolBox::DataChanged (const DataChangedEvent& rDCEvt) { Window::DataChanged (rDCEvt); diff --git a/sd/source/ui/toolpanel/TitleToolBox.hxx b/sd/source/ui/toolpanel/TitleToolBox.hxx index 1bee3eb6e..b8a620c47 100644 --- a/sd/source/ui/toolpanel/TitleToolBox.hxx +++ b/sd/source/ui/toolpanel/TitleToolBox.hxx @@ -45,27 +45,9 @@ class TitleToolBox : public ToolBox { public: - enum ToolBoxId { - TBID_DOCUMENT_CLOSE = 1, - TBID_PANEL_MENU = 2, - TBID_TRIANGLE_RIGHT = 3, - TBID_TRIANGLE_DOWN = 4, - TBID_TEST - }; - TitleToolBox (::Window* pParent, WinBits nStyle = 0); - void AddItem (ToolBoxId aId); - void DataChanged (const DataChangedEvent& rDCEvt); - -private: - Image maImage; - Image maImageHC; - Image maTriangleRight; - Image maTriangleDown; - - long lastSize; }; } } // end of namespace ::sd::toolbox diff --git a/sd/source/ui/toolpanel/TitledControl.cxx b/sd/source/ui/toolpanel/TitledControl.cxx index 7551d4e0a..68023cd59 100644 --- a/sd/source/ui/toolpanel/TitledControl.cxx +++ b/sd/source/ui/toolpanel/TitledControl.cxx @@ -55,8 +55,7 @@ TitledControl::TitledControl ( msTitle(rTitle), mbVisible(true), mpUserData(NULL), - mpClickHandler(new ClickHandler(rClickHandler)), - mbExpansionModeIsToggle(eType!=TitleBar::TBT_CONTROL_TITLE) + mpClickHandler(new ClickHandler(rClickHandler)) { if (pControl.get() != NULL) { diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.cxx b/sd/source/ui/toolpanel/ToolPanelDeck.cxx index ac3ecc261..63873d1f9 100755 --- a/sd/source/ui/toolpanel/ToolPanelDeck.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDeck.cxx @@ -28,7 +28,6 @@ #include "ToolPanelDeck.hxx" #include "taskpane/ToolPanelViewShell.hxx" -#include "ToolPanelDrawer.hxx" #include "taskpane/ControlContainer.hxx" #include "framework/FrameworkHelper.hxx" #include "TaskPaneToolPanel.hxx" @@ -40,6 +39,7 @@ /** === end UNO includes === **/ #include +#include #include //...................................................................................................................... @@ -88,11 +88,11 @@ namespace sd { namespace toolpanel void ToolPanelDeck::SetDrawersLayout() { const ::svt::PDeckLayouter pLayouter( GetLayouter() ); - const ToolPanelDrawer* pDrawerLayouter = dynamic_cast< const ToolPanelDrawer* >( pLayouter.get() ); + const ::svt::DrawerDeckLayouter* pDrawerLayouter = dynamic_cast< const ::svt::DrawerDeckLayouter* >( pLayouter.get() ); if ( pDrawerLayouter != NULL ) // already have the proper layout return; - SetLayouter( new ToolPanelDrawer( *this, *this ) ); + SetLayouter( new ::svt::DrawerDeckLayouter( *this, *this ) ); } //------------------------------------------------------------------------------------------------------------------ diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx deleted file mode 100755 index 92e7afa2a..000000000 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx +++ /dev/null @@ -1,282 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#include "precompiled_sd.hxx" - -#include "ToolPanelDrawer.hxx" -#include "taskpane/TitleBar.hxx" - -#include - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::accessibility::XAccessible; - /** === end UNO using === **/ - - //================================================================================================================== - //= ToolPanelDrawer - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - ToolPanelDrawer::ToolPanelDrawer( ::Window& i_rParentWindow, ::svt::IToolPanelDeck& i_rPanels ) - :m_rParentWindow( i_rParentWindow ) - ,m_rPanelDeck( i_rPanels ) - ,m_aDrawers() - ,m_aLastKnownActivePanel() - { - m_rPanelDeck.AddListener( *this ); - - // simulate PanelInserted events for the panels which are already there - for ( size_t i=0; i aActivePanel( m_rPanelDeck.GetActivePanel() ); - if ( !aActivePanel ) - aActivePanel = m_aLastKnownActivePanel; - - // arrange the title bars which are *above* the active panel (or *all* if there is no active panel), plus - // the title bar of the active panel itself - Point aUpperDrawerPos( i_rDeckPlayground.TopLeft() ); - const size_t nUpperBound = !!aActivePanel ? *aActivePanel : nPanelCount - 1; - for ( size_t i=0; i<=nUpperBound; ++i ) - { - sal_uInt32 nDrawerHeight = m_aDrawers[i]->GetPreferredHeight( nWidth ); - m_aDrawers[i]->GetWindow()->SetPosSizePixel( - aUpperDrawerPos, Size( nWidth, nDrawerHeight ) ); - aUpperDrawerPos.Move( 0, nDrawerHeight ); - } - - // arrange title bars which are below the active panel (or *none* if there is no active panel) - Point aLowerDrawerPos( i_rDeckPlayground.BottomLeft() ); - for ( size_t j = nPanelCount - 1; j > nUpperBound; --j ) - { - sal_uInt32 nDrawerHeight = m_aDrawers[j]->GetPreferredHeight( nWidth ); - m_aDrawers[j]->GetWindow()->SetPosSizePixel( - Point( aLowerDrawerPos.X(), aLowerDrawerPos.Y() - nDrawerHeight + 1 ), - Size( nWidth, nDrawerHeight ) - ); - aLowerDrawerPos.Move( 0, -nDrawerHeight ); - } - - // fincally calculate the rectangle for the active panel - return Rectangle( - aUpperDrawerPos, - Size( nWidth, aLowerDrawerPos.Y() - aUpperDrawerPos.Y() + 1 ) - ); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::Destroy() - { - while ( !m_aDrawers.empty() ) - impl_removeTitleBar( 0 ); - m_rPanelDeck.RemoveListener( *this ); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::SetFocusToPanelSelector() - { - const size_t nPanelCount( m_rPanelDeck.GetPanelCount() ); - if ( !nPanelCount ) - // nothing to focus - return; - ::boost::optional< size_t > aActivePanel( m_rPanelDeck.GetActivePanel() ); - if ( !aActivePanel ) - aActivePanel = 0; - ENSURE_OR_RETURN_VOID( *aActivePanel < m_aDrawers.size(), "ToolPanelDrawer::SetFocusToPanelSelector: invalid active panel, or inconsistent drawers!" ); - m_aDrawers[ *aActivePanel ]->GetWindow()->GrabFocus(); - } - - //------------------------------------------------------------------------------------------------------------------ - size_t ToolPanelDrawer::GetAccessibleChildCount() const - { - return m_aDrawers.size(); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > ToolPanelDrawer::GetAccessibleChild( const size_t i_nChildIndex, const Reference< XAccessible >& i_rParentAccessible ) - { - ENSURE_OR_RETURN( i_nChildIndex < m_aDrawers.size(), "illegal index", NULL ); - - const PTitleBar pTitleBar( m_aDrawers[ i_nChildIndex ] ); - Window* pItemWindow( pTitleBar->GetWindow() ); - - Reference< XAccessible > xItemAccessible( pItemWindow->GetAccessible( FALSE ) ); - if ( !xItemAccessible.is() ) - { - xItemAccessible = pTitleBar->CreateAccessibleObject( i_rParentAccessible ); - OSL_ENSURE( xItemAccessible.is(), "ToolPanelDrawer::GetAccessibleChild: invalid XAccessible returned by CreateAccessibleObject!" ); - pItemWindow->SetAccessible( xItemAccessible ); - } - - return xItemAccessible; - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) - { - OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "ToolPanelDrawer::PanelInserted: inconsistency!" ); - - ::boost::shared_ptr< TitleBar > pTitleBar( new TitleBar( &m_rParentWindow, i_pPanel->GetDisplayName(), TitleBar::TBT_CONTROL_TITLE, true ) ); - pTitleBar->GetWindow()->Show(); - pTitleBar->GetWindow()->AddEventListener( LINK( this, ToolPanelDrawer, OnWindowEvent ) ); - m_aDrawers.insert( m_aDrawers.begin() + i_nPosition, pTitleBar ); - impl_triggerRearrange(); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::PanelRemoved( const size_t i_nPosition ) - { - impl_removeTitleBar( i_nPosition ); - impl_triggerRearrange(); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::impl_triggerRearrange() const - { - // this is somewhat hacky, it assumes that the parent of our panels is a tool panel deck, which, in its - // Resize implementation, rearrances all elements. - m_rParentWindow.Resize(); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) - { - if ( !!i_rOldActive ) - { - OSL_ENSURE( *i_rOldActive < m_aDrawers.size(), "ToolPanelDrawer::ActivePanelChanged: illegal old index!" ); - m_aDrawers[ *i_rOldActive ]->Expand( false ); - } - - if ( !!i_rNewActive ) - { - OSL_ENSURE( *i_rNewActive < m_aDrawers.size(), "ToolPanelDrawer::ActivePanelChanged: illegal new index!" ); - m_aDrawers[ *i_rNewActive ]->Expand( true ); - } - - impl_triggerRearrange(); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) - { - // not interested in - (void)i_rNewLayouter; - } - - //------------------------------------------------------------------------------------------------------------------ - size_t ToolPanelDrawer::impl_getPanelPositionFromWindow( const Window* i_pTitleBarWindow ) const - { - for ( ::std::vector< PTitleBar >::const_iterator drawerPos = m_aDrawers.begin(); - drawerPos != m_aDrawers.end(); - ++drawerPos - ) - { - if ( (*drawerPos)->GetWindow() == i_pTitleBarWindow ) - return drawerPos - m_aDrawers.begin(); - } - return m_aDrawers.size(); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::impl_removeTitleBar( const size_t i_nPosition ) - { - OSL_PRECOND( i_nPosition < m_aDrawers.size(), "ToolPanelDrawer::impl_removeTitleBar: invalid panel position!" ); - m_aDrawers[ i_nPosition ]->GetWindow()->RemoveEventListener( LINK( this, ToolPanelDrawer, OnWindowEvent ) ); - OSL_ENSURE( m_aDrawers[ i_nPosition ].unique(), "ToolPanelDrawer::impl_removeTitleBar: somebody else is still holding a reference!" ); - m_aDrawers.erase( m_aDrawers.begin() + i_nPosition ); - } - - //------------------------------------------------------------------------------------------------------------------ - IMPL_LINK( ToolPanelDrawer, OnWindowEvent, VclSimpleEvent*, i_pEvent ) - { - const VclWindowEvent* pWindowEvent = PTR_CAST( VclWindowEvent, i_pEvent ); - ENSURE_OR_RETURN( pWindowEvent, "no WindowEvent", 0L ); - - bool bActivatePanel = false; - switch ( pWindowEvent->GetId() ) - { - case VCLEVENT_WINDOW_MOUSEBUTTONUP: - { - const MouseEvent* pMouseEvent = static_cast< const MouseEvent* >( pWindowEvent->GetData() ); - ENSURE_OR_RETURN( pMouseEvent, "no mouse event with MouseButtonUp", 0L ); - if ( pMouseEvent->GetButtons() == MOUSE_LEFT ) - { - bActivatePanel = true; - } - } - break; - case VCLEVENT_WINDOW_KEYINPUT: - { - const KeyEvent* pKeyEvent = static_cast< const KeyEvent* >( pWindowEvent->GetData() ); - ENSURE_OR_RETURN( pKeyEvent, "no key event with KeyInput", 0L ); - const KeyCode& rKeyCode( pKeyEvent->GetKeyCode() ); - if ( ( rKeyCode.GetModifier() == 0 ) && ( rKeyCode.GetCode() == KEY_RETURN ) ) - { - bActivatePanel = true; - } - } - break; - } - if ( bActivatePanel ) - { - const size_t nPanelPos = impl_getPanelPositionFromWindow( pWindowEvent->GetWindow() ); - m_rPanelDeck.ActivatePanel( nPanelPos ); - return 1L; - } - return 0L; - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::Dying() - { - Destroy(); - } - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.hxx b/sd/source/ui/toolpanel/ToolPanelDrawer.hxx deleted file mode 100755 index d65429f45..000000000 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.hxx +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef SD_TOOLPANEL_TOOLPANELDRAWER_HXX -#define SD_TOOLPANEL_TOOLPANELDRAWER_HXX - -#include -#include -#include - -#include - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - class ToolPanelViewShell; - class TitleBar; - typedef ::boost::shared_ptr< TitleBar > PTitleBar; - - //================================================================================================================== - //= ToolPanelDrawer - //================================================================================================================== - /** a class which implements a tool panel selector in the form of the classical drawers - */ - class ToolPanelDrawer :public ::svt::RefBase - ,public ::svt::IDeckLayouter - ,public ::svt::IToolPanelDeckListener - { - public: - ToolPanelDrawer( - ::Window& i_rParentWindow, - ::svt::IToolPanelDeck& i_rPanels - ); - ~ToolPanelDrawer(); - - // IReference - DECLARE_IREFERENCE() - - // IDeckLayouter - virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); - virtual void Destroy(); - virtual void SetFocusToPanelSelector(); - virtual size_t GetAccessibleChildCount() const; - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - GetAccessibleChild( - const size_t i_nChildIndex, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible - ); - - // IToolPanelDeckListener - virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); - virtual void PanelRemoved( const size_t i_nPosition ); - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); - virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); - virtual void Dying(); - - private: - // triggers a re-arrance of the panel deck elements - void impl_triggerRearrange() const; - size_t impl_getPanelPositionFromWindow( const Window* i_pTitleBarWindow ) const; - void impl_removeTitleBar( const size_t i_nPosition ); - - DECL_LINK( OnWindowEvent, VclSimpleEvent* ); - -private: - Window& m_rParentWindow; - ::svt::IToolPanelDeck& m_rPanelDeck; - ::std::vector< PTitleBar > m_aDrawers; - ::boost::optional< size_t > m_aLastKnownActivePanel; - }; - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... - -#endif // SD_TOOLPANEL_TOOLPANELDRAWER_HXX diff --git a/sd/source/ui/toolpanel/makefile.mk b/sd/source/ui/toolpanel/makefile.mk index 837ffb710..f9cd15685 100644 --- a/sd/source/ui/toolpanel/makefile.mk +++ b/sd/source/ui/toolpanel/makefile.mk @@ -60,7 +60,6 @@ SLOFILES = \ $(SLO)$/TaskPaneTreeNode.obj \ $(SLO)$/ToolPanelViewShell.obj \ $(SLO)$/ToolPanelDeck.obj \ - $(SLO)$/ToolPanelDrawer.obj \ $(SLO)$/TaskPaneToolPanel.obj \ $(SLO)$/CustomToolPanel.obj \ $(SLO)$/StandardToolPanel.obj \ -- cgit v1.2.3 From d8c8e23b6eafead5765a8e4f641c2f52427b57e3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 13:19:44 +0200 Subject: slidecopy: added SID_TASKPANE to Draw --- sd/source/ui/view/drvwshrg.cxx | 1 + sd/uiconfig/sdraw/menubar/menubar.xml | 605 +++++++++++++++++----------------- 2 files changed, 304 insertions(+), 302 deletions(-) diff --git a/sd/source/ui/view/drvwshrg.cxx b/sd/source/ui/view/drvwshrg.cxx index eb739c495..84f18651d 100644 --- a/sd/source/ui/view/drvwshrg.cxx +++ b/sd/source/ui/view/drvwshrg.cxx @@ -109,6 +109,7 @@ SFX_IMPL_INTERFACE(GraphicViewShell, SfxShell, SdResId(STR_DRAWVIEWSHELL)) //SOH { SFX_POPUPMENU_REGISTRATION( SdResId(RID_DRAW_TEXTOBJ_INSIDE_POPUP) ); SFX_CHILDWINDOW_CONTEXT_REGISTRATION( SID_NAVIGATOR ); + SFX_CHILDWINDOW_REGISTRATION( SID_TASKPANE ); SFX_CHILDWINDOW_REGISTRATION( SfxTemplateDialogWrapper::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SvxFontWorkChildWindow::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SvxColorChildWindow::GetChildWindowId() ); diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml index 9e5d927b2..e7471902a 100644 --- a/sd/uiconfig/sdraw/menubar/menubar.xml +++ b/sd/uiconfig/sdraw/menubar/menubar.xml @@ -1,330 +1,331 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - + + - - - + + + + + + + - - + + + + + + + + + + + + + + - - - - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From b396d46e186ffc2daa9041e9cf803be62b53eb41 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 13:24:23 +0200 Subject: slidecopy: FLT_RIGHT_PANE_DOCKING_WINDOW is obsolete (superseded by FLT_TOOL_PANEL_DOCKING_WINDOW) for quite some time now ... --- sd/source/ui/dlg/PaneDockingWindow.src | 16 ---------------- sd/source/ui/inc/PaneDockingWindow.hrc | 3 +-- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/sd/source/ui/dlg/PaneDockingWindow.src b/sd/source/ui/dlg/PaneDockingWindow.src index a9d7256aa..aea616509 100644 --- a/sd/source/ui/dlg/PaneDockingWindow.src +++ b/sd/source/ui/dlg/PaneDockingWindow.src @@ -62,22 +62,6 @@ DockingWindow FLT_LEFT_PANE_DRAW_DOCKING_WINDOW Text [ en-US ] = "Page Pane" ; }; -DockingWindow FLT_RIGHT_PANE_DOCKING_WINDOW -{ - // HelpID = SID_EFFECT_WIN ; - Border = TRUE ; - Hide = TRUE ; - SVLook = TRUE ; - Sizeable = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - Zoomable = TRUE ; - Dockable = TRUE ; - EnableResizing = TRUE ; - Size = MAP_APPFONT (100,200) ; - Text [ en-US ] = "Task Pane" ; -}; - DockingWindow FLT_TOOL_PANEL_DOCKING_WINDOW { // HelpID = SID_EFFECT_WIN ; diff --git a/sd/source/ui/inc/PaneDockingWindow.hrc b/sd/source/ui/inc/PaneDockingWindow.hrc index e29562739..8061c4d5b 100644 --- a/sd/source/ui/inc/PaneDockingWindow.hrc +++ b/sd/source/ui/inc/PaneDockingWindow.hrc @@ -30,5 +30,4 @@ #define FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW 792 #define FLT_LEFT_PANE_DRAW_DOCKING_WINDOW 793 -#define FLT_RIGHT_PANE_DOCKING_WINDOW 794 -#define FLT_TOOL_PANEL_DOCKING_WINDOW 795 +#define FLT_TOOL_PANEL_DOCKING_WINDOW 794 -- cgit v1.2.3 From 1f192e7e498ccdd956641e8d217d252a0c571486 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 9 Apr 2010 09:21:37 +0200 Subject: slidecopy: moved SD's version of DockingWindows (bearing a title bar, and a closer when docked) to SFX, and based the new TaskPane on it --- sd/source/ui/app/res_bmp.src | 8 - sd/source/ui/dlg/PaneDockingWindow.cxx | 341 +-------------------- .../ui/framework/factories/ChildWindowPane.cxx | 2 +- sd/source/ui/inc/PaneDockingWindow.hxx | 79 +---- sd/source/ui/inc/res_bmp.hrc | 6 - .../ui/slidesorter/controller/SlsFocusManager.cxx | 2 +- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 4 +- 7 files changed, 18 insertions(+), 424 deletions(-) diff --git a/sd/source/ui/app/res_bmp.src b/sd/source/ui/app/res_bmp.src index 77152aa63..a57bb7667 100644 --- a/sd/source/ui/app/res_bmp.src +++ b/sd/source/ui/app/res_bmp.src @@ -522,14 +522,6 @@ Bitmap BMP_WAIT_ICON // ---------------------------------------- -Bitmap BMP_CLOSE_DOC -{ - File = "closedoc.bmp"; -}; -Bitmap BMP_CLOSE_DOC_H -{ - File = "closedochc.bmp"; -}; Bitmap BMP_FADE_EFFECT_INDICATOR { File = "fade_effect_indicator.bmp"; diff --git a/sd/source/ui/dlg/PaneDockingWindow.cxx b/sd/source/ui/dlg/PaneDockingWindow.cxx index 114bec994..c1e0beaa3 100644 --- a/sd/source/ui/dlg/PaneDockingWindow.cxx +++ b/sd/source/ui/dlg/PaneDockingWindow.cxx @@ -44,297 +44,26 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; +using ::sfx2::TitledDockingWindow; namespace sd { -PaneDockingWindow::PaneDockingWindow ( - SfxBindings *_pBindings, - SfxChildWindow *pChildWindow, - ::Window* pParent, - const ResId& rResId, - const ::rtl::OUString& rsTitle) - : SfxDockingWindow ( - _pBindings, - pChildWindow, - pParent, - rResId - ), - msTitle(rsTitle), - mpTitleToolBox(), - maBorder (3,1,3,3), - mnChildWindowId(pChildWindow->GetType()), - mpContentWindow(new ::Window(this)), - mbIsLayoutPending(false) +PaneDockingWindow::PaneDockingWindow( + SfxBindings *_pBindings, SfxChildWindow *pChildWindow, ::Window* pParent, + const ResId& rResId, const ::rtl::OUString& rsTitle ) + :TitledDockingWindow( _pBindings, pChildWindow, pParent, rResId ) { - SetBackground (Wallpaper()); - - InitializeTitleToolBox(); - - // Tell the system window about the new docking window so that it can be - // reached via the keyboard. - SystemWindow* pSystemWindow = GetSystemWindow(); - if (pSystemWindow != NULL) - pSystemWindow->GetTaskPaneList()->AddWindow(this); - - mpContentWindow->Show(); + SetTitle( rsTitle ); } - - - PaneDockingWindow::~PaneDockingWindow (void) { - // Tell the next system window that the docking window is no longer - // available. - SystemWindow* pSystemWindow = GetSystemWindow(); - if (pSystemWindow != NULL) - pSystemWindow->GetTaskPaneList()->RemoveWindow(this); - mpTitleToolBox.reset(); -} - - - - -void PaneDockingWindow::SetTitle (const String& rsTitle) -{ - msTitle = rsTitle; - Invalidate(); -} - - - - -void PaneDockingWindow::Resize (void) -{ - SfxDockingWindow::Resize(); - mbIsLayoutPending = true; } - - - -void PaneDockingWindow::Layout (void) -{ - mbIsLayoutPending = false; - - Size aWindowSize (GetOutputSizePixel()); - Size aToolBoxSize (0,0); - int nTitleBarHeight (GetSettings().GetStyleSettings().GetTitleHeight()); - - // Place the title tool box. - if (mpTitleToolBox.get() != NULL) - { - if (IsFloatingMode()) - mpTitleToolBox->HideItem (1); - else - mpTitleToolBox->ShowItem (1); - - aToolBoxSize = mpTitleToolBox->CalcWindowSizePixel(); - if (aToolBoxSize.Height() > nTitleBarHeight) - nTitleBarHeight = aToolBoxSize.Height(); - mpTitleToolBox->SetPosSizePixel ( - Point(aWindowSize.Width()-aToolBoxSize.Width(), - (nTitleBarHeight-aToolBoxSize.Height())/2), - aToolBoxSize); - } - - // Place the content window. - if (nTitleBarHeight < aToolBoxSize.Height()) - nTitleBarHeight = aToolBoxSize.Height(); - aWindowSize.Height() -= nTitleBarHeight; - mpContentWindow->SetPosSizePixel( - Point(maBorder.Left(),nTitleBarHeight+maBorder.Top()), - Size (aWindowSize.Width()-maBorder.Left()-maBorder.Right(), - aWindowSize.Height()-maBorder.Top()-maBorder.Bottom())); -} - - - - -void PaneDockingWindow::Paint (const Rectangle& rRectangle) -{ - if (mbIsLayoutPending) - Layout(); - - SfxDockingWindow::Paint (rRectangle); - int nTitleBarHeight (GetSettings().GetStyleSettings().GetTitleHeight()); - Size aToolBoxSize = mpTitleToolBox->CalcWindowSizePixel(); - if (aToolBoxSize.Height() > nTitleBarHeight) - nTitleBarHeight = aToolBoxSize.Height(); - Color aOriginalLineColor (GetLineColor()); - Color aOriginalFillColor (GetFillColor()); - SetFillColor (GetSettings().GetStyleSettings().GetDialogColor()); - SetLineColor (); - - // Make font bold. - const Font& rOriginalFont (GetFont()); - Font aFont (rOriginalFont); - aFont.SetWeight (WEIGHT_BOLD); - SetFont (aFont); - - // Set border values. - Size aWindowSize (GetOutputSizePixel()); - int nOuterLeft = 0; - int nInnerLeft = nOuterLeft + maBorder.Left() - 1; - int nOuterRight = aWindowSize.Width() - 1; - int nInnerRight = nOuterRight - maBorder.Right() + 1; - int nInnerTop = nTitleBarHeight + maBorder.Top() - 1; - int nOuterBottom = aWindowSize.Height() - 1; - int nInnerBottom = nOuterBottom - maBorder.Bottom() + 1; - - // Paint title bar background. - Rectangle aTitleBarBox (Rectangle( - nOuterLeft, - 0, - nOuterRight, - nInnerTop-1)); - DrawRect (aTitleBarBox); - - if (nInnerLeft > nOuterLeft) - DrawRect ( - Rectangle (nOuterLeft, nInnerTop, nInnerLeft, nInnerBottom)); - if (nOuterRight > nInnerRight) - DrawRect ( - Rectangle (nInnerRight, nInnerTop, nOuterRight, nInnerBottom)); - if (nInnerBottom < nOuterBottom) - DrawRect ( - Rectangle (nOuterLeft, nInnerBottom, nOuterRight, nOuterBottom)); - - // Paint bevel border. - SetFillColor (); - SetLineColor (GetSettings().GetStyleSettings().GetShadowColor()); - if (maBorder.Top() > 0) - DrawLine ( - Point(nInnerLeft,nInnerTop), - Point(nInnerLeft,nInnerBottom)); - if (maBorder.Left() > 0) - DrawLine ( - Point(nInnerLeft,nInnerTop), - Point(nInnerRight,nInnerTop)); - SetLineColor (GetSettings().GetStyleSettings().GetLightColor()); - if (maBorder.Bottom() > 0) - DrawLine ( - Point(nInnerRight,nInnerBottom), - Point(nInnerLeft,nInnerBottom)); - if (maBorder.Right() > 0) - DrawLine ( - Point(nInnerRight,nInnerBottom), - Point(nInnerRight,nInnerTop)); - - // Paint title bar text. - SetLineColor (GetSettings().GetStyleSettings().GetActiveTextColor()); - SetFillColor (); - aTitleBarBox.Left() += 3; - DrawText (aTitleBarBox, msTitle, - TEXT_DRAW_LEFT - | TEXT_DRAW_VCENTER - | TEXT_DRAW_MULTILINE - | TEXT_DRAW_WORDBREAK); - - // Restore original values of the output device. - SetFont (rOriginalFont); - SetFillColor (aOriginalFillColor); -} - - - - -void PaneDockingWindow::InitializeTitleToolBox (void) -{ - if (mpTitleToolBox.get() == NULL) - { - // Initialize the title tool box. - mpTitleToolBox.reset (new ToolBox(this)); - mpTitleToolBox->SetSelectHdl ( - LINK(this, PaneDockingWindow, ToolboxSelectHandler)); - mpTitleToolBox->SetOutStyle (TOOLBOX_STYLE_FLAT); - mpTitleToolBox->SetBackground (Wallpaper ( - GetSettings().GetStyleSettings().GetDialogColor())); - mpTitleToolBox->Show(); - } - else - mpTitleToolBox->Clear(); - - // Get the closer bitmap and set it as right most button. - Bitmap aBitmap (SdResId (BMP_CLOSE_DOC)); - Bitmap aBitmapHC (SdResId (BMP_CLOSE_DOC_H)); - Image aImage = Image (aBitmap, Color (COL_LIGHTMAGENTA)); - Image aImageHC = Image (aBitmapHC, Color (BMP_COLOR_HIGHCONTRAST)); - mpTitleToolBox->InsertItem (1, - GetSettings().GetStyleSettings().GetHighContrastMode() - ? aImageHC - : aImage); - mpTitleToolBox->ShowItem (1); -} - - - - -USHORT PaneDockingWindow::AddMenu ( - const String& rsMenuName, - ULONG nHelpId, - const Link& rCallback) -{ - // Add the menu before the closer button. - USHORT nItemCount (mpTitleToolBox->GetItemCount()); - USHORT nItemId (nItemCount+1); - mpTitleToolBox->InsertItem ( - nItemId, - rsMenuName, - TIB_DROPDOWNONLY, - nItemCount>0 ? nItemCount-1 : (USHORT)-1); - mpTitleToolBox->SetHelpId( nItemId, nHelpId ); - mpTitleToolBox->SetClickHdl (rCallback); - mpTitleToolBox->SetDropdownClickHdl (rCallback); - - // The tool box has likely changed its size. The title bar has to be - // resized. - Resize(); - Invalidate(); - - return nItemCount+1; -} - - - - -IMPL_LINK(PaneDockingWindow, ToolboxSelectHandler, ToolBox*, pToolBox) -{ - USHORT nId = pToolBox->GetCurItemId(); - - if (nId == 1) - { - EndTracking(); - SfxBoolItem aVisibility (mnChildWindowId, FALSE); - GetBindings().GetDispatcher()->Execute ( - mnChildWindowId, - SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, - &aVisibility, - NULL); - } - - return 0; -} - - - - -long PaneDockingWindow::Notify( NotifyEvent& rNEvt ) -{ - return SfxDockingWindow::Notify (rNEvt); -} - - - - void PaneDockingWindow::StateChanged( StateChangedType nType ) { switch (nType) { - case STATE_CHANGE_INITSHOW: - Resize(); - break; - case STATE_CHANGE_VISIBLE: // The visibility of the docking window has changed. Tell the // ConfigurationController so that it can activate or deactivate @@ -352,49 +81,6 @@ void PaneDockingWindow::StateChanged( StateChangedType nType ) SfxDockingWindow::StateChanged (nType); } - - - -void PaneDockingWindow::DataChanged (const DataChangedEvent& rEvent) -{ - SfxDockingWindow::DataChanged (rEvent); - - switch (rEvent.GetType()) - { - case DATACHANGED_SETTINGS: - if ((rEvent.GetFlags() & SETTINGS_STYLE) == 0) - break; - // else fall through. - case DATACHANGED_FONTS: - case DATACHANGED_FONTSUBSTITUTION: - { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - // Font. - Font aFont = rStyleSettings.GetAppFont(); - if (IsControlFont()) - aFont.Merge(GetControlFont()); - SetZoomedPointFont(aFont); - - // Color. - Color aColor; - if (IsControlForeground()) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - SetTextColor(aColor); - SetTextFillColor(); - - Resize(); - Invalidate(); - } - break; - } -} - - - - void PaneDockingWindow::EndDocking( const Rectangle& rRect, BOOL bFloatMode ) { SfxDockingWindow::EndDocking( rRect, bFloatMode ); @@ -403,20 +89,9 @@ void PaneDockingWindow::EndDocking( const Rectangle& rRect, BOOL bFloatMode ) maEndDockingHdl.Call( this ); } - - -::Window* PaneDockingWindow::GetContentWindow (void) -{ - return mpContentWindow.get(); -} - - - - -::boost::shared_ptr PaneDockingWindow::GetTitleToolBox (void) const +void PaneDockingWindow::ResetToolBox() { - return mpTitleToolBox; + impl_resetToolBox(); } - } // end of namespace ::sd diff --git a/sd/source/ui/framework/factories/ChildWindowPane.cxx b/sd/source/ui/framework/factories/ChildWindowPane.cxx index 9c8ed4a33..4e3b20b43 100644 --- a/sd/source/ui/framework/factories/ChildWindowPane.cxx +++ b/sd/source/ui/framework/factories/ChildWindowPane.cxx @@ -195,7 +195,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/inc/PaneDockingWindow.hxx b/sd/source/ui/inc/PaneDockingWindow.hxx index 9b60e21d5..55549c9df 100644 --- a/sd/source/ui/inc/PaneDockingWindow.hxx +++ b/sd/source/ui/inc/PaneDockingWindow.hxx @@ -31,7 +31,7 @@ #ifndef SD_PANE_DOCKING_WINDOW_HXX #define SD_PANE_DOCKING_WINDOW_HXX -#include +#include #include #include @@ -41,15 +41,10 @@ class ToolBox; namespace sd { -class PaneDockingWindow - : public SfxDockingWindow + class PaneDockingWindow : public ::sfx2::TitledDockingWindow { public: - /** Create a new docking window that will be displayed in the specified - pane. - The constructor will determine the ViewShellBase via the given - bindings and tell its PaneManager about the new window. It will ask - the PaneManager for a window title. + /** Create a new docking window. @param pBindings Used, among others, to determine the ViewShellBase and PaneManager that manage the new docking window. @@ -60,8 +55,8 @@ public: The parent window of the new docking window. @param rResId The resource is used to determine initial size and attributes. - @param ePane - The pane in which to show the docking window. + @param rsTitle + the initial title */ PaneDockingWindow ( SfxBindings *pBindings, @@ -72,79 +67,17 @@ public: virtual ~PaneDockingWindow (void); - virtual void Paint (const Rectangle& rRectangle); - virtual void Resize (void); - - virtual long Notify( NotifyEvent& rNEvt ); virtual void StateChanged( StateChangedType nType ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); virtual void EndDocking( const Rectangle& rRect, BOOL bFloatMode ); - /** Initializing the title tool box either creates a new title tool box - or clears all items from an existing one. A closer is added as only - item. - */ - void InitializeTitleToolBox (void); - - /** Add a top down menu to the title bar or rather the top-level menu - entry. The given callback is called when the menu is clicked and it - is the task of the callback to show the menu. - @return - The id of the new menu is returned. It can be compared by the - callback to the value of GetCurItemId() when called at the given - tool box. - */ - USHORT AddMenu (const String& rsMenuName, ULONG nHelpId, const Link& rCallback); - void SetEndDockingHdl( const Link& i_rEndDockingHdl ) { maEndDockingHdl = i_rEndDockingHdl; } const Link& GetEndDockingHdl() const { return maEndDockingHdl; } - /** Set the title of the docking window to the given string. Use this - method when the title is not yet known at the time of construction - or can not be passed to the constructor. - */ - void SetTitle (const String& rsTitle); - - ::Window* GetContentWindow (void); - - ::boost::shared_ptr GetTitleToolBox (void) const; + void ResetToolBox(); private: - /** Title that is shown at the top of the docking window. - */ - ::rtl::OUString msTitle; - - /** The tool box that is displayed in the window title area contains - menus and the closer button. - */ - ::boost::shared_ptr mpTitleToolBox; - - /** The border that is painted arround the inner window. The bevel - shadow lines are part of the border, so where the border is 0 no - such line is painted. - */ - SvBorder maBorder; - - sal_uInt16 mnChildWindowId; - - ::boost::scoped_ptr< ::Window> mpContentWindow; - Link maEndDockingHdl; - - /** Remember that a layout is pending, i.e. Resize() has been called - since the last Paint(). - */ - bool mbIsLayoutPending; - - DECL_LINK(ToolboxSelectHandler, ToolBox*); - - /** This does the actual placing and sizing of the title bar and the - content window after the size of the docking window has changed. - This method is called from withing the Paint() method when since its - last invocation the size of the docking window has changed. - */ - void Layout (void); }; } // end of namespace ::sd diff --git a/sd/source/ui/inc/res_bmp.hrc b/sd/source/ui/inc/res_bmp.hrc index 190d9132a..4e0afd7b9 100644 --- a/sd/source/ui/inc/res_bmp.hrc +++ b/sd/source/ui/inc/res_bmp.hrc @@ -222,12 +222,6 @@ #define BMP_GROUP_H RID_SD_START+226 #define BMP_WAIT_ICON_H RID_SD_START+229 -#define BMP_CLOSE_DOC RID_SD_START+325 -#define BMP_CLOSE_DOC_H RID_SD_START+326 - // FREE - // FREE - // FREE - // FREE #define BMP_FADE_EFFECT_INDICATOR RID_SD_START+331 #define BMP_FADE_EFFECT_INDICATOR_H RID_SD_START+332 diff --git a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx index 7e834de12..cbf75f805 100644 --- a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx @@ -320,7 +320,7 @@ void FocusManager::SetFocusToToolBox (void) { PaneDockingWindow* pPaneDockingWindow = dynamic_cast(pDockingWindow); if (pPaneDockingWindow != NULL) - pPaneDockingWindow->GetTitleToolBox()->GrabFocus(); + pPaneDockingWindow->GetToolBox().GrabFocus(); } } } diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 64f75e601..08de566fe 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -1018,8 +1018,8 @@ void ToolPanelViewShell::ConnectToDockingWindow() PaneDockingWindow* pDockingWindow = dynamic_cast(GetDockingWindow()); if (pDockingWindow != NULL) { - pDockingWindow->InitializeTitleToolBox(); - mnMenuId = pDockingWindow->AddMenu ( + pDockingWindow->ResetToolBox(); + mnMenuId = pDockingWindow->AddDropDownToolBoxItem ( String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_TITLE)), HID_SD_TASK_PANE_VIEW_MENU, LINK(this, ToolPanelViewShell, ToolboxClickHandler)); -- cgit v1.2.3 From b8e1bbcf54a2c4b9afe4d922358308f8379f1f44 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 9 Apr 2010 11:28:30 +0200 Subject: slidecopy: moved XToolPanel from css.view to css.ui, now that it is an XUIElement --- sd/source/ui/toolpanel/CustomToolPanel.hxx | 4 ++-- sd/workben/custompanel/ctp_panel.hxx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sd/source/ui/toolpanel/CustomToolPanel.hxx b/sd/source/ui/toolpanel/CustomToolPanel.hxx index 60e8030a8..d1dc96e9d 100644 --- a/sd/source/ui/toolpanel/CustomToolPanel.hxx +++ b/sd/source/ui/toolpanel/CustomToolPanel.hxx @@ -33,7 +33,7 @@ #include #include #include -#include +#include /** === end UNO includes === **/ #include @@ -101,7 +101,7 @@ namespace sd { namespace toolpanel ::boost::shared_ptr< framework::FrameworkHelper > m_pFrameworkHelper; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > m_xPanelResourceId; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResource > m_xResource; - ::com::sun::star::uno::Reference< ::com::sun::star::view::XToolPanel > m_xToolPanel; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel > m_xToolPanel; bool m_bAttemptedPanelCreation; sal_uInt32 m_nResourceAccessLock; }; diff --git a/sd/workben/custompanel/ctp_panel.hxx b/sd/workben/custompanel/ctp_panel.hxx index ee6bf16bc..e34d021f6 100644 --- a/sd/workben/custompanel/ctp_panel.hxx +++ b/sd/workben/custompanel/ctp_panel.hxx @@ -29,7 +29,7 @@ /** === begin UNO includes === **/ #include -#include +#include #include #include #include @@ -50,7 +50,7 @@ namespace sd { namespace colortoolpanel //= class SingleColorPanel //================================================================================================================== typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::drawing::framework::XView - , ::com::sun::star::view::XToolPanel + , ::com::sun::star::ui::XToolPanel , ::com::sun::star::awt::XPaintListener > SingleColorPanel_Base; class SingleColorPanel :public ::cppu::BaseMutex -- cgit v1.2.3 From 04b528eedb2cf1a29935896786f5746cf9db20cb Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 9 Apr 2010 12:25:00 +0200 Subject: slidecopy: resolved post-rebase build breakers (method signature changed in MWS) --- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 64f75e601..1a9c76a7c 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -502,7 +502,7 @@ ToolPanelViewShell_Impl::PanelActivation ToolPanelViewShell_Impl::SetupDefaultPa } // create the panels - Reference< XFrame > xFrame( m_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ); + Reference< XFrame > xFrame( m_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame().GetFrameInterface() ); const BOOL bHiContrast( m_pPanelDeck->GetSettings().GetStyleSettings().GetHighContrastMode() ); for ( size_t i=0; i < sizeof( aPanels ) / sizeof( aPanels[0] ); ++i ) { -- cgit v1.2.3 From 6a2fc901cd8e2d6366f1d83eb2dc61f389c5f058 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 12 Apr 2010 13:17:03 +0200 Subject: slidecopy: removed unused forward declaration --- sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx | 1 - sd/source/ui/inc/taskpane/TitledControl.hxx | 1 - 2 files changed, 2 deletions(-) diff --git a/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx b/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx index aa0a110a0..5891fc995 100644 --- a/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx +++ b/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx @@ -57,7 +57,6 @@ class Window; namespace sd { namespace toolpanel { -class ControlFactory; class TreeNode; /** This panel demonstrates how to create a panel for the task pane. diff --git a/sd/source/ui/inc/taskpane/TitledControl.hxx b/sd/source/ui/inc/taskpane/TitledControl.hxx index 08692a7a7..2f774a8fe 100644 --- a/sd/source/ui/inc/taskpane/TitledControl.hxx +++ b/sd/source/ui/inc/taskpane/TitledControl.hxx @@ -48,7 +48,6 @@ class Window; namespace sd { namespace toolpanel { class ControlContainer; -class ControlFactory; /** This wrapper adds a title bar to a control. Both title bar and control are child windows. -- cgit v1.2.3 From 0f30328f39523644d18dcb7877b703c54136c6f9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 13 Apr 2010 09:17:28 +0200 Subject: slidecopy: adjusted to new XToolPanel --- sd/workben/custompanel/ctp_panel.cxx | 10 ++++++++++ sd/workben/custompanel/ctp_panel.hxx | 1 + 2 files changed, 11 insertions(+) diff --git a/sd/workben/custompanel/ctp_panel.cxx b/sd/workben/custompanel/ctp_panel.cxx index 1aa0772c3..3719816a9 100644 --- a/sd/workben/custompanel/ctp_panel.cxx +++ b/sd/workben/custompanel/ctp_panel.cxx @@ -76,6 +76,7 @@ namespace sd { namespace colortoolpanel using ::com::sun::star::lang::EventObject; using ::com::sun::star::awt::XDevice; using ::com::sun::star::awt::XGraphics; + using ::com::sun::star::accessibility::XAccessible; /** === end UNO using === **/ namespace WindowAttribute = ::com::sun::star::awt::WindowAttribute; namespace PosSize = ::com::sun::star::awt::PosSize; @@ -170,6 +171,15 @@ namespace sd { namespace colortoolpanel return m_xWindow; } + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL SingleColorPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException) + { + (void)i_rParentAccessible; + return Reference< XAccessible >( m_xWindow, UNO_QUERY ); + // TODO: this is, strictly, not correct, as we ignore i_ParentAccessible here. If you are not doing a sample + // extension only, you'll want to do this correctly .... + } + //------------------------------------------------------------------------------------------------------------------ Reference< XResourceId > SAL_CALL SingleColorPanel::getResourceId( ) throw (RuntimeException) { diff --git a/sd/workben/custompanel/ctp_panel.hxx b/sd/workben/custompanel/ctp_panel.hxx index e34d021f6..2aea52c0f 100644 --- a/sd/workben/custompanel/ctp_panel.hxx +++ b/sd/workben/custompanel/ctp_panel.hxx @@ -65,6 +65,7 @@ namespace sd { namespace colortoolpanel // XToolPanel virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL createAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& ParentAccessible ) throw (::com::sun::star::uno::RuntimeException); // XView // (no methods) -- cgit v1.2.3 From a268879a831922f6d595923c278d0e22c5b0248c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 13 Apr 2010 12:17:53 +0200 Subject: slidecopy: moved SD's task pane implementation to the new base implementation from SFX. Still not all previous functionality restored. --- .../ui/framework/factories/TaskPanelFactory.cxx | 5 +- .../ui/framework/factories/ViewShellWrapper.cxx | 90 +-- sd/source/ui/framework/tools/FrameworkHelper.cxx | 2 +- sd/source/ui/inc/framework/ViewShellWrapper.hxx | 33 +- sd/source/ui/inc/taskpane/PanelId.hxx | 5 + sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx | 26 +- sd/source/ui/toolpanel/CustomToolPanel.cxx | 290 ---------- sd/source/ui/toolpanel/CustomToolPanel.hxx | 113 ---- sd/source/ui/toolpanel/MethodGuard.hxx | 67 +++ sd/source/ui/toolpanel/StandardToolPanel.cxx | 163 ------ sd/source/ui/toolpanel/StandardToolPanel.hxx | 84 --- sd/source/ui/toolpanel/TaskPaneToolPanel.cxx | 101 ---- sd/source/ui/toolpanel/TaskPaneToolPanel.hxx | 97 ---- sd/source/ui/toolpanel/ToolPanel.cxx | 113 ++++ sd/source/ui/toolpanel/ToolPanel.hxx | 80 +++ sd/source/ui/toolpanel/ToolPanelDeck.cxx | 160 ------ sd/source/ui/toolpanel/ToolPanelDeck.hxx | 97 ---- sd/source/ui/toolpanel/ToolPanelFactory.cxx | 255 ++++++++ sd/source/ui/toolpanel/ToolPanelUIElement.cxx | 134 +++++ sd/source/ui/toolpanel/ToolPanelUIElement.hxx | 87 +++ sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 639 ++++++++------------- sd/source/ui/toolpanel/makefile.mk | 7 +- sd/source/ui/unoidl/facreg.cxx | 25 + sd/source/ui/view/drvwshrg.cxx | 1 + 24 files changed, 1043 insertions(+), 1631 deletions(-) delete mode 100644 sd/source/ui/toolpanel/CustomToolPanel.cxx delete mode 100644 sd/source/ui/toolpanel/CustomToolPanel.hxx create mode 100644 sd/source/ui/toolpanel/MethodGuard.hxx delete mode 100644 sd/source/ui/toolpanel/StandardToolPanel.cxx delete mode 100644 sd/source/ui/toolpanel/StandardToolPanel.hxx delete mode 100644 sd/source/ui/toolpanel/TaskPaneToolPanel.cxx delete mode 100644 sd/source/ui/toolpanel/TaskPaneToolPanel.hxx create mode 100644 sd/source/ui/toolpanel/ToolPanel.cxx create mode 100644 sd/source/ui/toolpanel/ToolPanel.hxx delete mode 100755 sd/source/ui/toolpanel/ToolPanelDeck.cxx delete mode 100644 sd/source/ui/toolpanel/ToolPanelDeck.hxx create mode 100644 sd/source/ui/toolpanel/ToolPanelFactory.cxx create mode 100644 sd/source/ui/toolpanel/ToolPanelUIElement.cxx create mode 100644 sd/source/ui/toolpanel/ToolPanelUIElement.hxx diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/sd/source/ui/framework/factories/TaskPanelFactory.cxx index 7091c64ab..e98d203fc 100644 --- a/sd/source/ui/framework/factories/TaskPanelFactory.cxx +++ b/sd/source/ui/framework/factories/TaskPanelFactory.cxx @@ -263,14 +263,15 @@ void SAL_CALL TaskPanelFactory::releaseResource ( const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) ); if ( pPaneViewShell != NULL ) { - toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( xResourceId->getResourceURL() ) ); + const ::rtl::OUString sPanelResourceURL( xResourceId->getResourceURL() ); + const toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sPanelResourceURL ) ); toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() ); if ( ( ePanelId != toolpanel::PID_UNKNOWN ) && ( pToolPanel != NULL ) ) { - pToolPanel->DeactivatePanel( ePanelId ); + pToolPanel->DeactivatePanel( sPanelResourceURL ); } else { diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx index 02b5b599e..fce2d2915 100644 --- a/sd/source/ui/framework/factories/ViewShellWrapper.cxx +++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx @@ -69,8 +69,7 @@ ViewShellWrapper::ViewShellWrapper ( : ViewShellWrapperInterfaceBase(MutexOwner::maMutex), mpViewShell(pViewShell), mxViewId(rxViewId), - mxWindow(rxWindow), - mbIsPane( pViewShell == NULL ? false : ( pViewShell->GetShellType() == ViewShell::ST_TASK_PANE ) ) + mxWindow(rxWindow) { if (rxWindow.is()) { @@ -118,93 +117,6 @@ void SAL_CALL ViewShellWrapper::disposing (void) -//----- XInterface ------------------------------------------------------------ - -Any SAL_CALL ViewShellWrapper::queryInterface( const Type& i_rType ) throw (RuntimeException) -{ - Any aInterface( ViewShellWrapperInterfaceBase::queryInterface( i_rType ) ); - if ( !aInterface.hasValue() ) - { - if ( mbIsPane ) - aInterface = ViewShellWrapper_PaneBase::queryInterface( i_rType ); - else - aInterface = ViewShellWrapper_ViewBase::queryInterface( i_rType ); - } - return aInterface; -} - -void SAL_CALL ViewShellWrapper::acquire() throw () -{ - ViewShellWrapperInterfaceBase::acquire(); -} - -void SAL_CALL ViewShellWrapper::release() throw () -{ - ViewShellWrapperInterfaceBase::release(); -} - -//----- XTypeProvider --------------------------------------------------------- - -Sequence< Type > SAL_CALL ViewShellWrapper::getTypes( ) throw (RuntimeException) -{ - const Sequence< Type > aCommonTypes( ViewShellWrapperInterfaceBase::getTypes() ); - const Sequence< Type > aSpecialTypes( - mbIsPane - ? ViewShellWrapper_PaneBase::getTypes() - : ViewShellWrapper_ViewBase::getTypes() - ); - return ::comphelper::concatSequences( aCommonTypes, aSpecialTypes ); -} - -Sequence< ::sal_Int8 > SAL_CALL ViewShellWrapper::getImplementationId( ) throw (RuntimeException) -{ - static ::cppu::OImplementationId* pViewId = NULL; - static ::cppu::OImplementationId* pPaneId = NULL; - if ( !pViewId ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pViewId ) - { - static ::cppu::OImplementationId aViewId; - static ::cppu::OImplementationId aPaneId; - pViewId = &aViewId; - pPaneId = &aPaneId; - } - } - - return ( mbIsPane ? pPaneId : pViewId )->getImplementationId(); -} - -//----- XPane ----------------------------------------------------------------- - -Reference< XInterface > ViewShellWrapper::impl_getPaneWindowOrCanvas( const bool i_bWindow ) -{ - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - ::osl::MutexGuard aGuard( maMutex ); - if ( !mpViewShell.get() ) - throw DisposedException( ::rtl::OUString(), *this ); - - ToolPanelViewShell* pToolPanelShell = dynamic_cast< ToolPanelViewShell* >( mpViewShell.get() ); - ENSURE_OR_RETURN( pToolPanelShell != NULL, "XPane should be accessible for a ToolPanelViewShell only", NULL ); - - ::Window* pPaneWindow = pToolPanelShell->GetToolPanelParentWindow(); - ENSURE_OR_RETURN( pPaneWindow, "shell is not able to provide a panel parent", NULL ); - - if ( i_bWindow ) - return VCLUnoHelper::GetInterface( pPaneWindow ); - return pPaneWindow->GetCanvas(); -} - -Reference< XWindow > SAL_CALL ViewShellWrapper::getWindow() throw (RuntimeException) -{ - return Reference< XWindow >( impl_getPaneWindowOrCanvas( true ), UNO_QUERY ); -} - -Reference< XCanvas > SAL_CALL ViewShellWrapper::getCanvas() throw (RuntimeException) -{ - return Reference< XCanvas >( impl_getPaneWindowOrCanvas( false ), UNO_QUERY ); -} - //----- XResource ------------------------------------------------------------- Reference SAL_CALL ViewShellWrapper::getResourceId (void) diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index d04cde395..05d200347 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -222,7 +222,7 @@ const OUString FrameworkHelper::msViewTabBarURL( // Task panel URLs. const ::rtl::OUString FrameworkHelper::msTaskPanelURLPrefix( - OUString::createFromAscii("private:resource/toolpanel/")); + OUString::createFromAscii("private:resource/toolpanel/DrawingFramework/")); const ::rtl::OUString FrameworkHelper::msMasterPagesTaskPanelURL( msTaskPanelURLPrefix + OUString::createFromAscii("MasterPages")); const ::rtl::OUString FrameworkHelper::msLayoutTaskPanelURL( diff --git a/sd/source/ui/inc/framework/ViewShellWrapper.hxx b/sd/source/ui/inc/framework/ViewShellWrapper.hxx index 0d049b4ce..9d2337db6 100644 --- a/sd/source/ui/inc/framework/ViewShellWrapper.hxx +++ b/sd/source/ui/inc/framework/ViewShellWrapper.hxx @@ -33,26 +33,22 @@ #include "MutexOwner.hxx" #include -#include #include #include #include #include -#include +#include #include #include namespace { -typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::lang::XUnoTunnel +typedef ::cppu::WeakComponentImplHelper4 < ::com::sun::star::lang::XUnoTunnel , ::com::sun::star::awt::XWindowListener , ::com::sun::star::drawing::framework::XRelocatableResource + , ::com::sun::star::drawing::framework::XView > ViewShellWrapperInterfaceBase; -typedef ::cppu::ImplHelper1 < ::com::sun::star::drawing::framework::XView - > ViewShellWrapper_ViewBase; -typedef ::cppu::ImplHelper1 < ::com::sun::star::drawing::framework::XPane - > ViewShellWrapper_PaneBase; } // end of anonymous namespace. @@ -66,8 +62,6 @@ namespace sd { namespace framework { */ class ViewShellWrapper :private sd::MutexOwner ,public ViewShellWrapperInterfaceBase - ,public ViewShellWrapper_ViewBase - ,public ViewShellWrapper_PaneBase { public: /** Create a new ViewShellWrapper object that wraps the given ViewShell @@ -103,22 +97,6 @@ public: virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence& rId) throw (com::sun::star::uno::RuntimeException); - // 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 (); - - // 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); - - // XPane - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > SAL_CALL getCanvas( ) throw (::com::sun::star::uno::RuntimeException); - // XResource virtual ::com::sun::star::uno::Reference @@ -166,11 +144,6 @@ private: ::boost::shared_ptr< ViewShell > mpViewShell; const ::com::sun::star::uno::Reference< com::sun::star::drawing::framework::XResourceId > mxViewId; ::com::sun::star::uno::Reference mxWindow; - const bool mbIsPane; - -private: - // only to be called when mbIsPane is - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > impl_getPaneWindowOrCanvas( const bool i_bWindow ); }; } } // end of namespace sd::framework diff --git a/sd/source/ui/inc/taskpane/PanelId.hxx b/sd/source/ui/inc/taskpane/PanelId.hxx index 4577f54c3..020e4c3e2 100644 --- a/sd/source/ui/inc/taskpane/PanelId.hxx +++ b/sd/source/ui/inc/taskpane/PanelId.hxx @@ -27,6 +27,11 @@ #ifndef SD_UI_TASKPANE_PANELID_HXX #define SD_UI_TASKPANE_PANELID_HXX +namespace rtl +{ + class OUString; +} + //...................................................................................................................... namespace sd { namespace toolpanel { diff --git a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx index 6f35893a8..6a29ee9dd 100644 --- a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx +++ b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx @@ -45,6 +45,10 @@ class PopupMenu; +namespace com { namespace sun { namespace star { namespace ui { + class XUIElement; +} } } } + namespace sd { class PaneDockingWindow; @@ -53,7 +57,6 @@ class TaskPaneShellManager; class TitleToolBox; class TitleBar; class TitledControl; -class ToolPanelDeck; class ToolPanelViewShell_Impl; /** The tool panel is a view shell for some very specific reasons: - It fits better into the concept of panes being docking windows whose @@ -99,17 +102,9 @@ public: TaskPaneShellManager& GetSubShellManager (void) const; - /** returns the window which should be used as parent for tool panel windows - */ - ::Window* GetToolPanelParentWindow(); - - /** activates the given panel, bypassing the configuration controller, deactivates the previously active one. - */ - void ActivatePanel( const PanelId i_ePanelId ); - /** deactivates the given panel, bypassing the configuration controller */ - void DeactivatePanel( const PanelId i_ePanelId ); + void DeactivatePanel( const ::rtl::OUString& i_rPanelResourceURL ); /** Return a pointer to the docking window that is the parent or a predecessor of the content window. @@ -137,6 +132,17 @@ public: */ virtual bool RelocateToParentWindow (::Window* pParentWindow); + /// returns if and only if the given window is the panel anchor window of our ToolPanelDeck + bool IsPanelAnchorWindow( const ::Window& i_rWindow ) const; + + /** creates an XUIElement for the given standard panel + */ + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > + CreatePanelUIElement( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocFrame, + const ::rtl::OUString& i_rPanelResourceURL + ); + private: ::boost::scoped_ptr< ToolPanelViewShell_Impl > mpImpl; diff --git a/sd/source/ui/toolpanel/CustomToolPanel.cxx b/sd/source/ui/toolpanel/CustomToolPanel.cxx deleted file mode 100644 index fd48753ab..000000000 --- a/sd/source/ui/toolpanel/CustomToolPanel.cxx +++ /dev/null @@ -1,290 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#include "precompiled_sd.hxx" - -#include "CustomToolPanel.hxx" -#include "framework/FrameworkHelper.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include - -#if OSL_DEBUG_LEVEL > 0 -#include -#endif - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::drawing::framework::XConfigurationController; - using ::com::sun::star::drawing::framework::XResourceId; - using ::com::sun::star::drawing::framework::ResourceId; - using ::com::sun::star::drawing::framework::XResource; - using ::com::sun::star::awt::XWindow; - using ::com::sun::star::accessibility::XAccessible; - using ::com::sun::star::drawing::framework::XPane2; - /** === end UNO using === **/ - namespace PosSize = ::com::sun::star::awt::PosSize; - - //================================================================================================================== - //= helper - //================================================================================================================== - namespace - { - ::rtl::OUString lcl_getPanelConfig( const ::utl::OConfigurationNode& i_rPanelConfig, const sal_Char* i_pAsciiPropName ) - { - ::rtl::OUString sConfigValue; - OSL_VERIFY( i_rPanelConfig.getNodeValue( i_pAsciiPropName ) >>= sConfigValue ); - if ( sConfigValue.getLength() == 0 ) - { -#if OSL_DEBUG_LEVEL > 0 - ::rtl::OStringBuffer aMessage; - aMessage.append( "lcl_getPanelConfig: invalid config value (" ); - aMessage.append( i_pAsciiPropName ); - aMessage.append( ") for panel config '" ); - aMessage.append( ::rtl::OUStringToOString( i_rPanelConfig.getLocalName(), RTL_TEXTENCODING_UTF8 ) ); - aMessage.append( "'" ); - OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() ); -#endif - } - return sConfigValue; - } - } - - //================================================================================================================== - //= CustomToolPanel - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - CustomToolPanel::CustomToolPanel( ToolPanelDeck& i_rPanelDeck, const ::utl::OConfigurationNode& i_rPanelConfig, - const Reference< XResourceId >& i_rPaneResourceId, const ::boost::shared_ptr< framework::FrameworkHelper >& i_pFrameworkHelper ) - :TaskPaneToolPanel( i_rPanelDeck, lcl_getPanelConfig( i_rPanelConfig, "DisplayTitle" ), Image() /* TODO */, SmartId() /* TODO */ ) - ,m_pFrameworkHelper( i_pFrameworkHelper ) - ,m_xPanelResourceId() - ,m_xResource() - ,m_xToolPanel() - ,m_bAttemptedPanelCreation( false ) - ,m_nResourceAccessLock( 0 ) - { - ENSURE_OR_THROW( m_pFrameworkHelper.get() != NULL, "invalid framework helper" ); - ENSURE_OR_THROW( i_rPaneResourceId.is(), "invalid pane resource id" ); - try - { - ::rtl::OUString sPanelResourceURL( lcl_getPanelConfig( i_rPanelConfig, "ResourceURL" ) ); - m_xPanelResourceId.set( - ResourceId::createWithAnchor( - ::comphelper::getProcessComponentContext(), - sPanelResourceURL, - i_rPaneResourceId ), - UNO_SET_THROW - ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //------------------------------------------------------------------------------------------------------------------ - CustomToolPanel::~CustomToolPanel() - { - } - - //------------------------------------------------------------------------------------------------------------------ - void CustomToolPanel::Activate( ::Window& i_rParentWindow ) - { - OSL_ENSURE( &getPanelWindowAnchor() == &i_rParentWindow, - "CustomToolPanel::Activate: invalid new parent window" ); - // getPanelWindowAnchor() is what is returned in the TaskPane's XPane::getWindow method. So, - // any custom panel which is loaded into the TaskPane will use this window as parent window. - // Consequently, this is the window which shall be passed here, since this method is intended to - // re-create the panel with the given parent. - - // we do not need to do anything here. The XResourceFactory::createResource method of the custom - // tool panel already created and showed the window. - } - - //------------------------------------------------------------------------------------------------------------------ - void CustomToolPanel::Deactivate() - { - // When a certain tool panel is activated, this is routed through the drawing framework, which ensures - // that the resource associated with the previously active panel is deactivated, which calls the - // XResourceFactory::destroyResource at our custom panel's factory. - - // So, we do not have to do anything here - except forgetting the XResource, at it might (or might not, - // if cached by the factory) be re-created next time. - m_xResource.clear(); - m_xToolPanel.clear(); - m_bAttemptedPanelCreation = false; - } - - //------------------------------------------------------------------------------------------------------------------ - void CustomToolPanel::SetSizePixel( const Size& i_rPanelWindowSize ) - { - impl_ensurePanel(); - if ( !m_xToolPanel.is() ) - // if the custom panel does not support XPanel, this just means it is its own responsibility - // to resize/layout everything within the pane window. - return; - - try - { - Reference< XWindow > xPanelWindow( m_xToolPanel->getWindow(), UNO_SET_THROW ); - xPanelWindow->setPosSize( 0, 0, i_rPanelWindowSize.Width(), i_rPanelWindowSize.Height(), - PosSize::POSSIZE ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //------------------------------------------------------------------------------------------------------------------ - void CustomToolPanel::GrabFocus() - { - impl_ensurePanel(); - if ( !m_xToolPanel.is() ) - // if the custom panel does not support XPanel, this just means it is its own responsibility - // to care for focus handling - return; - - try - { - Reference< XWindow > xPanelWindow( m_xToolPanel->getWindow(), UNO_SET_THROW ); - xPanelWindow->setFocus(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //------------------------------------------------------------------------------------------------------------------ - void CustomToolPanel::Dispose() - { - // nothing to do here. Lifetime handling of the XResource which this panel represents is done by - // the drawing framework, we ourself do not have resources to release. - TaskPaneToolPanel::Dispose(); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > CustomToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) - { - ENSURE_OR_RETURN( !isDisposed(), "CustomToolPanel::CreatePanelAccessible: already disposed!", NULL ); - (void)i_rParentAccessible; - - // an XResource might also be an XPane2, which can provide an XAccessible. Check this first. - const Reference< XPane2 > xPane( m_xResource, UNO_QUERY ); - if ( xPane.is() ) - { - const Reference< XAccessible > xPaneAccessible( xPane->getAccessible() ); - if ( xPaneAccessible.is() ) - return xPaneAccessible; - } - - // if we have an XToolPanel, ask it for its XWindow, and query it - impl_ensurePanel(); - if ( !m_xToolPanel.is() ) - return NULL; - - const Reference< XAccessible > xPanelWindowAccessible( m_xToolPanel->getWindow(), UNO_QUERY ); - if ( xPanelWindowAccessible.is() ) - return xPanelWindowAccessible; - - // maybe the XToolPanel itself can provide an XAccessible? - const Reference< XAccessible > xPanelAccessible( m_xToolPanel, UNO_QUERY ); - if ( xPanelAccessible.is() ) - return xPanelAccessible; - - OSL_ENSURE( false, "CustomToolPanel::CreatePanelAccessible: no XAccessible for the custom panel!" ); - return NULL; - } - - //------------------------------------------------------------------------------------------------------------------ - void CustomToolPanel::LockResourceAccess() - { - ++m_nResourceAccessLock; - } - - //------------------------------------------------------------------------------------------------------------------ - void CustomToolPanel::UnlockResourceAccess() - { - OSL_ENSURE( m_nResourceAccessLock > 0, "CustomToolPanel::UnlockResourceAccess: not locked!" ); - --m_nResourceAccessLock; - } - - //------------------------------------------------------------------------------------------------------------------ - const Reference< XResourceId >& CustomToolPanel::getResourceId() const - { - return m_xPanelResourceId; - } - - //------------------------------------------------------------------------------------------------------------------ - void CustomToolPanel::impl_ensurePanel() - { - ENSURE_OR_RETURN_VOID( !isDisposed(), "already disposed" ); - - if ( ( m_nResourceAccessLock == 0 ) && !m_bAttemptedPanelCreation ) - { - m_bAttemptedPanelCreation = true; - - try - { - Reference< XConfigurationController > xConfigController( m_pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW ); - m_xResource.set( xConfigController->getResource( m_xPanelResourceId ), UNO_QUERY_THROW ); - m_xToolPanel.set( m_xResource, UNO_QUERY ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... - diff --git a/sd/source/ui/toolpanel/CustomToolPanel.hxx b/sd/source/ui/toolpanel/CustomToolPanel.hxx deleted file mode 100644 index d1dc96e9d..000000000 --- a/sd/source/ui/toolpanel/CustomToolPanel.hxx +++ /dev/null @@ -1,113 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef SD_TOOLPANEL_CUSTOMTOOLPANEL_HXX -#define SD_TOOLPANEL_CUSTOMTOOLPANEL_HXX - -#include "TaskPaneToolPanel.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include - -namespace utl -{ - class OConfigurationNode; -} - -namespace sd { namespace framework -{ - class FrameworkHelper; -} } - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - class ToolPanelDeck; - - //================================================================================================================== - //= CustomToolPanel - //================================================================================================================== - /** is a ::svt::IToolPanel implementation for custom tool panels, i.e. those defined in the configuration, and - implemented by external components. - */ - class CustomToolPanel : public TaskPaneToolPanel - { - public: - CustomToolPanel( - ToolPanelDeck& i_rPanelDeck, - const ::utl::OConfigurationNode& i_rPanelConfig, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPaneResourceId, - const ::boost::shared_ptr< framework::FrameworkHelper >& i_pFrameworkHelper - ); - ~CustomToolPanel(); - - // IToolPanel overridables - virtual void Activate( ::Window& i_rParentWindow ); - virtual void Deactivate(); - virtual void SetSizePixel( const Size& i_rPanelWindowSize ); - virtual void GrabFocus(); - virtual void Dispose(); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - CreatePanelAccessible( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible - ); - - /** locks (aka prevents) the access to the associated XResource object - */ - void LockResourceAccess(); - /** unlocks (aka allows) the access to the associated XResource object - */ - void UnlockResourceAccess(); - - protected: - // TaskPaneToolPanel overridables - virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const; - - private: - void impl_ensurePanel(); - - private: - ::boost::shared_ptr< framework::FrameworkHelper > m_pFrameworkHelper; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > m_xPanelResourceId; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResource > m_xResource; - ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel > m_xToolPanel; - bool m_bAttemptedPanelCreation; - sal_uInt32 m_nResourceAccessLock; - }; - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... - -#endif // SD_TOOLPANEL_CUSTOMTOOLPANEL_HXX diff --git a/sd/source/ui/toolpanel/MethodGuard.hxx b/sd/source/ui/toolpanel/MethodGuard.hxx new file mode 100644 index 000000000..a8f6d673e --- /dev/null +++ b/sd/source/ui/toolpanel/MethodGuard.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_METHODGUARD_HXX +#define SD_METHODGUARD_HXX + +#include + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + //================================================================================================================== + //= MethodGuard + //================================================================================================================== + template < class COMPONENT > + class MethodGuard + { + public: + MethodGuard( COMPONENT& i_rComponent ) + :m_aGuard( i_rComponent.getMutex() ) + { + i_rComponent.checkDisposed(); + } + + ~MethodGuard() + { + } + + inline void clear() + { + m_aGuard.clear(); + } + + private: + ::osl::ClearableMutexGuard m_aGuard; + }; + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... + +#endif // SD_METHODGUARD_HXX diff --git a/sd/source/ui/toolpanel/StandardToolPanel.cxx b/sd/source/ui/toolpanel/StandardToolPanel.cxx deleted file mode 100644 index ddf41dcf7..000000000 --- a/sd/source/ui/toolpanel/StandardToolPanel.cxx +++ /dev/null @@ -1,163 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#include "precompiled_sd.hxx" - -#include "StandardToolPanel.hxx" -#include "ToolPanelDeck.hxx" -#include "sdresid.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::drawing::framework::XResourceId; - using ::com::sun::star::accessibility::XAccessible; - /** === end UNO using === **/ - - //================================================================================================================== - //= StandardToolPanel - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - StandardToolPanel::StandardToolPanel( ToolPanelDeck& i_rPanelDeck, ::std::auto_ptr< ControlFactory >& i_rControlFactory, - const USHORT i_nTitleResId, const Image& i_rImage, const ULONG i_nHelpId, - const Reference< XResourceId >& i_rPanelResourceId ) - :TaskPaneToolPanel( i_rPanelDeck, SdResId( i_nTitleResId ), i_rImage, SmartId( i_nHelpId ) ) - ,m_pControlFactory( i_rControlFactory ) - ,m_xPanelResourceId( i_rPanelResourceId ) - { - ENSURE_OR_THROW( m_pControlFactory.get(), "illegal control factory" ); - } - - //------------------------------------------------------------------------------------------------------------------ - StandardToolPanel::~StandardToolPanel() - { - m_pControl.reset(); - } - - //------------------------------------------------------------------------------------------------------------------ - void StandardToolPanel::Activate( ::Window& i_rParentWindow ) - { - Window* pPanelWindow( impl_getPanelWindow() ); - ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to show" ); - pPanelWindow->SetPosSizePixel( Point(), i_rParentWindow.GetSizePixel() ); - pPanelWindow->Show(); - } - - //------------------------------------------------------------------------------------------------------------------ - void StandardToolPanel::Deactivate() - { - Window* pPanelWindow( impl_getPanelWindow() ); - ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to hide" ); - pPanelWindow->Hide(); - } - - //------------------------------------------------------------------------------------------------------------------ - void StandardToolPanel::SetSizePixel( const Size& i_rPanelWindowSize ) - { - Window* pPanelWindow( impl_getPanelWindow() ); - ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to resize" ); - pPanelWindow->SetSizePixel( i_rPanelWindowSize ); - } - - //------------------------------------------------------------------------------------------------------------------ - void StandardToolPanel::GrabFocus() - { - Window* pPanelWindow( impl_getPanelWindow() ); - ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to focus" ); - pPanelWindow->GrabFocus(); - } - - //------------------------------------------------------------------------------------------------------------------ - void StandardToolPanel::Dispose() - { - m_pControl.reset(); - TaskPaneToolPanel::Dispose(); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > StandardToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) - { - ENSURE_OR_RETURN( !isDisposed(), "already disposed!", NULL ); - - Window* pControlWindow( m_pControl->GetWindow() ); - - Reference< XAccessible > xControlAccessible( pControlWindow->GetAccessible( FALSE ) ); - if ( !xControlAccessible.is() ) - { - xControlAccessible = m_pControl->CreateAccessibleObject( i_rParentAccessible ); - OSL_ENSURE( xControlAccessible.is(), "StandardToolPanel::CreatePanelAccessible: invalid XAccessible returned by CreateAccessibleObject!" ); - pControlWindow->SetAccessible( xControlAccessible ); - } - return xControlAccessible; - } - - //------------------------------------------------------------------------------------------------------------------ - const Reference< XResourceId >& StandardToolPanel::getResourceId() const - { - return m_xPanelResourceId; - } - - //------------------------------------------------------------------------------------------------------------------ - ::Window* StandardToolPanel::impl_getPanelWindow() const - { - if ( const_cast< StandardToolPanel* >( this )->impl_ensureControl() ) - return m_pControl->GetWindow(); - return NULL; - } - - //------------------------------------------------------------------------------------------------------------------ - bool StandardToolPanel::impl_ensureControl() - { - if ( m_pControl.get() ) - return true; - if ( isDisposed() ) - return false; - m_pControl = m_pControlFactory->CreateControl( getPanelWindowAnchor() ); - return ( m_pControl.get() != NULL ); - } - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/StandardToolPanel.hxx b/sd/source/ui/toolpanel/StandardToolPanel.hxx deleted file mode 100644 index 4ef7979a0..000000000 --- a/sd/source/ui/toolpanel/StandardToolPanel.hxx +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef SD_TOOLPANEL_STANDARDTOOLPANEL_HXX -#define SD_TOOLPANEL_STANDARDTOOLPANEL_HXX - -#include "TaskPaneToolPanel.hxx" - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - //================================================================================================================== - //= StandardToolPanel - //================================================================================================================== - /** an IToolPanel implementation for one of the standard (aka built-in) tool panels - */ - class StandardToolPanel : public TaskPaneToolPanel - { - public: - StandardToolPanel( - ToolPanelDeck& i_rPanelDeck, - ::std::auto_ptr< ControlFactory >& i_rControlFactory, - const USHORT i_nTitleResId, - const Image& i_rImage, - const ULONG i_nHelpId, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPanelResourceId - ); - ~StandardToolPanel(); - - // IToolPanel overridables - virtual void Activate( ::Window& i_rParentWindow ); - virtual void Deactivate(); - virtual void SetSizePixel( const Size& i_rPanelWindowSize ); - virtual void GrabFocus(); - virtual void Dispose(); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - CreatePanelAccessible( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible - ); - - // TaskPaneToolPanel overridables - virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const; - - private: - bool impl_ensureControl(); - ::Window* impl_getPanelWindow() const; - - private: - ::std::auto_ptr< ControlFactory > m_pControlFactory; - ::std::auto_ptr< TreeNode > m_pControl; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > - m_xPanelResourceId; - }; - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... - -#endif // SD_TOOLPANEL_STANDARDTOOLPANEL_HXX diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx deleted file mode 100644 index 254518bfc..000000000 --- a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#include "precompiled_sd.hxx" - -#include "TaskPaneToolPanel.hxx" -#include "ToolPanelDeck.hxx" - -#include -#include - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::drawing::framework::XResourceId; - /** === end UNO using === **/ - - //================================================================================================================== - //= TaskPaneToolPanel - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - TaskPaneToolPanel::TaskPaneToolPanel( ToolPanelDeck& i_rPanelDeck, const String& i_rPanelName, const Image& i_rImage, - const SmartId& i_rHelpId ) - :m_pPanelDeck( &i_rPanelDeck ) - ,m_aPanelImage( i_rImage ) - ,m_sPanelName( i_rPanelName ) - ,m_aHelpId( i_rHelpId ) - { - } - - //------------------------------------------------------------------------------------------------------------------ - TaskPaneToolPanel::~TaskPaneToolPanel() - { - } - - //------------------------------------------------------------------------------------------------------------------ - Window& TaskPaneToolPanel::getPanelWindowAnchor() - { - OSL_ENSURE( !isDisposed(), "already disposed!" ); - return m_pPanelDeck->GetPanelWindowAnchor(); - } - - //------------------------------------------------------------------------------------------------------------------ - ::rtl::OUString TaskPaneToolPanel::GetDisplayName() const - { - return m_sPanelName; - } - - //------------------------------------------------------------------------------------------------------------------ - Image TaskPaneToolPanel::GetImage() const - { - return m_aPanelImage; - } - - //------------------------------------------------------------------------------------------------------------------ - void TaskPaneToolPanel::Dispose() - { - ENSURE_OR_RETURN_VOID( m_pPanelDeck, "disposed twice" ); - m_pPanelDeck = NULL; - } - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx deleted file mode 100644 index 0be00972f..000000000 --- a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx +++ /dev/null @@ -1,97 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef SD_TASKPANETOOLPANEL_HXX -#define SD_TASKPANETOOLPANEL_HXX - -#include "taskpane/TaskPaneControlFactory.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -#include - -#include -#include - -#include - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - class ToolPanelDeck; - - //================================================================================================================== - //= TaskPaneToolPanel - //================================================================================================================== - class TaskPaneToolPanel : public ::svt::ToolPanelBase - { - protected: - TaskPaneToolPanel( - ToolPanelDeck& i_rPanelDeck, - const String& i_rPanelName, - const Image& i_rImage, - const SmartId& i_rHelpId - ); - ~TaskPaneToolPanel(); - - public: - // IToolPanel overridables - virtual ::rtl::OUString GetDisplayName() const; - virtual Image GetImage() const; - virtual void Dispose(); - // those are still abstract, and waiting to be overloaded - virtual void Activate( ::Window& i_rParentWindow ) = 0; - virtual void Deactivate() = 0; - virtual void SetSizePixel( const Size& i_rPanelWindowSize ) = 0; - virtual void GrabFocus() = 0; - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - CreatePanelAccessible( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible - ) = 0; - - // own overridables - virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const = 0; - - protected: - bool isDisposed() const { return m_pPanelDeck == NULL; } - Window& getPanelWindowAnchor(); - - private: - ToolPanelDeck* m_pPanelDeck; - const Image m_aPanelImage; - const String m_sPanelName; - const SmartId m_aHelpId; - }; - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... - -#endif // SD_TASKPANETOOLPANEL_HXX diff --git a/sd/source/ui/toolpanel/ToolPanel.cxx b/sd/source/ui/toolpanel/ToolPanel.cxx new file mode 100644 index 000000000..2438ed521 --- /dev/null +++ b/sd/source/ui/toolpanel/ToolPanel.cxx @@ -0,0 +1,113 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_sd.hxx" + +#include "ToolPanel.hxx" +#include "MethodGuard.hxx" +#include + +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + +#include + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::lang::DisposedException; + using ::com::sun::star::awt::XWindow; + using ::com::sun::star::accessibility::XAccessible; + /** === end UNO using === **/ + + typedef MethodGuard< ToolPanel > ToolPanelGuard; + + //================================================================================================================== + //= ToolPanel + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ToolPanel::ToolPanel( ::std::auto_ptr< TreeNode >& i_rControl ) + :ToolPanel_Base( m_aMutex ) + ,m_pControl( i_rControl ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + ToolPanel::~ToolPanel() + { + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanel::checkDisposed() + { + if ( m_pControl.get() == NULL ) + throw DisposedException( ::rtl::OUString(), *this ); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XWindow > SAL_CALL ToolPanel::getWindow() throw (RuntimeException) + { + ToolPanelGuard aGuard( *this ); + return Reference< XWindow >( m_pControl->GetWindow()->GetComponentInterface(), UNO_QUERY_THROW ); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL ToolPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException) + { + ToolPanelGuard aGuard( *this ); + Reference< XAccessible > xAccessible( m_pControl->GetWindow()->GetAccessible( FALSE ) ); + if ( !xAccessible.is() ) + { + xAccessible.set( m_pControl->CreateAccessibleObject( i_rParentAccessible ) ); + m_pControl->GetWindow()->SetAccessible( xAccessible ); + } + return xAccessible; + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL ToolPanel::disposing() + { + m_pControl.reset(); + } + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanel.hxx b/sd/source/ui/toolpanel/ToolPanel.hxx new file mode 100644 index 000000000..f40873a41 --- /dev/null +++ b/sd/source/ui/toolpanel/ToolPanel.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_TOOLPANEL_HXX +#define SD_TOOLPANEL_HXX + +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + +#include +#include + +#include + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + class TreeNode; + + //================================================================================================================== + //= ToolPanel + //================================================================================================================== + typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XToolPanel + > ToolPanel_Base; + class ToolPanel :public ::cppu::BaseMutex + ,public ToolPanel_Base + { + public: + ToolPanel( + ::std::auto_ptr< TreeNode >& i_rControl + ); + + // XToolPanel + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL createAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& ParentAccessible ) throw (::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + ::osl::Mutex& getMutex() { return m_aMutex; } + void checkDisposed(); + + protected: + ~ToolPanel(); + + private: + ::std::auto_ptr< TreeNode > m_pControl; + }; + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... + +#endif // SD_TOOLPANEL_HXX diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.cxx b/sd/source/ui/toolpanel/ToolPanelDeck.cxx deleted file mode 100755 index 63873d1f9..000000000 --- a/sd/source/ui/toolpanel/ToolPanelDeck.cxx +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#include "precompiled_sd.hxx" - -#include "ToolPanelDeck.hxx" -#include "taskpane/ToolPanelViewShell.hxx" -#include "taskpane/ControlContainer.hxx" -#include "framework/FrameworkHelper.hxx" -#include "TaskPaneToolPanel.hxx" -#include "strings.hrc" -#include "sdresid.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -#include -#include -#include - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::drawing::framework::XResourceId; - using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE; - /** === end UNO using === **/ - using ::sd::framework::FrameworkHelper; - - //================================================================================================================== - //= ToolPanelDeck - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - ToolPanelDeck::ToolPanelDeck( Window& i_rParent, ToolPanelViewShell& i_rViewShell ) - :ToolPanelDeck_Base( i_rParent, WB_DIALOGCONTROL ) - ,m_rViewShell( i_rViewShell ) - { - SetDrawersLayout(); - - const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) ); - SetAccessibleName( sPaneTitle ); - SetAccessibleDescription( sPaneTitle ); - } - - //------------------------------------------------------------------------------------------------------------------ - ToolPanelDeck::~ToolPanelDeck() - { - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDeck::SetDrawersLayout() - { - const ::svt::PDeckLayouter pLayouter( GetLayouter() ); - const ::svt::DrawerDeckLayouter* pDrawerLayouter = dynamic_cast< const ::svt::DrawerDeckLayouter* >( pLayouter.get() ); - if ( pDrawerLayouter != NULL ) - // already have the proper layout - return; - SetLayouter( new ::svt::DrawerDeckLayouter( *this, *this ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDeck::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ) - { - ::svt::PDeckLayouter pLayouter( GetLayouter() ); - ::svt::TabDeckLayouter* pTabLayouter = dynamic_cast< ::svt::TabDeckLayouter* >( pLayouter.get() ); - if ( ( pTabLayouter != NULL ) - && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) - && ( pTabLayouter->GetTabItemContent() == i_eTabContent ) - ) - // already have the requested layout - return; - - if ( pTabLayouter && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) ) - { - // changing only the item content does not require a new layouter instance - pTabLayouter->SetTabItemContent( i_eTabContent ); - return; - } - - SetLayouter( new ::svt::TabDeckLayouter( *this, *this, i_eTabAlignment, i_eTabContent ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDeck::ActivatePanelDirectly( const ::boost::optional< size_t >& i_rPanel ) - { - ToolPanelDeck_Base::ActivatePanel( i_rPanel ); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDeck::ActivatePanelResource( const size_t i_nPanel ) - { - // determine resource ID for the given panel - ::svt::PToolPanel pPanel( GetPanel( i_nPanel ) ); - const TaskPaneToolPanel* pTaskPanePanel( dynamic_cast< const TaskPaneToolPanel* >( pPanel.get() ) ); - ENSURE_OR_RETURN_VOID( pTaskPanePanel, "did not find the right panel/type at the given position" ); - const Reference< XResourceId > xPanelId( pTaskPanePanel->getResourceId() ); - - // delegate the request to the configuration controller - ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rViewShell.GetViewShellBase() ) ); - pFrameworkHelper->GetConfigurationController()->requestResourceActivation( - xPanelId, ResourceActivationMode_REPLACE ); - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDeck::ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) - { - if ( !i_rPanel ) - { - // this is a de-activate request. Quite improbable that this really happens: We're within the overloaded - // version of IToolPanelDeck::ActivatePanel. The only instance which has access to this IToolPanel - // interface is the panel layouter, which is not expected to call us with a NULL panel position. - // All other instances should not have access to this method, as it is protected in this class here. - OSL_ENSURE( false, "ToolPanelDeck::ActivatePanel: is this legitimate?" ); - // well, handle it nonetheless. - ActivatePanelDirectly( i_rPanel ); - } - else - ActivatePanelResource( *i_rPanel ); - } - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.hxx b/sd/source/ui/toolpanel/ToolPanelDeck.hxx deleted file mode 100644 index 3be9e024b..000000000 --- a/sd/source/ui/toolpanel/ToolPanelDeck.hxx +++ /dev/null @@ -1,97 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef SD_TOOLPANELDECK_HXX -#define SD_TOOLPANELDECK_HXX - -#include "taskpane/TaskPaneTreeNode.hxx" -#include "taskpane/TaskPaneControlFactory.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -#include -#include -#include - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - class ToolPanelViewShell; - - //================================================================================================================== - //= ToolPanelDeck - //================================================================================================================== - typedef ::svt::ToolPanelDeck ToolPanelDeck_Base; - class ToolPanelDeck : public ToolPanelDeck_Base - { - public: - ToolPanelDeck( - ::Window& i_rParent, - ToolPanelViewShell& i_rViewShell - ); - ~ToolPanelDeck(); - - /** activates a layout where the active panel is selected via tabs at the right/left/top/bottom (depending on - the given TabAlignment value). - */ - void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ); - - /** activates the "classical" layout with the panels being represneted by stacked drawers - */ - void SetDrawersLayout(); - - /** directly activates the given panel, without re-routing the activation request through the drawing - framework's configuration controller. - */ - void ActivatePanelDirectly( const ::boost::optional< size_t >& i_rPanel ); - - /** activates the given panel by delegating the acvtivation request to the drawing framework's configuration - controller. - */ - void ActivatePanelResource( const size_t i_nPanel ); - - protected: - // IToolPanelDeck - /** this method, which is part of the callback used by the PanelSelector, does not forward the request to - the base class. Instead, it forwards it to the ToolPanelViewShell, which transforms it into a request - to the drawing framework's configuration controller, which in turn will end up in our public - ActivatePanelDirectly method. - */ - virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ); - - private: - ToolPanelViewShell& m_rViewShell; - }; - -//...................................................................................................................... -} } // sd::toolpanel -//...................................................................................................................... - -#endif // SD_TOOLPANELDECK_HXX diff --git a/sd/source/ui/toolpanel/ToolPanelFactory.cxx b/sd/source/ui/toolpanel/ToolPanelFactory.cxx new file mode 100644 index 000000000..416b0e2a4 --- /dev/null +++ b/sd/source/ui/toolpanel/ToolPanelFactory.cxx @@ -0,0 +1,255 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_sd.hxx" + +#include "taskpane/ToolPanelViewShell.hxx" +#include "framework/FrameworkHelper.hxx" +#include "PaneChildWindows.hxx" +#include "ViewShellBase.hxx" +#include "app.hrc" + +/** === begin UNO includes === **/ +#include +#include +#include +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include +#include +#include +#include +#include +#include + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::XComponentContext; + using ::com::sun::star::ui::XUIElementFactory; + using ::com::sun::star::ui::XUIElement; + using ::com::sun::star::beans::PropertyValue; + using ::com::sun::star::container::NoSuchElementException; + using ::com::sun::star::lang::IllegalArgumentException; + using ::com::sun::star::lang::XServiceInfo; + using ::com::sun::star::lang::XInitialization; + using ::com::sun::star::frame::XFrame; + using ::com::sun::star::awt::XWindow; + /** === end UNO using === **/ + + //================================================================================================================== + //= ToolPanelFactory + //================================================================================================================== + typedef ::cppu::WeakImplHelper3 < XUIElementFactory + , XServiceInfo + , XInitialization + > ToolPanelFactory_Base; + class ToolPanelFactory : public ToolPanelFactory_Base + { + public: + ToolPanelFactory( const Reference< XComponentContext >& i_rContext ); + + // XUIElementFactory + virtual Reference< XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const Sequence< PropertyValue >& Args ) throw (NoSuchElementException, IllegalArgumentException, RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException); + virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException); + + protected: + virtual ~ToolPanelFactory(); + + private: + const Reference< XComponentContext > m_xContext; + }; + + //------------------------------------------------------------------------------------------------------------------ + Reference< XInterface > SAL_CALL ToolPanelFactory_createInstance( const Reference< XComponentContext >& i_rContext ) + { + return Reference< XInterface >( *new ToolPanelFactory( i_rContext ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString ToolPanelFactory_getImplementationName() throw(RuntimeException) + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.drawing.ToolPanelFactory" ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory_getSupportedServiceNames (void) + throw (RuntimeException) + { + const ::rtl::OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DefaultToolPanelFactory" ) ); + return Sequence< ::rtl::OUString >( &sServiceName, 1 ); + } + + //------------------------------------------------------------------------------------------------------------------ + ToolPanelFactory::ToolPanelFactory( const Reference< XComponentContext >& i_rContext ) + :m_xContext( i_rContext ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + ToolPanelFactory::~ToolPanelFactory() + { + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XUIElement > SAL_CALL ToolPanelFactory::createUIElement( const ::rtl::OUString& i_rResourceURL, const Sequence< PropertyValue >& i_rArgs ) throw (NoSuchElementException, IllegalArgumentException, RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + + const PanelId ePanelId( toolpanel::GetStandardPanelId( i_rResourceURL ) ); + if ( ePanelId == PID_UNKNOWN ) + throw NoSuchElementException( i_rResourceURL, *this ); + + const ::comphelper::NamedValueCollection aArgs( i_rArgs ); + const Reference< XFrame > xDocFrame( aArgs.getOrDefault( "Frame", Reference< XFrame >() ) ); + const Reference< XWindow > xParentWindow( aArgs.getOrDefault( "ParentWindow", Reference< XWindow >() ) ); + if ( !xDocFrame.is() || !xParentWindow.is() ) + throw IllegalArgumentException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "For creating a standard tool panel, a Frame and a Parent window are needed." ) ), + *this, + 2 + ); + + // look up the Sfx(View)Frame for the given XFrame + SfxViewFrame* pViewFrame = NULL; + for ( SfxFrame* pFrame = SfxFrame::GetFirst(); + pFrame != NULL; + pFrame = SfxFrame::GetNext( *pFrame ) + ) + { + if ( pFrame->GetFrameInterface() == xDocFrame ) + { + pViewFrame = pFrame->GetCurrentViewFrame(); + break; + } + } + + if ( !pViewFrame || !pViewFrame->HasChildWindow( SID_RIGHT_PANE ) ) + throw IllegalArgumentException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal frame." ) ), + *this, + 2 + ); + + // retrieve the task pane + ToolPanelChildWindow* pToolPanelWindow( dynamic_cast< ToolPanelChildWindow* >( pViewFrame->GetChildWindow( SID_RIGHT_PANE ) ) ); + if ( !pToolPanelWindow ) + throw IllegalArgumentException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No Impress document, or no Impress Task Pane." ) ), + *this, + 2 + ); + + // retrieve the ViewShellBase, and the view shell of the task pane + ViewShellBase* pViewShellBase = dynamic_cast< ViewShellBase* >( pViewFrame->GetViewShell() ); + ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper; + if ( pViewShellBase ) + pFrameworkHelper = framework::FrameworkHelper::Instance( *pViewShellBase ); + ::boost::shared_ptr< ViewShell > pViewShell; + if ( pFrameworkHelper.get() ) + pViewShell = pFrameworkHelper->GetViewShell( framework::FrameworkHelper::msRightPaneURL ); + ToolPanelViewShell* pToolPanelShell = dynamic_cast< ToolPanelViewShell* >( pViewShell.get() ); + + if ( !pToolPanelShell ) + throw IllegalArgumentException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Wrong document type." ) ), + *this, + 2 + ); + + ::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow ); + if ( !pParentWindow || !pToolPanelShell->IsPanelAnchorWindow( *pParentWindow ) ) + throw IllegalArgumentException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported parent window." ) ), + *this, + 2 + ); + + return pToolPanelShell->CreatePanelUIElement( xDocFrame, i_rResourceURL ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL ToolPanelFactory::getImplementationName( ) throw (RuntimeException) + { + return ToolPanelFactory_getImplementationName(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Bool SAL_CALL ToolPanelFactory::supportsService( const ::rtl::OUString& i_rServiceName ) throw (RuntimeException) + { + const Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() ); + for ( const ::rtl::OUString* pSupported = aSupported.getConstArray(); + pSupported != aSupported.getConstArray() + aSupported.getLength(); + ++pSupported + ) + if ( *pSupported == i_rServiceName ) + return sal_True; + + return sal_False; + } + + //------------------------------------------------------------------------------------------------------------------ + Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames( ) throw (RuntimeException) + { + return ToolPanelFactory_getSupportedServiceNames(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL ToolPanelFactory::initialize( const Sequence< Any >& i_rArguments ) throw (Exception, RuntimeException) + { + ::comphelper::NamedValueCollection aArgs( i_rArguments ); + (void)aArgs; + // TODO + } + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelUIElement.cxx b/sd/source/ui/toolpanel/ToolPanelUIElement.cxx new file mode 100644 index 000000000..b9b808133 --- /dev/null +++ b/sd/source/ui/toolpanel/ToolPanelUIElement.cxx @@ -0,0 +1,134 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_sd.hxx" + +#include "ToolPanelUIElement.hxx" +#include "MethodGuard.hxx" + +/** === begin UNO includes === **/ +#include +#include +/** === end UNO includes === **/ + +#include + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::frame::XFrame; + using ::com::sun::star::lang::XComponent; + using ::com::sun::star::ui::XToolPanel; + using ::com::sun::star::lang::DisposedException; + /** === end UNO using === **/ + namespace UIElementType = ::com::sun::star::ui::UIElementType; + + typedef MethodGuard< ToolPanelUIElement > UIElementMethodGuard; + + //================================================================================================================== + //= ToolPanelUIElement + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ToolPanelUIElement::ToolPanelUIElement( const Reference< XFrame >& i_rFrame, const ::rtl::OUString& i_rResourceURL, + const Reference< XToolPanel >& i_rToolPanel ) + :ToolPanelUIElement_Base( m_aMutex ) + ,m_xFrame( i_rFrame ) + ,m_sResourceURL( i_rResourceURL ) + ,m_xToolPanel( i_rToolPanel ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + ToolPanelUIElement::~ToolPanelUIElement() + { + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelUIElement::checkDisposed() + { + if ( !m_xToolPanel.is() ) + throw DisposedException( ::rtl::OUString(), *this ); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XFrame > SAL_CALL ToolPanelUIElement::getFrame() throw (RuntimeException) + { + UIElementMethodGuard aGuard( *this ); + return m_xFrame; + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL ToolPanelUIElement::getResourceURL() throw (RuntimeException) + { + UIElementMethodGuard aGuard( *this ); + return m_sResourceURL; + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Int16 SAL_CALL ToolPanelUIElement::getType() throw (RuntimeException) + { + UIElementMethodGuard aGuard( *this ); + return UIElementType::TOOLPANEL; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XInterface > SAL_CALL ToolPanelUIElement::getRealInterface( ) throw (RuntimeException) + { + UIElementMethodGuard aGuard( *this ); + return m_xToolPanel.get(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL ToolPanelUIElement::disposing() + { + try + { + Reference< XComponent > xPanelComponent( m_xToolPanel, UNO_QUERY_THROW ); + xPanelComponent->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelUIElement.hxx b/sd/source/ui/toolpanel/ToolPanelUIElement.hxx new file mode 100644 index 000000000..4b0baf02c --- /dev/null +++ b/sd/source/ui/toolpanel/ToolPanelUIElement.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_TOOLPANELUIELEMENT_HXX +#define SD_TOOLPANELUIELEMENT_HXX + +/** === begin UNO includes === **/ +#include +#include +/** === end UNO includes === **/ + +#include +#include + +#include + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + class TreeNode; + + //================================================================================================================== + //= ToolPanelUIElement + //================================================================================================================== + typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XUIElement + > ToolPanelUIElement_Base; + class ToolPanelUIElement :public ::cppu::BaseMutex + ,public ToolPanelUIElement_Base + { + public: + ToolPanelUIElement( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, + const ::rtl::OUString& i_rResourceURL, + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel >& i_rToolPanel + ); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface( ) throw (::com::sun::star::uno::RuntimeException); + + void checkDisposed(); + ::osl::Mutex& getMutex() { return m_aMutex; } + + protected: + virtual ~ToolPanelUIElement(); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + private: + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; + const ::rtl::OUString m_sResourceURL; + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel > m_xToolPanel; + }; + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... + +#endif // SD_TOOLPANELUIELEMENT_HXX diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 08de566fe..3a6ab4d5a 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -31,18 +31,18 @@ #include "TaskPaneShellManager.hxx" #include "TaskPaneFocusManager.hxx" -#include "StandardToolPanel.hxx" -#include "CustomToolPanel.hxx" +#include "taskpane/TaskPaneControlFactory.hxx" #include "controls/MasterPagesPanel.hxx" #include "LayoutMenu.hxx" #include "controls/TableDesignPanel.hxx" #include "controls/CustomAnimationPanel.hxx" #include "controls/SlideTransitionPanel.hxx" #include "controls/MasterPagesSelector.hxx" +#include "ToolPanel.hxx" +#include "ToolPanelUIElement.hxx" #include "PaneDockingWindow.hxx" #include "FrameView.hxx" #include "Window.hxx" -#include "ToolPanelDeck.hxx" #include "sdmod.hxx" #include "app.hrc" #include "glob.hrc" @@ -56,10 +56,14 @@ #include #include #include +#include #include /** === end UNO includes === **/ +#include +#include #include +#include #include #include #include @@ -114,6 +118,9 @@ using ::com::sun::star::drawing::framework::XConfigurationControllerBroadcaster; using ::com::sun::star::drawing::framework::XConfigurationController; using ::com::sun::star::drawing::framework::XConfiguration; using ::com::sun::star::drawing::framework::AnchorBindingMode_DIRECT; +using ::com::sun::star::ui::XUIElement; +using ::com::sun::star::ui::XToolPanel; +using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE; /** === end UNO using === **/ using ::sd::framework::FrameworkHelper; @@ -225,42 +232,26 @@ public: PanelSelectorLayout GetLayout() const { return m_eCurrentLayout; } - /** called by our configuration controller listener when the request to activate a tool panel has been observed. + /** activates the panel which has the given resource URL */ - void OnToolPanelActivationRequest( const ::rtl::OUString& i_rResourceURL ); + void ActivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL ); - /** provides access to the the VCL window of the panel deck - */ - ::Window& GetPanelDeck() { return *m_pPanelDeck.get(); } - const ::Window& GetPanelDeck() const { return *m_pPanelDeck.get(); } + /** de-activates the panel given by its resource URL, bypassing the configuration controller - ::Window* GetToolPanelParentWindow() { return m_pPanelDeck.get() ? &m_pPanelDeck->GetPanelWindowAnchor() : NULL; } - - /** returns the logical number of panels. This is greater than or equal to the number of panels displayed in the - panel deck + If the panel is not active currently, nothing happens. */ - size_t GetPanelCount() const - { - return m_aPanels.size(); - } + void DeactivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL ); + + /** provides access to the the VCL window of the panel deck + */ + ::sfx2::ModuleTaskPane& GetTaskPane() { return *m_pTaskPane; } + const ::sfx2::ModuleTaskPane& GetTaskPane() const { return *m_pTaskPane; } - const PanelDescriptor& GetPanel( const size_t i_nLogicalPanelIndex ) const - { - return m_aPanels[ i_nLogicalPanelIndex ]; - } + ::svt::ToolPanelDeck& GetToolPanelDeck() { return GetTaskPane().GetPanelDeck(); } + const ::svt::ToolPanelDeck& GetToolPanelDeck() const { return GetTaskPane().GetPanelDeck(); } void TogglePanelVisibility( const size_t i_nLogicalPanelIndex ); - /** ensures the panel with the given ID is visible, and directly activates it, bypassing the configuration controller - */ - void ActivatePanelDirectly( const PanelId i_nPanelId ); - - /** de-activates the panel given by ID, bypassing the configuration controller - - If the panel is not active currently, nothing happens. - */ - void DeactivatePanelDirectly( const PanelId i_nPanelId ); - Reference< XAccessible > CreateAccessible( ::sd::Window& i_rWindow ); @@ -273,35 +264,27 @@ protected: virtual void Dying(); private: - void RegisterPanel( size_t i_nPosition, PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ); void UpdateDockingWindowTitle(); - /** creates the built-in panels, returns the position of the panel to initially activate - */ - struct PanelActivation + struct InitialPanel { - size_t nPanelPos; - bool bActivateAsResource; - - PanelActivation() - :nPanelPos( size_t( -1 ) ) - ,bActivateAsResource( true ) + ::rtl::OUString sPanelResourceURL; + bool bActivateDirectly; + InitialPanel() + :sPanelResourceURL() + ,bActivateDirectly( true ) { } }; - PanelActivation SetupDefaultPanels(); - - /** creates the custom panels - */ - void SetupCustomPanels(); - - typedef ::std::vector< PanelDescriptor > PanelDescriptors; - PanelDescriptors m_aPanels; - ToolPanelViewShell& m_rPanelViewShell; - ::boost::scoped_ptr< ToolPanelDeck > m_pPanelDeck; - ::rtl::Reference< ConfigurationListener > m_pConfigListener; - PanelSelectorLayout m_eCurrentLayout; - bool m_bInitialized; + InitialPanel DetermineInitialPanel(); + + typedef ::std::vector< PanelDescriptor > PanelDescriptors; + ToolPanelViewShell& m_rPanelViewShell; + ::boost::scoped_ptr< ::sfx2::ModuleTaskPane > m_pTaskPane; + //::boost::scoped_ptr< ToolPanelDeck > m_pPanelDeck; + ::rtl::Reference< ConfigurationListener > m_pConfigListener; + PanelSelectorLayout m_eCurrentLayout; + bool m_bInitialized; }; // ===================================================================================================================== @@ -335,17 +318,6 @@ void SAL_CALL ConfigurationListener::notifyConfigurationChange( const Configurat ::osl::MutexGuard aGuard( m_aMutex ); impl_checkDisposed_throw(); -// if ( i_rEvent.Type == FrameworkHelper::msConfigurationUpdateStartEvent ) -// { -// m_pShellImpl->GetPanelDeck().SetUpdateMode( FALSE ); -// return; -// } -// if ( i_rEvent.Type == FrameworkHelper::msConfigurationUpdateEndEvent ) -// { -// m_pShellImpl->GetPanelDeck().SetUpdateMode( TRUE ); -// return; -// } -// // is this an event we're interested in? if ( i_rEvent.Type != FrameworkHelper::msResourceActivationEvent ) return; @@ -360,7 +332,7 @@ void SAL_CALL ConfigurationListener::notifyConfigurationChange( const Configurat if ( sAnchorURL != FrameworkHelper::msTaskPaneURL ) return; - m_pShellImpl->OnToolPanelActivationRequest( i_rEvent.ResourceId->getResourceURL() ); + m_pShellImpl->ActivatePanelByResource( i_rEvent.ResourceId->getResourceURL() ); } // --------------------------------------------------------------------------------------------------------------------- @@ -410,75 +382,17 @@ SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL)) TYPEINIT1(ToolPanelViewShell, ViewShell); // --------------------------------------------------------------------------------------------------------------------- -ToolPanelViewShell_Impl::PanelActivation ToolPanelViewShell_Impl::SetupDefaultPanels() +ToolPanelViewShell_Impl::InitialPanel ToolPanelViewShell_Impl::DetermineInitialPanel() { - typedef std::auto_ptr (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell ); - - struct PanelDescriptor - { - ControlFactoryFactory pFactory; - const sal_Char* pImageCommandName; - USHORT nTitleResourceID; - ULONG nHelpID; - PanelId nPanelID; - ::rtl::OUString sResourceURL; - }; - - PanelDescriptor aPanels[] = - { - // "Master Pages" - { &controls::MasterPagesPanel::CreateControlFactory, - "PresentationLayout", - STR_TASKPANEL_MASTER_PAGE_TITLE, - HID_SD_SLIDE_DESIGNS, - PID_MASTER_PAGES, - FrameworkHelper::msMasterPagesTaskPanelURL - }, - // "Layout" - { &LayoutMenu::CreateControlFactory, - "ModifyPage", - STR_TASKPANEL_LAYOUT_MENU_TITLE, - HID_SD_SLIDE_LAYOUTS, - PID_LAYOUT, - FrameworkHelper::msLayoutTaskPanelURL - }, - // "Tables Design" - { &controls::TableDesignPanel::CreateControlFactory, - "InsertTable", - DLG_TABLEDESIGNPANE, - HID_SD_TABLE_DESIGN, - PID_TABLE_DESIGN, - FrameworkHelper::msTableDesignPanelURL - }, - // "Custom Animation" - { &controls::CustomAnimationPanel::CreateControlFactory, - "CustomAnimation", - STR_CUSTOMANIMATIONPANE, - HID_SD_CUSTOM_ANIMATIONS, - PID_CUSTOM_ANIMATION, - FrameworkHelper::msCustomAnimationTaskPanelURL - }, - // "Slide Transition" - { &controls::SlideTransitionPanel::CreateControlFactory, - "RehearseTimings", - STR_SLIDE_TRANSITION_PANE, - HID_SD_SLIDE_TRANSITIONS, - PID_SLIDE_TRANSITION, - FrameworkHelper::msSlideTransitionTaskPanelURL - } - }; - - // compose the resource ID for the ToolPanel view - ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) ); - const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ) ); - - // determine which panel should be activated initially. - // Default to PID_LAYOUT, but check whether the requested configuration already contains a tool panel, in this case, + // Default to Layout panel, but check whether the requested configuration already contains a tool panel, in this case, // use that one. - PanelId nPanelToActivate = PID_LAYOUT; - PanelActivation aPanelToActivate; + InitialPanel aPanelToActivate; + aPanelToActivate.sPanelResourceURL = FrameworkHelper::msLayoutTaskPanelURL; + aPanelToActivate.bActivateDirectly = false; try { + ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) ); + const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ) ); Reference< XConfigurationController > xCC( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW ); Reference< XConfiguration > xConfiguration( xCC->getRequestedConfiguration(), UNO_QUERY_THROW ); Sequence< Reference< XResourceId > > aViewIds( xConfiguration->getResources( @@ -491,8 +405,8 @@ ToolPanelViewShell_Impl::PanelActivation ToolPanelViewShell_Impl::SetupDefaultPa PanelId nRequestedPanel = GetStandardPanelId( sResourceURL ); if ( nRequestedPanel != PID_UNKNOWN ) { - nPanelToActivate = nRequestedPanel; - aPanelToActivate.bActivateAsResource = false; + aPanelToActivate.sPanelResourceURL = sResourceURL; + aPanelToActivate.bActivateDirectly = true; } } } @@ -500,74 +414,9 @@ ToolPanelViewShell_Impl::PanelActivation ToolPanelViewShell_Impl::SetupDefaultPa { DBG_UNHANDLED_EXCEPTION(); } - - // create the panels - Reference< XFrame > xFrame( m_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ); - const BOOL bHiContrast( m_pPanelDeck->GetSettings().GetStyleSettings().GetHighContrastMode() ); - for ( size_t i=0; i < sizeof( aPanels ) / sizeof( aPanels[0] ); ++i ) - { - // compose the command name, and obtain the image for it - ::rtl::OUStringBuffer aCommandName; - aCommandName.appendAscii( ".uno:" ); - aCommandName.appendAscii( aPanels[i].pImageCommandName ); - const Image aPanelImage( GetImage( xFrame, aCommandName.makeStringAndClear(), FALSE, bHiContrast ) ); - - // compose the resource ID of the panel - const Reference< XResourceId > xPanelId( pFrameworkHelper->CreateResourceId( aPanels[i].sResourceURL, xToolPanelId ) ); - - // create and insert the panel - ::std::auto_ptr< ControlFactory > pControlFactory( (*aPanels[i].pFactory)( m_rPanelViewShell ) ); - ::svt::PToolPanel pNewPanel( new StandardToolPanel( - *m_pPanelDeck, - pControlFactory, - aPanels[i].nTitleResourceID, - aPanelImage, - aPanels[i].nHelpID, - xPanelId - ) ); - const size_t nPanelPos = m_pPanelDeck->InsertPanel( pNewPanel, m_pPanelDeck->GetPanelCount() ); - - // remember it - RegisterPanel( nPanelPos, aPanels[i].nPanelID, pNewPanel ); - - if ( nPanelToActivate == aPanels[i].nPanelID ) - aPanelToActivate.nPanelPos = nPanelPos; - } - return aPanelToActivate; } -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::SetupCustomPanels() -{ - // compose the resource ID for the ToolPanel view - ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) ); - const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ) ); - - // get the config node holding the custom tool panel descriptions - ::utl::OConfigurationTreeRoot aConfig( ::comphelper::ComponentContext( ::comphelper::getProcessServiceFactory() ), - "/org.openoffice.Office.Impress/MultiPaneGUI/ToolPanel/CustomPanels", false ); - const Sequence< ::rtl::OUString > aCustomPanelDescs( aConfig.getNodeNames() ); - - // create panels - size_t nCustomPanelNo = 0; - for ( const ::rtl::OUString* panelNodeName = aCustomPanelDescs.getConstArray(); - panelNodeName != aCustomPanelDescs.getConstArray() + aCustomPanelDescs.getLength(); - ++panelNodeName - ) - { - ::utl::OConfigurationNode aPanelDesc( aConfig.openNode( *panelNodeName ) ); - - // create and insert the panel - ::svt::PToolPanel pNewPanel( new CustomToolPanel( *m_pPanelDeck, aPanelDesc, xToolPanelId, pFrameworkHelper ) ); - const size_t nPanelPos = m_pPanelDeck->InsertPanel( pNewPanel, m_pPanelDeck->GetPanelCount() ); - - // remember it - RegisterPanel( nPanelPos, PanelId( PID_FIRST_CUSTOM_PANEL + nCustomPanelNo ), pNewPanel ); - ++nCustomPanelNo; - } -} - // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell_Impl::Setup() { @@ -575,20 +424,26 @@ void ToolPanelViewShell_Impl::Setup() return; m_bInitialized = true; - // standard (built-in) panels - const PanelActivation aPanelToActivate = SetupDefaultPanels(); - - // custom panels - SetupCustomPanels(); - - // activate default panel - if ( aPanelToActivate.bActivateAsResource ) - m_pPanelDeck->ActivatePanelResource( aPanelToActivate.nPanelPos ); - else - m_pPanelDeck->ActivatePanelDirectly( aPanelToActivate.nPanelPos ); + // initially activate a panel + const InitialPanel aInitialPanel = DetermineInitialPanel(); + if ( aInitialPanel.sPanelResourceURL.getLength() ) + { + if ( aInitialPanel.bActivateDirectly ) + { + ActivatePanelByResource( aInitialPanel.sPanelResourceURL ); + } + else + { + ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) ); + const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( + FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL, aInitialPanel.sPanelResourceURL ) ); + pFrameworkHelper->GetConfigurationController()->requestResourceActivation( + xToolPanelId, ResourceActivationMode_REPLACE ); + } + } - // add as listener to the panel deck - m_pPanelDeck->AddListener( *this ); +// // add as listener to the panel deck +// m_pPanelDeck->AddListener( *this ); // initialize panel selector SetLayout( LAYOUT_DRAWERS, true ); @@ -596,7 +451,7 @@ void ToolPanelViewShell_Impl::Setup() // listen at the configuration m_pConfigListener.set( new ConfigurationListener( *this ) ); - m_pPanelDeck->Show(); + m_pTaskPane->Show(); } // --------------------------------------------------------------------------------------------------------------------- @@ -605,24 +460,24 @@ void ToolPanelViewShell_Impl::SetLayout( const PanelSelectorLayout i_eLayout, co if ( !i_bForce && ( m_eCurrentLayout == i_eLayout ) ) return; - switch ( i_eLayout ) - { - case LAYOUT_DRAWERS: - m_pPanelDeck->SetDrawersLayout(); - break; - case LAYOUT_TABS_TOP: - m_pPanelDeck->SetTabsLayout( ::svt::TABS_TOP, ::svt::TABITEM_IMAGE_ONLY ); - break; - case LAYOUT_TABS_BOTTOM: - m_pPanelDeck->SetTabsLayout( ::svt::TABS_BOTTOM, ::svt::TABITEM_IMAGE_ONLY ); - break; - case LAYOUT_TABS_LEFT: - m_pPanelDeck->SetTabsLayout( ::svt::TABS_LEFT, ::svt::TABITEM_IMAGE_ONLY ); - break; - case LAYOUT_TABS_RIGHT: - m_pPanelDeck->SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY ); - break; - } +// switch ( i_eLayout ) +// { +// case LAYOUT_DRAWERS: +// m_pPanelDeck->SetDrawersLayout(); +// break; +// case LAYOUT_TABS_TOP: +// m_pPanelDeck->SetTabsLayout( ::svt::TABS_TOP, ::svt::TABITEM_IMAGE_ONLY ); +// break; +// case LAYOUT_TABS_BOTTOM: +// m_pPanelDeck->SetTabsLayout( ::svt::TABS_BOTTOM, ::svt::TABITEM_IMAGE_ONLY ); +// break; +// case LAYOUT_TABS_LEFT: +// m_pPanelDeck->SetTabsLayout( ::svt::TABS_LEFT, ::svt::TABITEM_IMAGE_ONLY ); +// break; +// case LAYOUT_TABS_RIGHT: +// m_pPanelDeck->SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY ); +// break; +// } m_eCurrentLayout = i_eLayout; UpdateDockingWindowTitle(); } @@ -632,56 +487,45 @@ void ToolPanelViewShell_Impl::Cleanup() { if ( m_bInitialized ) { - m_pPanelDeck->RemoveListener( *this ); - // remove the panels which are not under the control of the panel deck currently - for ( PanelDescriptors::iterator panelPos = m_aPanels.begin(); - panelPos != m_aPanels.end(); - ++panelPos - ) - { - if ( panelPos->bHidden ) - panelPos->pPanel->Dispose(); - } - m_aPanels.clear(); - - if ( m_pConfigListener.is() ) - m_pConfigListener->dispose(); +// m_pPanelDeck->RemoveListener( *this ); +// // remove the panels which are not under the control of the panel deck currently +// for ( PanelDescriptors::iterator panelPos = m_aPanels.begin(); +// panelPos != m_aPanels.end(); +// ++panelPos +// ) +// { +// if ( panelPos->bHidden ) +// panelPos->pPanel->Dispose(); +// } +// m_aPanels.clear(); +// +// if ( m_pConfigListener.is() ) +// m_pConfigListener->dispose(); } - m_pPanelDeck.reset(); +// m_pPanelDeck.reset(); + m_pTaskPane.reset(); } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::OnToolPanelActivationRequest( const ::rtl::OUString& i_rResourceURL ) +void ToolPanelViewShell_Impl::ActivatePanelByResource( const ::rtl::OUString& i_rResourceURL ) { - // look up the panel which belongs to the given resource - for ( size_t i=0; i( rPanel.pPanel.get() ) ); - ENSURE_OR_CONTINUE( pPanel != NULL, "ToolPanelViewShell::OnToolPanelActivationRequest: illegal panel implementation!" ); - - Reference< XResourceId > xPanelId( pPanel->getResourceId() ); - ::rtl::OUString sPanelURL( xPanelId.is() ? xPanelId->getResourceURL() : ::rtl::OUString() ); - ENSURE_OR_CONTINUE( sPanelURL.getLength(), "illegal panel resource!" ); + // determine position of the requested panel + ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rResourceURL ); + OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::ActivatePanelByResource: illegal panel resource, or illegal panel deck setup!" ); + if ( !!aPanelPos ) + GetToolPanelDeck().ActivatePanel( *aPanelPos ); +} - if ( sPanelURL == i_rResourceURL ) - { - CustomToolPanel* pCustomPanel = dynamic_cast< CustomToolPanel* >( rPanel.pPanel.get() ); - OSL_ENSURE( ( pCustomPanel != NULL ) == ( rPanel.nId >= PID_FIRST_CUSTOM_PANEL ), - "ToolPanelViewShell::OnToolPanelActivationRequest: inconsistency!" ); - if ( pCustomPanel != NULL ) - { - // if that's a custom tool panel, then temporarily disable the access of the tool panel implementation - // to the XPane object. Otherwise, it would request this resource from the configuration controller during - // the below ActivatePanelDirectly call, which would fail, since the resource is just to be created. - pCustomPanel->LockResourceAccess(); - } - ActivatePanelDirectly( rPanel.nId ); - if ( pCustomPanel != NULL ) - { - pCustomPanel->UnlockResourceAccess(); - } - } +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell_Impl::DeactivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL ) +{ + // determine position of the requested panel + ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rPanelResourceURL ); + OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::DeactivatePanelByResource: illegal panel resource, or illegal panel deck setup!" ); + if ( !!aPanelPos ) + { + if ( GetToolPanelDeck().GetActivePanel() == *aPanelPos ) + GetToolPanelDeck().ActivatePanel( ::boost::optional< size_t >() ); } } @@ -775,7 +619,7 @@ void ToolPanelViewShell::ArrangeGUIElements() Initialize(); - mpImpl->GetPanelDeck().SetPosSizePixel( Point(), maViewSize ); + mpImpl->GetTaskPane().SetPosSizePixel( Point(), maViewSize ); } // --------------------------------------------------------------------------------------------------------------------- @@ -796,8 +640,8 @@ void ToolPanelViewShell::KeyInput( const KeyEvent& i_rKeyEvent ) const KeyCode nCode = i_rKeyEvent.GetKeyCode(); if ( nCode == KEY_RETURN ) { - if ( !mpImpl->GetPanelDeck().HasChildPathFocus() ) - mpImpl->GetPanelDeck().GrabFocus(); + if ( !mpImpl->GetTaskPane().HasChildPathFocus() ) + mpImpl->GetTaskPane().GrabFocus(); } else ViewShell::KeyInput( i_rKeyEvent, NULL ); @@ -921,14 +765,14 @@ IMPL_LINK(ToolPanelViewShell, MenuSelectHandler, Menu*, pMenu) // Add one entry for every tool panel element to individually make // them visible or hide them. USHORT nIndex = MID_FIRST_PANEL; - for ( size_t i=0; iGetPanelCount(); ++i, ++nIndex ) - { - const PanelDescriptor& rPanelDesc( mpImpl->GetPanel(i) ); - pMenu->InsertItem( nIndex, rPanelDesc.pPanel->GetDisplayName(), MIB_CHECKABLE ); - pMenu->SetUserValue( nIndex, rPanelDesc.nId ); - pMenu->CheckItem( nIndex, !rPanelDesc.bHidden ); - } - pMenu->InsertSeparator(); +// for ( size_t i=0; iGetPanelCount(); ++i, ++nIndex ) +// { +// const PanelDescriptor& rPanelDesc( mpImpl->GetPanel(i) ); +// pMenu->InsertItem( nIndex, rPanelDesc.pPanel->GetDisplayName(), MIB_CHECKABLE ); +// pMenu->SetUserValue( nIndex, rPanelDesc.nId ); +// pMenu->CheckItem( nIndex, !rPanelDesc.bHidden ); +// } +// pMenu->InsertSeparator(); #if OSL_DEBUG_LEVEL > 0 pMenu->InsertItem( MID_LAYOUT_TABS, String::CreateFromAscii( "Tab-Layout (exp.)" ), MIB_CHECKABLE ); @@ -1030,15 +874,15 @@ void ToolPanelViewShell::ConnectToDockingWindow() // Tell the focus manager that we want to pass the focus to our // child. - FocusManager::Instance().RegisterDownLink( GetParentWindow(), &mpImpl->GetPanelDeck() ); + FocusManager::Instance().RegisterDownLink( GetParentWindow(), &mpImpl->GetTaskPane() ); } // --------------------------------------------------------------------------------------------------------------------- bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow ) { ::Window* pOldParentWindow = GetParentWindow(); - FocusManager::Instance().RemoveLinks( pOldParentWindow, &mpImpl->GetPanelDeck() ); - FocusManager::Instance().RemoveLinks( &mpImpl->GetPanelDeck(), pOldParentWindow ); + FocusManager::Instance().RemoveLinks( pOldParentWindow, &mpImpl->GetTaskPane() ); + FocusManager::Instance().RemoveLinks( &mpImpl->GetTaskPane(), pOldParentWindow ); PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( GetDockingWindow() ); if ( pDockingWindow != NULL ) @@ -1055,36 +899,91 @@ bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow ) return true; } -// --------------------------------------------------------------------------------------------------------------------- -::Window* ToolPanelViewShell::GetToolPanelParentWindow() +//--------------------------------------------------------------------------------------------------------------------- +bool ToolPanelViewShell::IsPanelAnchorWindow( const ::Window& i_rWindow ) const +{ + return &mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() == &i_rWindow; +} + +//--------------------------------------------------------------------------------------------------------------------- +namespace { - return mpImpl->GetToolPanelParentWindow(); + typedef std::auto_ptr< ControlFactory > (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell ); + + struct PanelFactory + { + ControlFactoryFactory pFactory; + ULONG nHelpID; + PanelFactory( const ControlFactoryFactory i_pFactory, const ULONG i_nHelpID ) + :pFactory( i_pFactory ) + ,nHelpID( i_nHelpID ) + { + } + }; + + const PanelFactory lcl_describePanel( const PanelId i_ePanelId ) + { + switch ( i_ePanelId ) + { + case PID_MASTER_PAGES: + return PanelFactory( &controls::MasterPagesPanel::CreateControlFactory, HID_SD_SLIDE_DESIGNS ); + case PID_LAYOUT: + return PanelFactory( &LayoutMenu::CreateControlFactory, HID_SD_SLIDE_LAYOUTS ); + case PID_TABLE_DESIGN: + return PanelFactory( &controls::TableDesignPanel::CreateControlFactory, HID_SD_TABLE_DESIGN ); + case PID_CUSTOM_ANIMATION: + return PanelFactory( &controls::CustomAnimationPanel::CreateControlFactory, HID_SD_CUSTOM_ANIMATIONS ); + case PID_SLIDE_TRANSITION: + return PanelFactory( &controls::SlideTransitionPanel::CreateControlFactory, HID_SD_SLIDE_TRANSITIONS ); + default: + break; + } + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "illegal panel ID" ) ), NULL ); + } } //--------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::DeactivatePanel( const PanelId i_ePanelId ) +Reference< XUIElement > ToolPanelViewShell::CreatePanelUIElement( const Reference< XFrame >& i_rDocFrame, const ::rtl::OUString& i_rPanelResourceURL ) { - mpImpl->DeactivatePanelDirectly( i_ePanelId ); + const PanelId ePanelId( GetStandardPanelId( i_rPanelResourceURL ) ); + ENSURE_OR_RETURN( ePanelId != PID_UNKNOWN, "ToolPanelViewShell::CreatePanelUIElement: illegal panel URL!", NULL ); + + // a TreeNode which will resemble the panel + const PanelFactory aPanelFactory( lcl_describePanel( ePanelId ) ); + ::std::auto_ptr< ControlFactory > pControlFactory( (*aPanelFactory.pFactory)( *this ) ); + ::std::auto_ptr< TreeNode > pNode( pControlFactory->CreateControl( mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() ) ); + ENSURE_OR_THROW( ( pNode.get() != NULL ) && ( pNode->GetWindow() != NULL ), + "illegal node returned by the control factory" ); + pNode->GetWindow()->SetHelpId( aPanelFactory.nHelpID ); + + // create an XToolPanel + Reference< XToolPanel > xPanel( new ToolPanel( pNode ) ); + + // create an XUIElement providing this panel + const Reference< XUIElement > xUIElement( new ToolPanelUIElement( i_rDocFrame, i_rPanelResourceURL, xPanel ) ); + + return xUIElement; } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::ActivatePanel( const PanelId i_ePanelId ) +void ToolPanelViewShell::DeactivatePanel( const ::rtl::OUString& i_rPanelResourceURL ) { - mpImpl->ActivatePanelDirectly( i_ePanelId ); + mpImpl->DeactivatePanelByResource( i_rPanelResourceURL ); } - // ===================================================================================================================== // = ToolPanelViewShell_Impl - implementation // ===================================================================================================================== // --------------------------------------------------------------------------------------------------------------------- ToolPanelViewShell_Impl::ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent ) - :m_aPanels() - ,m_rPanelViewShell( i_rPanelViewShell ) - ,m_pPanelDeck( new ToolPanelDeck( i_rPanelDeckParent, i_rPanelViewShell ) ) + :m_rPanelViewShell( i_rPanelViewShell ) + ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ) ) ,m_eCurrentLayout( LAYOUT_DRAWERS ) ,m_bInitialized( false ) { + const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) ); + GetToolPanelDeck().SetAccessibleName( sPaneTitle ); + GetToolPanelDeck().SetAccessibleDescription( sPaneTitle ); } // --------------------------------------------------------------------------------------------------------------------- @@ -1095,72 +994,30 @@ ToolPanelViewShell_Impl::~ToolPanelViewShell_Impl() // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell_Impl::TogglePanelVisibility( const size_t i_nLogicalPanelIndex ) { - ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < m_aPanels.size(), "illegal index" ); - - // get the actual panel index, within the deck - size_t nActualPanelIndex(0); - for ( size_t i=0; i < i_nLogicalPanelIndex; ++i ) - { - if ( !m_aPanels[i].bHidden ) - ++nActualPanelIndex; - } - if ( m_aPanels[ i_nLogicalPanelIndex ].bHidden ) - { - OSL_VERIFY( m_pPanelDeck->InsertPanel( m_aPanels[ i_nLogicalPanelIndex ].pPanel, nActualPanelIndex ) == nActualPanelIndex ); - // if there has not been an active panel before, activate the newly inserted one - ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() ); - if ( !aActivePanel ) - m_pPanelDeck->ActivatePanelResource( nActualPanelIndex ); - } - else - { - OSL_VERIFY( m_pPanelDeck->RemovePanel( nActualPanelIndex ).get() == m_aPanels[ i_nLogicalPanelIndex ].pPanel.get() ); - } - m_aPanels[ i_nLogicalPanelIndex ].bHidden = !m_aPanels[ i_nLogicalPanelIndex ].bHidden; -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::DeactivatePanelDirectly( const PanelId i_nPanelId ) -{ - for ( size_t i=0; iGetActivePanel() == i ) - m_pPanelDeck->ActivatePanelDirectly( ::boost::optional< size_t >() ); - return; - } - } -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::ActivatePanelDirectly( const PanelId i_nPanelId ) -{ - size_t nActualPanelIndex(0); - for ( size_t i=0; iActivatePanelDirectly( nActualPanelIndex ); - return; - } - if ( !m_aPanels[i].bHidden ) - ++nActualPanelIndex; - } - OSL_ENSURE( false, "ToolPanelViewShell::ActivatePanelDirectly: don't have a panel with the given ID!" ); -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::RegisterPanel( size_t i_nPosition, PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ) -{ - if ( i_nPosition >= m_aPanels.size() ) - m_aPanels.resize( i_nPosition + 1 ); - - OSL_PRECOND( m_aPanels[ i_nPosition ].nId == PID_UNKNOWN, "ToolPanelViewShell_Impl::RegisterPanel: " - "already registered a panel for this ID!" ); - m_aPanels[ i_nPosition ] = PanelDescriptor( i_nPanelId, i_rPanel ); + OSL_ENSURE( false, "ToolPanelViewShell_Impl::TogglePanelVisibility: not yet re-implemented!" ); +// ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < m_aPanels.size(), "illegal index" ); +// +// // get the actual panel index, within the deck +// size_t nActualPanelIndex(0); +// for ( size_t i=0; i < i_nLogicalPanelIndex; ++i ) +// { +// if ( !m_aPanels[i].bHidden ) +// ++nActualPanelIndex; +// } +// if ( m_aPanels[ i_nLogicalPanelIndex ].bHidden ) +// { +// OSL_VERIFY( m_pPanelDeck->InsertPanel( m_aPanels[ i_nLogicalPanelIndex ].pPanel, nActualPanelIndex ) == nActualPanelIndex ); +// // if there has not been an active panel before, activate the newly inserted one +// ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() ); +// if ( !aActivePanel ) +// m_pPanelDeck->ActivatePanelResource( nActualPanelIndex ); +// } +// else +// { +// OSL_VERIFY( m_pPanelDeck->RemovePanel( nActualPanelIndex ).get() == m_aPanels[ i_nLogicalPanelIndex ].pPanel.get() ); +// } +// m_aPanels[ i_nLogicalPanelIndex ].bHidden = !m_aPanels[ i_nLogicalPanelIndex ].bHidden; + (void)i_nLogicalPanelIndex; } // --------------------------------------------------------------------------------------------------------------------- @@ -1179,28 +1036,28 @@ void ToolPanelViewShell_Impl::PanelRemoved( const size_t i_nPosition ) // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell_Impl::UpdateDockingWindowTitle() { - PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( m_rPanelViewShell.GetDockingWindow() ); - ENSURE_OR_RETURN_VOID( pDockingWindow, "ToolPanelViewShell_Impl::UpdateDockingWindowTitle: no PaneDockingWindow!?" ); - - ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() ); - if ( !aActivePanel || ( GetLayout() == LAYOUT_DRAWERS ) ) - pDockingWindow->SetTitle( String( SdResId( STR_RIGHT_PANE_TITLE ) ) ); - else - { - size_t nNewActive( *aActivePanel ); - for ( size_t i=0; i < m_aPanels.size(); ++i ) - { - if ( m_aPanels[i].bHidden ) - continue; - - if ( !nNewActive ) - { - pDockingWindow->SetTitle( m_aPanels[i].pPanel->GetDisplayName() ); - break; - } - --nNewActive; - } - } +// PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( m_rPanelViewShell.GetDockingWindow() ); +// ENSURE_OR_RETURN_VOID( pDockingWindow, "ToolPanelViewShell_Impl::UpdateDockingWindowTitle: no PaneDockingWindow!?" ); +// +// ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() ); +// if ( !aActivePanel || ( GetLayout() == LAYOUT_DRAWERS ) ) +// pDockingWindow->SetTitle( String( SdResId( STR_RIGHT_PANE_TITLE ) ) ); +// else +// { +// size_t nNewActive( *aActivePanel ); +// for ( size_t i=0; i < m_aPanels.size(); ++i ) +// { +// if ( m_aPanels[i].bHidden ) +// continue; +// +// if ( !nNewActive ) +// { +// pDockingWindow->SetTitle( m_aPanels[i].pPanel->GetDisplayName() ); +// break; +// } +// --nNewActive; +// } +// } } // --------------------------------------------------------------------------------------------------------------------- @@ -1230,9 +1087,11 @@ void ToolPanelViewShell_Impl::Dying() // --------------------------------------------------------------------------------------------------------------------- Reference< XAccessible > ToolPanelViewShell_Impl::CreateAccessible( ::sd::Window& i_rWindow ) { - ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow(); - m_pPanelDeck->SetAccessibleParentWindow( pAccessibleParent ); - return m_pPanelDeck->GetAccessible(); +// ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow(); +// m_pPanelDeck->SetAccessibleParentWindow( pAccessibleParent ); +// return m_pPanelDeck->GetAccessible(); + (void)i_rWindow; + return Reference< XAccessible >(); } // --------------------------------------------------------------------------------------------------------------------- diff --git a/sd/source/ui/toolpanel/makefile.mk b/sd/source/ui/toolpanel/makefile.mk index f9cd15685..a50355d18 100644 --- a/sd/source/ui/toolpanel/makefile.mk +++ b/sd/source/ui/toolpanel/makefile.mk @@ -58,11 +58,10 @@ SLOFILES = \ $(SLO)$/TaskPaneFocusManager.obj \ $(SLO)$/TaskPaneShellManager.obj \ $(SLO)$/TaskPaneTreeNode.obj \ + $(SLO)$/ToolPanel.obj \ $(SLO)$/ToolPanelViewShell.obj \ - $(SLO)$/ToolPanelDeck.obj \ - $(SLO)$/TaskPaneToolPanel.obj \ - $(SLO)$/CustomToolPanel.obj \ - $(SLO)$/StandardToolPanel.obj \ + $(SLO)$/ToolPanelFactory.obj \ + $(SLO)$/ToolPanelUIElement.obj \ \ $(SLO)$/EmptyWindow.obj \ $(SLO)$/LayoutMenu.obj \ diff --git a/sd/source/ui/unoidl/facreg.cxx b/sd/source/ui/unoidl/facreg.cxx index c68fe0473..a5ff18343 100644 --- a/sd/source/ui/unoidl/facreg.cxx +++ b/sd/source/ui/unoidl/facreg.cxx @@ -145,6 +145,17 @@ extern uno::Sequence SAL_CALL PresentationFactoryProvider_getSupported } } +namespace sd { namespace toolpanel { + +extern uno::Reference SAL_CALL ToolPanelFactory_createInstance( + const uno::Reference& rxContext) + throw(uno::Exception); +extern OUString ToolPanelFactory_getImplementationName(void) throw (uno::RuntimeException); +extern uno::Sequence SAL_CALL ToolPanelFactory_getSupportedServiceNames (void) + throw (uno::RuntimeException); + +} } + namespace sd { namespace presenter { extern uno::Reference SAL_CALL SlideRenderer_createInstance( const uno::Reference& rxContext) @@ -202,6 +213,7 @@ using namespace ::sd; using namespace ::sd::framework; using namespace ::sd::presenter; using namespace ::sd::slidesorter; +using namespace ::sd::toolpanel; @@ -225,6 +237,7 @@ enum FactoryId BasicToolBarFactoryFactoryId, BasicViewFactoryFactoryId, TaskPanelFactoryFactoryId, + ToolPanelFactoryFactoryId, ResourceIdFactoryId, PresentationFactoryProviderFactoryId, SlideRendererFactoryId, @@ -256,6 +269,7 @@ static ::boost::shared_ptr spFactoryMap; (*spFactoryMap)[BasicToolBarFactory_getImplementationName()] = BasicToolBarFactoryFactoryId; (*spFactoryMap)[BasicViewFactory_getImplementationName()] = BasicViewFactoryFactoryId; (*spFactoryMap)[TaskPanelFactory_getImplementationName()] = TaskPanelFactoryFactoryId; + (*spFactoryMap)[ToolPanelFactory_getImplementationName()] = ToolPanelFactoryFactoryId; (*spFactoryMap)[ResourceId_getImplementationName()] = ResourceIdFactoryId; (*spFactoryMap)[PresentationFactoryProvider_getImplementationName()] = PresentationFactoryProviderFactoryId; (*spFactoryMap)[SlideRenderer_getImplementationName()] = SlideRendererFactoryId; @@ -336,6 +350,10 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( pKey, sd::framework::TaskPanelFactory_getImplementationName(), sd::framework::TaskPanelFactory_getSupportedServiceNames()); + writeInfo( + pKey, + sd::toolpanel::ToolPanelFactory_getImplementationName(), + sd::toolpanel::ToolPanelFactory_getSupportedServiceNames()); writeInfo( pKey, sd::framework::ResourceId_getImplementationName(), @@ -487,6 +505,13 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( sd::framework::TaskPanelFactory_getSupportedServiceNames()); break; + case ToolPanelFactoryFactoryId: + xComponentFactory = ::cppu::createSingleComponentFactory( + sd::toolpanel::ToolPanelFactory_createInstance, + sd::toolpanel::ToolPanelFactory_getImplementationName(), + sd::toolpanel::ToolPanelFactory_getSupportedServiceNames()); + break; + case ResourceIdFactoryId: xComponentFactory = ::cppu::createSingleComponentFactory( sd::framework::ResourceId_createInstance, diff --git a/sd/source/ui/view/drvwshrg.cxx b/sd/source/ui/view/drvwshrg.cxx index 84f18651d..62528dd11 100644 --- a/sd/source/ui/view/drvwshrg.cxx +++ b/sd/source/ui/view/drvwshrg.cxx @@ -83,6 +83,7 @@ SFX_IMPL_INTERFACE(DrawViewShell, SfxShell, SdResId(STR_DRAWVIEWSHELL)) { SFX_POPUPMENU_REGISTRATION( SdResId(RID_DRAW_TEXTOBJ_INSIDE_POPUP) ); SFX_CHILDWINDOW_CONTEXT_REGISTRATION( SID_NAVIGATOR ); + SFX_CHILDWINDOW_REGISTRATION( SID_TASKPANE ); SFX_CHILDWINDOW_REGISTRATION( SfxTemplateDialogWrapper::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SvxFontWorkChildWindow::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SvxColorChildWindow::GetChildWindowId() ); -- cgit v1.2.3 From 9ce1485325f60de21825629e01466f6edfa3b3d9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 13 Apr 2010 12:20:58 +0200 Subject: slidecopy: the custom toolpanel example in sd/workben/custompanel is superseded by the one in sfx2/workben/custompanel --- sd/prj/build.lst | 1 - sd/workben/custompanel/Impress.xcu | 34 ----- sd/workben/custompanel/colorpanel.map | 8 -- sd/workben/custompanel/ctp_factory.cxx | 195 -------------------------- sd/workben/custompanel/ctp_factory.hxx | 114 --------------- sd/workben/custompanel/ctp_panel.cxx | 239 -------------------------------- sd/workben/custompanel/ctp_panel.hxx | 98 ------------- sd/workben/custompanel/ctp_services.cxx | 92 ------------ sd/workben/custompanel/delzip | 0 sd/workben/custompanel/description.xml | 16 --- sd/workben/custompanel/makefile.mk | 93 ------------- sd/workben/custompanel/manifest.xml | 8 -- 12 files changed, 898 deletions(-) delete mode 100644 sd/workben/custompanel/Impress.xcu delete mode 100644 sd/workben/custompanel/colorpanel.map delete mode 100644 sd/workben/custompanel/ctp_factory.cxx delete mode 100644 sd/workben/custompanel/ctp_factory.hxx delete mode 100644 sd/workben/custompanel/ctp_panel.cxx delete mode 100644 sd/workben/custompanel/ctp_panel.hxx delete mode 100644 sd/workben/custompanel/ctp_services.cxx delete mode 100644 sd/workben/custompanel/delzip delete mode 100644 sd/workben/custompanel/description.xml delete mode 100644 sd/workben/custompanel/makefile.mk delete mode 100644 sd/workben/custompanel/manifest.xml diff --git a/sd/prj/build.lst b/sd/prj/build.lst index 1b565ac71..bc8bf923f 100644 --- a/sd/prj/build.lst +++ b/sd/prj/build.lst @@ -44,4 +44,3 @@ sd sd\source\ui\framework\factories nmake - all sd_framework_factories sd sd sd\source\ui\framework\tools nmake - all sd_framework_tools sd_inc NULL sd sd\source\ui\annotations nmake - all sd_uiannotations sd_inc NULL sd sd\util nmake - all sd_util sd_app sd_cgm sd_core sd_dlg sd_docsh sd_eppt sd_filt sd_func sd_grf sd_unid sd_view sd_xml sd_html sd_ppt sd_accessibility sd_animations sd_toolpanel sd_toolpanel_controls sd_tools sd_slsshell sd_slsmodel sd_slsview sd_slscontroller sd_slscache sd_notes sd_table sd_slideshow sd_presenter sd_undo sd_helper sd_framework_configuration sd_framework_module sd_framework_tools sd_framework_factories sd_text sd_annotations sd_uiannotations NULL -sd sd\workben\custompanel nmake - all sd_workben_panel sd_inc NULL diff --git a/sd/workben/custompanel/Impress.xcu b/sd/workben/custompanel/Impress.xcu deleted file mode 100644 index 6f8ced492..000000000 --- a/sd/workben/custompanel/Impress.xcu +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - private:resource/toolpanel/SingleColorView - - - Single Color Panel - - - - - - - - - org.openoffice.example.colorpanel.ResourceFactory - - - - - private:resource/toolpanel/SingleColorView - - - - - - - - diff --git a/sd/workben/custompanel/colorpanel.map b/sd/workben/custompanel/colorpanel.map deleted file mode 100644 index f4ed78b9e..000000000 --- a/sd/workben/custompanel/colorpanel.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/sd/workben/custompanel/ctp_factory.cxx b/sd/workben/custompanel/ctp_factory.cxx deleted file mode 100644 index e38b23392..000000000 --- a/sd/workben/custompanel/ctp_factory.cxx +++ /dev/null @@ -1,195 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#include "precompiled_sd.hxx" - -#include "ctp_factory.hxx" -#include "ctp_panel.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -/** === end UNO includes === **/ - -//...................................................................................................................... -namespace sd { namespace colortoolpanel -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::drawing::framework::XResourceId; - using ::com::sun::star::drawing::framework::XResource; - using ::com::sun::star::lang::NotInitializedException; - using ::com::sun::star::lang::IllegalArgumentException; - using ::com::sun::star::drawing::framework::XResourceFactoryManager; - using ::com::sun::star::lang::WrappedTargetException; - using ::com::sun::star::lang::XComponent; - /** === end UNO using === **/ - - //================================================================================================================== - //= helper - //================================================================================================================== - namespace - { - const ::rtl::OUString& lcl_getSingleColorViewURL() - { - static ::rtl::OUString s_sSingleColorViewURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolpanel/SingleColorView" ) ); - return s_sSingleColorViewURL; - } - } - - //================================================================================================================== - //= ResourceFactory - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - ResourceFactory::ResourceFactory( const Reference< XComponentContext >& i_rContext ) - :m_xContext( i_rContext ) - { - } - - //------------------------------------------------------------------------------------------------------------------ - ResourceFactory::~ResourceFactory() - { - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XResource > SAL_CALL ResourceFactory::createResource( const Reference< XResourceId >& i_rResourceId ) throw (RuntimeException, IllegalArgumentException, WrappedTargetException) - { - FactoryGuard aGuard( *this ); - if ( !i_rResourceId.is() ) - throw IllegalArgumentException( ::rtl::OUString::createFromAscii( "illegal resource ID" ), *this, 1 ); - - const ::rtl::OUString sResourceURL( i_rResourceId->getResourceURL() ); - if ( sResourceURL != lcl_getSingleColorViewURL() ) - throw IllegalArgumentException( ::rtl::OUString::createFromAscii( "unsupported resource URL" ), *this, 1 ); - - return new SingleColorPanel( m_xContext, m_xControllerManager->getConfigurationController(), i_rResourceId ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL ResourceFactory::releaseResource( const Reference< XResource >& i_rResource ) throw (RuntimeException) - { - FactoryGuard aGuard( *this ); - - // here, we could decide to actually not destroy the resource, but cache it. In this case, we would need - // to re-parent the VCL window to another, temporary window, or *at least* hide it. - - // However, for the simplicity of this example, we will simply dispose the component here, which will destroy - // all associated resources, including the VCL window. - Reference< XComponent > xComponent( i_rResource, UNO_QUERY_THROW ); - xComponent->dispose(); - } - - //------------------------------------------------------------------------------------------------------------------ - ::rtl::OUString SAL_CALL ResourceFactory::getImplementationName( ) throw (RuntimeException) - { - return getImplementationName_static(); - } - - //------------------------------------------------------------------------------------------------------------------ - ::rtl::OUString SAL_CALL ResourceFactory::getImplementationName_static( ) throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.example.colorpanel.ResourceFactory" ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Bool SAL_CALL ResourceFactory::supportsService( const ::rtl::OUString& i_rServiceName ) throw (RuntimeException) - { - const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() ); - for ( const ::rtl::OUString* serviceName = aServiceNames.getConstArray(); - serviceName != aServiceNames.getConstArray() + aServiceNames.getLength(); - ++serviceName - ) - { - if ( i_rServiceName == *serviceName ) - return sal_True; - } - return sal_False; - } - - //------------------------------------------------------------------------------------------------------------------ - Sequence< ::rtl::OUString > SAL_CALL ResourceFactory::getSupportedServiceNames() throw (RuntimeException) - { - return getSupportedServiceNames_static(); - } - - //------------------------------------------------------------------------------------------------------------------ - Sequence< ::rtl::OUString > SAL_CALL ResourceFactory::getSupportedServiceNames_static() throw (RuntimeException) - { - Sequence< ::rtl::OUString > aServiceNames(1); - aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.example.colorpanel.ResourceFactory" ) ); - return aServiceNames; - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XInterface > SAL_CALL ResourceFactory::Create( const Reference< XComponentContext >& i_rContext ) throw (RuntimeException) - { - return *( new ResourceFactory( i_rContext ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - void ResourceFactory::checkInitialized( GuardAccess ) const - { - if ( !m_xControllerManager.is() ) - throw NotInitializedException( ::rtl::OUString(), *const_cast< ResourceFactory* >( this ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - void ResourceFactory::checkDisposed( GuardAccess ) const - { - // cannot be disposed currently ... - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL ResourceFactory::initialize( const Sequence< Any >& i_rArguments ) throw (Exception, RuntimeException) - { - if ( !i_rArguments.getLength() ) - throw IllegalArgumentException(); - - FactoryGuard aGuard( *this, false ); - m_xControllerManager.set( i_rArguments[0], UNO_QUERY_THROW ); - - Reference< XResourceFactoryManager > xFactoryManager( m_xControllerManager->getConfigurationController(), UNO_QUERY_THROW ); - xFactoryManager->addResourceFactory( lcl_getSingleColorViewURL(), this ); - } - -//...................................................................................................................... -} } // namespace sd::colortoolpanel -//...................................................................................................................... diff --git a/sd/workben/custompanel/ctp_factory.hxx b/sd/workben/custompanel/ctp_factory.hxx deleted file mode 100644 index ca0ed0ab3..000000000 --- a/sd/workben/custompanel/ctp_factory.hxx +++ /dev/null @@ -1,114 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef SD_WORKBENCH_CTP_FACTORY_HXX -#define SD_WORKBENCH_CTP_FACTORY_HXX - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include - -//...................................................................................................................... -namespace sd { namespace colortoolpanel -{ -//...................................................................................................................... - - class FactoryGuard; - - //================================================================================================================== - //= ResourceFactory - //================================================================================================================== - typedef ::cppu::WeakImplHelper3 < ::com::sun::star::drawing::framework::XResourceFactory - , ::com::sun::star::lang::XServiceInfo - , ::com::sun::star::lang::XInitialization - > ResourceFactory_Base; - class ResourceFactory :public ::cppu::BaseMutex - ,public ResourceFactory_Base - { - public: - ResourceFactory( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext - ); - ~ResourceFactory(); - - // XResourceFactory - virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResource > SAL_CALL createResource( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& xResourceId ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException); - virtual void SAL_CALL releaseResource( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResource >& xResource ) throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - static versions - static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext ) 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); - - public: - struct GuardAccess { friend class FactoryGuard; private: GuardAccess() { } }; - - void checkInitialized( GuardAccess ) const; - void checkDisposed( GuardAccess ) const; - ::osl::Mutex& getMutex( GuardAccess ) { return m_aMutex; } - - private: - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > - m_xContext; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XControllerManager > - m_xControllerManager; - }; - - class FactoryGuard - { - public: - FactoryGuard( ResourceFactory& i_rFactory, const bool i_bNeedInit = true ) - :m_aGuard( i_rFactory.getMutex( ResourceFactory::GuardAccess() ) ) - { - i_rFactory.checkDisposed( ResourceFactory::GuardAccess() ); - if ( i_bNeedInit ) - i_rFactory.checkInitialized( ResourceFactory::GuardAccess() ); - } - - protected: - ::osl::MutexGuard m_aGuard; - }; - -//...................................................................................................................... -} } // namespace sd::colortoolpanel -//...................................................................................................................... - -#endif // SD_WORKBENCH_CTP_FACTORY_HXX diff --git a/sd/workben/custompanel/ctp_panel.cxx b/sd/workben/custompanel/ctp_panel.cxx deleted file mode 100644 index 1aa0772c3..000000000 --- a/sd/workben/custompanel/ctp_panel.cxx +++ /dev/null @@ -1,239 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#include "precompiled_sd.hxx" - -#include "ctp_panel.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include - -//...................................................................................................................... -namespace sd { namespace colortoolpanel -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::drawing::framework::XConfigurationController; - using ::com::sun::star::drawing::framework::XResourceId; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::drawing::framework::XPane; - using ::com::sun::star::awt::XWindow; - using ::com::sun::star::rendering::XCanvas; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::awt::XWindowPeer; - using ::com::sun::star::lang::XMultiComponentFactory; - using ::com::sun::star::awt::XToolkit; - using ::com::sun::star::awt::WindowDescriptor; - using ::com::sun::star::awt::WindowClass_SIMPLE; - using ::com::sun::star::awt::Rectangle; - using ::com::sun::star::awt::PaintEvent; - using ::com::sun::star::lang::EventObject; - using ::com::sun::star::awt::XDevice; - using ::com::sun::star::awt::XGraphics; - /** === end UNO using === **/ - namespace WindowAttribute = ::com::sun::star::awt::WindowAttribute; - namespace PosSize = ::com::sun::star::awt::PosSize; - - //================================================================================================================== - //= helpers - //================================================================================================================== - namespace - { - Reference< XWindow > lcl_createPlainWindow_nothrow( const Reference< XComponentContext >& i_rContext, - const Reference< XWindowPeer >& i_rParentWindow ) - { - try - { - ENSURE_OR_THROW( i_rContext.is(), "illegal component context" ); - Reference< XMultiComponentFactory > xFactory( i_rContext->getServiceManager(), UNO_SET_THROW ); - Reference< XToolkit > xToolkit( xFactory->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ), - i_rContext - ), UNO_QUERY_THROW ); - - WindowDescriptor aWindow; - aWindow.Type = WindowClass_SIMPLE; - aWindow.WindowServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "window" ) ); - aWindow.Parent = i_rParentWindow; - aWindow.WindowAttributes = WindowAttribute::BORDER; - - Reference< XWindowPeer > xWindow( xToolkit->createWindow( aWindow ), UNO_SET_THROW ); - return Reference< XWindow >( xWindow, UNO_QUERY_THROW ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return NULL; - } - } - //================================================================================================================== - //= class SingleColorPanel - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - SingleColorPanel::SingleColorPanel( const Reference< XComponentContext >& i_rContext, - const Reference< XConfigurationController >& i_rConfigController, const Reference< XResourceId >& i_rResourceId ) - :SingleColorPanel_Base( m_aMutex ) - ,m_xContext( i_rContext ) - ,m_xResourceId( i_rResourceId ) - ,m_xWindow() - { - ENSURE_OR_THROW( i_rConfigController.is(), "invalid configuration controller" ); - ENSURE_OR_THROW( m_xResourceId.is(), "invalid resource id" ); - - // retrieve the parent window for our to-be-created pane window - Reference< XWindow > xParentWindow; - Reference< XWindowPeer > xParentPeer; - try - { - Reference< XResource > xAnchor( i_rConfigController->getResource( m_xResourceId->getAnchor() ), UNO_SET_THROW ); - Reference< XPane > xAnchorPane( xAnchor, UNO_QUERY_THROW ); - xParentWindow.set( xAnchorPane->getWindow(), UNO_SET_THROW ); - xParentPeer.set( xParentWindow, UNO_QUERY_THROW ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - osl_incrementInterlockedCount( &m_refCount ); - if ( xParentWindow.is() ) - { - m_xWindow = lcl_createPlainWindow_nothrow( m_xContext, xParentPeer ); - m_xWindow->addPaintListener( this ); - if ( m_xWindow.is() ) - { - const Rectangle aPanelAnchorSize( xParentWindow->getPosSize() ); - m_xWindow->setPosSize( 0, 0, aPanelAnchorSize.Width, aPanelAnchorSize.Height, PosSize::POSSIZE ); - m_xWindow->setVisible( sal_True ); - } - } - osl_decrementInterlockedCount( &m_refCount ); - } - - //------------------------------------------------------------------------------------------------------------------ - SingleColorPanel::~SingleColorPanel() - { - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XWindow > SAL_CALL SingleColorPanel::getWindow( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_xWindow.get() ) - throw DisposedException( ::rtl::OUString(), *this ); - return m_xWindow; - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XResourceId > SAL_CALL SingleColorPanel::getResourceId( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_xWindow.is() ) - throw DisposedException( ::rtl::OUString(), *this ); - return m_xResourceId; - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Bool SAL_CALL SingleColorPanel::isAnchorOnly( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_xWindow.is() ) - throw DisposedException( ::rtl::OUString(), *this ); - return sal_False; - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL SingleColorPanel::windowPaint( const PaintEvent& i_rEvent ) throw (RuntimeException) - { - try - { - const Reference< XDevice > xDevice( i_rEvent.Source, UNO_QUERY_THROW ); - const Reference< XGraphics > xGraphics( xDevice->createGraphics(), UNO_SET_THROW ); - xGraphics->setFillColor( 0x80 << 8 ); - xGraphics->setLineColor( 0x80 << 16 ); - - const Reference< XWindow > xWindow( i_rEvent.Source, UNO_QUERY_THROW ); - const Rectangle aWindowRect( xWindow->getPosSize() ); - xGraphics->drawRect( 0, 0, aWindowRect.Width - 1, aWindowRect.Height - 1 ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL SingleColorPanel::disposing( const EventObject& i_rSource ) throw (RuntimeException) - { - (void)i_rSource; - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL SingleColorPanel::disposing() - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_xWindow.is() ) - // already disposed - return; - m_xWindow->removePaintListener( this ); - try - { - Reference< XComponent > xWindowComp( m_xWindow, UNO_QUERY_THROW ); - xWindowComp->dispose(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - m_xWindow.clear(); - } - -//...................................................................................................................... -} } // namespace sd::colortoolpanel -//...................................................................................................................... diff --git a/sd/workben/custompanel/ctp_panel.hxx b/sd/workben/custompanel/ctp_panel.hxx deleted file mode 100644 index e34d021f6..000000000 --- a/sd/workben/custompanel/ctp_panel.hxx +++ /dev/null @@ -1,98 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef SD_WORKBENCH_CTP_PANEL_HXX -#define SD_WORKBENCH_CTP_PANEL_HXX - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include - -#include - -//...................................................................................................................... -namespace sd { namespace colortoolpanel -{ -//...................................................................................................................... - - //================================================================================================================== - //= class SingleColorPanel - //================================================================================================================== - typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::drawing::framework::XView - , ::com::sun::star::ui::XToolPanel - , ::com::sun::star::awt::XPaintListener - > SingleColorPanel_Base; - class SingleColorPanel :public ::cppu::BaseMutex - ,public SingleColorPanel_Base - { - public: - SingleColorPanel( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XConfigurationController >& i_rConfigController, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rResourceId - ); - - // XToolPanel - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow( ) throw (::com::sun::star::uno::RuntimeException); - - // XView - // (no methods) - - // XResource - virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > SAL_CALL getResourceId( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isAnchorOnly( ) throw (::com::sun::star::uno::RuntimeException); - - // XPaintListener - virtual void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) 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); - - // XComponent equivalents - virtual void SAL_CALL disposing(); - - protected: - ~SingleColorPanel(); - - private: - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > m_xResourceId; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow; - }; - -//...................................................................................................................... -} } // namespace sd::colortoolpanel -//...................................................................................................................... - -#endif // SD_WORKBENCH_CTP_PANEL_HXX diff --git a/sd/workben/custompanel/ctp_services.cxx b/sd/workben/custompanel/ctp_services.cxx deleted file mode 100644 index eccdb867e..000000000 --- a/sd/workben/custompanel/ctp_services.cxx +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#include "precompiled_sd.hxx" - -#include "ctp_factory.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include - -//...................................................................................................................... -namespace sd { namespace colortoolpanel -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - /** === end UNO using === **/ - - //================================================================================================================== - //= descriptors for the services implemented in this component - //================================================================================================================== - static struct ::cppu::ImplementationEntry s_aServiceEntries[] = - { - { - ResourceFactory::Create, - ResourceFactory::getImplementationName_static, - ResourceFactory::getSupportedServiceNames_static, - ::cppu::createSingleComponentFactory, NULL, 0 - }, - { 0, 0, 0, 0, 0, 0 } - }; - -//...................................................................................................................... -} } // namespace sd::colortoolpanel -//...................................................................................................................... - -extern "C" -{ - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) - { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } - - //------------------------------------------------------------------------------------------------------------------ - sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey ) - { - return ::cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, ::sd::colortoolpanel::s_aServiceEntries ); - } - - //------------------------------------------------------------------------------------------------------------------ - void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) - { - return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , ::sd::colortoolpanel::s_aServiceEntries ); - } -} diff --git a/sd/workben/custompanel/delzip b/sd/workben/custompanel/delzip deleted file mode 100644 index e69de29bb..000000000 diff --git a/sd/workben/custompanel/description.xml b/sd/workben/custompanel/description.xml deleted file mode 100644 index a1dbdf4f1..000000000 --- a/sd/workben/custompanel/description.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - Custom Tool Panel Example - - - - - diff --git a/sd/workben/custompanel/makefile.mk b/sd/workben/custompanel/makefile.mk deleted file mode 100644 index 6df319089..000000000 --- a/sd/workben/custompanel/makefile.mk +++ /dev/null @@ -1,93 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=../.. -PRJNAME=sd - -TARGET=colorpanel -ENABLE_EXCEPTIONS=TRUE -LIBTARGET=NO -EXTENSIONNAME:=colored-tool-panel - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -#------------------------------------------------------------------- - -#---- extension version -EXTENSION_VERSION_BASE=0.1 -.IF ( "$(CWS_WORK_STAMP)" == "" ) || ( "$(UPDATER)" == "YES" ) - EXTENSION_VERSION=$(EXTENSION_VERSION_BASE) -.ELSE - EXTENSION_VERSION=$(EXTENSION_VERSION_BASE).cws.$(CWS_WORK_STAMP) -.ENDIF - -#---- extension title package name -EXTENSION_TITLE=Custom Tool Panel Example -EXTENSION_ZIPNAME=$(EXTENSIONNAME)-$(EXTENSION_VERSION_BASE)-$(RTL_OS:l)-$(RTL_ARCH:l) - -#-------------------------------------------------- - -SHL1DLLPRE= -SHL1TARGET=$(TARGET).uno -LIB1TARGET=$(SLB)/$(SHL1TARGET).lib -LIB1OBJFILES= \ - $(SLO)/ctp_factory.obj \ - $(SLO)/ctp_services.obj \ - $(SLO)/ctp_panel.obj - -SHL1STDLIBS= \ - $(CPPULIB) \ - $(SALLIB) \ - $(SALHELPERLIB) \ - $(CPPUHELPERLIB) - -SHL1VERSIONMAP=$(TARGET).map -SHL1LIBS= $(LIB1TARGET) -SHL1DEF= $(MISC)/$(SHL1TARGET).def -SHL1RPATH= OXT -DEF1NAME= $(SHL1TARGET) - -# create Extension ----------------------------- - -COMPONENT_CONFIGDEST=. - -COMPONENT_XCU = \ - $(EXTENSIONDIR)/Impress.xcu - -COMPONENT_LIBRARIES = \ - $(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST) - -# ........ dependencies for packaging the extension ........ -EXTENSION_PACKDEPS=makefile.mk - -# --- Targets ------------------------------------------------------ -.INCLUDE : extension_pre.mk -.INCLUDE : target.mk -.INCLUDE : extension_post.mk - diff --git a/sd/workben/custompanel/manifest.xml b/sd/workben/custompanel/manifest.xml deleted file mode 100644 index 96f62afe4..000000000 --- a/sd/workben/custompanel/manifest.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - -- cgit v1.2.3 From 5df4f4395edc25f8a3117164e90ca357984d4689 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 13 Apr 2010 12:50:50 +0200 Subject: slidecopy: Impress does not support the SID_TASKPANE slot, the task pane is available via SID_RIGHT_PANE --- sd/source/ui/view/drvwshrg.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/sd/source/ui/view/drvwshrg.cxx b/sd/source/ui/view/drvwshrg.cxx index 62528dd11..84f18651d 100644 --- a/sd/source/ui/view/drvwshrg.cxx +++ b/sd/source/ui/view/drvwshrg.cxx @@ -83,7 +83,6 @@ SFX_IMPL_INTERFACE(DrawViewShell, SfxShell, SdResId(STR_DRAWVIEWSHELL)) { SFX_POPUPMENU_REGISTRATION( SdResId(RID_DRAW_TEXTOBJ_INSIDE_POPUP) ); SFX_CHILDWINDOW_CONTEXT_REGISTRATION( SID_NAVIGATOR ); - SFX_CHILDWINDOW_REGISTRATION( SID_TASKPANE ); SFX_CHILDWINDOW_REGISTRATION( SfxTemplateDialogWrapper::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SvxFontWorkChildWindow::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SvxColorChildWindow::GetChildWindowId() ); -- cgit v1.2.3 From 57789eb9554152bbdb3f79f6b15a0bdf1ad90f15 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 14 Apr 2010 10:37:41 +0200 Subject: slidecopy: re-implemented the TaskPane's "View" menu in SFX, using the code formerly found in SD --- sd/source/ui/dlg/PaneDockingWindow.cxx | 13 - sd/source/ui/inc/PaneDockingWindow.hxx | 10 - sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx | 12 - sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 380 ++--------------------- 4 files changed, 22 insertions(+), 393 deletions(-) diff --git a/sd/source/ui/dlg/PaneDockingWindow.cxx b/sd/source/ui/dlg/PaneDockingWindow.cxx index c1e0beaa3..6da1e3cb9 100644 --- a/sd/source/ui/dlg/PaneDockingWindow.cxx +++ b/sd/source/ui/dlg/PaneDockingWindow.cxx @@ -81,17 +81,4 @@ void PaneDockingWindow::StateChanged( StateChangedType nType ) SfxDockingWindow::StateChanged (nType); } -void PaneDockingWindow::EndDocking( const Rectangle& rRect, BOOL bFloatMode ) -{ - SfxDockingWindow::EndDocking( rRect, bFloatMode ); - - if ( maEndDockingHdl.IsSet() ) - maEndDockingHdl.Call( this ); -} - -void PaneDockingWindow::ResetToolBox() -{ - impl_resetToolBox(); -} - } // end of namespace ::sd diff --git a/sd/source/ui/inc/PaneDockingWindow.hxx b/sd/source/ui/inc/PaneDockingWindow.hxx index 55549c9df..819637a2c 100644 --- a/sd/source/ui/inc/PaneDockingWindow.hxx +++ b/sd/source/ui/inc/PaneDockingWindow.hxx @@ -68,16 +68,6 @@ public: virtual ~PaneDockingWindow (void); virtual void StateChanged( StateChangedType nType ); - - virtual void EndDocking( const Rectangle& rRect, BOOL bFloatMode ); - - void SetEndDockingHdl( const Link& i_rEndDockingHdl ) { maEndDockingHdl = i_rEndDockingHdl; } - const Link& GetEndDockingHdl() const { return maEndDockingHdl; } - - void ResetToolBox(); - -private: - Link maEndDockingHdl; }; } // end of namespace ::sd diff --git a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx index 6a29ee9dd..ba5b602ae 100644 --- a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx +++ b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx @@ -114,14 +114,6 @@ public: */ DockingWindow* GetDockingWindow (void); - /** Called when a mouse button has been pressed but not yet - released, this handler is used to show the popup menu of the - title bar. - */ - DECL_LINK(ToolboxClickHandler, ToolBox*); - DECL_LINK(MenuSelectHandler, Menu*); - DECL_LINK(DockingChanged, PaneDockingWindow*); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> CreateAccessibleDocumentView (::sd::Window* pWindow); @@ -163,10 +155,6 @@ private: ::std::auto_ptr CreatePopupMenu (bool bIsDocking); - /** connects to a (new) (Pane)DockingWindow - */ - void ConnectToDockingWindow(); - /** Initialize the task pane view shell if that has not yet been done before. If mbIsInitialized is already set to then this method returns immediately. diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 3a6ab4d5a..835bfb5c8 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -127,33 +127,6 @@ using ::sd::framework::FrameworkHelper; namespace sd { namespace toolpanel { -// ===================================================================================================================== -// = PanelDescriptor -// ===================================================================================================================== -/** is a helper class for ToolPanelViewShell_Impl, holding the details about a single panel which is not - contained in the IToolPanel implementation itself. -*/ -struct PanelDescriptor -{ - PanelId nId; - ::svt::PToolPanel pPanel; - bool bHidden; - - PanelDescriptor() - :nId( PID_UNKNOWN ) - ,pPanel() - ,bHidden( false ) - { - } - - PanelDescriptor( const PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel ) - :nId( i_nPanelId ) - ,pPanel( i_rPanel ) - ,bHidden( false ) - { - } -}; - // ===================================================================================================================== // = PanelSelectorLayout // ===================================================================================================================== @@ -205,7 +178,7 @@ private: // ===================================================================================================================== /** Inner implementation class of ToolPanelViewShell. */ -class ToolPanelViewShell_Impl : public ::svt::IToolPanelDeckListener +class ToolPanelViewShell_Impl : public ::boost::noncopyable { public: static const size_t mnInvalidId = static_cast< size_t >( -1 ); @@ -223,15 +196,6 @@ public: */ void Cleanup(); - /** sets the given layout for the panel selector - */ - void SetLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce = false ); - - /** returns the current layout - */ - PanelSelectorLayout - GetLayout() const { return m_eCurrentLayout; } - /** activates the panel which has the given resource URL */ void ActivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL ); @@ -250,22 +214,12 @@ public: ::svt::ToolPanelDeck& GetToolPanelDeck() { return GetTaskPane().GetPanelDeck(); } const ::svt::ToolPanelDeck& GetToolPanelDeck() const { return GetTaskPane().GetPanelDeck(); } - void TogglePanelVisibility( const size_t i_nLogicalPanelIndex ); - Reference< XAccessible > CreateAccessible( ::sd::Window& i_rWindow ); -protected: - // IToolPanelDeckListener overridables - virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); - virtual void PanelRemoved( const size_t i_nPosition ); - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); - virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); - virtual void Dying(); + void ConnectToDockingWindow(); private: - void UpdateDockingWindowTitle(); - struct InitialPanel { ::rtl::OUString sPanelResourceURL; @@ -278,10 +232,9 @@ private: }; InitialPanel DetermineInitialPanel(); - typedef ::std::vector< PanelDescriptor > PanelDescriptors; ToolPanelViewShell& m_rPanelViewShell; ::boost::scoped_ptr< ::sfx2::ModuleTaskPane > m_pTaskPane; - //::boost::scoped_ptr< ToolPanelDeck > m_pPanelDeck; + ::std::auto_ptr< ::sfx2::TaskPaneController > m_pTaskPaneController; ::rtl::Reference< ConfigurationListener > m_pConfigListener; PanelSelectorLayout m_eCurrentLayout; bool m_bInitialized; @@ -354,22 +307,6 @@ void ConfigurationListener::dispose() m_pShellImpl = NULL; } -// ===================================================================================================================== -// = helpers -// ===================================================================================================================== -// --------------------------------------------------------------------------------------------------------------------- -namespace { - -enum MenuId { - MID_UNLOCK_TASK_PANEL = 1, - MID_LOCK_TASK_PANEL = 2, - MID_LAYOUT_TABS = 3, - MID_LAYOUT_DRAWERS = 4, - MID_FIRST_PANEL = 5 -}; - -} // end of anonymouse namespace - // ===================================================================================================================== // = ToolPanelViewShell // ===================================================================================================================== @@ -442,67 +379,21 @@ void ToolPanelViewShell_Impl::Setup() } } -// // add as listener to the panel deck -// m_pPanelDeck->AddListener( *this ); - - // initialize panel selector - SetLayout( LAYOUT_DRAWERS, true ); - // listen at the configuration m_pConfigListener.set( new ConfigurationListener( *this ) ); m_pTaskPane->Show(); } -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::SetLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce ) -{ - if ( !i_bForce && ( m_eCurrentLayout == i_eLayout ) ) - return; - -// switch ( i_eLayout ) -// { -// case LAYOUT_DRAWERS: -// m_pPanelDeck->SetDrawersLayout(); -// break; -// case LAYOUT_TABS_TOP: -// m_pPanelDeck->SetTabsLayout( ::svt::TABS_TOP, ::svt::TABITEM_IMAGE_ONLY ); -// break; -// case LAYOUT_TABS_BOTTOM: -// m_pPanelDeck->SetTabsLayout( ::svt::TABS_BOTTOM, ::svt::TABITEM_IMAGE_ONLY ); -// break; -// case LAYOUT_TABS_LEFT: -// m_pPanelDeck->SetTabsLayout( ::svt::TABS_LEFT, ::svt::TABITEM_IMAGE_ONLY ); -// break; -// case LAYOUT_TABS_RIGHT: -// m_pPanelDeck->SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY ); -// break; -// } - m_eCurrentLayout = i_eLayout; - UpdateDockingWindowTitle(); -} - // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell_Impl::Cleanup() { if ( m_bInitialized ) { -// m_pPanelDeck->RemoveListener( *this ); -// // remove the panels which are not under the control of the panel deck currently -// for ( PanelDescriptors::iterator panelPos = m_aPanels.begin(); -// panelPos != m_aPanels.end(); -// ++panelPos -// ) -// { -// if ( panelPos->bHidden ) -// panelPos->pPanel->Dispose(); -// } -// m_aPanels.clear(); -// -// if ( m_pConfigListener.is() ) -// m_pConfigListener->dispose(); + if ( m_pConfigListener.is() ) + m_pConfigListener->dispose(); } -// m_pPanelDeck.reset(); + m_pTaskPaneController.reset(); m_pTaskPane.reset(); } @@ -553,7 +444,7 @@ ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rVi GetParentWindow()->SetHelpId(HID_SD_TASK_PANE); - ConnectToDockingWindow(); + mpImpl->ConnectToDockingWindow(); SetPool( &GetDoc()->GetPool() ); @@ -666,138 +557,6 @@ namespace } } -// --------------------------------------------------------------------------------------------------------------------- -IMPL_LINK( ToolPanelViewShell, DockingChanged, PaneDockingWindow*, i_pDockingWindow ) -{ - ENSURE_OR_RETURN( i_pDockingWindow == dynamic_cast< PaneDockingWindow* >( GetDockingWindow() ), "unknown source", 0 ); - - if ( mpImpl->GetLayout() == LAYOUT_DRAWERS ) - return 0L; - - mpImpl->SetLayout( lcl_getTabLayoutFromAlignment( i_pDockingWindow->GetAlignment() ) ); - return 0L; -} - -// --------------------------------------------------------------------------------------------------------------------- -IMPL_LINK(ToolPanelViewShell, ToolboxClickHandler, ToolBox*, pToolBox) -{ - if (pToolBox->GetCurItemId() == mnMenuId) - { - pToolBox->EndSelection(); - - DockingWindow* pDockingWindow = GetDockingWindow(); - ::std::auto_ptr pMenu = CreatePopupMenu ( - pDockingWindow!=NULL && !pDockingWindow->IsFloatingMode()); - pMenu->SetSelectHdl ( - LINK(this, ToolPanelViewShell, MenuSelectHandler)); - - // pass toolbox button rect so the menu can stay open on button up - Rectangle aRect = pToolBox->GetItemRect(mnMenuId); - aRect.SetPos(pToolBox->GetPosPixel() ); - pMenu->Execute (pDockingWindow, aRect, POPUPMENU_EXECUTE_DOWN); - } - - return 0; -} - -// --------------------------------------------------------------------------------------------------------------------- -IMPL_LINK(ToolPanelViewShell, MenuSelectHandler, Menu*, pMenu) -{ - if (pMenu) - { - pMenu->Deactivate(); - switch (pMenu->GetCurItemId()) - { - case MID_UNLOCK_TASK_PANEL: - { - DockingWindow* pDockingWindow = GetDockingWindow(); - if (pDockingWindow != NULL) - pDockingWindow->SetFloatingMode (TRUE); - } - break; - - case MID_LOCK_TASK_PANEL: - { - DockingWindow* pDockingWindow = GetDockingWindow(); - if (pDockingWindow != NULL) - pDockingWindow->SetFloatingMode (FALSE); - } - break; - - case MID_LAYOUT_DRAWERS: - mpImpl->SetLayout( LAYOUT_DRAWERS ); - break; - - case MID_LAYOUT_TABS: - { - PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( GetDockingWindow() ); - OSL_ENSURE( pDockingWindow != NULL, "ToolPanelViewShell::MenuSelectHandler: unknown docking window type!" ); - if ( pDockingWindow ) - mpImpl->SetLayout( lcl_getTabLayoutFromAlignment( pDockingWindow->GetAlignment() ) ); - } - break; - - default: - { - size_t nPanelIndex = size_t( pMenu->GetCurItemId() - MID_FIRST_PANEL ); - mpImpl->TogglePanelVisibility( nPanelIndex ); - } - break; - } - } - - return 0; -} - -// --------------------------------------------------------------------------------------------------------------------- -::std::auto_ptr ToolPanelViewShell::CreatePopupMenu ( - bool bIsDocking) -{ - ::std::auto_ptr pMenu (new PopupMenu ()); - FloatingWindow* pFloat = static_cast(pMenu->GetWindow()); - if (pFloat != NULL) - { - pFloat->SetPopupModeFlags ( - pFloat->GetPopupModeFlags() - | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE); - } - - // Add one entry for every tool panel element to individually make - // them visible or hide them. - USHORT nIndex = MID_FIRST_PANEL; -// for ( size_t i=0; iGetPanelCount(); ++i, ++nIndex ) -// { -// const PanelDescriptor& rPanelDesc( mpImpl->GetPanel(i) ); -// pMenu->InsertItem( nIndex, rPanelDesc.pPanel->GetDisplayName(), MIB_CHECKABLE ); -// pMenu->SetUserValue( nIndex, rPanelDesc.nId ); -// pMenu->CheckItem( nIndex, !rPanelDesc.bHidden ); -// } -// pMenu->InsertSeparator(); - -#if OSL_DEBUG_LEVEL > 0 - pMenu->InsertItem( MID_LAYOUT_TABS, String::CreateFromAscii( "Tab-Layout (exp.)" ), MIB_CHECKABLE ); - pMenu->CheckItem( MID_LAYOUT_TABS, mpImpl->GetLayout() != LAYOUT_DRAWERS ); - pMenu->InsertItem( MID_LAYOUT_DRAWERS, String::CreateFromAscii( "Drawer-Layout" ), MIB_CHECKABLE ); - pMenu->CheckItem( MID_LAYOUT_DRAWERS, mpImpl->GetLayout() == LAYOUT_DRAWERS ); - - pMenu->InsertSeparator(); -#endif - - // Add entry for docking or un-docking the tool panel. - if (bIsDocking) - pMenu->InsertItem ( - MID_UNLOCK_TASK_PANEL, - String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_UNLOCK))); - else - pMenu->InsertItem ( - MID_LOCK_TASK_PANEL, - String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_LOCK))); - - pMenu->RemoveDisabledEntries (FALSE, FALSE); - - return pMenu; -} - // --------------------------------------------------------------------------------------------------------------------- SdPage* ToolPanelViewShell::GetActualPage() { @@ -856,27 +615,6 @@ Reference< XDrawSubController > ToolPanelViewShell::CreateSubController() return Reference< XDrawSubController >(); } -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::ConnectToDockingWindow() -{ - PaneDockingWindow* pDockingWindow = dynamic_cast(GetDockingWindow()); - if (pDockingWindow != NULL) - { - pDockingWindow->ResetToolBox(); - mnMenuId = pDockingWindow->AddDropDownToolBoxItem ( - String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_TITLE)), - HID_SD_TASK_PANE_VIEW_MENU, - LINK(this, ToolPanelViewShell, ToolboxClickHandler)); - - // be notified when the docking position of the window changes - pDockingWindow->SetEndDockingHdl( LINK( this, ToolPanelViewShell, DockingChanged ) ); - } - - // Tell the focus manager that we want to pass the focus to our - // child. - FocusManager::Instance().RegisterDownLink( GetParentWindow(), &mpImpl->GetTaskPane() ); -} - // --------------------------------------------------------------------------------------------------------------------- bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow ) { @@ -892,7 +630,7 @@ bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow ) ViewShell::RelocateToParentWindow(pParentWindow); - ConnectToDockingWindow(); + mpImpl->ConnectToDockingWindow(); Resize(); @@ -992,96 +730,21 @@ ToolPanelViewShell_Impl::~ToolPanelViewShell_Impl() } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::TogglePanelVisibility( const size_t i_nLogicalPanelIndex ) +void ToolPanelViewShell_Impl::ConnectToDockingWindow() { - OSL_ENSURE( false, "ToolPanelViewShell_Impl::TogglePanelVisibility: not yet re-implemented!" ); -// ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < m_aPanels.size(), "illegal index" ); -// -// // get the actual panel index, within the deck -// size_t nActualPanelIndex(0); -// for ( size_t i=0; i < i_nLogicalPanelIndex; ++i ) -// { -// if ( !m_aPanels[i].bHidden ) -// ++nActualPanelIndex; -// } -// if ( m_aPanels[ i_nLogicalPanelIndex ].bHidden ) -// { -// OSL_VERIFY( m_pPanelDeck->InsertPanel( m_aPanels[ i_nLogicalPanelIndex ].pPanel, nActualPanelIndex ) == nActualPanelIndex ); -// // if there has not been an active panel before, activate the newly inserted one -// ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() ); -// if ( !aActivePanel ) -// m_pPanelDeck->ActivatePanelResource( nActualPanelIndex ); -// } -// else -// { -// OSL_VERIFY( m_pPanelDeck->RemovePanel( nActualPanelIndex ).get() == m_aPanels[ i_nLogicalPanelIndex ].pPanel.get() ); -// } -// m_aPanels[ i_nLogicalPanelIndex ].bHidden = !m_aPanels[ i_nLogicalPanelIndex ].bHidden; - (void)i_nLogicalPanelIndex; -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) -{ - (void)i_pPanel; - (void)i_nPosition; -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::PanelRemoved( const size_t i_nPosition ) -{ - (void)i_nPosition; -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::UpdateDockingWindowTitle() -{ -// PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( m_rPanelViewShell.GetDockingWindow() ); -// ENSURE_OR_RETURN_VOID( pDockingWindow, "ToolPanelViewShell_Impl::UpdateDockingWindowTitle: no PaneDockingWindow!?" ); -// -// ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() ); -// if ( !aActivePanel || ( GetLayout() == LAYOUT_DRAWERS ) ) -// pDockingWindow->SetTitle( String( SdResId( STR_RIGHT_PANE_TITLE ) ) ); -// else -// { -// size_t nNewActive( *aActivePanel ); -// for ( size_t i=0; i < m_aPanels.size(); ++i ) -// { -// if ( m_aPanels[i].bHidden ) -// continue; -// -// if ( !nNewActive ) -// { -// pDockingWindow->SetTitle( m_aPanels[i].pPanel->GetDisplayName() ); -// break; -// } -// --nNewActive; -// } -// } -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) -{ - if ( GetLayout() == LAYOUT_DRAWERS ) - // no adjustment of the title when we use the classical "drawers" layout - return; - - UpdateDockingWindowTitle( ); - (void)i_rOldActive; - (void)i_rNewActive; -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) -{ - // not interested in - (void)i_rNewLayouter; -} + m_pTaskPaneController.reset(); + DockingWindow* pDockingWindow( GetAntiImpl().GetDockingWindow() ); + if ( pDockingWindow ) + { + PaneDockingWindow* pPaneDockingWindow = dynamic_cast< PaneDockingWindow* >( pDockingWindow ); + OSL_ENSURE( pPaneDockingWindow, "ToolPanelViewShell_Impl::ConnectToDockingWindow: unsupported docking window type!" ); + if ( pPaneDockingWindow != NULL ) + m_pTaskPaneController.reset( new ::sfx2::TaskPaneController( GetTaskPane(), *pPaneDockingWindow ) ); + } -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::Dying() -{ + // Tell the focus manager that we want to pass the focus to our + // child. + FocusManager::Instance().RegisterDownLink( GetAntiImpl().GetParentWindow(), &GetTaskPane() ); } // --------------------------------------------------------------------------------------------------------------------- @@ -1090,6 +753,7 @@ Reference< XAccessible > ToolPanelViewShell_Impl::CreateAccessible( ::sd::Window // ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow(); // m_pPanelDeck->SetAccessibleParentWindow( pAccessibleParent ); // return m_pPanelDeck->GetAccessible(); + // TODO: re-implement this (void)i_rWindow; return Reference< XAccessible >(); } -- cgit v1.2.3 From e97ba58e94c886eb8827d6418a4ec580636e3707 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 14 Apr 2010 13:30:12 +0200 Subject: slidecopy: removed PID_FIRST_CUSTOM_PANEL (not used anymore) --- sd/source/ui/inc/taskpane/PanelId.hxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sd/source/ui/inc/taskpane/PanelId.hxx b/sd/source/ui/inc/taskpane/PanelId.hxx index 020e4c3e2..759bcc9f4 100644 --- a/sd/source/ui/inc/taskpane/PanelId.hxx +++ b/sd/source/ui/inc/taskpane/PanelId.hxx @@ -49,9 +49,7 @@ namespace sd { namespace toolpanel PID_LAYOUT = 2, PID_TABLE_DESIGN = 3, PID_CUSTOM_ANIMATION = 4, - PID_SLIDE_TRANSITION = 5, - - PID_FIRST_CUSTOM_PANEL = 6 + PID_SLIDE_TRANSITION = 5 }; PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL ); -- cgit v1.2.3 From ef51bc9276eae4fcf7779b933c7fe0ed2fecd1a8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 14 Apr 2010 13:31:04 +0200 Subject: slidecopy: when a panel is de/activated, let the drawing framework know of the change --- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 68 +++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 835bfb5c8..d9ff1e9f7 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -178,7 +178,8 @@ private: // ===================================================================================================================== /** Inner implementation class of ToolPanelViewShell. */ -class ToolPanelViewShell_Impl : public ::boost::noncopyable +class ToolPanelViewShell_Impl :public ::boost::noncopyable + ,public ::svt::IToolPanelDeckListener { public: static const size_t mnInvalidId = static_cast< size_t >( -1 ); @@ -219,6 +220,14 @@ public: void ConnectToDockingWindow(); +private: + // IToolPanelDeckListener overridables + virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void PanelRemoved( const size_t i_nPosition ); + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); + virtual void Dying(); + private: struct InitialPanel { @@ -372,10 +381,7 @@ void ToolPanelViewShell_Impl::Setup() else { ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) ); - const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( - FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL, aInitialPanel.sPanelResourceURL ) ); - pFrameworkHelper->GetConfigurationController()->requestResourceActivation( - xToolPanelId, ResourceActivationMode_REPLACE ); + pFrameworkHelper->RequestTaskPanel( aInitialPanel.sPanelResourceURL ); } } @@ -393,6 +399,7 @@ void ToolPanelViewShell_Impl::Cleanup() if ( m_pConfigListener.is() ) m_pConfigListener->dispose(); } + GetToolPanelDeck().RemoveListener( *this ); m_pTaskPaneController.reset(); m_pTaskPane.reset(); } @@ -722,6 +729,8 @@ ToolPanelViewShell_Impl::ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelVi const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) ); GetToolPanelDeck().SetAccessibleName( sPaneTitle ); GetToolPanelDeck().SetAccessibleDescription( sPaneTitle ); + + GetToolPanelDeck().AddListener( *this ); } // --------------------------------------------------------------------------------------------------------------------- @@ -729,6 +738,55 @@ ToolPanelViewShell_Impl::~ToolPanelViewShell_Impl() { } +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) +{ + // not interested in + (void)i_pPanel; + (void)i_nPosition; +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell_Impl::PanelRemoved( const size_t i_nPosition ) +{ + // not interested in + (void)i_nPosition; +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) +{ + (void)i_rOldActive; + + ::rtl::OUString sPanelURL; + if ( !!i_rNewActive ) + { + sPanelURL = GetTaskPane().GetPanelResourceURL( *i_rNewActive ); + const PanelId ePanelId( GetStandardPanelId( sPanelURL ) ); + if ( ePanelId == PID_UNKNOWN ) + sPanelURL = ::rtl::OUString(); + } + + if ( sPanelURL.getLength() ) + { + ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) ); + pFrameworkHelper->RequestTaskPanel( sPanelURL ); + } +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) +{ + // not interested in + (void)i_rNewLayouter; +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell_Impl::Dying() +{ + // not interested in +} + // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell_Impl::ConnectToDockingWindow() { -- cgit v1.2.3 From 61f31b3c7be2ab79959e89de7af6ec62a43cacdc Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 14 Apr 2010 14:30:00 +0200 Subject: slidecopy: re-implement CreateAccessible, and fix ActivePanelChanged --- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 175 ++++++++++++++------------ 1 file changed, 98 insertions(+), 77 deletions(-) diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index d9ff1e9f7..631d23c5c 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -83,6 +83,7 @@ #include #include #include +#include #include #include #include @@ -128,16 +129,46 @@ using ::sd::framework::FrameworkHelper; namespace sd { namespace toolpanel { // ===================================================================================================================== -// = PanelSelectorLayout +// = misc helper // ===================================================================================================================== -enum PanelSelectorLayout +// --------------------------------------------------------------------------------------------------------------------- +PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL, const bool i_bIgnoreUnknown ) { - LAYOUT_DRAWERS, - LAYOUT_TABS_RIGHT, - LAYOUT_TABS_LEFT, - LAYOUT_TABS_TOP, - LAYOUT_TABS_BOTTOM -}; + PanelId ePanelId( PID_UNKNOWN ); + + if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msMasterPagesTaskPanelURL ) ) + { + ePanelId = PID_MASTER_PAGES; + } + else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msLayoutTaskPanelURL ) ) + { + ePanelId = PID_LAYOUT; + } + else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msTableDesignPanelURL ) ) + { + ePanelId = PID_TABLE_DESIGN; + } + else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msCustomAnimationTaskPanelURL ) ) + { + ePanelId = PID_CUSTOM_ANIMATION; + } + else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msSlideTransitionTaskPanelURL ) ) + { + ePanelId = PID_SLIDE_TRANSITION; + } + else + { + OSL_ENSURE( i_bIgnoreUnknown, "GetStandardPanelId: cannot translate the given resource URL!" ); + } + + return ePanelId; +} + +// --------------------------------------------------------------------------------------------------------------------- +PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL ) +{ + return GetStandardPanelId( i_rTaskPanelResourceURL, false ); +} // ===================================================================================================================== // = ConfigurationListener - declaration @@ -239,13 +270,14 @@ private: { } }; - InitialPanel DetermineInitialPanel(); + InitialPanel impl_determineInitialPanel(); + ::rtl::OUString impl_getPanelURL( const ::boost::optional< size_t >& i_rPanel ); +private: ToolPanelViewShell& m_rPanelViewShell; ::boost::scoped_ptr< ::sfx2::ModuleTaskPane > m_pTaskPane; ::std::auto_ptr< ::sfx2::TaskPaneController > m_pTaskPaneController; ::rtl::Reference< ConfigurationListener > m_pConfigListener; - PanelSelectorLayout m_eCurrentLayout; bool m_bInitialized; }; @@ -328,7 +360,7 @@ SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL)) TYPEINIT1(ToolPanelViewShell, ViewShell); // --------------------------------------------------------------------------------------------------------------------- -ToolPanelViewShell_Impl::InitialPanel ToolPanelViewShell_Impl::DetermineInitialPanel() +ToolPanelViewShell_Impl::InitialPanel ToolPanelViewShell_Impl::impl_determineInitialPanel() { // Default to Layout panel, but check whether the requested configuration already contains a tool panel, in this case, // use that one. @@ -371,7 +403,7 @@ void ToolPanelViewShell_Impl::Setup() m_bInitialized = true; // initially activate a panel - const InitialPanel aInitialPanel = DetermineInitialPanel(); + const InitialPanel aInitialPanel = impl_determineInitialPanel(); if ( aInitialPanel.sPanelResourceURL.getLength() ) { if ( aInitialPanel.bActivateDirectly ) @@ -545,25 +577,6 @@ void ToolPanelViewShell::KeyInput( const KeyEvent& i_rKeyEvent ) ViewShell::KeyInput( i_rKeyEvent, NULL ); } -// --------------------------------------------------------------------------------------------------------------------- -namespace -{ - PanelSelectorLayout lcl_getTabLayoutFromAlignment( const SfxChildAlignment i_eAlignment ) - { - switch ( i_eAlignment ) - { - case SFX_ALIGN_LEFT: - return LAYOUT_TABS_LEFT; - case SFX_ALIGN_TOP: - return LAYOUT_TABS_TOP; - case SFX_ALIGN_BOTTOM: - return LAYOUT_TABS_BOTTOM; - default: - return LAYOUT_TABS_RIGHT; - } - } -} - // --------------------------------------------------------------------------------------------------------------------- SdPage* ToolPanelViewShell::GetActualPage() { @@ -723,7 +736,6 @@ void ToolPanelViewShell::DeactivatePanel( const ::rtl::OUString& i_rPanelResourc ToolPanelViewShell_Impl::ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent ) :m_rPanelViewShell( i_rPanelViewShell ) ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ) ) - ,m_eCurrentLayout( LAYOUT_DRAWERS ) ,m_bInitialized( false ) { const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) ); @@ -754,23 +766,54 @@ void ToolPanelViewShell_Impl::PanelRemoved( const size_t i_nPosition ) } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) +::rtl::OUString ToolPanelViewShell_Impl::impl_getPanelURL( const ::boost::optional< size_t >& i_rPanel ) { - (void)i_rOldActive; - ::rtl::OUString sPanelURL; - if ( !!i_rNewActive ) + if ( !!i_rPanel ) { - sPanelURL = GetTaskPane().GetPanelResourceURL( *i_rNewActive ); - const PanelId ePanelId( GetStandardPanelId( sPanelURL ) ); + sPanelURL = GetTaskPane().GetPanelResourceURL( *i_rPanel ); + const PanelId ePanelId( GetStandardPanelId( sPanelURL, true ) ); if ( ePanelId == PID_UNKNOWN ) sPanelURL = ::rtl::OUString(); } + return sPanelURL; +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) +{ + // update the configuration controller, since this change in the active panel might have been triggered by means other + // than the drawing framework, so it does not yet know about it. + + const ::rtl::OUString sOldPanelURL( impl_getPanelURL( i_rOldActive ) ); + const ::rtl::OUString sNewPanelURL( impl_getPanelURL( i_rNewActive ) ); - if ( sPanelURL.getLength() ) + const ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) ); + if ( sNewPanelURL.getLength() ) { - ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) ); - pFrameworkHelper->RequestTaskPanel( sPanelURL ); + // activate the resource belonging to the new panel. This will automatically de-activate the previously active + // panel resource (since ResourceActivationMode_REPLACE is used) + pFrameworkHelper->RequestTaskPanel( sNewPanelURL ); + } + else if ( sOldPanelURL.getLength() ) + { + // there is no new active panel, or it is not one of our standard panels, i.e. it is not covered by the + // resource framework. => Deactivate the old resource. + try + { + Reference< XConfigurationController > xConfigController( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW ); + xConfigController->requestResourceDeactivation( + pFrameworkHelper->CreateResourceId( + sOldPanelURL, + FrameworkHelper::msTaskPaneURL, + FrameworkHelper::msRightPaneURL + ) + ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } } @@ -808,45 +851,23 @@ void ToolPanelViewShell_Impl::ConnectToDockingWindow() // --------------------------------------------------------------------------------------------------------------------- Reference< XAccessible > ToolPanelViewShell_Impl::CreateAccessible( ::sd::Window& i_rWindow ) { -// ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow(); -// m_pPanelDeck->SetAccessibleParentWindow( pAccessibleParent ); -// return m_pPanelDeck->GetAccessible(); - // TODO: re-implement this - (void)i_rWindow; - return Reference< XAccessible >(); -} + Reference< XAccessible > xAccessibleParent; + ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow(); + if ( pAccessibleParent ) + xAccessibleParent.set( pAccessibleParent->GetAccessible() ); -// --------------------------------------------------------------------------------------------------------------------- -PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL ) -{ - PanelId ePanelId( PID_UNKNOWN ); - - if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msMasterPagesTaskPanelURL ) ) + Reference< XAccessible > xAccessible( GetToolPanelDeck().GetAccessible( FALSE ) ); + if ( !xAccessible.is() ) { - ePanelId = PID_MASTER_PAGES; - } - else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msLayoutTaskPanelURL ) ) - { - ePanelId = PID_LAYOUT; - } - else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msTableDesignPanelURL ) ) - { - ePanelId = PID_TABLE_DESIGN; - } - else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msCustomAnimationTaskPanelURL ) ) - { - ePanelId = PID_CUSTOM_ANIMATION; - } - else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msSlideTransitionTaskPanelURL ) ) - { - ePanelId = PID_SLIDE_TRANSITION; - } - else - { - OSL_ENSURE( false, "GetStandardPanelId: cannot translate the given resource URL!" ); + xAccessible = GetToolPanelDeck().GetAccessible( TRUE ); + ENSURE_OR_RETURN( xAccessible.is(), "ToolPanelViewShell_Impl::CreateAccessible: illegal ToolPanelDeck accessible!", NULL ); + if ( xAccessibleParent.is() ) + { + ::comphelper::OAccessibleImplementationAccess::setAccessibleParent( + xAccessible->getAccessibleContext(), xAccessibleParent ); + } } - - return ePanelId; + return xAccessible; } } } // end of namespace ::sd::toolpanel -- cgit v1.2.3 From 567281047ed0501de9c69a303ba1007c222c131e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 14 Apr 2010 20:24:29 +0200 Subject: slidecopy: allow sorting the tool panels in the TaskPane (so far, the implicit ordering was defined by the order in which the config nodes were returned by the config manager) --- sd/source/ui/inc/taskpane/PanelId.hxx | 13 +++++++------ sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/sd/source/ui/inc/taskpane/PanelId.hxx b/sd/source/ui/inc/taskpane/PanelId.hxx index 759bcc9f4..16f861ebc 100644 --- a/sd/source/ui/inc/taskpane/PanelId.hxx +++ b/sd/source/ui/inc/taskpane/PanelId.hxx @@ -44,12 +44,13 @@ namespace sd { namespace toolpanel */ enum PanelId { - PID_UNKNOWN = 0, - PID_MASTER_PAGES = 1, - PID_LAYOUT = 2, - PID_TABLE_DESIGN = 3, - PID_CUSTOM_ANIMATION = 4, - PID_SLIDE_TRANSITION = 5 + PID_MASTER_PAGES = 0, + PID_LAYOUT = 1, + PID_TABLE_DESIGN = 2, + PID_CUSTOM_ANIMATION = 3, + PID_SLIDE_TRANSITION = 4, + + PID_UNKNOWN = 5 }; PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL ); diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 631d23c5c..ff1bbf27c 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -211,6 +211,7 @@ private: */ class ToolPanelViewShell_Impl :public ::boost::noncopyable ,public ::svt::IToolPanelDeckListener + ,public ::sfx2::IToolPanelCompare { public: static const size_t mnInvalidId = static_cast< size_t >( -1 ); @@ -259,6 +260,9 @@ private: virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); virtual void Dying(); + // IToolPanelCompare overridables + virtual short compareToolPanelsURLs( const ::rtl::OUString& i_rLHS, const ::rtl::OUString& i_rRHS ) const; + private: struct InitialPanel { @@ -735,7 +739,7 @@ void ToolPanelViewShell::DeactivatePanel( const ::rtl::OUString& i_rPanelResourc // --------------------------------------------------------------------------------------------------------------------- ToolPanelViewShell_Impl::ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent ) :m_rPanelViewShell( i_rPanelViewShell ) - ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ) ) + ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface(), *this ) ) ,m_bInitialized( false ) { const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) ); @@ -830,6 +834,18 @@ void ToolPanelViewShell_Impl::Dying() // not interested in } +// --------------------------------------------------------------------------------------------------------------------- +short ToolPanelViewShell_Impl::compareToolPanelsURLs( const ::rtl::OUString& i_rLHS, const ::rtl::OUString& i_rRHS ) const +{ + const PanelId eLHS( GetStandardPanelId( i_rLHS, true ) ); + const PanelId eRHS( GetStandardPanelId( i_rRHS, true ) ); + if ( eLHS < eRHS ) + return -1; + if ( eLHS == eRHS ) + return 0; + return 1; +} + // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell_Impl::ConnectToDockingWindow() { -- cgit v1.2.3 From 4159b53958e463fdfbe50183dc11d9f109bf2122 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 14 Apr 2010 21:05:33 +0200 Subject: slidecopy: post-rebase problems --- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index ff1bbf27c..a516a92f5 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -739,7 +739,7 @@ void ToolPanelViewShell::DeactivatePanel( const ::rtl::OUString& i_rPanelResourc // --------------------------------------------------------------------------------------------------------------------- ToolPanelViewShell_Impl::ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent ) :m_rPanelViewShell( i_rPanelViewShell ) - ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface(), *this ) ) + ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame().GetFrameInterface(), *this ) ) ,m_bInitialized( false ) { const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) ); -- cgit v1.2.3 From aa2e559b76dd3902f406186df6f743ed7805711f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 16 Apr 2010 15:14:15 +0200 Subject: slidecopy: now using SID_TASK_PANE in all applications, also in Impress. Implies registering the respective child window in the apps, not in SFX. Also implies getting rid of SID_RIGHT_PANE in Impress. Also, renamed SID_TASK_PANE in Impress to SID_SHOW_TOOL_PANEL, which better fits its purpose, and avoids confusion with SID_TASKPANE. --- sd/inc/app.hrc | 4 ++-- sd/sdi/ViewShellBase.sdi | 32 +++------------------------ sd/source/ui/dlg/PaneChildWindows.cxx | 2 +- sd/source/ui/toolpanel/ToolPanelFactory.cxx | 4 ++-- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 7 +++++- sd/source/ui/view/GraphicViewShellBase.cxx | 4 ++-- sd/source/ui/view/ViewShellBase.cxx | 6 ++--- sd/source/ui/view/ViewShellImplementation.cxx | 2 +- sd/uiconfig/simpress/menubar/menubar.xml | 2 +- 9 files changed, 21 insertions(+), 42 deletions(-) diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index a8424d7cc..57c7d28e6 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -430,7 +430,7 @@ #define SID_LEFT_PANE_IMPRESS (SID_SD_START+414) #define SID_LEFT_PANE_DRAW (SID_SD_START+415) -#define SID_RIGHT_PANE (SID_SD_START+416) + // FREE #define SID_NOTES_WINDOW (SID_SD_START+417) #define SID_SWITCH_SHELL_PANE (SID_SD_START+418) #define SID_LAYER_DIALOG_WIN (SID_SD_START+419) @@ -446,7 +446,7 @@ #define SID_TP_USE_FOR_NEW_PRESENTATIONS (SID_SD_START+427) #define SID_TP_SHOW_LARGE_PREVIEW (SID_SD_START+428) #define SID_TP_SHOW_SMALL_PREVIEW (SID_SD_START+429) -#define SID_TASK_PANE (SID_SD_START+430) +#define SID_SHOW_TOOL_PANEL (SID_SD_START+430) #define SID_INSERT_MASTER_PAGE (SID_SD_START+431) #define SID_DELETE_MASTER_PAGE (SID_SD_START+432) #define SID_RENAME_MASTER_PAGE (SID_SD_START+433) diff --git a/sd/sdi/ViewShellBase.sdi b/sd/sdi/ViewShellBase.sdi index 72aee8ab5..82eaced38 100644 --- a/sd/sdi/ViewShellBase.sdi +++ b/sd/sdi/ViewShellBase.sdi @@ -135,32 +135,6 @@ SfxBoolItem LeftPaneDraw SID_LEFT_PANE_DRAW GroupId = GID_MODIFY; ] -SfxBoolItem RightPane SID_RIGHT_PANE - -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_MODIFY; -] - SfxVoidItem NotesChildWindow SID_NOTES_WINDOW [ @@ -239,7 +213,7 @@ SfxBoolItem SlideSorterMultiPaneGUI SID_SLIDE_SORTER_MULTI_PANE_GUI GroupId = GID_MODIFY; ] -SfxVoidItem TaskPaneShowPanel SID_TASK_PANE ( +SfxVoidItem TaskPaneShowPanel SID_SHOW_TOOL_PANEL ( SfxBoolItem IsPanelVisible ID_VAL_ISVISIBLE, SfxUInt32Item PanelId ID_VAL_PANEL_INDEX) [ @@ -280,7 +254,7 @@ interface ViewShellBaseView ExecMethod = Execute; StateMethod = GetState; ] - SID_RIGHT_PANE + SID_TASKPANE [ ExecMethod = Execute; StateMethod = GetState; @@ -325,7 +299,7 @@ interface ViewShellBaseView ExecMethod = Execute; StateMethod = GetState; ] - SID_TASK_PANE + SID_SHOW_TOOL_PANEL [ ExecMethod = Execute; StateMethod = GetState; diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx index c50226dd2..a282764a6 100755 --- a/sd/source/ui/dlg/PaneChildWindows.cxx +++ b/sd/source/ui/dlg/PaneChildWindows.cxx @@ -45,7 +45,7 @@ namespace sd { SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS) SFX_IMPL_DOCKINGWINDOW(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW) -SFX_IMPL_DOCKINGWINDOW( ToolPanelChildWindow, SID_RIGHT_PANE) +SFX_IMPL_DOCKINGWINDOW( ToolPanelChildWindow, SID_TASKPANE) //===== PaneChildWindow ======================================================= diff --git a/sd/source/ui/toolpanel/ToolPanelFactory.cxx b/sd/source/ui/toolpanel/ToolPanelFactory.cxx index 416b0e2a4..767dece44 100644 --- a/sd/source/ui/toolpanel/ToolPanelFactory.cxx +++ b/sd/source/ui/toolpanel/ToolPanelFactory.cxx @@ -172,7 +172,7 @@ namespace sd { namespace toolpanel } } - if ( !pViewFrame || !pViewFrame->HasChildWindow( SID_RIGHT_PANE ) ) + if ( !pViewFrame || !pViewFrame->HasChildWindow( SID_TASKPANE ) ) throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal frame." ) ), *this, @@ -180,7 +180,7 @@ namespace sd { namespace toolpanel ); // retrieve the task pane - ToolPanelChildWindow* pToolPanelWindow( dynamic_cast< ToolPanelChildWindow* >( pViewFrame->GetChildWindow( SID_RIGHT_PANE ) ) ); + ToolPanelChildWindow* pToolPanelWindow( dynamic_cast< ToolPanelChildWindow* >( pViewFrame->GetChildWindow( SID_TASKPANE ) ) ); if ( !pToolPanelWindow ) throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No Impress document, or no Impress Task Pane." ) ), diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index a516a92f5..aa31b4342 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -34,6 +34,7 @@ #include "taskpane/TaskPaneControlFactory.hxx" #include "controls/MasterPagesPanel.hxx" #include "LayoutMenu.hxx" +#include "DrawDocShell.hxx" #include "controls/TableDesignPanel.hxx" #include "controls/CustomAnimationPanel.hxx" #include "controls/SlideTransitionPanel.hxx" @@ -366,9 +367,13 @@ TYPEINIT1(ToolPanelViewShell, ViewShell); // --------------------------------------------------------------------------------------------------------------------- ToolPanelViewShell_Impl::InitialPanel ToolPanelViewShell_Impl::impl_determineInitialPanel() { + InitialPanel aPanelToActivate; + if ( GetAntiImpl().GetViewShellBase().GetDocShell()->GetDocumentType() == DOCUMENT_TYPE_DRAW ) + // for Draw, rely on SFX's default handling, which is to activate the previously active panel + return aPanelToActivate; + // Default to Layout panel, but check whether the requested configuration already contains a tool panel, in this case, // use that one. - InitialPanel aPanelToActivate; aPanelToActivate.sPanelResourceURL = FrameworkHelper::msLayoutTaskPanelURL; aPanelToActivate.bActivateDirectly = false; try diff --git a/sd/source/ui/view/GraphicViewShellBase.cxx b/sd/source/ui/view/GraphicViewShellBase.cxx index 2d9371439..8026c942c 100644 --- a/sd/source/ui/view/GraphicViewShellBase.cxx +++ b/sd/source/ui/view/GraphicViewShellBase.cxx @@ -100,18 +100,18 @@ void GraphicViewShellBase::Execute (SfxRequest& rRequest) switch (nSlotId) { - case SID_RIGHT_PANE: case SID_NOTES_WINDOW: case SID_SLIDE_SORTER_MULTI_PANE_GUI: case SID_DIAMODE: case SID_OUTLINEMODE: case SID_NOTESMODE: case SID_HANDOUTMODE: - case SID_TASK_PANE: + case SID_SHOW_TOOL_PANEL: // Prevent some Impress-only slots from being executed. rRequest.Cancel(); break; + case SID_TASKPANE: case SID_SWITCH_SHELL: case SID_LEFT_PANE_DRAW: case SID_LEFT_PANE_IMPRESS: diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 0143a85a4..c4b4dca1f 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -809,7 +809,7 @@ void ViewShellBase::Execute (SfxRequest& rRequest) framework::FrameworkHelper::msSlideSorterURL); break; - case SID_RIGHT_PANE: + case SID_TASKPANE: mpImpl->SetPaneVisibility( rRequest, framework::FrameworkHelper::msRightPaneURL, @@ -830,7 +830,7 @@ void ViewShellBase::Execute (SfxRequest& rRequest) // The full screen mode is not supported. Ignore the request. break; - case SID_TASK_PANE: + case SID_SHOW_TOOL_PANEL: mpImpl->ProcessTaskPaneSlot(rRequest); break; @@ -1535,7 +1535,7 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet) xContext, FrameworkHelper::msLeftDrawPaneURL); break; - case SID_RIGHT_PANE: + case SID_TASKPANE: xResourceId = ResourceId::create( xContext, FrameworkHelper::msRightPaneURL); break; diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index 9dedf6cc1..fd4a89aa3 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -200,7 +200,7 @@ void ViewShell::Implementation::ProcessModifyPageSlot ( if (pFrame!=NULL && pFrame->GetDispatcher()!=NULL) { pFrame->GetDispatcher()->Execute ( - SID_TASK_PANE, + SID_SHOW_TOOL_PANEL, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aMakeToolPaneVisible, &aPanelId, diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml index 5b79fdd1f..3cf5193fd 100644 --- a/sd/uiconfig/simpress/menubar/menubar.xml +++ b/sd/uiconfig/simpress/menubar/menubar.xml @@ -99,7 +99,7 @@ - + -- cgit v1.2.3 From 9fad408424389973e804f7b563301f587ee800ba Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 19 Apr 2010 15:02:15 +0200 Subject: slidecopy: make the value set somewhat smaller, so there's some space after it ... --- sd/source/ui/table/TableDesignPane.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 25aa40de3..aa10007b5 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -389,7 +389,7 @@ void TableDesignPane::updateLayout() mxControls[nId]->SetPaintTransparent(TRUE); mxControls[nId]->SetBackground(); } - aValueSetSize = Size( aPaneSize.Width() - 2 * aOffset.X(), nStylesHeight - mxControls[FL_TABLE_STYLES]->GetSizePixel().Height() - mnOrgOffsetY[FL_TABLE_STYLES] ); + aValueSetSize = Size( pValueSet->GetSizePixel().Width(), nStylesHeight - mxControls[FL_TABLE_STYLES]->GetSizePixel().Height() - mnOrgOffsetY[FL_TABLE_STYLES] ); } else { -- cgit v1.2.3 From 3d568187dcd8050631e68fa9d083c0b478e90208 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 22 Apr 2010 16:16:37 +0200 Subject: slidecopy: removed accelerator/*/default.xml - they're not used for a long time now ... (accelerator config is now in Accelerators.xcu in officecfg. No need to confuse people with those dead files) --- sd/prj/d.lst | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/sd/prj/d.lst b/sd/prj/d.lst index fd21f7cd4..14f85e982 100644 --- a/sd/prj/d.lst +++ b/sd/prj/d.lst @@ -8,16 +8,6 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\menubar mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\simpress\menubar mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\toolbar mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\simpress\toolbar -mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\accelerator -mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\simpress\accelerator -mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\accelerator\en-US -mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\accelerator\de -mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\accelerator\es -mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\accelerator\fr -mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\simpress\accelerator\en-US -mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\simpress\accelerator\de -mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\simpress\accelerator\es -mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\simpress\accelerator\fr mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\statusbar mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\simpress\statusbar @@ -62,15 +52,6 @@ mkdir: %_DEST%\inc%_EXT%\sd ..\uiconfig\simpress\menubar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\simpress\menubar\*.xml ..\uiconfig\sdraw\toolbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\toolbar\*.xml ..\uiconfig\simpress\toolbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\simpress\toolbar\*.xml -..\uiconfig\sdraw\accelerator\en-US\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\accelerator\en-US\*.xml -..\uiconfig\sdraw\accelerator\de\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\accelerator\de\*.xml -..\uiconfig\sdraw\accelerator\es\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\accelerator\es\*.xml -..\uiconfig\sdraw\accelerator\fr\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\accelerator\fr\*.xml -..\uiconfig\simpress\accelerator\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\simpress\accelerator\*.xml -..\uiconfig\simpress\accelerator\en-US\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\simpress\accelerator\en-US\*.xml -..\uiconfig\simpress\accelerator\de\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\simpress\accelerator\de\*.xml -..\uiconfig\simpress\accelerator\es\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\simpress\accelerator\es\*.xml -..\uiconfig\simpress\accelerator\fr\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\simpress\accelerator\fr\*.xml ..\uiconfig\sdraw\statusbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\sdraw\statusbar\*.xml ..\uiconfig\simpress\statusbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\simpress\statusbar\*.xml -- cgit v1.2.3 From 75ee7b6a494724dcf7e6b8d8e1b517ea76284ce3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 26 Apr 2010 22:30:32 +0200 Subject: slidecopy: corrected parenthood of the ToolPanelDecks's A11Y object - had a cyclic ancestor chain before ... --- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index aa31b4342..29f4b16c8 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -84,7 +84,6 @@ #include #include #include -#include #include #include #include @@ -872,21 +871,19 @@ void ToolPanelViewShell_Impl::ConnectToDockingWindow() // --------------------------------------------------------------------------------------------------------------------- Reference< XAccessible > ToolPanelViewShell_Impl::CreateAccessible( ::sd::Window& i_rWindow ) { - Reference< XAccessible > xAccessibleParent; - ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow(); - if ( pAccessibleParent ) - xAccessibleParent.set( pAccessibleParent->GetAccessible() ); - Reference< XAccessible > xAccessible( GetToolPanelDeck().GetAccessible( FALSE ) ); if ( !xAccessible.is() ) { + // determine the XAccessible which is the parent of the to-be-created object + ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow(); + OSL_ENSURE( pAccessibleParent, "ToolPanelViewShell_Impl::CreateAccessible: illegal accessible parent provided by the sd::Window!" ); + GetToolPanelDeck().SetAccessibleParentWindow( pAccessibleParent ); + xAccessible = GetToolPanelDeck().GetAccessible( TRUE ); ENSURE_OR_RETURN( xAccessible.is(), "ToolPanelViewShell_Impl::CreateAccessible: illegal ToolPanelDeck accessible!", NULL ); - if ( xAccessibleParent.is() ) - { - ::comphelper::OAccessibleImplementationAccess::setAccessibleParent( - xAccessible->getAccessibleContext(), xAccessibleParent ); - } + OSL_ENSURE( xAccessible->getAccessibleContext().is() + && xAccessible->getAccessibleContext()->getAccessibleParent() == pAccessibleParent->GetAccessible(), + "ToolPanelViewShell_Impl::CreateAccessible: illegal parenthood!" ); } return xAccessible; } -- cgit v1.2.3 From 7fedceaccc2e7a379ab28edf6e6c0b85a95b98e3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 28 Apr 2010 09:41:55 +0200 Subject: slidecopy: make compile on unxsol[i|s]4.pro and unxmacxi[.pro] --- sd/source/ui/toolpanel/LayoutMenu.cxx | 6 +++--- sd/source/ui/toolpanel/LayoutMenu.hxx | 2 +- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sd/source/ui/toolpanel/LayoutMenu.cxx b/sd/source/ui/toolpanel/LayoutMenu.cxx index 2028fb627..276b889a5 100644 --- a/sd/source/ui/toolpanel/LayoutMenu.cxx +++ b/sd/source/ui/toolpanel/LayoutMenu.cxx @@ -228,14 +228,14 @@ LayoutMenu::LayoutMenu( TreeNode* pParent, ToolPanelViewShell& i_rPanelViewShell mbSelectionUpdatePending(true), mbIsMainViewChangePending(false) { - ImplConstruct( *mrBase.GetDocument()->GetDocSh() ); + implConstruct( *mrBase.GetDocument()->GetDocSh() ); } -void LayoutMenu::ImplConstruct( DrawDocShell& rDocumentShell ) +void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell ) { OSL_ENSURE( mrBase.GetDocument()->GetDocSh() == &rDocumentShell, - "LayoutMenu::ImplConstruct: hmm?" ); + "LayoutMenu::implConstruct: hmm?" ); // if this fires, then my assumption that the rDocumentShell parameter to our first ctor is superfluous ... SetStyle ( diff --git a/sd/source/ui/toolpanel/LayoutMenu.hxx b/sd/source/ui/toolpanel/LayoutMenu.hxx index b20f305fa..c269ba467 100644 --- a/sd/source/ui/toolpanel/LayoutMenu.hxx +++ b/sd/source/ui/toolpanel/LayoutMenu.hxx @@ -228,7 +228,7 @@ private: void UpdateSelection (void); // internal ctor - void ImplConstruct( DrawDocShell& rDocumentShell ); + void implConstruct( DrawDocShell& rDocumentShell ); /** When clicked then set the current page of the view in the center pane. */ diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 29f4b16c8..b1624ffa6 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -159,6 +159,7 @@ PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL, cons else { OSL_ENSURE( i_bIgnoreUnknown, "GetStandardPanelId: cannot translate the given resource URL!" ); + (void)i_bIgnoreUnknown; } return ePanelId; -- cgit v1.2.3 From 5f4b093f6922e40dd5550c94dd2c4a2d92a7820b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 7 May 2010 10:19:42 +0200 Subject: slidecopy: allow activating a tool panel view XLayoutManager::showElement --- sd/source/ui/dlg/PaneChildWindows.cxx | 27 ++++++++++++++++++++++++ sd/source/ui/inc/PaneChildWindows.hxx | 7 +++++- sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx | 5 +++++ sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 8 +++++++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx index a282764a6..5ee7b4f77 100755 --- a/sd/source/ui/dlg/PaneChildWindows.cxx +++ b/sd/source/ui/dlg/PaneChildWindows.cxx @@ -32,6 +32,7 @@ #include "PaneDockingWindow.hxx" #include "ViewShellBase.hxx" #include "framework/FrameworkHelper.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "app.hrc" #include "strings.hrc" #include "sdresid.hxx" @@ -40,6 +41,7 @@ #include #include #include +#include namespace sd { @@ -148,4 +150,29 @@ ToolPanelChildWindow::ToolPanelChildWindow( ::Window* i_pParentWindow, USHORT i_ { } +//---------------------------------------------------------------------------------------------------------------------- +void ToolPanelChildWindow::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) +{ + SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() ); + ViewShellBase* pViewShellBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame() ); + ENSURE_OR_RETURN_VOID( pViewShellBase != NULL, "ToolPanelChildWindow::ActivateToolPanel: no view shell access!" ); + + const ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper( framework::FrameworkHelper::Instance( *pViewShellBase ) ); + + if ( i_rPanelURL.indexOf( framework::FrameworkHelper::msTaskPanelURLPrefix ) == 0 ) + { + // it's one of our standard panels known to the drawing framework + pFrameworkHelper->RequestTaskPanel( i_rPanelURL ); + } + else + { + // TODO: it would be nice if the drawing framework were able to handle non-standard panels, installed by + // extensions, too. As long as this is not the case, we need to take the direct way ... + ::boost::shared_ptr< ViewShell > pViewShell = pFrameworkHelper->GetViewShell( framework::FrameworkHelper::msRightPaneURL ); + toolpanel::ToolPanelViewShell* pToolPanelViewShell = dynamic_cast< toolpanel::ToolPanelViewShell* >( pViewShell.get() ); + ENSURE_OR_RETURN_VOID( pToolPanelViewShell != NULL, "ToolPanelChildWindow::ActivateToolPanel: no tool panel view shell access!" ); + pToolPanelViewShell->ActivatePanel( i_rPanelURL ); + } +} + } // end of namespace ::sd diff --git a/sd/source/ui/inc/PaneChildWindows.hxx b/sd/source/ui/inc/PaneChildWindows.hxx index c3edde997..d88118cf1 100644 --- a/sd/source/ui/inc/PaneChildWindows.hxx +++ b/sd/source/ui/inc/PaneChildWindows.hxx @@ -29,6 +29,7 @@ #define SD_PANE_CHILD_WINDOWS_HXX #include +#include namespace sd { @@ -77,7 +78,8 @@ public: //====================================================================================================================== //= ToolPanelChildWindow //====================================================================================================================== -class ToolPanelChildWindow : public PaneChildWindow +class ToolPanelChildWindow :public PaneChildWindow + ,public ::sfx2::ITaskPaneToolPanelAccess { public: ToolPanelChildWindow( @@ -87,6 +89,9 @@ public: SfxChildWinInfo* i_pChildWindowInfo ); SFX_DECL_CHILDWINDOW( ToolPanelChildWindow ); + + // ::sfx2::ITaskPaneToolPanelAccess + virtual void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ); }; diff --git a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx index ba5b602ae..b510a33f9 100644 --- a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx +++ b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx @@ -102,6 +102,11 @@ public: TaskPaneShellManager& GetSubShellManager (void) const; + /** deactivates the given panel, bypassing the configuration controller. Only valid for tool panels which are + not under the drawing framework's control. + */ + void ActivatePanel( const ::rtl::OUString& i_rPanelResourceURL ); + /** deactivates the given panel, bypassing the configuration controller */ void DeactivatePanel( const ::rtl::OUString& i_rPanelResourceURL ); diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index b1624ffa6..e8cdd0619 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -732,6 +732,14 @@ Reference< XUIElement > ToolPanelViewShell::CreatePanelUIElement( const Referenc return xUIElement; } +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::ActivatePanel( const ::rtl::OUString& i_rPanelResourceURL ) +{ + OSL_ENSURE( i_rPanelResourceURL.indexOf( FrameworkHelper::msTaskPanelURLPrefix ) < 0, + "ToolPanelViewShell::ActivatePanel: for drawing-framework-controller panels, please use FrameworkHelper::RequestTaskPanel!" ); + mpImpl->ActivatePanelByResource( i_rPanelResourceURL ); +} + // --------------------------------------------------------------------------------------------------------------------- void ToolPanelViewShell::DeactivatePanel( const ::rtl::OUString& i_rPanelResourceURL ) { -- cgit v1.2.3 From 65529e8b9435b45d90ec802912ef650426f38d63 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 19 May 2010 12:08:26 +0200 Subject: slidecopy: fixed key navigation within titled controls --- sd/source/ui/toolpanel/TitledControl.cxx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sd/source/ui/toolpanel/TitledControl.cxx b/sd/source/ui/toolpanel/TitledControl.cxx index fe4dd04fa..328f06e2d 100644 --- a/sd/source/ui/toolpanel/TitledControl.cxx +++ b/sd/source/ui/toolpanel/TitledControl.cxx @@ -54,16 +54,13 @@ TitledControl::TitledControl ( mpUserData(NULL), mpClickHandler(new ClickHandler(rClickHandler)) { - if (pControl.get() != NULL) - { - mpControlContainer->AddControl (::std::auto_ptr ( - new TitleBar (this, rTitle, eType, pControl->IsExpandable()))); - pControl->SetParentNode (this); - } + mpControlContainer->AddControl (::std::auto_ptr ( + new TitleBar (this, rTitle, eType, pControl->IsExpandable()))); + pControl->SetParentNode (this); mpControlContainer->AddControl (pControl); - FocusManager::Instance().RegisterDownLink(this, GetControl()->GetWindow()); - FocusManager::Instance().RegisterUpLink(GetControl()->GetWindow(), this); + FocusManager::Instance().RegisterDownLink( GetTitleBar()->GetWindow(), GetControl()->GetWindow() ); + FocusManager::Instance().RegisterUpLink( GetControl()->GetWindow(), GetTitleBar()->GetWindow() ); SetBackground (Wallpaper()); -- cgit v1.2.3