xref: /trunk/main/sd/source/ui/dlg/tabtempl.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sd.hxx"
30 
31 #ifdef SD_DLLIMPLEMENTATION
32 #undef SD_DLLIMPLEMENTATION
33 #endif
34 
35 #include <editeng/flstitem.hxx>
36 
37 #include <svx/svxids.hrc>
38 
39 #include <svx/drawitem.hxx>
40 #include <svl/intitem.hxx>
41 #include <svx/ofaitem.hxx>
42 #include <svx/svxgrahicitem.hxx>
43 #include <svx/svdmodel.hxx>
44 #include <svl/cjkoptions.hxx>
45 
46 
47 #include <svx/dialogs.hrc>
48 
49 #include <svx/svxdlg.hxx>
50 #include <svx/tabline.hxx>
51 #include <svl/style.hxx>
52 #include <svx/xtable.hxx>
53 
54 #include "DrawDocShell.hxx"
55 #include "tabtempl.hxx"
56 #include "tabtempl.hrc"
57 #include "sdresid.hxx"
58 #include "dlg_char.hxx"
59 #include "paragr.hxx"
60 #include <svx/flagsdef.hxx>
61 
62 /*************************************************************************
63 |*
64 |* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
65 |*
66 \************************************************************************/
67 
68 SdTabTemplateDlg::SdTabTemplateDlg( Window* pParent,
69 								const SfxObjectShell* pDocShell,
70 								SfxStyleSheetBase& rStyleBase,
71 								SdrModel* pModel,
72 								SdrView* pView ) :
73 		SfxStyleDialog      ( pParent, SdResId( TAB_TEMPLATE ), rStyleBase, sal_False ),
74 		rDocShell			( *pDocShell ),
75 		pSdrView			( pView ),
76 		pColorTab			( pModel->GetColorTable() ),
77 		pGradientList		( pModel->GetGradientList() ),
78 		pHatchingList		( pModel->GetHatchList() ),
79 		pBitmapList 		( pModel->GetBitmapList() ),
80 		pDashList			( pModel->GetDashList() ),
81 		pLineEndList		( pModel->GetLineEndList() )
82 {
83 	FreeResource();
84 
85 	// Listbox fuellen und Select-Handler ueberladen
86 
87 	AddTabPage( RID_SVXPAGE_LINE);
88 	AddTabPage( RID_SVXPAGE_AREA);
89 	AddTabPage( RID_SVXPAGE_SHADOW);
90 	AddTabPage( RID_SVXPAGE_TRANSPARENCE);
91 	AddTabPage( RID_SVXPAGE_CHAR_NAME );
92 	AddTabPage( RID_SVXPAGE_CHAR_EFFECTS );
93 	AddTabPage( RID_SVXPAGE_STD_PARAGRAPH );
94 	AddTabPage( RID_SVXPAGE_TEXTATTR );
95 	AddTabPage( RID_SVXPAGE_TEXTANIMATION );
96 	AddTabPage( RID_SVXPAGE_MEASURE);
97 	AddTabPage( RID_SVXPAGE_CONNECTION);
98 	AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH );
99 	AddTabPage( RID_SVXPAGE_TABULATOR );
100 	SvtCJKOptions aCJKOptions;
101 	if( aCJKOptions.IsAsianTypographyEnabled() )
102 		AddTabPage( RID_SVXPAGE_PARA_ASIAN );
103 	else
104 		RemoveTabPage( RID_SVXPAGE_PARA_ASIAN );
105 
106 	nDlgType = 1;
107 	nPageType = 0;
108 	nPos = 0;
109 
110 	nColorTableState = CT_NONE;
111 	nBitmapListState = CT_NONE;
112 	nGradientListState = CT_NONE;
113 	nHatchingListState = CT_NONE;
114 }
115 
116 // -----------------------------------------------------------------------
117 
118 SdTabTemplateDlg::~SdTabTemplateDlg()
119 {
120 }
121 
122 // -----------------------------------------------------------------------
123 
124 void SdTabTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
125 {
126     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
127 	switch( nId )
128 	{
129 		case RID_SVXPAGE_LINE:
130 			aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE));
131 			aSet.Put (SvxDashListItem(pDashList,SID_DASH_LIST));
132 			aSet.Put (SvxLineEndListItem(pLineEndList,SID_LINEEND_LIST));
133 			aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
134 			rPage.PageCreated(aSet);
135 			break;
136 
137 		case RID_SVXPAGE_AREA:
138 			aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE));
139 			aSet.Put (SvxGradientListItem(pGradientList,SID_GRADIENT_LIST));
140 			aSet.Put (SvxHatchListItem(pHatchingList,SID_HATCH_LIST));
141 			aSet.Put (SvxBitmapListItem(pBitmapList,SID_BITMAP_LIST));
142 			aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
143 			aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
144 			aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos));
145 			rPage.PageCreated(aSet);
146 
147 
148 		break;
149 
150 		case RID_SVXPAGE_SHADOW:
151 				aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); //add CHINA001
152 				aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
153 				aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
154 				rPage.PageCreated(aSet);
155 			break;
156 
157 		case RID_SVXPAGE_TRANSPARENCE:
158 					aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
159 					aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
160 					rPage.PageCreated(aSet);
161 		break;
162 
163 		case RID_SVXPAGE_CHAR_NAME:
164 		{
165 			SvxFontListItem aItem(*( (const SvxFontListItem*)
166 				( rDocShell.GetItem( SID_ATTR_CHAR_FONTLIST) ) ) );
167 
168 			aSet.Put (SvxFontListItem( aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
169 			rPage.PageCreated(aSet);
170 		}
171 		break;
172 
173 		case RID_SVXPAGE_CHAR_EFFECTS:
174 			aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
175 			rPage.PageCreated(aSet);
176 		break;
177 
178 		case RID_SVXPAGE_STD_PARAGRAPH:
179 		break;
180 
181 		case RID_SVXPAGE_TEXTATTR:
182 		{
183 			aSet.Put(OfaPtrItem(SID_SVXTEXTATTRPAGE_VIEW,pSdrView));
184 			rPage.PageCreated(aSet);
185 		}
186 		break;
187 
188 		case RID_SVXPAGE_TEXTANIMATION:
189 		break;
190 
191 		case RID_SVXPAGE_MEASURE:
192 			aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView));
193 			rPage.PageCreated(aSet);
194 		break;
195 
196 		case RID_SVXPAGE_CONNECTION:
197 		{
198 			aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView));
199 			rPage.PageCreated(aSet);
200 		}
201 		break;
202 	}
203 }
204 
205 // -----------------------------------------------------------------------
206 
207 const SfxItemSet* SdTabTemplateDlg::GetRefreshedSet()
208 {
209     SfxItemSet* pRet = GetInputSetImpl();
210 
211     if( pRet )
212     {
213         pRet->ClearItem();
214         pRet->SetParent( GetStyleSheet().GetItemSet().GetParent() );
215     }
216     else
217         pRet = new SfxItemSet( GetStyleSheet().GetItemSet() );
218 
219 	return pRet;
220 }
221 
222 
223 
224