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