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: MasterPagesPanel.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 "MasterPagesPanel.hxx"
35 #include "taskpane/ScrollPanel.hxx"
36 #include "CurrentMasterPagesSelector.hxx"
37 #include "RecentMasterPagesSelector.hxx"
38 #include "AllMasterPagesSelector.hxx"
39 #include "taskpane/TaskPaneControlFactory.hxx"
40 #include "taskpane/TitledControl.hxx"
41 #include "../TaskPaneShellManager.hxx"
43 #include "DrawViewShell.hxx"
44 #include "ViewShellBase.hxx"
46 #include "strings.hrc"
47 #include "sdresid.hxx"
49 #include <svtools/valueset.hxx>
51 namespace sd
{ namespace toolpanel
{ namespace controls
{
54 MasterPagesPanel::MasterPagesPanel (TreeNode
* pParent
, ViewShellBase
& rBase
)
55 : ScrollPanel (pParent
)
57 SdDrawDocument
* pDocument
= rBase
.GetDocument();
58 ::std::auto_ptr
<controls::MasterPagesSelector
> pSelector
;
59 TitledControl
* pTitledControl
;
61 ::boost::shared_ptr
<MasterPageContainer
> pContainer (new MasterPageContainer());
63 // Create a panel with the master pages that are in use by the currently
65 DrawViewShell
* pDrawViewShell
= dynamic_cast<DrawViewShell
*>(rBase
.GetMainViewShell().get());
66 pSelector
.reset(new controls::CurrentMasterPagesSelector (
71 pSelector
->LateInit();
72 pSelector
->SetSmartHelpId( SmartId(HID_SD_TASK_PANE_PREVIEW_CURRENT
) );
73 GetShellManager()->AddSubShell(
74 HID_SD_TASK_PANE_PREVIEW_CURRENT
,
76 pSelector
->GetWindow());
77 pTitledControl
= AddControl (
78 ::std::auto_ptr
<TreeNode
>(pSelector
.release()),
79 SdResId(STR_TASKPANEL_CURRENT_MASTER_PAGES_TITLE
),
80 HID_SD_CURRENT_MASTERS
);
82 // Create a panel with the most recently used master pages.
83 pSelector
.reset(new controls::RecentMasterPagesSelector (
88 pSelector
->LateInit();
89 pSelector
->SetSmartHelpId( SmartId(HID_SD_TASK_PANE_PREVIEW_RECENT
) );
90 GetShellManager()->AddSubShell(
91 HID_SD_TASK_PANE_PREVIEW_RECENT
,
93 pSelector
->GetWindow());
94 pTitledControl
= AddControl (
95 ::std::auto_ptr
<TreeNode
>(pSelector
.release()),
96 SdResId(STR_TASKPANEL_RECENT_MASTER_PAGES_TITLE
),
97 HID_SD_RECENT_MASTERS
);
99 // Create a panel with all available master pages.
100 pSelector
.reset(new controls::AllMasterPagesSelector (
106 pSelector
->LateInit();
107 pSelector
->SetSmartHelpId( SmartId(HID_SD_TASK_PANE_PREVIEW_ALL
) );
108 GetShellManager()->AddSubShell(
109 HID_SD_TASK_PANE_PREVIEW_ALL
,
111 pSelector
->GetWindow());
112 pTitledControl
= AddControl (
113 ::std::auto_ptr
<TreeNode
>(pSelector
.release()),
114 SdResId(STR_TASKPANEL_ALL_MASTER_PAGES_TITLE
),
122 MasterPagesPanel::~MasterPagesPanel (void)
129 std::auto_ptr
<ControlFactory
> MasterPagesPanel::CreateControlFactory (ViewShellBase
& rBase
)
131 return std::auto_ptr
<ControlFactory
>(
132 new ControlFactoryWithArgs1
<MasterPagesPanel
,ViewShellBase
>(rBase
));
138 } } } // end of namespace ::sd::toolpanel::controls