1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5efeef26fSAndrew Rist * distributed with this work for additional information
6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10efeef26fSAndrew Rist *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist *
13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist * software distributed under the License is distributed on an
15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17efeef26fSAndrew Rist * specific language governing permissions and limitations
18efeef26fSAndrew Rist * under the License.
19efeef26fSAndrew Rist *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION
28cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include "hintids.hxx"
33cdf0e10cSrcweir #include <svx/htmlmode.hxx>
34cdf0e10cSrcweir #include <svl/style.hxx>
35cdf0e10cSrcweir
36cdf0e10cSrcweir #include <svtools/htmlcfg.hxx>
37cdf0e10cSrcweir
38cdf0e10cSrcweir #ifndef _SVSTDARR_STRINGSSORTDTOR
39cdf0e10cSrcweir #define _SVSTDARR_STRINGSSORTDTOR
40cdf0e10cSrcweir #include <svl/svstdarr.hxx>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
43cdf0e10cSrcweir #include "docsh.hxx"
44cdf0e10cSrcweir #include "wrtsh.hxx"
45cdf0e10cSrcweir #include "frmatr.hxx"
46cdf0e10cSrcweir #include "view.hxx"
47cdf0e10cSrcweir #include "globals.hrc"
48cdf0e10cSrcweir #include "swuipardlg.hxx"
49cdf0e10cSrcweir #include "pagedesc.hxx"
50cdf0e10cSrcweir #include "paratr.hxx"
51cdf0e10cSrcweir #include "drpcps.hxx"
52cdf0e10cSrcweir #include "uitool.hxx"
53cdf0e10cSrcweir #include "viewopt.hxx"
54cdf0e10cSrcweir #include <numpara.hxx>
55cdf0e10cSrcweir #include "chrdlg.hrc"
56cdf0e10cSrcweir #include "poolfmt.hrc"
57cdf0e10cSrcweir #include <svx/svxids.hrc>
58cdf0e10cSrcweir #include <svl/eitem.hxx>
59cdf0e10cSrcweir #include <svl/intitem.hxx>
60cdf0e10cSrcweir #include <svx/svxdlg.hxx>
61cdf0e10cSrcweir #include <svx/dialogs.hrc>
62cdf0e10cSrcweir #include <svx/flagsdef.hxx>
63cdf0e10cSrcweir // STATIC DATA -----------------------------------------------------------
64cdf0e10cSrcweir
65cdf0e10cSrcweir
SwParaDlg(Window * pParent,SwView & rVw,const SfxItemSet & rCoreSet,sal_uInt8 nDialogMode,const String * pTitle,sal_Bool bDraw,sal_uInt16 nDefPage)66cdf0e10cSrcweir SwParaDlg::SwParaDlg(Window *pParent,
67cdf0e10cSrcweir SwView& rVw,
68cdf0e10cSrcweir const SfxItemSet& rCoreSet,
69cdf0e10cSrcweir sal_uInt8 nDialogMode,
70cdf0e10cSrcweir const String *pTitle,
71cdf0e10cSrcweir sal_Bool bDraw,
72cdf0e10cSrcweir sal_uInt16 nDefPage):
73cdf0e10cSrcweir
74cdf0e10cSrcweir SfxTabDialog(pParent, bDraw ? SW_RES(DLG_DRAWPARA) : SW_RES(DLG_PARA),
75cdf0e10cSrcweir &rCoreSet, 0 != pTitle),
76cdf0e10cSrcweir
77cdf0e10cSrcweir rView(rVw),
78cdf0e10cSrcweir nDlgMode(nDialogMode),
79cdf0e10cSrcweir bDrawParaDlg(bDraw)
80cdf0e10cSrcweir
81cdf0e10cSrcweir {
82cdf0e10cSrcweir FreeResource();
83cdf0e10cSrcweir
84cdf0e10cSrcweir nHtmlMode = ::GetHtmlMode(rVw.GetDocShell());
85cdf0e10cSrcweir sal_Bool bHtmlMode = static_cast< sal_Bool >(nHtmlMode & HTMLMODE_ON);
86cdf0e10cSrcweir if(pTitle)
87cdf0e10cSrcweir {
88cdf0e10cSrcweir // Update des Titels
89cdf0e10cSrcweir String aTmp( GetText() );
90cdf0e10cSrcweir aTmp += SW_RESSTR(STR_TEXTCOLL_HEADER);
91cdf0e10cSrcweir aTmp += *pTitle;
92cdf0e10cSrcweir aTmp += ')';
93cdf0e10cSrcweir SetText(aTmp);
94cdf0e10cSrcweir }
95cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
96cdf0e10cSrcweir
97cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageCreatorFunc fail!");
98cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageRangesFunc fail!");
99cdf0e10cSrcweir AddTabPage( TP_PARA_STD, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH) );
100cdf0e10cSrcweir
101cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageCreatorFunc fail!");
102cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageRangesFunc fail!");
103cdf0e10cSrcweir AddTabPage( TP_PARA_ALIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH) );
104cdf0e10cSrcweir
105cdf0e10cSrcweir SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
106cdf0e10cSrcweir if (!bDrawParaDlg && (!bHtmlMode || pHtmlOpt->IsPrintLayoutExtension()))
107cdf0e10cSrcweir {
108cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageCreatorFunc fail!");
109cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageRangesFunc fail!");
110cdf0e10cSrcweir AddTabPage( TP_PARA_EXT, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
111cdf0e10cSrcweir
112cdf0e10cSrcweir }
113cdf0e10cSrcweir else
114cdf0e10cSrcweir RemoveTabPage(TP_PARA_EXT);
115cdf0e10cSrcweir
116cdf0e10cSrcweir SvtCJKOptions aCJKOptions;
117cdf0e10cSrcweir if(!bHtmlMode && aCJKOptions.IsAsianTypographyEnabled())
118cdf0e10cSrcweir {
119cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
120cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");
121cdf0e10cSrcweir AddTabPage( TP_PARA_ASIAN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
122cdf0e10cSrcweir }
123cdf0e10cSrcweir else
124cdf0e10cSrcweir RemoveTabPage(TP_PARA_ASIAN);
125cdf0e10cSrcweir
126cdf0e10cSrcweir sal_uInt16 nWhich(rCoreSet.GetPool()->GetWhich(SID_ATTR_LRSPACE));
127cdf0e10cSrcweir sal_Bool bLRValid = SFX_ITEM_AVAILABLE <= rCoreSet.GetItemState(nWhich);
128cdf0e10cSrcweir if(bHtmlMode || !bLRValid)
129cdf0e10cSrcweir RemoveTabPage(TP_TABULATOR);
130cdf0e10cSrcweir else
131cdf0e10cSrcweir {
132cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), "GetTabPageCreatorFunc fail!");
133cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR), "GetTabPageRangesFunc fail!");
134cdf0e10cSrcweir AddTabPage( TP_TABULATOR, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
135cdf0e10cSrcweir
136cdf0e10cSrcweir }
137cdf0e10cSrcweir if (!bDrawParaDlg)
138cdf0e10cSrcweir {
139cdf0e10cSrcweir if(!(nDlgMode & DLG_ENVELOP))
140cdf0e10cSrcweir AddTabPage(TP_NUMPARA, SwParagraphNumTabPage::Create,SwParagraphNumTabPage::GetRanges);
141cdf0e10cSrcweir else
142cdf0e10cSrcweir RemoveTabPage(TP_NUMPARA);
143cdf0e10cSrcweir if(!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES))
144cdf0e10cSrcweir {
145cdf0e10cSrcweir AddTabPage(TP_DROPCAPS, SwDropCapsPage::Create, SwDropCapsPage::GetRanges);
146cdf0e10cSrcweir }
147cdf0e10cSrcweir else
148cdf0e10cSrcweir {
149cdf0e10cSrcweir RemoveTabPage(TP_DROPCAPS);
150cdf0e10cSrcweir }
151cdf0e10cSrcweir if(!bHtmlMode || (nHtmlMode & (HTMLMODE_SOME_STYLES|HTMLMODE_FULL_STYLES)))
152cdf0e10cSrcweir {
153*56b35d86SArmin Le Grand //UUUU remove?
154*56b35d86SArmin Le Grand //DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
155*56b35d86SArmin Le Grand //DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
156*56b35d86SArmin Le Grand //AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
157*56b35d86SArmin Le Grand
158*56b35d86SArmin Le Grand //UUUU add Area and Transparence TabPages
159*56b35d86SArmin Le Grand AddTabPage(RID_SVXPAGE_AREA);
160*56b35d86SArmin Le Grand AddTabPage(RID_SVXPAGE_TRANSPARENCE);
161*56b35d86SArmin Le Grand }
162cdf0e10cSrcweir else
163cdf0e10cSrcweir {
164*56b35d86SArmin Le Grand //UUUU RemoveTabPage(TP_BACKGROUND);
165*56b35d86SArmin Le Grand RemoveTabPage(RID_SVXPAGE_AREA);
166*56b35d86SArmin Le Grand RemoveTabPage(RID_SVXPAGE_TRANSPARENCE);
167cdf0e10cSrcweir }
168cdf0e10cSrcweir if(!bHtmlMode || (nHtmlMode & HTMLMODE_PARA_BORDER))
169cdf0e10cSrcweir {
170cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
171cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
172cdf0e10cSrcweir AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
173cdf0e10cSrcweir }
174cdf0e10cSrcweir else
175cdf0e10cSrcweir RemoveTabPage(TP_BORDER);
176cdf0e10cSrcweir }
177cdf0e10cSrcweir
178cdf0e10cSrcweir if (nDefPage)
179cdf0e10cSrcweir SetCurPageId(nDefPage);
180cdf0e10cSrcweir }
181cdf0e10cSrcweir
182cdf0e10cSrcweir
~SwParaDlg()183cdf0e10cSrcweir __EXPORT SwParaDlg::~SwParaDlg()
184cdf0e10cSrcweir {
185cdf0e10cSrcweir }
186cdf0e10cSrcweir
187cdf0e10cSrcweir
PageCreated(sal_uInt16 nId,SfxTabPage & rPage)188*56b35d86SArmin Le Grand void __EXPORT SwParaDlg::PageCreated(sal_uInt16 nId,SfxTabPage& rPage)
189cdf0e10cSrcweir {
190*56b35d86SArmin Le Grand SwWrtShell& rSh = rView.GetWrtShell();
191cdf0e10cSrcweir SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
192cdf0e10cSrcweir
193*56b35d86SArmin Le Grand switch(nId)
194*56b35d86SArmin Le Grand {
195*56b35d86SArmin Le Grand case TP_BORDER:
196cdf0e10cSrcweir {
197*56b35d86SArmin Le Grand // Bei Tabellenumrandung kann im Writer kein Schatten eingestellt werden
198*56b35d86SArmin Le Grand aSet.Put(SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
199cdf0e10cSrcweir rPage.PageCreated(aSet);
200*56b35d86SArmin Le Grand break;
201*56b35d86SArmin Le Grand }
202*56b35d86SArmin Le Grand case TP_PARA_STD:
203*56b35d86SArmin Le Grand {
204*56b35d86SArmin Le Grand aSet.Put(SfxUInt16Item(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,
205*56b35d86SArmin Le Grand static_cast<sal_uInt16>(rSh.GetAnyCurRect(RECT_PAGE_PRT).Width())));
206*56b35d86SArmin Le Grand
207*56b35d86SArmin Le Grand if(!bDrawParaDlg)
208*56b35d86SArmin Le Grand {
209*56b35d86SArmin Le Grand aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000E));
210*56b35d86SArmin Le Grand aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,MM50 / 10));
211*56b35d86SArmin Le Grand
212*56b35d86SArmin Le Grand }
213cdf0e10cSrcweir rPage.PageCreated(aSet);
214*56b35d86SArmin Le Grand break;
215*56b35d86SArmin Le Grand }
216*56b35d86SArmin Le Grand case TP_PARA_ALIGN:
217cdf0e10cSrcweir {
218*56b35d86SArmin Le Grand if(!bDrawParaDlg)
219*56b35d86SArmin Le Grand {
220*56b35d86SArmin Le Grand aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_True));
221*56b35d86SArmin Le Grand rPage.PageCreated(aSet);
222*56b35d86SArmin Le Grand }
223*56b35d86SArmin Le Grand break;
224*56b35d86SArmin Le Grand }
225*56b35d86SArmin Le Grand case TP_PARA_EXT:
226*56b35d86SArmin Le Grand {
227*56b35d86SArmin Le Grand // Seitenumbruch nur, wenn der Cursor im Body-Bereich und nicht in
228*56b35d86SArmin Le Grand // einer Tabelle steht
229*56b35d86SArmin Le Grand const sal_uInt16 eType = rSh.GetFrmType(0,sal_True);
230*56b35d86SArmin Le Grand if(!(FRMTYPE_BODY & eType) ||
231*56b35d86SArmin Le Grand rSh.GetSelectionType() & nsSelectionType::SEL_TBL)
232*56b35d86SArmin Le Grand {
233*56b35d86SArmin Le Grand aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_True));
234*56b35d86SArmin Le Grand rPage.PageCreated(aSet);
235*56b35d86SArmin Le Grand }
236*56b35d86SArmin Le Grand break;
237*56b35d86SArmin Le Grand }
238*56b35d86SArmin Le Grand case TP_DROPCAPS:
239*56b35d86SArmin Le Grand {
240*56b35d86SArmin Le Grand ((SwDropCapsPage&)rPage).SetFormat(sal_False);
241*56b35d86SArmin Le Grand break;
242*56b35d86SArmin Le Grand }
243*56b35d86SArmin Le Grand case TP_BACKGROUND:
244*56b35d86SArmin Le Grand {
245*56b35d86SArmin Le Grand if(!(nHtmlMode & HTMLMODE_ON) ||
246*56b35d86SArmin Le Grand nHtmlMode & HTMLMODE_SOME_STYLES)
247*56b35d86SArmin Le Grand {
248*56b35d86SArmin Le Grand aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,SVX_SHOW_SELECTOR));
249*56b35d86SArmin Le Grand rPage.PageCreated(aSet);
250*56b35d86SArmin Le Grand }
251*56b35d86SArmin Le Grand break;
252*56b35d86SArmin Le Grand }
253*56b35d86SArmin Le Grand case TP_NUMPARA:
254*56b35d86SArmin Le Grand {
255*56b35d86SArmin Le Grand //-->#outline level,added by zhaojianwei
256*56b35d86SArmin Le Grand SwTxtFmtColl* pTmpColl = rSh.GetCurTxtFmtColl();
257*56b35d86SArmin Le Grand if(pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle())
258*56b35d86SArmin Le Grand {
259*56b35d86SArmin Le Grand ((SwParagraphNumTabPage&)rPage).DisableOutline();
260*56b35d86SArmin Le Grand }//<-end
261*56b35d86SArmin Le Grand
262*56b35d86SArmin Le Grand ((SwParagraphNumTabPage&)rPage).EnableNewStart();
263*56b35d86SArmin Le Grand ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
264*56b35d86SArmin Le Grand SfxStyleSheetBasePool* pPool = rView.GetDocShell()->GetStyleSheetPool();
265*56b35d86SArmin Le Grand pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO,SFXSTYLEBIT_ALL);
266*56b35d86SArmin Le Grand const SfxStyleSheetBase* pBase = pPool->First();
267*56b35d86SArmin Le Grand SvStringsSortDtor aNames;
268*56b35d86SArmin Le Grand while(pBase)
269*56b35d86SArmin Le Grand {
270*56b35d86SArmin Le Grand aNames.Insert(new String(pBase->GetName()));
271*56b35d86SArmin Le Grand pBase = pPool->Next();
272*56b35d86SArmin Le Grand }
273*56b35d86SArmin Le Grand for(sal_uInt16 i = 0; i < aNames.Count(); i++)
274*56b35d86SArmin Le Grand rBox.InsertEntry(*aNames.GetObject(i));
275*56b35d86SArmin Le Grand break;
276*56b35d86SArmin Le Grand }
277*56b35d86SArmin Le Grand
278*56b35d86SArmin Le Grand //UUUU inits for Area and Transparency TabPages
279*56b35d86SArmin Le Grand // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
280*56b35d86SArmin Le Grand // the color table) need to be added as items (e.g. SvxColorTableItem) to make
281*56b35d86SArmin Le Grand // these pages find the needed attributes for fill style suggestions.
282*56b35d86SArmin Le Grand // These are added in SwDocStyleSheet::GetItemSet() for the SFX_STYLE_FAMILY_PARA on
283*56b35d86SArmin Le Grand // demand, but could also be directly added from the DrawModel.
284*56b35d86SArmin Le Grand case RID_SVXPAGE_AREA:
285*56b35d86SArmin Le Grand {
286*56b35d86SArmin Le Grand SfxItemSet aNew(*aSet.GetPool(),
287*56b35d86SArmin Le Grand SID_COLOR_TABLE, SID_BITMAP_LIST,
288*56b35d86SArmin Le Grand SID_OFFER_IMPORT, SID_OFFER_IMPORT, 0, 0);
289cdf0e10cSrcweir
290*56b35d86SArmin Le Grand aNew.Put(*GetInputSetImpl());
291*56b35d86SArmin Le Grand
292*56b35d86SArmin Le Grand // add flag for direct graphic content selection
293*56b35d86SArmin Le Grand aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true));
294cdf0e10cSrcweir
295*56b35d86SArmin Le Grand rPage.PageCreated(aNew);
296*56b35d86SArmin Le Grand break;
297*56b35d86SArmin Le Grand }
298cdf0e10cSrcweir
299*56b35d86SArmin Le Grand case RID_SVXPAGE_TRANSPARENCE:
300*56b35d86SArmin Le Grand {
301*56b35d86SArmin Le Grand rPage.PageCreated(*GetInputSetImpl());
302*56b35d86SArmin Le Grand break;
303*56b35d86SArmin Le Grand }
304*56b35d86SArmin Le Grand }
305*56b35d86SArmin Le Grand }
306cdf0e10cSrcweir
307*56b35d86SArmin Le Grand // eof
308