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 <hintids.hxx>
21 :
22 : #include <vcl/msgbox.hxx>
23 : #include <sfx2/viewfrm.hxx>
24 : #include <svx/hdft.hxx>
25 : #include <editeng/flstitem.hxx>
26 : #include <sfx2/htmlmode.hxx>
27 : #include <svtools/htmlcfg.hxx>
28 : #include <svl/cjkoptions.hxx>
29 : #include <numpara.hxx>
30 : #include <fmtclds.hxx>
31 : #include <swtypes.hxx>
32 : #include <swmodule.hxx>
33 : #include <wrtsh.hxx>
34 : #include <view.hxx>
35 : #include <wdocsh.hxx>
36 : #include <viewopt.hxx>
37 : #include <pgfnote.hxx>
38 : #include <pggrid.hxx>
39 : #include <tmpdlg.hxx>
40 : #include <column.hxx>
41 : #include <drpcps.hxx>
42 : #include <frmpage.hxx>
43 : #include <wrap.hxx>
44 : #include <frmmgr.hxx>
45 : #include <ccoll.hxx>
46 : #include <swuiccoll.hxx>
47 : #include <docstyle.hxx>
48 : #include <fmtcol.hxx>
49 : #include <macassgn.hxx>
50 : #include <poolfmt.hxx>
51 : #include <uitool.hxx>
52 : #include <shellres.hxx>
53 : #include <swabstdlg.hxx>
54 :
55 : #include <cmdid.h>
56 : #include <helpid.h>
57 : #include <globals.hrc>
58 : #include <SwStyleNameMapper.hxx>
59 : #include <svx/svxids.hrc>
60 : #include <svl/stritem.hxx>
61 : #include <svl/aeitem.hxx>
62 : #include <svl/slstitm.hxx>
63 : #include <svl/eitem.hxx>
64 : #include <svl/intitem.hxx>
65 : #include <svx/svxdlg.hxx>
66 : #include <svx/dialogs.hrc>
67 : #include <svx/flagsdef.hxx>
68 :
69 : extern SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell();
70 :
71 : /*--------------------------------------------------------------------
72 : Description: the dialog's carrier
73 : --------------------------------------------------------------------*/
74 :
75 0 : SwTemplateDlg::SwTemplateDlg(Window* pParent,
76 : SfxStyleSheetBase& rBase,
77 : sal_uInt16 nRegion,
78 : const OString& sPage,
79 : SwWrtShell* pActShell,
80 : bool bNew)
81 : : SfxStyleDialog(pParent,
82 0 : OString("TemplateDialog") + OString::number(nRegion),
83 0 : OUString("modules/swriter/ui/templatedialog") +
84 0 : OUString::number(nRegion) + ".ui",
85 : rBase)
86 : , nType(nRegion)
87 : , pWrtShell(pActShell)
88 : , bNewStyle(bNew)
89 : , m_nIndentsId(0)
90 : , m_nAlignId(0)
91 : , m_nTextFlowId(0)
92 : , m_nAsianTypo(0)
93 : , m_nFontId(0)
94 : , m_nFontEffectId(0)
95 : , m_nPositionId(0)
96 : , m_nAsianLayoutId(0)
97 : , m_nTabId(0)
98 : , m_nOutlineId(0)
99 : , m_nDropCapsId(0)
100 : , m_nBackgroundId(0)
101 : , m_nAreaId(0)
102 : , m_nTransparenceId(0)
103 : , m_nBorderId(0)
104 : , m_nConditionId(0)
105 : , m_nTypeId(0)
106 : , m_nOptionsId(0)
107 : , m_nWrapId(0)
108 : , m_nColumnId(0)
109 : , m_nMacroId(0)
110 : , m_nHeaderId(0)
111 : , m_nFooterId(0)
112 : , m_nPageId(0)
113 : , m_nFootNoteId(0)
114 : , m_nTextGridId(0)
115 : , m_nSingleId(0)
116 : , m_nBulletId(0)
117 : , m_nNumId(0)
118 : , m_nBmpId(0)
119 : , m_nNumOptId(0)
120 0 : , m_nNumPosId(0)
121 : {
122 0 : nHtmlMode = ::GetHtmlMode(pWrtShell->GetView().GetDocShell());
123 0 : SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
124 : OSL_ENSURE(pFact, "Dialogdiet fail!");
125 : // tinker TabPages together
126 0 : switch( nRegion )
127 : {
128 : // character styles
129 : case SFX_STYLE_FAMILY_CHAR:
130 : {
131 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
132 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) , "GetTabPageRangesFunc fail!");
133 0 : m_nFontId = AddTabPage("font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ));
134 :
135 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
136 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) , "GetTabPageRangesFunc fail!");
137 0 : m_nFontEffectId = AddTabPage("fonteffect", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ));
138 :
139 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), "GetTabPageCreatorFunc fail!");
140 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) , "GetTabPageRangesFunc fail!");
141 0 : m_nPositionId = AddTabPage("position", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ));
142 :
143 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), "GetTabPageCreatorFunc fail!");
144 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) , "GetTabPageRangesFunc fail!");
145 0 : m_nAsianLayoutId = AddTabPage("asianlayout", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ));
146 :
147 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
148 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) , "GetTabPageRangesFunc fail!");
149 0 : m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ));
150 :
151 : SAL_WARN_IF(!pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "sw.ui", "GetTabPageCreatorFunc fail!");
152 : SAL_WARN_IF(!pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "sw.ui", "GetTabPageRangesFunc fail!");
153 0 : m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ));
154 :
155 0 : SvtCJKOptions aCJKOptions;
156 0 : if(nHtmlMode & HTMLMODE_ON || !aCJKOptions.IsDoubleLinesEnabled())
157 0 : RemoveTabPage("asianlayout");
158 : }
159 0 : break;
160 : // paragraph styles
161 : case SFX_STYLE_FAMILY_PARA:
162 : {
163 : OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageCreatorFunc fail!");
164 : OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageRangesFunc fail!");
165 0 : m_nIndentsId = AddTabPage("indents", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH) );
166 :
167 : OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageCreatorFunc fail!");
168 : OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageRangesFunc fail!");
169 0 : m_nAlignId = AddTabPage("alignment", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH) );
170 :
171 : OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageCreatorFunc fail!");
172 : OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageRangesFunc fail!");
173 0 : m_nTextFlowId = AddTabPage("textflow", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
174 :
175 : OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
176 : OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");
177 0 : m_nAsianTypo = AddTabPage("asiantypo", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
178 :
179 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
180 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageRangesFunc fail!");
181 0 : m_nFontId = AddTabPage("font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) );
182 :
183 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
184 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageRangesFunc fail!");
185 0 : m_nFontEffectId = AddTabPage("fonteffect", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) );
186 :
187 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), "GetTabPageCreatorFunc fail!");
188 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) , "GetTabPageRangesFunc fail!");
189 0 : m_nPositionId = AddTabPage("position", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) );
190 :
191 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), "GetTabPageCreatorFunc fail!");
192 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) , "GetTabPageRangesFunc fail!");
193 0 : m_nAsianLayoutId = AddTabPage("asianlayout", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) );
194 :
195 : OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), "GetTabPageCreatorFunc fail!");
196 : OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR), "GetTabPageRangesFunc fail!");
197 0 : m_nTabId = AddTabPage("tabs", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
198 :
199 : m_nOutlineId = AddTabPage("outline", SwParagraphNumTabPage::Create,
200 0 : SwParagraphNumTabPage::GetRanges);
201 : m_nDropCapsId = AddTabPage("dropcaps", SwDropCapsPage::Create,
202 0 : SwDropCapsPage::GetRanges );
203 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
204 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
205 0 : m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
206 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
207 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
208 0 : m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
209 :
210 : m_nConditionId = AddTabPage("condition", SwCondCollPage::Create,
211 0 : SwCondCollPage::GetRanges );
212 0 : if( (!bNewStyle && RES_CONDTXTFMTCOLL != ((SwDocStyleSheet&)rBase).GetCollection()->Which())
213 0 : || nHtmlMode & HTMLMODE_ON )
214 0 : RemoveTabPage("condition");
215 :
216 0 : SvtCJKOptions aCJKOptions;
217 0 : if(nHtmlMode & HTMLMODE_ON)
218 : {
219 0 : SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
220 0 : if (!rHtmlOpt.IsPrintLayoutExtension())
221 0 : RemoveTabPage("textflow");
222 0 : RemoveTabPage("asiantypo");
223 0 : RemoveTabPage("tabs");
224 0 : RemoveTabPage("outline");
225 0 : RemoveTabPage("asianlayout");
226 0 : if(!(nHtmlMode & HTMLMODE_FULL_STYLES))
227 : {
228 0 : RemoveTabPage("background");
229 0 : RemoveTabPage("dropcaps");
230 : }
231 : }
232 : else
233 : {
234 0 : if(!aCJKOptions.IsAsianTypographyEnabled())
235 0 : RemoveTabPage("asiantypo");
236 0 : if(!aCJKOptions.IsDoubleLinesEnabled())
237 0 : RemoveTabPage("asianlayout");
238 0 : }
239 : }
240 0 : break;
241 : // frame styles
242 : case SFX_STYLE_FAMILY_FRAME:
243 : {
244 : m_nTypeId = AddTabPage("type", SwFrmPage::Create,
245 0 : SwFrmPage::GetRanges);
246 : m_nOptionsId = AddTabPage("options", SwFrmAddPage::Create,
247 0 : SwFrmAddPage::GetRanges);
248 : m_nWrapId = AddTabPage("wrap", SwWrapTabPage::Create,
249 0 : SwWrapTabPage::GetRanges);
250 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
251 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
252 :
253 : //UUUU remove?
254 : //m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
255 : //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
256 : //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
257 :
258 : //UUUU add Area and Transparence TabPages
259 0 : m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
260 0 : m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
261 :
262 0 : m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
263 :
264 : m_nColumnId = AddTabPage("columns", SwColumnPage::Create,
265 0 : SwColumnPage::GetRanges );
266 :
267 0 : m_nMacroId = AddTabPage("macros", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0);
268 :
269 0 : break;
270 : }
271 : // page styles
272 : case SFX_STYLE_FAMILY_PAGE:
273 : {
274 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
275 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
276 0 : m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
277 0 : m_nHeaderId = AddTabPage("header", SvxHeaderPage::Create, SvxHeaderPage::GetRanges);
278 0 : m_nFooterId = AddTabPage("footer", SvxFooterPage::Create, SvxFooterPage::GetRanges);
279 :
280 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!");
281 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!");
282 : m_nPageId = AddTabPage("page",
283 0 : pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ),
284 0 : pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ) );
285 0 : if(!pActShell || 0 == ::GetHtmlMode(pWrtShell->GetView().GetDocShell()))
286 : {
287 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
288 : OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
289 : m_nBorderId = AddTabPage("borders",
290 0 : pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
291 0 : m_nColumnId = AddTabPage("columns", SwColumnPage::Create, SwColumnPage::GetRanges );
292 : m_nFootNoteId = AddTabPage("footnotes",
293 : SwFootNotePage::Create,
294 0 : SwFootNotePage::GetRanges );
295 : m_nTextGridId = AddTabPage("textgrid",
296 : SwTextGridPage::Create,
297 0 : SwTextGridPage::GetRanges );
298 0 : SvtCJKOptions aCJKOptions;
299 0 : if(!aCJKOptions.IsAsianTypographyEnabled())
300 0 : RemoveTabPage("textgrid");
301 : }
302 : }
303 0 : break;
304 : // numbering styles
305 : case SFX_STYLE_FAMILY_PSEUDO:
306 : {
307 0 : m_nSingleId = AddTabPage("numbering", RID_SVXPAGE_PICK_SINGLE_NUM);
308 0 : m_nBulletId = AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET);
309 0 : m_nNumId = AddTabPage("outline", RID_SVXPAGE_PICK_NUM);
310 0 : m_nBmpId = AddTabPage("graphics", RID_SVXPAGE_PICK_BMP);
311 0 : m_nNumOptId = AddTabPage("options", RID_SVXPAGE_NUM_OPTIONS );
312 0 : m_nNumPosId = AddTabPage("position", RID_SVXPAGE_NUM_POSITION );
313 : }
314 0 : break;
315 :
316 : default:
317 : OSL_ENSURE(!this, "wrong family");
318 : }
319 :
320 0 : if (!sPage.isEmpty())
321 0 : SetCurPageId(sPage);
322 0 : }
323 :
324 0 : short SwTemplateDlg::Ok()
325 : {
326 0 : short nRet = SfxTabDialog::Ok();
327 0 : if( RET_OK == nRet )
328 : {
329 : const SfxPoolItem *pOutItem, *pExItem;
330 0 : if( SFX_ITEM_SET == pExampleSet->GetItemState(
331 0 : SID_ATTR_NUMBERING_RULE, false, &pExItem ) &&
332 0 : ( !GetOutputItemSet() ||
333 : SFX_ITEM_SET != GetOutputItemSet()->GetItemState(
334 0 : SID_ATTR_NUMBERING_RULE, false, &pOutItem ) ||
335 0 : *pExItem != *pOutItem ))
336 : {
337 0 : if( GetOutputItemSet() )
338 0 : ((SfxItemSet*)GetOutputItemSet())->Put( *pExItem );
339 : else
340 0 : nRet = RET_CANCEL;
341 : }
342 : }
343 : else
344 : //JP 09.01.98 Bug #46446#:
345 : // that's the Ok-Handler, so OK has to be default!
346 0 : nRet = RET_OK;
347 0 : return nRet;
348 : }
349 :
350 0 : const SfxItemSet* SwTemplateDlg::GetRefreshedSet()
351 : {
352 0 : SfxItemSet* pInSet = GetInputSetImpl();
353 0 : pInSet->ClearItem();
354 0 : pInSet->SetParent( &GetStyleSheet().GetItemSet() );
355 0 : return pInSet;
356 : }
357 :
358 0 : void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
359 : {
360 : // set style's and metric's names
361 0 : OUString sNumCharFmt, sBulletCharFmt;
362 0 : SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFmt);
363 0 : SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFmt);
364 0 : SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
365 :
366 0 : if (nId == m_nFontId)
367 : {
368 : OSL_ENSURE(::GetActiveView(), "no active view");
369 :
370 : SvxFontListItem aFontListItem( *( (SvxFontListItem*)::GetActiveView()->
371 0 : GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) );
372 :
373 0 : aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
374 0 : sal_uInt32 nFlags = 0;
375 0 : if(rPage.GetItemSet().GetParent() && 0 == (nHtmlMode & HTMLMODE_ON ))
376 0 : nFlags = SVX_RELATIVE_MODE;
377 0 : if( SFX_STYLE_FAMILY_CHAR == nType )
378 0 : nFlags = nFlags|SVX_PREVIEW_CHARACTER;
379 0 : aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
380 0 : rPage.PageCreated(aSet);
381 : }
382 0 : else if (nId == m_nFontEffectId)
383 : {
384 0 : sal_uInt32 nFlags = SVX_ENABLE_FLASH;
385 0 : if( SFX_STYLE_FAMILY_CHAR == nType )
386 0 : nFlags = nFlags|SVX_PREVIEW_CHARACTER;
387 0 : aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
388 0 : rPage.PageCreated(aSet);
389 : }
390 0 : else if (nId == m_nPositionId)
391 : {
392 0 : if( SFX_STYLE_FAMILY_CHAR == nType )
393 : {
394 0 : aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
395 0 : rPage.PageCreated(aSet);
396 : }
397 : }
398 0 : else if (nId == m_nAsianLayoutId)
399 : {
400 0 : if( SFX_STYLE_FAMILY_CHAR == nType )
401 : {
402 0 : aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
403 0 : rPage.PageCreated(aSet);
404 : }
405 : }
406 0 : else if (nId == m_nIndentsId)
407 : {
408 0 : if( rPage.GetItemSet().GetParent() )
409 : {
410 0 : aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,MM50/10));
411 0 : aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000F));
412 0 : rPage.PageCreated(aSet);
413 : }
414 :
415 : }
416 0 : else if (nId == m_nOutlineId)
417 : {
418 : // handle if the current paragraph style is assigned to a list level of outline style,
419 0 : SwTxtFmtColl* pTmpColl = pWrtShell->FindTxtFmtCollByName( GetStyleSheet().GetName() );
420 0 : if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
421 : {
422 0 : ((SwParagraphNumTabPage&)rPage).DisableOutline() ;
423 0 : ((SwParagraphNumTabPage&)rPage).DisableNumbering();
424 : }//<-end
425 0 : ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
426 0 : SfxStyleSheetBasePool* pPool = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
427 0 : pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
428 0 : const SfxStyleSheetBase* pBase = pPool->First();
429 0 : std::set<OUString> aNames;
430 0 : while(pBase)
431 : {
432 0 : aNames.insert(pBase->GetName());
433 0 : pBase = pPool->Next();
434 : }
435 0 : for(std::set<OUString>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
436 0 : rBox.InsertEntry(*it);
437 : }
438 0 : else if (nId == m_nAlignId)
439 : {
440 0 : aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,true));
441 0 : rPage.PageCreated(aSet);
442 : }
443 0 : else if (nId == m_nTypeId)
444 : {
445 0 : ((SwFrmPage&)rPage).SetNewFrame( sal_True );
446 0 : ((SwFrmPage&)rPage).SetFormatUsed( sal_True );
447 : }
448 0 : else if (nId == m_nOptionsId)
449 : {
450 0 : ((SwFrmAddPage&)rPage).SetFormatUsed(sal_True);
451 0 : ((SwFrmAddPage&)rPage).SetNewFrame(sal_True);
452 : }
453 0 : else if (nId == m_nWrapId)
454 : {
455 0 : ((SwWrapTabPage&)rPage).SetFormatUsed( sal_True, sal_False );
456 : }
457 0 : else if (nId == m_nColumnId)
458 : {
459 0 : if( nType == SFX_STYLE_FAMILY_FRAME )
460 0 : ((SwColumnPage&)rPage).SetFrmMode(sal_True);
461 0 : ((SwColumnPage&)rPage).SetFormatUsed( sal_True );
462 : }
463 : //UUUU do not remove; many other style dialog combinations still use the SfxTabPage
464 : // for the SvxBrushItem (see RID_SVXPAGE_BACKGROUND)
465 0 : else if (nId == m_nBackgroundId)
466 : {
467 0 : sal_Int32 nFlagType = 0;
468 0 : if( SFX_STYLE_FAMILY_PARA == nType )
469 0 : nFlagType |= SVX_SHOW_PARACTL;
470 0 : if( SFX_STYLE_FAMILY_CHAR != nType )
471 0 : nFlagType |= SVX_SHOW_SELECTOR;
472 0 : if( SFX_STYLE_FAMILY_FRAME == nType )
473 0 : nFlagType |= SVX_ENABLE_TRANSPARENCY;
474 0 : aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
475 0 : rPage.PageCreated(aSet);
476 : }
477 0 : else if (nId == m_nConditionId)
478 : {
479 : ((SwCondCollPage&)rPage).SetCollection(
480 0 : ((SwDocStyleSheet&)GetStyleSheet()).GetCollection(), bNewStyle );
481 : }
482 0 : else if (nId == m_nPageId)
483 : {
484 0 : if(0 == (nHtmlMode & HTMLMODE_ON ))
485 : {
486 0 : std::vector<OUString> aList;
487 0 : OUString aNew;
488 0 : SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, aNew );
489 0 : aList.push_back( aNew );
490 0 : if( pWrtShell )
491 : {
492 : SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
493 0 : GetView().GetDocShell()->GetStyleSheetPool();
494 0 : pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA);
495 0 : SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First();
496 0 : while(pFirstStyle)
497 : {
498 0 : aList.push_back( pFirstStyle->GetName() );
499 0 : pFirstStyle = pStyleSheetPool->Next();
500 : }
501 : }
502 0 : aSet.Put (SfxStringListItem(SID_COLLECT_LIST, &aList));
503 0 : rPage.PageCreated(aSet);
504 : }
505 : }
506 0 : else if (nId == m_nMacroId)
507 : {
508 0 : SfxAllItemSet aNewSet(*aSet.GetPool());
509 0 : aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
510 0 : if ( pWrtShell )
511 0 : rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
512 0 : rPage.PageCreated(aNewSet);
513 : }
514 0 : else if (nId == m_nNumId)
515 : {
516 0 : aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
517 0 : aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
518 0 : rPage.PageCreated(aSet);
519 : }
520 0 : else if (nId == m_nNumOptId)
521 : {
522 :
523 0 : aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
524 0 : aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
525 : // collect character styles
526 0 : ListBox rCharFmtLB(this);
527 0 : rCharFmtLB.Clear();
528 0 : rCharFmtLB.InsertEntry( SwViewShell::GetShellRes()->aStrNone );
529 0 : SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
530 0 : ::FillCharStyleListBox(rCharFmtLB, pDocShell);
531 :
532 0 : std::vector<OUString> aList;
533 0 : for(sal_Int32 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
534 0 : aList.push_back( rCharFmtLB.GetEntry(j) );
535 :
536 0 : aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
537 0 : FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
538 0 : aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
539 0 : rPage.PageCreated(aSet);
540 : }
541 0 : else if (nId == m_nNumPosId)
542 : {
543 0 : SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
544 0 : FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
545 :
546 0 : aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
547 0 : rPage.PageCreated(aSet);
548 : }
549 0 : else if (nId == m_nBulletId)
550 : {
551 0 : aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
552 0 : rPage.PageCreated(aSet);
553 : }
554 0 : else if (nId == m_nHeaderId)
555 : {
556 0 : if(0 == (nHtmlMode & HTMLMODE_ON ))
557 0 : ((SvxHeaderPage&)rPage).EnableDynamicSpacing();
558 : }
559 0 : else if (nId == m_nFooterId)
560 : {
561 0 : if(0 == (nHtmlMode & HTMLMODE_ON ))
562 0 : ((SvxFooterPage&)rPage).EnableDynamicSpacing();
563 : }
564 0 : else if (nId == m_nBorderId)
565 : {
566 0 : if( SFX_STYLE_FAMILY_PARA == nType )
567 : {
568 0 : aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
569 : }
570 0 : else if( SFX_STYLE_FAMILY_FRAME == nType )
571 : {
572 0 : aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME));
573 : }
574 0 : rPage.PageCreated(aSet);
575 : }
576 : //UUUU inits for Area and Transparency TabPages
577 : // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
578 : // the color table) need to be added as items (e.g. SvxColorTableItem) to make
579 : // these pages find the needed attributes for fill style suggestions.
580 : // These are added in SwDocStyleSheet::GetItemSet() for the SFX_STYLE_FAMILY_PARA on
581 : // demand, but could also be directly added from the DrawModel.
582 0 : else if (nId == m_nAreaId)
583 : {
584 0 : SfxItemSet aNew(*aSet.GetPool(),
585 : SID_COLOR_TABLE, SID_BITMAP_LIST,
586 0 : SID_OFFER_IMPORT, SID_OFFER_IMPORT, 0, 0);
587 :
588 0 : aNew.Put(GetStyleSheet().GetItemSet());
589 :
590 : // add flag for direct graphic content selection
591 0 : aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true));
592 :
593 0 : rPage.PageCreated(aNew);
594 : }
595 0 : else if (nId == m_nTransparenceId)
596 : {
597 0 : rPage.PageCreated(GetStyleSheet().GetItemSet());
598 0 : }
599 0 : }
600 :
601 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|