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
10cdf0e10cSrcweir *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
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.
19cdf0e10cSrcweir *
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);
161cdf0e10cSrcweir }
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)188cdf0e10cSrcweir void __EXPORT SwParaDlg::PageCreated(sal_uInt16 nId,SfxTabPage& rPage)
189cdf0e10cSrcweir {
190cdf0e10cSrcweir SwWrtShell& rSh = rView.GetWrtShell();
191cdf0e10cSrcweir SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
192cdf0e10cSrcweir
193*56b35d86SArmin Le Grand switch(nId)
194cdf0e10cSrcweir {
195*56b35d86SArmin Le Grand case TP_BORDER:
196*56b35d86SArmin Le Grand {
197*56b35d86SArmin Le Grand // Bei Tabellenumrandung kann im Writer kein Schatten eingestellt werden
198cdf0e10cSrcweir aSet.Put(SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
199cdf0e10cSrcweir rPage.PageCreated(aSet);
200*56b35d86SArmin Le Grand break;
201cdf0e10cSrcweir }
202*56b35d86SArmin Le Grand case TP_PARA_STD:
203cdf0e10cSrcweir {
204cdf0e10cSrcweir aSet.Put(SfxUInt16Item(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,
205cdf0e10cSrcweir static_cast<sal_uInt16>(rSh.GetAnyCurRect(RECT_PAGE_PRT).Width())));
206cdf0e10cSrcweir
207cdf0e10cSrcweir if(!bDrawParaDlg)
208cdf0e10cSrcweir {
209cdf0e10cSrcweir aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000E));
210cdf0e10cSrcweir aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,MM50 / 10));
211cdf0e10cSrcweir
212cdf0e10cSrcweir }
213cdf0e10cSrcweir rPage.PageCreated(aSet);
214*56b35d86SArmin Le Grand break;
215cdf0e10cSrcweir }
216*56b35d86SArmin Le Grand case TP_PARA_ALIGN:
217cdf0e10cSrcweir {
218cdf0e10cSrcweir if(!bDrawParaDlg)
219cdf0e10cSrcweir {
220cdf0e10cSrcweir aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_True));
221cdf0e10cSrcweir rPage.PageCreated(aSet);
222cdf0e10cSrcweir }
223*56b35d86SArmin Le Grand break;
224cdf0e10cSrcweir }
225*56b35d86SArmin Le Grand case TP_PARA_EXT:
226cdf0e10cSrcweir {
227cdf0e10cSrcweir // Seitenumbruch nur, wenn der Cursor im Body-Bereich und nicht in
228cdf0e10cSrcweir // einer Tabelle steht
229cdf0e10cSrcweir const sal_uInt16 eType = rSh.GetFrmType(0,sal_True);
230cdf0e10cSrcweir if(!(FRMTYPE_BODY & eType) ||
231cdf0e10cSrcweir rSh.GetSelectionType() & nsSelectionType::SEL_TBL)
232cdf0e10cSrcweir {
233cdf0e10cSrcweir aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_True));
234cdf0e10cSrcweir rPage.PageCreated(aSet);
235cdf0e10cSrcweir }
236*56b35d86SArmin Le Grand break;
237cdf0e10cSrcweir }
238*56b35d86SArmin Le Grand case TP_DROPCAPS:
239cdf0e10cSrcweir {
240cdf0e10cSrcweir ((SwDropCapsPage&)rPage).SetFormat(sal_False);
241*56b35d86SArmin Le Grand break;
242cdf0e10cSrcweir }
243*56b35d86SArmin Le Grand case TP_BACKGROUND:
244cdf0e10cSrcweir {
245cdf0e10cSrcweir if(!(nHtmlMode & HTMLMODE_ON) ||
246cdf0e10cSrcweir nHtmlMode & HTMLMODE_SOME_STYLES)
247cdf0e10cSrcweir {
248cdf0e10cSrcweir aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,SVX_SHOW_SELECTOR));
249cdf0e10cSrcweir rPage.PageCreated(aSet);
250cdf0e10cSrcweir }
251*56b35d86SArmin Le Grand break;
252cdf0e10cSrcweir }
253*56b35d86SArmin Le Grand case TP_NUMPARA:
254cdf0e10cSrcweir {
255cdf0e10cSrcweir //-->#outline level,added by zhaojianwei
256cdf0e10cSrcweir SwTxtFmtColl* pTmpColl = rSh.GetCurTxtFmtColl();
257cdf0e10cSrcweir if(pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle())
258cdf0e10cSrcweir {
259cdf0e10cSrcweir ((SwParagraphNumTabPage&)rPage).DisableOutline();
260cdf0e10cSrcweir }//<-end
261cdf0e10cSrcweir
262cdf0e10cSrcweir ((SwParagraphNumTabPage&)rPage).EnableNewStart();
263cdf0e10cSrcweir ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
264cdf0e10cSrcweir SfxStyleSheetBasePool* pPool = rView.GetDocShell()->GetStyleSheetPool();
265cdf0e10cSrcweir pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO,SFXSTYLEBIT_ALL);
266cdf0e10cSrcweir const SfxStyleSheetBase* pBase = pPool->First();
267cdf0e10cSrcweir SvStringsSortDtor aNames;
268cdf0e10cSrcweir while(pBase)
269cdf0e10cSrcweir {
270cdf0e10cSrcweir aNames.Insert(new String(pBase->GetName()));
271cdf0e10cSrcweir pBase = pPool->Next();
272cdf0e10cSrcweir }
273cdf0e10cSrcweir for(sal_uInt16 i = 0; i < aNames.Count(); i++)
274cdf0e10cSrcweir rBox.InsertEntry(*aNames.GetObject(i));
275*56b35d86SArmin Le Grand break;
276cdf0e10cSrcweir }
277cdf0e10cSrcweir
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);
289*56b35d86SArmin Le Grand
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));
294*56b35d86SArmin Le Grand
295*56b35d86SArmin Le Grand rPage.PageCreated(aNew);
296*56b35d86SArmin Le Grand break;
297cdf0e10cSrcweir }
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