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
;
110 namespace sd
{ namespace toolpanel
{
112 SFX_IMPL_INTERFACE(TaskPaneViewShell
, SfxShell
, SdResId(STR_TASKPANEVIEWSHELL
))
117 TYPEINIT1(TaskPaneViewShell
, ViewShell
);
120 /** Inner implementation class of TaskPaneViewShell.
122 class TaskPaneViewShell::Implementation
125 static const sal_uInt32 mnInvalidId
= 0xffffffff;
127 Implementation (void);
128 ~Implementation (void);
130 /** Here the panels are created that are shown in the task pane.
132 void Setup (ToolPanel
* pToolPanel
, ViewShellBase
& rBase
);
134 /** Make a new panel known to the translation table that translates
135 between internal indices as returned by
136 ControlContainer::AddControl() and public indices defined by
137 TaskPaneViewShell::PanelId.
139 void AddPanel (sal_uInt32 nInternalId
, PanelId nPublicId
);
141 /** Return the public id for the given internal one.
143 When the given public id is not known then PID_UNKNOWN is
146 PanelId
GetPublicId (sal_uInt32 nInternalId
) const;
148 /** Return the internal id for the given public one.
150 When the given public id is not known then mnInvalidId is
153 sal_uInt32
GetInternalId (PanelId nPublicId
) const;
156 /** This map translates between internal indices returned by
157 ControlContainer::AddControl() and public indices defined by
158 TaskPaneViewShell::PanelId.
160 typedef ::std::vector
<PanelId
> InternalIdToPanelIdMap
;
161 InternalIdToPanelIdMap maIndexMap
;
170 MID_UNLOCK_TASK_PANEL
= 1,
171 MID_LOCK_TASK_PANEL
= 2,
173 MID_FIRST_CONTROL
= 4
176 /** This control is used for extracting the title string from the resource
177 of some dialogs that are displayed in the task pane. With this the
178 actual controls can be created on demand. This class only loads (a part
181 class DummyControl
: public Control
184 DummyControl (::Window
* pParent
, const ResId
& rResId
)
185 : Control(pParent
,rResId
)
191 class ResourceActivationClickHandler
194 ResourceActivationClickHandler (
195 const ::boost::shared_ptr
<FrameworkHelper
>& rpFrameworkHelper
,
196 const Reference
<drawing::framework::XResourceId
>& rxResourceId
,
197 ControlContainer
& rControlContainer
);
198 void operator () (TitledControl
& rTitledControl
);
201 ::boost::shared_ptr
<FrameworkHelper
> mpFrameworkHelper
;
202 Reference
<drawing::framework::XResourceId
> mxResourceId
;
203 ControlContainer
& mrControlContainer
;
206 } // end of anonymouse namespace
212 void TaskPaneViewShell::Implementation::Setup (
213 ToolPanel
* pToolPanel
,
214 ViewShellBase
& rBase
)
216 SdDrawDocument
* pDocument
= rBase
.GetDocument();
218 sal_uInt32 nIdOfControlToExpand
;
220 ::boost::shared_ptr
<FrameworkHelper
> pFrameworkHelper (FrameworkHelper::Instance(rBase
));
221 Reference
<drawing::framework::XResourceId
> xTaskPaneId (pFrameworkHelper
->CreateResourceId(
222 FrameworkHelper::msTaskPaneURL
, FrameworkHelper::msRightPaneURL
));
224 // The master page controls.
225 nId
= pToolPanel
->AddControl (
226 controls::MasterPagesPanel::CreateControlFactory(rBase
),
227 SdResId(STR_TASKPANEL_MASTER_PAGE_TITLE
),
228 HID_SD_SLIDE_DESIGNS
,
229 ResourceActivationClickHandler(
231 pFrameworkHelper
->CreateResourceId(
232 FrameworkHelper::msMasterPagesTaskPanelURL
, xTaskPaneId
),
233 pToolPanel
->GetControlContainer()));
234 AddPanel (nId
, PID_MASTER_PAGES
);
237 nId
= pToolPanel
->AddControl (
238 LayoutMenu::CreateControlFactory(rBase
, *pDocument
->GetDocSh()),
239 SdResId(STR_TASKPANEL_LAYOUT_MENU_TITLE
),
240 HID_SD_SLIDE_LAYOUTS
,
241 ResourceActivationClickHandler(
243 pFrameworkHelper
->CreateResourceId(
244 FrameworkHelper::msLayoutTaskPanelURL
, xTaskPaneId
),
245 pToolPanel
->GetControlContainer()));
246 AddPanel (nId
, PID_LAYOUT
);
247 nIdOfControlToExpand
= nId
;
250 DummyControl
aControl (pToolPanel
, SdResId(DLG_TABLEDESIGNPANE
));
253 nId
= pToolPanel
->AddControl (
254 controls::TableDesignPanel::CreateControlFactory(rBase
),
257 ResourceActivationClickHandler(
259 pFrameworkHelper
->CreateResourceId(
260 FrameworkHelper::msTableDesignPanelURL
, xTaskPaneId
),
261 pToolPanel
->GetControlContainer()));
262 AddPanel (nId
, PID_TABLE_DESIGN
);
266 DummyControl
aControl (pToolPanel
, SdResId(RID_CUSTOMANIMATION_START
+0));
268 // CustomAnimationPanel
269 nId
= pToolPanel
->AddControl (
270 controls::CustomAnimationPanel::CreateControlFactory(rBase
),
272 HID_SD_CUSTOM_ANIMATIONS
,
273 ResourceActivationClickHandler(
275 pFrameworkHelper
->CreateResourceId(
276 FrameworkHelper::msCustomAnimationTaskPanelURL
, xTaskPaneId
),
277 pToolPanel
->GetControlContainer()));
278 AddPanel (nId
, PID_CUSTOM_ANIMATION
);
281 // SlideTransitionPanel
283 DummyControl
aControl (pToolPanel
, SdResId(RID_CUSTOMANIMATION_START
+3));
285 nId
= pToolPanel
->AddControl (
286 controls::SlideTransitionPanel::CreateControlFactory(rBase
),
288 HID_SD_SLIDE_TRANSITIONS
,
289 ResourceActivationClickHandler(
291 pFrameworkHelper
->CreateResourceId(
292 FrameworkHelper::msSlideTransitionTaskPanelURL
, xTaskPaneId
),
293 pToolPanel
->GetControlContainer()));
294 AddPanel (nId
, PID_SLIDE_TRANSITION
);
297 #ifdef SHOW_COLOR_MENU
299 pToolPanel
->AddControl (
300 ColorMenu::CreateControlFactory(),
301 String::CreateFromAscii ("Color Test Menu"),
305 #ifdef SHOW_TEST_PANEL
307 pToolPanel
->AddControl (
308 TestPanel::CreateControlFactory(),
309 String::CreateFromAscii ("Test Panel"),
313 #ifdef USE_SLIDE_SORTER_CACHE_DISPLAY
314 pToolPanel
->AddControl (
315 SlideSorterCacheDisplay::CreateControlFactory(pDocument
),
316 String::CreateFromAscii("Slide Sorter Cache Status"),
320 // Expand the layout menu.
321 pToolPanel
->GetControlContainer().SetExpansionState (
322 nIdOfControlToExpand
,
323 ControlContainer::ES_EXPAND
);
325 pToolPanel
->GetWindow()->Show();
331 void TaskPaneViewShell::Initialize (void)
333 if ( ! mbIsInitialized
)
335 mbIsInitialized
= true;
336 mpImpl
->Setup (mpTaskPane
.get(), GetViewShellBase());
343 TaskPaneViewShell::TaskPaneViewShell (
344 SfxViewFrame
* pFrame
,
345 ViewShellBase
& rViewShellBase
,
346 ::Window
* pParentWindow
,
347 FrameView
* pFrameViewArgument
)
348 : ViewShell (pFrame
, pParentWindow
, rViewShellBase
),
351 mbIsInitialized(false),
355 meShellType
= ST_TASK_PANE
;
357 mpImpl
.reset (new Implementation());
359 mpContentWindow
->SetCenterAllowed (false);
360 pParentWindow
->SetStyle(pParentWindow
->GetStyle() | WB_DIALOGCONTROL
);
362 mpTaskPane
= ::std::auto_ptr
<ToolPanel
>(new ToolPanel (
363 mpContentWindow
.get(), *this));
365 GetParentWindow()->SetBackground(Wallpaper());
366 mpContentWindow
->SetBackground(Wallpaper());
368 GetParentWindow()->SetHelpId(HID_SD_TASK_PANE
);
370 PaneDockingWindow
* pDockingWindow
= dynamic_cast<PaneDockingWindow
*>(GetDockingWindow());
371 if (pDockingWindow
!= NULL
)
373 pDockingWindow
->InitializeTitleToolBox();
374 mnMenuId
= pDockingWindow
->AddMenu (
375 String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_TITLE
)),
376 HID_SD_TASK_PANE_VIEW_MENU
,
377 LINK(this, TaskPaneViewShell
, ToolboxClickHandler
));
380 // Tell the focus manager that we want to pass the focus to our
382 FocusManager::Instance().RegisterDownLink(pParentWindow
, mpTaskPane
.get());
384 SetPool (&GetDoc()->GetPool());
386 if (pFrameViewArgument
!= NULL
)
387 mpFrameView
= pFrameViewArgument
;
389 mpFrameView
= new FrameView(GetDoc());
390 GetFrameView()->Connect();
392 // Hide or delete unused controls that we have inherited from the
393 // ViewShell base class.
394 mpHorizontalScrollBar
.reset();
395 mpVerticalScrollBar
.reset();
396 mpScrollBarBox
.reset();
397 mpHorizontalRuler
.reset();
398 mpVerticalRuler
.reset();
400 SetName (String (RTL_CONSTASCII_USTRINGPARAM("TaskPaneViewShell")));
402 // For accessibility we have to shortly hide the content window. This
403 // triggers the construction of a new accessibility object for the new
404 // view shell. (One is created earlier while the construtor of the base
405 // class is executed. At that time the correct accessibility object can
406 // not be constructed.)
407 if (mpContentWindow
.get() !=NULL
)
409 mpContentWindow
->Hide();
410 mpContentWindow
->Show();
413 // Register the shell manager as factory at the ViewShellManager.
414 mpSubShellManager
.reset (new TaskPaneShellManager(
415 GetViewShellBase().GetViewShellManager(),
417 GetViewShellBase().GetViewShellManager()->AddSubShellFactory(this, mpSubShellManager
);
423 TaskPaneViewShell::~TaskPaneViewShell (void)
425 GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager
);
431 void TaskPaneViewShell::RegisterControls (void)
433 SfxModule
* pModule
= SD_MOD();
434 controls::MasterPagesSelector::RegisterInterface (pModule
);
435 LayoutMenu::RegisterInterface (pModule
);
441 void TaskPaneViewShell::ArrangeGUIElements (void)
443 ViewShell::ArrangeGUIElements();
445 Point
aOrigin (maViewPos
);
446 Size
aSize (maViewSize
);
450 // Place the task pane.
451 if (mpTaskPane
.get() != NULL
)
452 mpTaskPane
->SetPosSizePixel (Point(0,0), aSize
);
458 void TaskPaneViewShell::GetFocus (void)
466 void TaskPaneViewShell::LoseFocus (void)
474 void TaskPaneViewShell::KeyInput (const KeyEvent
& rEvent
)
476 KeyCode nCode
= rEvent
.GetKeyCode();
477 if (nCode
== KEY_RETURN
)
479 mpTaskPane
->GrabFocus();
482 ViewShell::KeyInput (rEvent
, NULL
);
488 IMPL_LINK(TaskPaneViewShell
, ToolboxClickHandler
, ToolBox
*, pToolBox
)
490 if (pToolBox
->GetCurItemId() == mnMenuId
)
492 pToolBox
->EndSelection();
494 DockingWindow
* pDockingWindow
= GetDockingWindow();
495 ::std::auto_ptr
<PopupMenu
> pMenu
= CreatePopupMenu (
496 pDockingWindow
!=NULL
&& !pDockingWindow
->IsFloatingMode());
497 pMenu
->SetSelectHdl (
498 LINK(this, TaskPaneViewShell
, MenuSelectHandler
));
500 // pass toolbox button rect so the menu can stay open on button up
501 Rectangle aRect
= pToolBox
->GetItemRect(mnMenuId
);
502 aRect
.SetPos(pToolBox
->GetPosPixel() );
503 pMenu
->Execute (pDockingWindow
, aRect
, POPUPMENU_EXECUTE_DOWN
);
512 IMPL_LINK(TaskPaneViewShell
, MenuSelectHandler
, Menu
*, pMenu
)
517 switch (pMenu
->GetCurItemId())
519 case MID_UNLOCK_TASK_PANEL
:
521 DockingWindow
* pDockingWindow
= GetDockingWindow();
522 if (pDockingWindow
!= NULL
)
523 pDockingWindow
->SetFloatingMode (TRUE
);
527 case MID_LOCK_TASK_PANEL
:
529 DockingWindow
* pDockingWindow
= GetDockingWindow();
530 if (pDockingWindow
!= NULL
)
531 pDockingWindow
->SetFloatingMode (FALSE
);
536 DBG_ASSERT (0, "Customization not yet implemented");
541 sal_uInt32
nIndex (pMenu
->GetUserValue(pMenu
->GetCurItemId()));
542 mpTaskPane
->GetControlContainer().SetVisibilityState (
544 ControlContainer::VS_TOGGLE
);
545 // mpTaskPane->Resize();
546 // mpTaskPane->Invalidate();
558 ::std::auto_ptr
<PopupMenu
> TaskPaneViewShell::CreatePopupMenu (
561 ::std::auto_ptr
<PopupMenu
> pMenu (new PopupMenu ());
562 FloatingWindow
* pFloat
= static_cast<FloatingWindow
*>(pMenu
->GetWindow());
565 pFloat
->SetPopupModeFlags (
566 pFloat
->GetPopupModeFlags()
567 | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE
);
570 // warning free code changes:
571 // FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE is 0x10000, so cast to USHORT is 0
572 // so why was this used anyway?
573 pMenu
->SetMenuFlags (
574 pMenu
->GetMenuFlags() /* | (USHORT)FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE */ );
576 // Add one entry for every tool panel element to individually make
577 // them visible or hide them.
578 USHORT nIndex
= MID_FIRST_CONTROL
;
579 sal_uInt32 nControlIndex
;
580 ControlContainer
& rContainer (mpTaskPane
->GetControlContainer());
581 for (nControlIndex
=0;
582 nControlIndex
<rContainer
.GetControlCount();
583 nControlIndex
=rContainer
.GetNextIndex(nControlIndex
,true,false))
585 TreeNode
* pChild
= rContainer
.GetControl(nControlIndex
);
586 TitledControl
* pControl
587 = static_cast<TitledControl
*>(pChild
->GetWindow());
588 pMenu
->InsertItem (nIndex
,
589 pControl
->GetTitle(),
591 pMenu
->SetUserValue (nIndex
, nControlIndex
);
592 if (pControl
->IsVisible())
593 pMenu
->CheckItem (nIndex
, TRUE
);
597 pMenu
->InsertSeparator ();
599 // Add entry for docking or un-docking the tool panel.
602 MID_UNLOCK_TASK_PANEL
,
603 String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_UNLOCK
)));
607 String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_LOCK
)));
608 pMenu
->RemoveDisabledEntries (FALSE
, FALSE
);
616 SdPage
* TaskPaneViewShell::GetActualPage (void)
621 SdPage
* TaskPaneViewShell::getCurrentPage(void) const
628 void TaskPaneViewShell::Execute (SfxRequest
& )
635 void TaskPaneViewShell::GetState (SfxItemSet
& rItemSet
)
643 TaskPaneShellManager
& TaskPaneViewShell::GetSubShellManager (void) const
645 return *mpSubShellManager
.get();
651 DockingWindow
* TaskPaneViewShell::GetDockingWindow (void)
653 ::Window
* pParentWindow
= GetParentWindow();
654 DockingWindow
* pDockingWindow
= NULL
;
655 while (pParentWindow
!=NULL
&& pDockingWindow
==NULL
)
657 pDockingWindow
= dynamic_cast<DockingWindow
*>(pParentWindow
);
658 pParentWindow
= pParentWindow
->GetParent();
660 return pDockingWindow
;
666 void TaskPaneViewShell::ShowPanel (const PanelId nPublicId
)
669 sal_uInt32
nId (mpImpl
->GetInternalId(nPublicId
));
670 if (nId
!= Implementation::mnInvalidId
)
672 mpTaskPane
->GetControlContainer().SetVisibilityState (
674 ControlContainer::VS_SHOW
);
681 void TaskPaneViewShell::HidePanel (const PanelId nPublicId
)
684 sal_uInt32
nId (mpImpl
->GetInternalId(nPublicId
));
685 if (nId
!= Implementation::mnInvalidId
)
687 mpTaskPane
->GetControlContainer().SetVisibilityState (
689 ControlContainer::VS_HIDE
);
696 void TaskPaneViewShell::ExpandPanel (const PanelId nPublicId
)
699 sal_uInt32
nId (mpImpl
->GetInternalId(nPublicId
));
700 if (nId
!= Implementation::mnInvalidId
)
702 mpTaskPane
->GetControlContainer().SetExpansionState (
704 ControlContainer::ES_EXPAND
);
711 void TaskPaneViewShell::CollapsePanel (const PanelId nPublicId
)
714 sal_uInt32
nId (mpImpl
->GetInternalId(nPublicId
));
715 if (nId
!= Implementation::mnInvalidId
)
717 mpTaskPane
->GetControlContainer().SetExpansionState (
719 ControlContainer::ES_COLLAPSE
);
726 ::com::sun::star::uno::Reference
<
727 ::com::sun::star::accessibility::XAccessible
>
728 TaskPaneViewShell::CreateAccessibleDocumentView (::sd::Window
* pWindow
)
730 ::com::sun::star::uno::Reference
<
731 ::com::sun::star::accessibility::XAccessible
> xAccessible
;
733 if (mpTaskPane
.get()!=NULL
&& pWindow
!=NULL
)
735 // We have to call CreateAccessible directly so that we can specify
736 // the correct accessible parent.
737 ::Window
* pParentWindow
= pWindow
->GetAccessibleParentWindow();
738 if (pParentWindow
!= NULL
)
739 xAccessible
= mpTaskPane
->CreateAccessibleObject(
740 pParentWindow
->GetAccessible());
749 Reference
<drawing::XDrawSubController
> TaskPaneViewShell::CreateSubController (void)
751 // This view shell is not designed to be the main view shell and thus
752 // does not support a UNO sub controller.
753 return Reference
<drawing::XDrawSubController
>();
759 bool TaskPaneViewShell::RelocateToParentWindow (::Window
* pParentWindow
)
761 ::Window
* pOldParentWindow
= GetParentWindow();
762 FocusManager::Instance().RemoveLinks(pOldParentWindow
, mpTaskPane
.get());
763 FocusManager::Instance().RemoveLinks(mpTaskPane
.get(), pOldParentWindow
);
765 ViewShell::RelocateToParentWindow(pParentWindow
);
767 PaneDockingWindow
* pDockingWindow
= dynamic_cast<PaneDockingWindow
*>(GetDockingWindow());
768 if (pDockingWindow
!= NULL
)
770 pDockingWindow
->InitializeTitleToolBox();
771 mnMenuId
= pDockingWindow
->AddMenu (
772 String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_TITLE
)),
773 HID_SD_TASK_PANE_VIEW_MENU
,
774 LINK(this, TaskPaneViewShell
, ToolboxClickHandler
));
776 FocusManager::Instance().RegisterDownLink(pParentWindow
, mpTaskPane
.get());
786 //===== TaskPaneViewShell::Implementation =====================================
788 TaskPaneViewShell::Implementation::Implementation (void)
790 (InternalIdToPanelIdMap::size_type
)PID__END
,
798 TaskPaneViewShell::Implementation::~Implementation (void)
805 void TaskPaneViewShell::Implementation::AddPanel (
806 sal_uInt32 nInternalId
,
809 maIndexMap
[nInternalId
] = nPublicId
;
815 TaskPaneViewShell::PanelId
816 TaskPaneViewShell::Implementation::GetPublicId (
817 sal_uInt32 nInternalId
) const
819 if (nInternalId
< maIndexMap
.size())
820 return maIndexMap
[nInternalId
];
829 TaskPaneViewShell::Implementation::GetInternalId (
830 TaskPaneViewShell::PanelId nPublicId
) const
832 sal_uInt32 nId
= mnInvalidId
;
833 for (sal_uInt32 nI
=0; nI
<maIndexMap
.size(); nI
++)
834 if (maIndexMap
[nI
] == nPublicId
)
846 //===== PanelActivation =======================================================
848 PanelActivation::PanelActivation (ViewShellBase
& rBase
, TaskPaneViewShell::PanelId nPanelId
)
854 void PanelActivation::operator() (bool)
856 toolpanel::TaskPaneViewShell
* pTaskPane
857 = dynamic_cast<toolpanel::TaskPaneViewShell
*>(
858 framework::FrameworkHelper::Instance(mrBase
)
859 ->GetViewShell(framework::FrameworkHelper::msRightPaneURL
).get());
860 if (pTaskPane
!= NULL
)
861 pTaskPane
->ShowPanel(mnPanelId
);
867 //===== ResourceActivationClickHandler ========================================
869 ResourceActivationClickHandler::ResourceActivationClickHandler (
870 const ::boost::shared_ptr
<FrameworkHelper
>& rpFrameworkHelper
,
871 const Reference
<drawing::framework::XResourceId
>& rxResourceId
,
872 ControlContainer
& rControlContainer
)
873 : mpFrameworkHelper(rpFrameworkHelper
),
874 mxResourceId(rxResourceId
),
875 mrControlContainer(rControlContainer
)
882 void ResourceActivationClickHandler::operator () (TitledControl
& rTitledControl
)
884 mrControlContainer
.SetExpansionState (
886 ControlContainer::ES_EXPAND
);
887 mpFrameworkHelper
->GetConfigurationController()->requestResourceActivation(
888 mxResourceId
, drawing::framework::ResourceActivationMode_REPLACE
);
892 } } // end of namespace ::sd::toolpanel