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/aeitem.hxx>
33 #include <svx/flagsdef.hxx>
34
35 /**
36 * Constructor of tab dialog: appends pages to the dialog
37 */
SdPageDlg(SfxObjectShell const * pDocSh,weld::Window * pParent,const SfxItemSet * pAttr,bool bAreaPage,bool bIsImpressDoc)38 SdPageDlg::SdPageDlg(SfxObjectShell const * pDocSh, weld::Window* pParent, const SfxItemSet* pAttr, bool bAreaPage, bool bIsImpressDoc)
39 : SfxTabDialogController(pParent, "modules/sdraw/ui/drawpagedialog.ui", "DrawPageDialog", pAttr)
40 , mpDocShell(pDocSh)
41 , mbIsImpressDoc(bIsImpressDoc)
42 {
43
44 SvxColorListItem const * pColorListItem = mpDocShell->GetItem( SID_COLOR_TABLE );
45 SvxGradientListItem const * pGradientListItem = mpDocShell->GetItem( SID_GRADIENT_LIST );
46 SvxBitmapListItem const * pBitmapListItem = mpDocShell->GetItem( SID_BITMAP_LIST );
47 SvxPatternListItem const * pPatternListItem = mpDocShell->GetItem( SID_PATTERN_LIST );
48 SvxHatchListItem const * pHatchListItem = mpDocShell->GetItem( SID_HATCH_LIST );
49
50 mpColorList = pColorListItem->GetColorList();
51 mpGradientList = pGradientListItem->GetGradientList();
52 mpHatchingList = pHatchListItem->GetHatchList();
53 mpBitmapList = pBitmapListItem->GetBitmapList();
54 mpPatternList = pPatternListItem->GetPatternList();
55
56 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
57
58 AddTabPage("RID_SVXPAGE_PAGE", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PAGE), nullptr);
59 AddTabPage("RID_SVXPAGE_AREA", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_AREA), nullptr);
60 AddTabPage("RID_SVXPAGE_TRANSPARENCE", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TRANSPARENCE), nullptr);
61
62 if (!bAreaPage) // I have to add the page before I remove it !
63 {
64 RemoveTabPage("RID_SVXPAGE_AREA");
65 RemoveTabPage("RID_SVXPAGE_TRANSPARENCE");
66 }
67
68 if (mbIsImpressDoc)
69 {
70 set_title(SdResId(STR_SLIDE_SETUP_TITLE));
71 m_xTabCtrl->set_tab_label_text("RID_SVXPAGE_PAGE", SdResId(STR_SLIDE_NAME));
72 }
73 }
74
PageCreated(const OString & rId,SfxTabPage & rPage)75 void SdPageDlg::PageCreated(const OString& rId, SfxTabPage& rPage)
76 {
77 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
78 if (rId == "RID_SVXPAGE_PAGE")
79 {
80 aSet.Put (SfxUInt16Item(sal_uInt16(SID_ENUM_PAGE_MODE), SVX_PAGE_MODE_PRESENTATION));
81 aSet.Put (SfxUInt16Item(SID_PAPER_START, PAPER_A0));
82 aSet.Put (SfxUInt16Item(SID_PAPER_END, PAPER_E));
83
84 if (mbIsImpressDoc)
85 aSet.Put(SfxBoolItem(SID_IMPRESS_DOC, true));
86
87 rPage.PageCreated(aSet);
88 }
89 else if (rId == "RID_SVXPAGE_AREA")
90 {
91 aSet.Put (SvxColorListItem(mpColorList,SID_COLOR_TABLE));
92 aSet.Put (SvxGradientListItem(mpGradientList,SID_GRADIENT_LIST));
93 aSet.Put (SvxHatchListItem(mpHatchingList,SID_HATCH_LIST));
94 aSet.Put (SvxBitmapListItem(mpBitmapList,SID_BITMAP_LIST));
95 aSet.Put (SvxPatternListItem(mpPatternList,SID_PATTERN_LIST));
96 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0));
97 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,1));
98 aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,0));
99 rPage.PageCreated(aSet);
100 }
101 else if (rId == "RID_SVXPAGE_TRANSPARENCE")
102 {
103 aSet.Put(SfxUInt16Item(SID_PAGE_TYPE,0));
104 aSet.Put(SfxUInt16Item(SID_DLG_TYPE,1));
105 rPage.PageCreated(aSet);
106 }
107 }
108
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
110