Line data Source code
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/svxgrahicitem.hxx>
28 : #include <svx/svdmodel.hxx>
29 : #include <svl/cjkoptions.hxx>
30 :
31 :
32 : #include <svx/dialogs.hrc>
33 :
34 : #include <svx/svxdlg.hxx>
35 : #include <svx/tabline.hxx>
36 : #include <svl/style.hxx>
37 : #include <svx/xtable.hxx>
38 :
39 : #include "DrawDocShell.hxx"
40 : #include "tabtempl.hxx"
41 : #include "sdresid.hxx"
42 : #include "dlg_char.hxx"
43 : #include "paragr.hxx"
44 : #include <svx/flagsdef.hxx>
45 :
46 : /**
47 : * Constructor of the Tab dialog: appends pages to the dialog
48 : */
49 0 : SdTabTemplateDlg::SdTabTemplateDlg( Window* pParent,
50 : const SfxObjectShell* pDocShell,
51 : SfxStyleSheetBase& rStyleBase,
52 : SdrModel* pModel,
53 : SdrView* pView )
54 : : SfxStyleDialog(pParent, "TemplateDialog",
55 : "modules/simpress/ui/templatedialog.ui",
56 : rStyleBase)
57 : , rDocShell(*pDocShell)
58 : , pSdrView(pView)
59 : , pColorList(pModel->GetColorList())
60 : , pGradientList(pModel->GetGradientList())
61 : , pHatchingList(pModel->GetHatchList())
62 : , pBitmapList(pModel->GetBitmapList())
63 : , pDashList(pModel->GetDashList())
64 : , pLineEndList(pModel->GetLineEndList())
65 : , m_nLineId(0)
66 : , m_nAreaId(0)
67 : , m_nShadowId(0)
68 : , m_nTransparencyId(0)
69 : , m_nFontId(0)
70 : , m_nFontEffectId(0)
71 : , m_nIndentsId(0)
72 : , m_nTextId(0)
73 : , m_nAnimationId(0)
74 : , m_nDimensionId(0)
75 : , m_nConnectorId(0)
76 : , m_nAlignId(0)
77 : , m_nTabId(0)
78 0 : , m_nAsianTypoId(0)
79 : {
80 : // fill Listbox and overload Select-Handler
81 :
82 0 : m_nLineId = AddTabPage("line", RID_SVXPAGE_LINE);
83 0 : m_nAreaId = AddTabPage("area", RID_SVXPAGE_AREA);
84 0 : m_nShadowId = AddTabPage("shadowing", RID_SVXPAGE_SHADOW);
85 0 : m_nTransparencyId = AddTabPage("transparency", RID_SVXPAGE_TRANSPARENCE);
86 0 : m_nFontId = AddTabPage("font", RID_SVXPAGE_CHAR_NAME);
87 0 : m_nFontEffectId = AddTabPage("fonteffect", RID_SVXPAGE_CHAR_EFFECTS);
88 0 : m_nIndentsId = AddTabPage("indents", RID_SVXPAGE_STD_PARAGRAPH);
89 0 : m_nTextId = AddTabPage("text", RID_SVXPAGE_TEXTATTR);
90 0 : m_nAnimationId = AddTabPage("animation", RID_SVXPAGE_TEXTANIMATION);
91 0 : m_nDimensionId = AddTabPage("dimensioning", RID_SVXPAGE_MEASURE);
92 0 : m_nConnectorId = AddTabPage("connector", RID_SVXPAGE_CONNECTION);
93 0 : m_nAlignId = AddTabPage("alignment", RID_SVXPAGE_ALIGN_PARAGRAPH);
94 0 : m_nTabId = AddTabPage("tabs", RID_SVXPAGE_TABULATOR);
95 0 : SvtCJKOptions aCJKOptions;
96 0 : if( aCJKOptions.IsAsianTypographyEnabled() )
97 0 : m_nAsianTypoId = AddTabPage("asiantypo", RID_SVXPAGE_PARA_ASIAN);
98 : else
99 0 : RemoveTabPage("asiantypo");
100 :
101 0 : nDlgType = 1;
102 0 : nPageType = 0;
103 0 : nPos = 0;
104 :
105 0 : nColorTableState = CT_NONE;
106 0 : nBitmapListState = CT_NONE;
107 0 : nGradientListState = CT_NONE;
108 0 : nHatchingListState = CT_NONE;
109 0 : }
110 :
111 :
112 :
113 0 : void SdTabTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
114 : {
115 0 : SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
116 0 : if (nId == m_nLineId)
117 : {
118 0 : aSet.Put (SvxColorListItem(pColorList,SID_COLOR_TABLE));
119 0 : aSet.Put (SvxDashListItem(pDashList,SID_DASH_LIST));
120 0 : aSet.Put (SvxLineEndListItem(pLineEndList,SID_LINEEND_LIST));
121 0 : aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
122 0 : rPage.PageCreated(aSet);
123 : }
124 0 : else if (nId == m_nAreaId)
125 : {
126 0 : aSet.Put (SvxColorListItem(pColorList,SID_COLOR_TABLE));
127 0 : aSet.Put (SvxGradientListItem(pGradientList,SID_GRADIENT_LIST));
128 0 : aSet.Put (SvxHatchListItem(pHatchingList,SID_HATCH_LIST));
129 0 : aSet.Put (SvxBitmapListItem(pBitmapList,SID_BITMAP_LIST));
130 0 : aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
131 0 : aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
132 0 : aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos));
133 0 : rPage.PageCreated(aSet);
134 : }
135 0 : else if (nId == m_nShadowId)
136 : {
137 0 : aSet.Put (SvxColorListItem(pColorList,SID_COLOR_TABLE));
138 0 : aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
139 0 : aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
140 0 : rPage.PageCreated(aSet);
141 : }
142 0 : else if (nId == m_nTransparencyId)
143 : {
144 0 : aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
145 0 : aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
146 0 : rPage.PageCreated(aSet);
147 : }
148 0 : else if (nId == m_nFontId)
149 : {
150 : SvxFontListItem aItem(*( (const SvxFontListItem*)
151 0 : ( rDocShell.GetItem( SID_ATTR_CHAR_FONTLIST) ) ) );
152 :
153 0 : aSet.Put (SvxFontListItem( aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
154 0 : rPage.PageCreated(aSet);
155 : }
156 0 : else if (nId == m_nFontEffectId)
157 : {
158 0 : aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
159 0 : rPage.PageCreated(aSet);
160 : }
161 0 : else if (nId == m_nTextId)
162 : {
163 0 : aSet.Put(OfaPtrItem(SID_SVXTEXTATTRPAGE_VIEW,pSdrView));
164 0 : rPage.PageCreated(aSet);
165 : }
166 0 : else if (nId == m_nDimensionId)
167 : {
168 0 : aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView));
169 0 : rPage.PageCreated(aSet);
170 : }
171 0 : else if (nId == m_nConnectorId)
172 : {
173 0 : aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView));
174 0 : rPage.PageCreated(aSet);
175 0 : }
176 0 : }
177 :
178 :
179 :
180 0 : const SfxItemSet* SdTabTemplateDlg::GetRefreshedSet()
181 : {
182 0 : SfxItemSet* pRet = GetInputSetImpl();
183 :
184 0 : if( pRet )
185 : {
186 0 : pRet->ClearItem();
187 0 : pRet->SetParent( GetStyleSheet().GetItemSet().GetParent() );
188 : }
189 : else
190 0 : pRet = new SfxItemSet( GetStyleSheet().GetItemSet() );
191 :
192 0 : return pRet;
193 0 : }
194 :
195 :
196 :
197 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|