fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / ui / toolpanel / controls / MasterPagesPanel.cxx
blob4acb64dee2048d99b64b37bf012a773a745cc7ef
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "MasterPagesPanel.hxx"
22 #include "taskpane/ScrollPanel.hxx"
23 #include "CurrentMasterPagesSelector.hxx"
24 #include "RecentMasterPagesSelector.hxx"
25 #include "AllMasterPagesSelector.hxx"
26 #include "taskpane/ToolPanelViewShell.hxx"
27 #include "taskpane/TaskPaneControlFactory.hxx"
28 #include "taskpane/TitledControl.hxx"
29 #include "../TaskPaneShellManager.hxx"
31 #include "DrawViewShell.hxx"
32 #include "ViewShellBase.hxx"
34 #include "strings.hrc"
35 #include "sdresid.hxx"
36 #include "helpids.h"
37 #include "app.hrc"
39 namespace sd { namespace toolpanel { namespace controls {
42 MasterPagesPanel::MasterPagesPanel (::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell)
43 :ScrollPanel (i_rParentWindow)
44 ,m_pPanelViewShell( &i_rPanelViewShell )
46 impl_construct( m_pPanelViewShell->GetViewShellBase() );
49 void MasterPagesPanel::impl_construct( ViewShellBase& rBase )
51 SdDrawDocument* pDocument = rBase.GetDocument();
52 ::std::auto_ptr<controls::MasterPagesSelector> pSelector;
54 ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
56 // Create a panel with the master pages that are in use by the currently
57 // edited document.
58 DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(rBase.GetMainViewShell().get());
59 pSelector.reset(new controls::CurrentMasterPagesSelector (
60 this,
61 *pDocument,
62 rBase,
63 pContainer));
64 pSelector->LateInit();
65 pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT );
66 GetShellManager()->AddSubShell(
67 SHELLID_SD_TASK_PANE_PREVIEW_CURRENT,
68 pSelector.get(),
69 pSelector->GetWindow());
70 AddControl (
71 ::std::auto_ptr<TreeNode>(pSelector.release()),
72 SdResId(STR_TASKPANEL_CURRENT_MASTER_PAGES_TITLE),
73 HID_SD_CURRENT_MASTERS);
75 // Create a panel with the most recently used master pages.
76 pSelector.reset(new controls::RecentMasterPagesSelector (
77 this,
78 *pDocument,
79 rBase,
80 pContainer));
81 pSelector->LateInit();
82 pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_RECENT );
83 GetShellManager()->AddSubShell(
84 SHELLID_SD_TASK_PANE_PREVIEW_RECENT,
85 pSelector.get(),
86 pSelector->GetWindow());
87 AddControl (
88 ::std::auto_ptr<TreeNode>(pSelector.release()),
89 SdResId(STR_TASKPANEL_RECENT_MASTER_PAGES_TITLE),
90 HID_SD_RECENT_MASTERS);
92 // Create a panel with all available master pages.
93 pSelector.reset(new controls::AllMasterPagesSelector (
94 this,
95 *pDocument,
96 rBase,
97 *pDrawViewShell,
98 pContainer));
99 pSelector->LateInit();
100 pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_ALL );
101 GetShellManager()->AddSubShell(
102 SHELLID_SD_TASK_PANE_PREVIEW_ALL,
103 pSelector.get(),
104 pSelector->GetWindow());
105 AddControl (
106 ::std::auto_ptr<TreeNode>(pSelector.release()),
107 SdResId(STR_TASKPANEL_ALL_MASTER_PAGES_TITLE),
108 HID_SD_ALL_MASTERS);
115 MasterPagesPanel::~MasterPagesPanel (void)
117 TaskPaneShellManager* pShellManager( GetShellManager() );
118 OSL_ENSURE( pShellManager, "MasterPagesPanel::~MasterPagesPanel: no shell manager anymore - cannot remove sub shells!" );
119 if ( pShellManager )
121 pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_CURRENT );
122 pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_RECENT );
123 pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_ALL );
130 TaskPaneShellManager* MasterPagesPanel::GetShellManager()
132 if ( m_pPanelViewShell )
133 return &m_pPanelViewShell->GetSubShellManager();
134 return TreeNode::GetShellManager();
140 std::auto_ptr< ControlFactory > MasterPagesPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell )
142 return std::auto_ptr< ControlFactory >(
143 new RootControlFactoryWithArg< MasterPagesPanel, ToolPanelViewShell >( i_rToolPanelShell ) );
146 } } } // end of namespace ::sd::toolpanel::controls
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */