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 <editeng/flstitem.hxx>
21
22 #include <svx/svxids.hrc>
23
24 #include <svx/drawitem.hxx>
25 #include <svl/intitem.hxx>
26 #include <svx/ofaitem.hxx>
27 #include <svx/svdmodel.hxx>
28 #include <svl/cjkoptions.hxx>
29 #include <sfx2/objsh.hxx>
30 #include <svx/dialogs.hrc>
31 #include <svl/style.hxx>
32
33 #include <tabtempl.hxx>
34 #include <svx/flagsdef.hxx>
35
36 /**
37 * Constructor of the Tab dialog: appends pages to the dialog
38 */
SdTabTemplateDlg(weld::Window * pParent,const SfxObjectShell * pDocShell,SfxStyleSheetBase & rStyleBase,SdrModel const * pModel,SdrView * pView)39 SdTabTemplateDlg::SdTabTemplateDlg(weld::Window* pParent,
40 const SfxObjectShell* pDocShell,
41 SfxStyleSheetBase& rStyleBase,
42 SdrModel const * pModel,
43 SdrView* pView)
44 : SfxStyleDialogController(pParent, "modules/simpress/ui/templatedialog.ui",
45 "TemplateDialog", rStyleBase)
46 , rDocShell(*pDocShell)
47 , pSdrView(pView)
48 , pColorList(pModel->GetColorList())
49 , pGradientList(pModel->GetGradientList())
50 , pHatchingList(pModel->GetHatchList())
51 , pBitmapList(pModel->GetBitmapList())
52 , pPatternList(pModel->GetPatternList())
53 , pDashList(pModel->GetDashList())
54 , pLineEndList(pModel->GetLineEndList())
55 {
56 // fill Listbox and set Select-Handler
57
58 AddTabPage("line", RID_SVXPAGE_LINE);
59 AddTabPage("area", RID_SVXPAGE_AREA);
60 AddTabPage("shadowing", RID_SVXPAGE_SHADOW);
61 AddTabPage("transparency", RID_SVXPAGE_TRANSPARENCE);
62 AddTabPage("font", RID_SVXPAGE_CHAR_NAME);
63 AddTabPage("fonteffect", RID_SVXPAGE_CHAR_EFFECTS);
64 AddTabPage("background", RID_SVXPAGE_BKG);
65 AddTabPage("indents", RID_SVXPAGE_STD_PARAGRAPH);
66 AddTabPage("text", RID_SVXPAGE_TEXTATTR);
67 AddTabPage("animation", RID_SVXPAGE_TEXTANIMATION);
68 AddTabPage("dimensioning", RID_SVXPAGE_MEASURE);
69 AddTabPage("connector", RID_SVXPAGE_CONNECTION);
70 AddTabPage("alignment", RID_SVXPAGE_ALIGN_PARAGRAPH);
71 AddTabPage("tabs", RID_SVXPAGE_TABULATOR);
72 SvtCJKOptions aCJKOptions;
73 if( aCJKOptions.IsAsianTypographyEnabled() )
74 AddTabPage("asiantypo", RID_SVXPAGE_PARA_ASIAN);
75 else
76 RemoveTabPage("asiantypo");
77 }
78
PageCreated(const OString & rId,SfxTabPage & rPage)79 void SdTabTemplateDlg::PageCreated(const OString& rId, SfxTabPage &rPage)
80 {
81 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
82 if (rId == "line")
83 {
84 aSet.Put (SvxColorListItem(pColorList,SID_COLOR_TABLE));
85 aSet.Put (SvxDashListItem(pDashList,SID_DASH_LIST));
86 aSet.Put (SvxLineEndListItem(pLineEndList,SID_LINEEND_LIST));
87 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,1));
88 rPage.PageCreated(aSet);
89 }
90 else if (rId == "area")
91 {
92 aSet.Put (SvxColorListItem(pColorList,SID_COLOR_TABLE));
93 aSet.Put (SvxGradientListItem(pGradientList,SID_GRADIENT_LIST));
94 aSet.Put (SvxHatchListItem(pHatchingList,SID_HATCH_LIST));
95 aSet.Put (SvxBitmapListItem(pBitmapList,SID_BITMAP_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 aSet.Put (SvxPatternListItem(pPatternList,SID_PATTERN_LIST));
100 rPage.PageCreated(aSet);
101 }
102 else if (rId == "shadowing")
103 {
104 aSet.Put (SvxColorListItem(pColorList,SID_COLOR_TABLE));
105 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0));
106 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,1));
107 rPage.PageCreated(aSet);
108 }
109 else if (rId == "transparency")
110 {
111 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0));
112 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,1));
113 rPage.PageCreated(aSet);
114 }
115 else if (rId == "font")
116 {
117 SvxFontListItem aItem(*static_cast<const SvxFontListItem*>(
118 rDocShell.GetItem( SID_ATTR_CHAR_FONTLIST) ) );
119
120 aSet.Put (SvxFontListItem( aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
121 rPage.PageCreated(aSet);
122 }
123 else if (rId == "fonteffect")
124 {
125 rPage.PageCreated(aSet);
126 }
127 else if (rId == "background")
128 {
129 aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR)));
130 rPage.PageCreated(aSet);
131 }
132 else if (rId == "text")
133 {
134 rPage.PageCreated(aSet);
135 }
136 else if (rId == "dimensioning")
137 {
138 aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView));
139 rPage.PageCreated(aSet);
140 }
141 else if (rId == "connector")
142 {
143 aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView));
144 rPage.PageCreated(aSet);
145 }
146 }
147
RefreshInputSet()148 void SdTabTemplateDlg::RefreshInputSet()
149 {
150 SfxItemSet* pInputSet = GetInputSetImpl();
151
152 if( pInputSet )
153 {
154 pInputSet->ClearItem();
155 pInputSet->SetParent( GetStyleSheet().GetItemSet().GetParent() );
156 }
157 else
158 SetInputSet(&GetStyleSheet().GetItemSet());
159 }
160
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
162