1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TaskPaneViewShell.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include "TaskPaneViewShell.hxx"
36 #include "TaskPaneShellManager.hxx"
37 #include "ToolPanelChildWindow.hrc"
38 #include "ToolPanelChildWindow.hxx"
39 #include "taskpane/SlideSorterCacheDisplay.hxx"
40 #include "taskpane/ToolPanel.hxx"
41 #include "taskpane/TitledControl.hxx"
42 #include "LayoutMenu.hxx"
43 #include "TaskPaneFocusManager.hxx"
44 #include "taskpane/SubToolPanel.hxx"
45 #include "taskpane/ScrollPanel.hxx"
46 #include "taskpane/TaskPaneControlFactory.hxx"
47 #include "controls/MasterPagesPanel.hxx"
48 #include "controls/MasterPagesSelector.hxx"
49 #include "controls/TableDesignPanel.hxx"
50 #include "controls/CustomAnimationPanel.hxx"
51 #include "controls/SlideTransitionPanel.hxx"
52 #include "controls/AnimationSchemesPanel.hxx"
53 #include "TitleToolBox.hxx"
54 #include "taskpane/ControlContainer.hxx"
55 #include "FrameView.hxx"
57 #include "PaneDockingWindow.hxx"
58 #include "AccessibleTaskPane.hxx"
59 #include "DrawSubController.hxx"
63 #include "res_bmp.hrc"
65 #include "strings.hrc"
66 #include "sdresid.hxx"
67 #include "framework/FrameworkHelper.hxx"
68 #include <com/sun/star/drawing/framework/XResourceId.hpp>
69 #include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
70 #include <com/sun/star/drawing/XDrawSubController.hpp>
72 #include <svx/dlgctrl.hxx>
73 #include <sfx2/bindings.hxx>
74 #include <sfx2/dispatch.hxx>
75 #include <sfx2/viewfrm.hxx>
76 #include <sfx2/msg.hxx>
77 #include <sfx2/objface.hxx>
78 #include <svx/colrctrl.hxx>
79 #include <svx/xtable.hxx>
80 #include <vcl/dockwin.hxx>
81 #include "sdtreelb.hxx"
82 #include "DrawViewShell.hxx"
83 #include "drawdoc.hxx"
84 #include "ViewShellBase.hxx"
85 #include <svx/ruler.hxx>
86 #include <vcl/svapp.hxx>
88 //#define SHOW_TEST_PANEL
89 #ifdef SHOW_TEST_PANEL
90 #include "TestPanel.hxx"
92 //#define SHOW_COLOR_MENU
93 #ifdef SHOW_COLOR_MENU
94 #include "TestMenu.hxx"
98 #include <boost/shared_ptr.hpp>
100 using namespace ::sd::toolpanel
;
102 #define TaskPaneViewShell
103 #include "sdslots.hxx"
106 using namespace ::com::sun::star
;
107 using namespace ::com::sun::star::uno
;
108 using ::sd::framework::FrameworkHelper
;
111 namespace sd
{ namespace toolpanel
{
113 SFX_IMPL_INTERFACE(TaskPaneViewShell
, SfxShell
, SdResId(STR_TASKPANEVIEWSHELL
))
118 TYPEINIT1(TaskPaneViewShell
, ViewShell
);
121 /** Inner implementation class of TaskPaneViewShell.
123 class TaskPaneViewShell::Implementation
126 static const sal_uInt32 mnInvalidId
= 0xffffffff;
128 Implementation (void);
129 ~Implementation (void);
131 /** Here the panels are created that are shown in the task pane.
133 void Setup (ToolPanel
* pToolPanel
, ViewShellBase
& rBase
);
135 /** Make a new panel known to the translation table that translates
136 between internal indices as returned by
137 ControlContainer::AddControl() and public indices defined by
138 TaskPaneViewShell::PanelId.
140 void AddPanel (sal_uInt32 nInternalId
, PanelId nPublicId
);
142 /** Return the public id for the given internal one.
144 When the given public id is not known then PID_UNKNOWN is
147 PanelId
GetPublicId (sal_uInt32 nInternalId
) const;
149 /** Return the internal id for the given public one.
151 When the given public id is not known then mnInvalidId is
154 sal_uInt32
GetInternalId (PanelId nPublicId
) const;
157 /** This map translates between internal indices returned by
158 ControlContainer::AddControl() and public indices defined by
159 TaskPaneViewShell::PanelId.
161 typedef ::std::vector
<PanelId
> InternalIdToPanelIdMap
;
162 InternalIdToPanelIdMap maIndexMap
;
171 MID_UNLOCK_TASK_PANEL
= 1,
172 MID_LOCK_TASK_PANEL
= 2,
174 MID_FIRST_CONTROL
= 4
177 /** This control is used for extracting the title string from the resource
178 of some dialogs that are displayed in the task pane. With this the
179 actual controls can be created on demand. This class only loads (a part
182 class DummyControl
: public Control
185 DummyControl (::Window
* pParent
, const ResId
& rResId
)
186 : Control(pParent
,rResId
)
192 class ResourceActivationClickHandler
195 ResourceActivationClickHandler (
196 const ::boost::shared_ptr
<FrameworkHelper
>& rpFrameworkHelper
,
197 const Reference
<drawing::framework::XResourceId
>& rxResourceId
,
198 ControlContainer
& rControlContainer
);
199 void operator () (TitledControl
& rTitledControl
);
202 ::boost::shared_ptr
<FrameworkHelper
> mpFrameworkHelper
;
203 Reference
<drawing::framework::XResourceId
> mxResourceId
;
204 ControlContainer
& mrControlContainer
;
207 } // end of anonymouse namespace
213 void TaskPaneViewShell::Implementation::Setup (
214 ToolPanel
* pToolPanel
,
215 ViewShellBase
& rBase
)
217 SdDrawDocument
* pDocument
= rBase
.GetDocument();
219 sal_uInt32 nIdOfControlToExpand
;
221 ::boost::shared_ptr
<FrameworkHelper
> pFrameworkHelper (FrameworkHelper::Instance(rBase
));
222 Reference
<drawing::framework::XResourceId
> xTaskPaneId (pFrameworkHelper
->CreateResourceId(
223 FrameworkHelper::msTaskPaneURL
, FrameworkHelper::msRightPaneURL
));
225 // The master page controls.
226 nId
= pToolPanel
->AddControl (
227 controls::MasterPagesPanel::CreateControlFactory(rBase
),
228 SdResId(STR_TASKPANEL_MASTER_PAGE_TITLE
),
229 HID_SD_SLIDE_DESIGNS
,
230 ResourceActivationClickHandler(
232 pFrameworkHelper
->CreateResourceId(
233 FrameworkHelper::msMasterPagesTaskPanelURL
, xTaskPaneId
),
234 pToolPanel
->GetControlContainer()));
235 AddPanel (nId
, PID_MASTER_PAGES
);
238 nId
= pToolPanel
->AddControl (
239 LayoutMenu::CreateControlFactory(rBase
, *pDocument
->GetDocSh()),
240 SdResId(STR_TASKPANEL_LAYOUT_MENU_TITLE
),
241 HID_SD_SLIDE_LAYOUTS
,
242 ResourceActivationClickHandler(
244 pFrameworkHelper
->CreateResourceId(
245 FrameworkHelper::msLayoutTaskPanelURL
, xTaskPaneId
),
246 pToolPanel
->GetControlContainer()));
247 AddPanel (nId
, PID_LAYOUT
);
248 nIdOfControlToExpand
= nId
;
251 DummyControl
aControl (pToolPanel
, SdResId(DLG_TABLEDESIGNPANE
));
254 nId
= pToolPanel
->AddControl (
255 controls::TableDesignPanel::CreateControlFactory(rBase
),
258 ResourceActivationClickHandler(
260 pFrameworkHelper
->CreateResourceId(
261 FrameworkHelper::msTableDesignPanelURL
, xTaskPaneId
),
262 pToolPanel
->GetControlContainer()));
263 AddPanel (nId
, PID_TABLE_DESIGN
);
267 DummyControl
aControl (pToolPanel
, SdResId(RID_CUSTOMANIMATION_START
+0));
269 // CustomAnimationPanel
270 nId
= pToolPanel
->AddControl (
271 controls::CustomAnimationPanel::CreateControlFactory(rBase
),
273 HID_SD_CUSTOM_ANIMATIONS
,
274 ResourceActivationClickHandler(
276 pFrameworkHelper
->CreateResourceId(
277 FrameworkHelper::msCustomAnimationTaskPanelURL
, xTaskPaneId
),
278 pToolPanel
->GetControlContainer()));
279 AddPanel (nId
, PID_CUSTOM_ANIMATION
);
282 // SlideTransitionPanel
284 DummyControl
aControl (pToolPanel
, SdResId(RID_CUSTOMANIMATION_START
+3));
286 nId
= pToolPanel
->AddControl (
287 controls::SlideTransitionPanel::CreateControlFactory(rBase
),
289 HID_SD_SLIDE_TRANSITIONS
,
290 ResourceActivationClickHandler(
292 pFrameworkHelper
->CreateResourceId(
293 FrameworkHelper::msSlideTransitionTaskPanelURL
, xTaskPaneId
),
294 pToolPanel
->GetControlContainer()));
295 AddPanel (nId
, PID_SLIDE_TRANSITION
);
298 #ifdef SHOW_COLOR_MENU
300 pToolPanel
->AddControl (
301 ColorMenu::CreateControlFactory(),
302 String::CreateFromAscii ("Color Test Menu"),
306 #ifdef SHOW_TEST_PANEL
308 pToolPanel
->AddControl (
309 TestPanel::CreateControlFactory(),
310 String::CreateFromAscii ("Test Panel"),
314 #ifdef USE_SLIDE_SORTER_CACHE_DISPLAY
315 pToolPanel
->AddControl (
316 SlideSorterCacheDisplay::CreateControlFactory(pDocument
),
317 String::CreateFromAscii("Slide Sorter Cache Status"),
321 // Expand the layout menu.
322 pToolPanel
->GetControlContainer().SetExpansionState (
323 nIdOfControlToExpand
,
324 ControlContainer::ES_EXPAND
);
326 pToolPanel
->GetWindow()->Show();
332 void TaskPaneViewShell::Initialize (void)
334 if ( ! mbIsInitialized
)
336 mbIsInitialized
= true;
337 mpImpl
->Setup (mpTaskPane
.get(), GetViewShellBase());
344 TaskPaneViewShell::TaskPaneViewShell (
345 SfxViewFrame
* pFrame
,
346 ViewShellBase
& rViewShellBase
,
347 ::Window
* pParentWindow
,
348 FrameView
* pFrameViewArgument
)
349 : ViewShell (pFrame
, pParentWindow
, rViewShellBase
),
352 mbIsInitialized(false),
356 meShellType
= ST_TASK_PANE
;
358 mpImpl
.reset (new Implementation());
360 mpContentWindow
->SetCenterAllowed (false);
361 pParentWindow
->SetStyle(pParentWindow
->GetStyle() | WB_DIALOGCONTROL
);
363 mpTaskPane
= ::std::auto_ptr
<ToolPanel
>(new ToolPanel (
364 mpContentWindow
.get(), *this));
366 GetParentWindow()->SetBackground(Wallpaper());
367 mpContentWindow
->SetBackground(Wallpaper());
369 GetParentWindow()->SetHelpId(HID_SD_TASK_PANE
);
371 PaneDockingWindow
* pDockingWindow
= dynamic_cast<PaneDockingWindow
*>(GetDockingWindow());
372 if (pDockingWindow
!= NULL
)
374 pDockingWindow
->InitializeTitleToolBox();
375 mnMenuId
= pDockingWindow
->AddMenu (
376 String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_TITLE
)),
377 HID_SD_TASK_PANE_VIEW_MENU
,
378 LINK(this, TaskPaneViewShell
, ToolboxClickHandler
));
381 // Tell the focus manager that we want to pass the focus to our
383 FocusManager::Instance().RegisterDownLink(pParentWindow
, mpTaskPane
.get());
385 SetPool (&GetDoc()->GetPool());
387 if (pFrameViewArgument
!= NULL
)
388 mpFrameView
= pFrameViewArgument
;
390 mpFrameView
= new FrameView(GetDoc());
391 GetFrameView()->Connect();
393 // Hide or delete unused controls that we have inherited from the
394 // ViewShell base class.
395 mpHorizontalScrollBar
.reset();
396 mpVerticalScrollBar
.reset();
397 mpScrollBarBox
.reset();
398 mpHorizontalRuler
.reset();
399 mpVerticalRuler
.reset();
401 SetName (String (RTL_CONSTASCII_USTRINGPARAM("TaskPaneViewShell")));
403 // For accessibility we have to shortly hide the content window. This
404 // triggers the construction of a new accessibility object for the new
405 // view shell. (One is created earlier while the construtor of the base
406 // class is executed. At that time the correct accessibility object can
407 // not be constructed.)
408 if (mpContentWindow
.get() !=NULL
)
410 mpContentWindow
->Hide();
411 mpContentWindow
->Show();
414 // Register the shell manager as factory at the ViewShellManager.
415 mpSubShellManager
.reset (new TaskPaneShellManager(
416 GetViewShellBase().GetViewShellManager(),
418 GetViewShellBase().GetViewShellManager()->AddSubShellFactory(this, mpSubShellManager
);
424 TaskPaneViewShell::~TaskPaneViewShell (void)
426 GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager
);
432 void TaskPaneViewShell::RegisterControls (void)
434 SfxModule
* pModule
= SD_MOD();
435 controls::MasterPagesSelector::RegisterInterface (pModule
);
436 LayoutMenu::RegisterInterface (pModule
);
442 void TaskPaneViewShell::ArrangeGUIElements (void)
444 ViewShell::ArrangeGUIElements();
446 Point
aOrigin (maViewPos
);
447 Size
aSize (maViewSize
);
451 // Place the task pane.
452 if (mpTaskPane
.get() != NULL
)
453 mpTaskPane
->SetPosSizePixel (Point(0,0), aSize
);
459 void TaskPaneViewShell::GetFocus (void)
467 void TaskPaneViewShell::LoseFocus (void)
475 void TaskPaneViewShell::KeyInput (const KeyEvent
& rEvent
)
477 KeyCode nCode
= rEvent
.GetKeyCode();
478 if (nCode
== KEY_RETURN
)
480 mpTaskPane
->GrabFocus();
483 ViewShell::KeyInput (rEvent
, NULL
);
489 IMPL_LINK(TaskPaneViewShell
, ToolboxClickHandler
, ToolBox
*, pToolBox
)
491 if (pToolBox
->GetCurItemId() == mnMenuId
)
493 pToolBox
->EndSelection();
495 DockingWindow
* pDockingWindow
= GetDockingWindow();
496 ::std::auto_ptr
<PopupMenu
> pMenu
= CreatePopupMenu (
497 pDockingWindow
!=NULL
&& !pDockingWindow
->IsFloatingMode());
498 pMenu
->SetSelectHdl (
499 LINK(this, TaskPaneViewShell
, MenuSelectHandler
));
501 // pass toolbox button rect so the menu can stay open on button up
502 Rectangle aRect
= pToolBox
->GetItemRect(mnMenuId
);
503 aRect
.SetPos(pToolBox
->GetPosPixel() );
504 pMenu
->Execute (pDockingWindow
, aRect
, POPUPMENU_EXECUTE_DOWN
);
513 IMPL_LINK(TaskPaneViewShell
, MenuSelectHandler
, Menu
*, pMenu
)
518 switch (pMenu
->GetCurItemId())
520 case MID_UNLOCK_TASK_PANEL
:
522 DockingWindow
* pDockingWindow
= GetDockingWindow();
523 if (pDockingWindow
!= NULL
)
524 pDockingWindow
->SetFloatingMode (TRUE
);
528 case MID_LOCK_TASK_PANEL
:
530 DockingWindow
* pDockingWindow
= GetDockingWindow();
531 if (pDockingWindow
!= NULL
)
532 pDockingWindow
->SetFloatingMode (FALSE
);
537 DBG_ASSERT (0, "Customization not yet implemented");
542 sal_uInt32
nIndex (pMenu
->GetUserValue(pMenu
->GetCurItemId()));
543 mpTaskPane
->GetControlContainer().SetVisibilityState (
545 ControlContainer::VS_TOGGLE
);
546 // mpTaskPane->Resize();
547 // mpTaskPane->Invalidate();
559 ::std::auto_ptr
<PopupMenu
> TaskPaneViewShell::CreatePopupMenu (
562 ::std::auto_ptr
<PopupMenu
> pMenu (new PopupMenu ());
563 FloatingWindow
* pFloat
= static_cast<FloatingWindow
*>(pMenu
->GetWindow());
566 pFloat
->SetPopupModeFlags (
567 pFloat
->GetPopupModeFlags()
568 | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE
);
571 // warning free code changes:
572 // FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE is 0x10000, so cast to USHORT is 0
573 // so why was this used anyway?
574 pMenu
->SetMenuFlags (
575 pMenu
->GetMenuFlags() /* | (USHORT)FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE */ );
577 // Add one entry for every tool panel element to individually make
578 // them visible or hide them.
579 USHORT nIndex
= MID_FIRST_CONTROL
;
580 sal_uInt32 nControlIndex
;
581 ControlContainer
& rContainer (mpTaskPane
->GetControlContainer());
582 for (nControlIndex
=0;
583 nControlIndex
<rContainer
.GetControlCount();
584 nControlIndex
=rContainer
.GetNextIndex(nControlIndex
,true,false))
586 TreeNode
* pChild
= rContainer
.GetControl(nControlIndex
);
587 TitledControl
* pControl
588 = static_cast<TitledControl
*>(pChild
->GetWindow());
589 pMenu
->InsertItem (nIndex
,
590 pControl
->GetTitle(),
592 pMenu
->SetUserValue (nIndex
, nControlIndex
);
593 if (pControl
->IsVisible())
594 pMenu
->CheckItem (nIndex
, TRUE
);
598 pMenu
->InsertSeparator ();
600 // Add entry for docking or un-docking the tool panel.
603 MID_UNLOCK_TASK_PANEL
,
604 String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_UNLOCK
)));
608 String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_LOCK
)));
609 pMenu
->RemoveDisabledEntries (FALSE
, FALSE
);
617 SdPage
* TaskPaneViewShell::GetActualPage (void)
622 SdPage
* TaskPaneViewShell::getCurrentPage(void) const
629 void TaskPaneViewShell::Execute (SfxRequest
& )
636 void TaskPaneViewShell::GetState (SfxItemSet
& rItemSet
)
644 TaskPaneShellManager
& TaskPaneViewShell::GetSubShellManager (void) const
646 return *mpSubShellManager
.get();
652 DockingWindow
* TaskPaneViewShell::GetDockingWindow (void)
654 ::Window
* pParentWindow
= GetParentWindow();
655 DockingWindow
* pDockingWindow
= NULL
;
656 while (pParentWindow
!=NULL
&& pDockingWindow
==NULL
)
658 pDockingWindow
= dynamic_cast<DockingWindow
*>(pParentWindow
);
659 pParentWindow
= pParentWindow
->GetParent();
661 return pDockingWindow
;
667 void TaskPaneViewShell::ShowPanel (const PanelId nPublicId
)
670 sal_uInt32
nId (mpImpl
->GetInternalId(nPublicId
));
671 if (nId
!= Implementation::mnInvalidId
)
673 mpTaskPane
->GetControlContainer().SetVisibilityState (
675 ControlContainer::VS_SHOW
);
682 void TaskPaneViewShell::HidePanel (const PanelId nPublicId
)
685 sal_uInt32
nId (mpImpl
->GetInternalId(nPublicId
));
686 if (nId
!= Implementation::mnInvalidId
)
688 mpTaskPane
->GetControlContainer().SetVisibilityState (
690 ControlContainer::VS_HIDE
);
697 void TaskPaneViewShell::ExpandPanel (const PanelId nPublicId
)
700 sal_uInt32
nId (mpImpl
->GetInternalId(nPublicId
));
701 if (nId
!= Implementation::mnInvalidId
)
703 mpTaskPane
->GetControlContainer().SetExpansionState (
705 ControlContainer::ES_EXPAND
);
712 void TaskPaneViewShell::CollapsePanel (const PanelId nPublicId
)
715 sal_uInt32
nId (mpImpl
->GetInternalId(nPublicId
));
716 if (nId
!= Implementation::mnInvalidId
)
718 mpTaskPane
->GetControlContainer().SetExpansionState (
720 ControlContainer::ES_COLLAPSE
);
727 ::com::sun::star::uno::Reference
<
728 ::com::sun::star::accessibility::XAccessible
>
729 TaskPaneViewShell::CreateAccessibleDocumentView (::sd::Window
* pWindow
)
731 ::com::sun::star::uno::Reference
<
732 ::com::sun::star::accessibility::XAccessible
> xAccessible
;
734 if (mpTaskPane
.get()!=NULL
&& pWindow
!=NULL
)
736 // We have to call CreateAccessible directly so that we can specify
737 // the correct accessible parent.
738 ::Window
* pParentWindow
= pWindow
->GetAccessibleParentWindow();
739 if (pParentWindow
!= NULL
)
740 xAccessible
= mpTaskPane
->CreateAccessibleObject(
741 pParentWindow
->GetAccessible());
750 Reference
<drawing::XDrawSubController
> TaskPaneViewShell::CreateSubController (void)
752 // This view shell is not designed to be the main view shell and thus
753 // does not support a UNO sub controller.
754 return Reference
<drawing::XDrawSubController
>();
760 bool TaskPaneViewShell::RelocateToParentWindow (::Window
* pParentWindow
)
762 ::Window
* pOldParentWindow
= GetParentWindow();
763 FocusManager::Instance().RemoveLinks(pOldParentWindow
, mpTaskPane
.get());
764 FocusManager::Instance().RemoveLinks(mpTaskPane
.get(), pOldParentWindow
);
766 ViewShell::RelocateToParentWindow(pParentWindow
);
768 PaneDockingWindow
* pDockingWindow
= dynamic_cast<PaneDockingWindow
*>(GetDockingWindow());
769 if (pDockingWindow
!= NULL
)
771 pDockingWindow
->InitializeTitleToolBox();
772 mnMenuId
= pDockingWindow
->AddMenu (
773 String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_TITLE
)),
774 HID_SD_TASK_PANE_VIEW_MENU
,
775 LINK(this, TaskPaneViewShell
, ToolboxClickHandler
));
777 FocusManager::Instance().RegisterDownLink(pParentWindow
, mpTaskPane
.get());
787 //===== TaskPaneViewShell::Implementation =====================================
789 TaskPaneViewShell::Implementation::Implementation (void)
791 (InternalIdToPanelIdMap::size_type
)PID__END
,
799 TaskPaneViewShell::Implementation::~Implementation (void)
806 void TaskPaneViewShell::Implementation::AddPanel (
807 sal_uInt32 nInternalId
,
810 maIndexMap
[nInternalId
] = nPublicId
;
816 TaskPaneViewShell::PanelId
817 TaskPaneViewShell::Implementation::GetPublicId (
818 sal_uInt32 nInternalId
) const
820 if (nInternalId
< maIndexMap
.size())
821 return maIndexMap
[nInternalId
];
830 TaskPaneViewShell::Implementation::GetInternalId (
831 TaskPaneViewShell::PanelId nPublicId
) const
833 sal_uInt32 nId
= mnInvalidId
;
834 for (sal_uInt32 nI
=0; nI
<maIndexMap
.size(); nI
++)
835 if (maIndexMap
[nI
] == nPublicId
)
847 //===== PanelActivation =======================================================
849 PanelActivation::PanelActivation (ViewShellBase
& rBase
, TaskPaneViewShell::PanelId nPanelId
)
855 void PanelActivation::operator() (bool)
857 toolpanel::TaskPaneViewShell
* pTaskPane
858 = dynamic_cast<toolpanel::TaskPaneViewShell
*>(
859 framework::FrameworkHelper::Instance(mrBase
)
860 ->GetViewShell(framework::FrameworkHelper::msRightPaneURL
).get());
861 if (pTaskPane
!= NULL
)
862 pTaskPane
->ShowPanel(mnPanelId
);
868 //===== ResourceActivationClickHandler ========================================
870 ResourceActivationClickHandler::ResourceActivationClickHandler (
871 const ::boost::shared_ptr
<FrameworkHelper
>& rpFrameworkHelper
,
872 const Reference
<drawing::framework::XResourceId
>& rxResourceId
,
873 ControlContainer
& rControlContainer
)
874 : mpFrameworkHelper(rpFrameworkHelper
),
875 mxResourceId(rxResourceId
),
876 mrControlContainer(rControlContainer
)
883 void ResourceActivationClickHandler::operator () (TitledControl
& rTitledControl
)
885 mrControlContainer
.SetExpansionState (
887 ControlContainer::ES_EXPAND
);
888 mpFrameworkHelper
->GetConfigurationController()->requestResourceActivation(
889 mxResourceId
, drawing::framework::ResourceActivationMode_REPLACE
);
893 } } // end of namespace ::sd::toolpanel