xref: /aoo42x/main/sd/source/ui/dlg/tabtempl.cxx (revision 79aad27f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 
27 #ifdef SD_DLLIMPLEMENTATION
28 #undef SD_DLLIMPLEMENTATION
29 #endif
30 
31 #include <editeng/flstitem.hxx>
32 
33 #include <svx/svxids.hrc>
34 
35 #include <svx/drawitem.hxx>
36 #include <svl/intitem.hxx>
37 #include <svx/ofaitem.hxx>
38 #include <svx/svxgrahicitem.hxx>
39 #include <svx/svdmodel.hxx>
40 #include <svl/cjkoptions.hxx>
41 
42 
43 #include <svx/dialogs.hrc>
44 
45 #include <svx/svxdlg.hxx>
46 #include <svx/tabline.hxx>
47 #include <svl/style.hxx>
48 #include <svx/xtable.hxx>
49 
50 #include "DrawDocShell.hxx"
51 #include "tabtempl.hxx"
52 #include "tabtempl.hrc"
53 #include "sdresid.hxx"
54 #include "dlg_char.hxx"
55 #include "paragr.hxx"
56 #include <svx/flagsdef.hxx>
57 
58 /*************************************************************************
59 |*
60 |* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
61 |*
62 \************************************************************************/
63 
64 SdTabTemplateDlg::SdTabTemplateDlg( Window* pParent,
65 								const SfxObjectShell* pDocShell,
66 								SfxStyleSheetBase& rStyleBase,
67 								SdrModel* pModel,
68 								SdrView* pView ) :
69 		SfxStyleDialog      ( pParent, SdResId( TAB_TEMPLATE ), rStyleBase, sal_False ),
70 		rDocShell			( *pDocShell ),
71 		pSdrView			( pView ),
72 		pColorTab			( pModel->GetColorTable() ),
73 		pGradientList		( pModel->GetGradientList() ),
74 		pHatchingList		( pModel->GetHatchList() ),
75 		pBitmapList 		( pModel->GetBitmapList() ),
76 		pDashList			( pModel->GetDashList() ),
77 		pLineEndList		( pModel->GetLineEndList() )
78 {
79 	FreeResource();
80 
81 	// Listbox fuellen und Select-Handler ueberladen
82 
83 	AddTabPage( RID_SVXPAGE_LINE);
84 	AddTabPage( RID_SVXPAGE_AREA);
85 	AddTabPage( RID_SVXPAGE_SHADOW);
86 	AddTabPage( RID_SVXPAGE_TRANSPARENCE);
87 	AddTabPage( RID_SVXPAGE_CHAR_NAME );
88 	AddTabPage( RID_SVXPAGE_CHAR_EFFECTS );
89 	AddTabPage( RID_SVXPAGE_STD_PARAGRAPH );
90 	AddTabPage( RID_SVXPAGE_TEXTATTR );
91 	AddTabPage( RID_SVXPAGE_TEXTANIMATION );
92 	AddTabPage( RID_SVXPAGE_MEASURE);
93 	AddTabPage( RID_SVXPAGE_CONNECTION);
94 	AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH );
95 	AddTabPage( RID_SVXPAGE_TABULATOR );
96 	SvtCJKOptions aCJKOptions;
97 	if( aCJKOptions.IsAsianTypographyEnabled() )
98 		AddTabPage( RID_SVXPAGE_PARA_ASIAN );
99 	else
100 		RemoveTabPage( RID_SVXPAGE_PARA_ASIAN );
101 
102 	nDlgType = 1;
103 	nPageType = 0;
104 	nPos = 0;
105 
106 	nColorTableState = CT_NONE;
107 	nBitmapListState = CT_NONE;
108 	nGradientListState = CT_NONE;
109 	nHatchingListState = CT_NONE;
110 }
111 
112 // -----------------------------------------------------------------------
113 
114 SdTabTemplateDlg::~SdTabTemplateDlg()
115 {
116 }
117 
118 // -----------------------------------------------------------------------
119 
120 void SdTabTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
121 {
122     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
123 	switch( nId )
124 	{
125 		case RID_SVXPAGE_LINE:
126 			aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE));
127 			aSet.Put (SvxDashListItem(pDashList,SID_DASH_LIST));
128 			aSet.Put (SvxLineEndListItem(pLineEndList,SID_LINEEND_LIST));
129 			aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
130 			rPage.PageCreated(aSet);
131 			break;
132 
133 		case RID_SVXPAGE_AREA:
134 			aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE));
135 			aSet.Put (SvxGradientListItem(pGradientList,SID_GRADIENT_LIST));
136 			aSet.Put (SvxHatchListItem(pHatchingList,SID_HATCH_LIST));
137 			aSet.Put (SvxBitmapListItem(pBitmapList,SID_BITMAP_LIST));
138 			aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
139 			aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
140 			aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos));
141 			rPage.PageCreated(aSet);
142 
143 
144 		break;
145 
146 		case RID_SVXPAGE_SHADOW:
147 				aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); //add CHINA001
148 				aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
149 				aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
150 				rPage.PageCreated(aSet);
151 			break;
152 
153 		case RID_SVXPAGE_TRANSPARENCE:
154 					aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
155 					aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
156 					rPage.PageCreated(aSet);
157 		break;
158 
159 		case RID_SVXPAGE_CHAR_NAME:
160 		{
161 			SvxFontListItem aItem(*( (const SvxFontListItem*)
162 				( rDocShell.GetItem( SID_ATTR_CHAR_FONTLIST) ) ) );
163 
164 			aSet.Put (SvxFontListItem( aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
165 			rPage.PageCreated(aSet);
166 		}
167 		break;
168 
169 		case RID_SVXPAGE_CHAR_EFFECTS:
170 			aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
171 			rPage.PageCreated(aSet);
172 		break;
173 
174 		case RID_SVXPAGE_STD_PARAGRAPH:
175 		break;
176 
177 		case RID_SVXPAGE_TEXTATTR:
178 		{
179 			aSet.Put(OfaPtrItem(SID_SVXTEXTATTRPAGE_VIEW,pSdrView));
180 			rPage.PageCreated(aSet);
181 		}
182 		break;
183 
184 		case RID_SVXPAGE_TEXTANIMATION:
185 		break;
186 
187 		case RID_SVXPAGE_MEASURE:
188 			aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView));
189 			rPage.PageCreated(aSet);
190 		break;
191 
192 		case RID_SVXPAGE_CONNECTION:
193 		{
194 			aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView));
195 			rPage.PageCreated(aSet);
196 		}
197 		break;
198 	}
199 }
200 
201 // -----------------------------------------------------------------------
202 
203 const SfxItemSet* SdTabTemplateDlg::GetRefreshedSet()
204 {
205     SfxItemSet* pRet = GetInputSetImpl();
206 
207     if( pRet )
208     {
209         pRet->ClearItem();
210         pRet->SetParent( GetStyleSheet().GetItemSet().GetParent() );
211     }
212     else
213         pRet = new SfxItemSet( GetStyleSheet().GetItemSet() );
214 
215 	return pRet;
216 }
217 
218 
219 
220