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