LibreOffice Module sd (master) 1
dlgpage.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <svl/intitem.hxx>
21#include <svx/dialogs.hrc>
22#include <svx/svxids.hrc>
23#include <svx/drawitem.hxx>
24#include <i18nutil/paper.hxx>
25#include <sfx2/objsh.hxx>
26#include <sfx2/sfxdlg.hxx>
27
28#include <dlgpage.hxx>
29#include <sdresid.hxx>
30#include <strings.hrc>
31
32#include <svl/eitem.hxx>
33#include <svx/flagsdef.hxx>
34
38SdPageDlg::SdPageDlg(SfxObjectShell const* pDocSh, weld::Window* pParent, const SfxItemSet* pAttr,
39 bool bAreaPage, bool bIsImpressDoc, bool bIsImpressMaster)
40 : SfxTabDialogController(pParent, "modules/sdraw/ui/drawpagedialog.ui", "DrawPageDialog", pAttr)
41 , mbIsImpressDoc(bIsImpressDoc)
42{
43 SvxColorListItem const* pColorListItem = pDocSh->GetItem(SID_COLOR_TABLE);
44 SvxGradientListItem const* pGradientListItem = pDocSh->GetItem(SID_GRADIENT_LIST);
45 SvxBitmapListItem const* pBitmapListItem = pDocSh->GetItem(SID_BITMAP_LIST);
46 SvxPatternListItem const* pPatternListItem = pDocSh->GetItem(SID_PATTERN_LIST);
47 SvxHatchListItem const* pHatchListItem = pDocSh->GetItem(SID_HATCH_LIST);
48
49 mpColorList = pColorListItem->GetColorList();
50 mpGradientList = pGradientListItem->GetGradientList();
51 mpHatchingList = pHatchListItem->GetHatchList();
52 mpBitmapList = pBitmapListItem->GetBitmapList();
53 mpPatternList = pPatternListItem->GetPatternList();
54
56
57 AddTabPage("RID_SVXPAGE_PAGE", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PAGE), nullptr);
58 AddTabPage("RID_SVXPAGE_AREA", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_AREA), nullptr);
59 AddTabPage("RID_SVXPAGE_TRANSPARENCE", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TRANSPARENCE),
60 nullptr);
61 AddTabPage("RID_SVXPAGE_THEME", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_THEME), nullptr);
62
63 if (!bAreaPage) // I have to add the page before I remove it !
64 {
65 RemoveTabPage("RID_SVXPAGE_AREA");
66 RemoveTabPage("RID_SVXPAGE_TRANSPARENCE");
67 }
68
69 if (!bIsImpressMaster)
70 {
71 // Only slide masters can have a theme.
72 RemoveTabPage("RID_SVXPAGE_THEME");
73 }
74
76 {
77 set_title(SdResId(STR_SLIDE_SETUP_TITLE));
78 m_xTabCtrl->set_tab_label_text("RID_SVXPAGE_PAGE", SdResId(STR_SLIDE_NAME));
79 }
80}
81
82void SdPageDlg::PageCreated(const OUString& rId, SfxTabPage& rPage)
83{
84 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
85 if (rId == "RID_SVXPAGE_PAGE")
86 {
87 aSet.Put(SfxUInt16Item(SID_ENUM_PAGE_MODE, SVX_PAGE_MODE_PRESENTATION));
88 aSet.Put(SfxUInt16Item(SID_PAPER_START, PAPER_A0));
89 aSet.Put(SfxUInt16Item(SID_PAPER_END, PAPER_E));
90
92 aSet.Put(SfxBoolItem(SID_IMPRESS_DOC, true));
93
94 rPage.PageCreated(aSet);
95 }
96 else if (rId == "RID_SVXPAGE_AREA")
97 {
98 aSet.Put(SvxColorListItem(mpColorList, SID_COLOR_TABLE));
99 aSet.Put(SvxGradientListItem(mpGradientList, SID_GRADIENT_LIST));
100 aSet.Put(SvxHatchListItem(mpHatchingList, SID_HATCH_LIST));
101 aSet.Put(SvxBitmapListItem(mpBitmapList, SID_BITMAP_LIST));
102 aSet.Put(SvxPatternListItem(mpPatternList, SID_PATTERN_LIST));
103 aSet.Put(SfxUInt16Item(SID_PAGE_TYPE, 0));
104 aSet.Put(SfxUInt16Item(SID_DLG_TYPE, 1));
105 aSet.Put(SfxUInt16Item(SID_TABPAGE_POS, 0));
106 rPage.PageCreated(aSet);
107 }
108 else if (rId == "RID_SVXPAGE_TRANSPARENCE")
109 {
110 aSet.Put(SfxUInt16Item(SID_PAGE_TYPE, 0));
111 aSet.Put(SfxUInt16Item(SID_DLG_TYPE, 1));
112 rPage.PageCreated(aSet);
113 }
114}
115
116/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XGradientListRef mpGradientList
Definition: dlgpage.hxx:37
XBitmapListRef mpBitmapList
Definition: dlgpage.hxx:39
SdPageDlg(SfxObjectShell const *pDocSh, weld::Window *pParent, const SfxItemSet *pAttr, bool bAreaPage, bool bIsImpressDoc, bool bIsImpressMaster)
Constructor of tab dialog: appends pages to the dialog.
Definition: dlgpage.cxx:38
bool mbIsImpressDoc
Definition: dlgpage.hxx:34
XHatchListRef mpHatchingList
Definition: dlgpage.hxx:38
XColorListRef mpColorList
Definition: dlgpage.hxx:36
XPatternListRef mpPatternList
Definition: dlgpage.hxx:40
virtual void PageCreated(const OUString &rId, SfxTabPage &rPage) override
Definition: dlgpage.cxx:82
static SfxAbstractDialogFactory * Create()
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
void AddTabPage(const OUString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
void RemoveTabPage(const OUString &rName)
std::unique_ptr< weld::Notebook > m_xTabCtrl
SfxItemSet * GetInputSetImpl()
virtual void PageCreated(const SfxAllItemSet &aSet)
const XBitmapListRef & GetBitmapList() const
const XColorListRef & GetColorList() const
const XGradientListRef & GetGradientList() const
const XHatchListRef & GetHatchList() const
const XPatternListRef & GetPatternList() const
SVX_PAGE_MODE_PRESENTATION
PAPER_A0
PAPER_E
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83