1*efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*efeef26fSAndrew Rist * distributed with this work for additional information 6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*efeef26fSAndrew Rist * software distributed under the License is distributed on an 15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17*efeef26fSAndrew Rist * specific language governing permissions and limitations 18*efeef26fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*efeef26fSAndrew Rist *************************************************************/ 21*efeef26fSAndrew Rist 22*efeef26fSAndrew 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 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 { 153cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); 154cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); 155cdf0e10cSrcweir AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); 156cdf0e10cSrcweir } 157cdf0e10cSrcweir else 158cdf0e10cSrcweir { 159cdf0e10cSrcweir RemoveTabPage(TP_BACKGROUND); 160cdf0e10cSrcweir } 161cdf0e10cSrcweir if(!bHtmlMode || (nHtmlMode & HTMLMODE_PARA_BORDER)) 162cdf0e10cSrcweir { 163cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!"); 164cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!"); 165cdf0e10cSrcweir AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) ); 166cdf0e10cSrcweir } 167cdf0e10cSrcweir else 168cdf0e10cSrcweir RemoveTabPage(TP_BORDER); 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir if (nDefPage) 172cdf0e10cSrcweir SetCurPageId(nDefPage); 173cdf0e10cSrcweir } 174cdf0e10cSrcweir 175cdf0e10cSrcweir 176cdf0e10cSrcweir __EXPORT SwParaDlg::~SwParaDlg() 177cdf0e10cSrcweir { 178cdf0e10cSrcweir } 179cdf0e10cSrcweir 180cdf0e10cSrcweir 181cdf0e10cSrcweir void __EXPORT SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) 182cdf0e10cSrcweir { 183cdf0e10cSrcweir SwWrtShell& rSh = rView.GetWrtShell(); 184cdf0e10cSrcweir SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); 185cdf0e10cSrcweir 186cdf0e10cSrcweir // Bei Tabellenumrandung kann im Writer kein Schatten eingestellt werden 187cdf0e10cSrcweir if (nId == TP_BORDER) 188cdf0e10cSrcweir { 189cdf0e10cSrcweir aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA)); 190cdf0e10cSrcweir rPage.PageCreated(aSet); 191cdf0e10cSrcweir } 192cdf0e10cSrcweir else if( nId == TP_PARA_STD ) 193cdf0e10cSrcweir { 194cdf0e10cSrcweir aSet.Put(SfxUInt16Item(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH, 195cdf0e10cSrcweir static_cast< sal_uInt16 >(rSh.GetAnyCurRect(RECT_PAGE_PRT).Width()) )); 196cdf0e10cSrcweir 197cdf0e10cSrcweir if (!bDrawParaDlg) 198cdf0e10cSrcweir { 199cdf0e10cSrcweir aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000E)); 200cdf0e10cSrcweir aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, MM50/10)); 201cdf0e10cSrcweir 202cdf0e10cSrcweir } 203cdf0e10cSrcweir rPage.PageCreated(aSet); 204cdf0e10cSrcweir } 205cdf0e10cSrcweir else if( TP_PARA_ALIGN == nId) 206cdf0e10cSrcweir { 207cdf0e10cSrcweir if (!bDrawParaDlg) 208cdf0e10cSrcweir { 209cdf0e10cSrcweir aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_True)); 210cdf0e10cSrcweir rPage.PageCreated(aSet); 211cdf0e10cSrcweir } 212cdf0e10cSrcweir } 213cdf0e10cSrcweir else if( TP_PARA_EXT == nId ) 214cdf0e10cSrcweir { 215cdf0e10cSrcweir // Seitenumbruch nur, wenn der Cursor im Body-Bereich und nicht in 216cdf0e10cSrcweir // einer Tabelle steht 217cdf0e10cSrcweir const sal_uInt16 eType = rSh.GetFrmType(0,sal_True); 218cdf0e10cSrcweir if( !(FRMTYPE_BODY & eType) || 219cdf0e10cSrcweir rSh.GetSelectionType() & nsSelectionType::SEL_TBL ) 220cdf0e10cSrcweir { 221cdf0e10cSrcweir aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_True)); 222cdf0e10cSrcweir rPage.PageCreated(aSet); 223cdf0e10cSrcweir } 224cdf0e10cSrcweir } 225cdf0e10cSrcweir else if( TP_DROPCAPS == nId ) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir ((SwDropCapsPage&)rPage).SetFormat(sal_False); 228cdf0e10cSrcweir } 229cdf0e10cSrcweir else if( TP_BACKGROUND == nId ) 230cdf0e10cSrcweir { 231cdf0e10cSrcweir if(!( nHtmlMode & HTMLMODE_ON ) || 232cdf0e10cSrcweir nHtmlMode & HTMLMODE_SOME_STYLES) 233cdf0e10cSrcweir { 234cdf0e10cSrcweir aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR)); 235cdf0e10cSrcweir rPage.PageCreated(aSet); 236cdf0e10cSrcweir } 237cdf0e10cSrcweir } 238cdf0e10cSrcweir else if( TP_NUMPARA == nId) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir //-->#outline level,added by zhaojianwei 241cdf0e10cSrcweir SwTxtFmtColl* pTmpColl = rSh.GetCurTxtFmtColl(); 242cdf0e10cSrcweir if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() ) 243cdf0e10cSrcweir { 244cdf0e10cSrcweir ((SwParagraphNumTabPage&)rPage).DisableOutline() ; 245cdf0e10cSrcweir }//<-end 246cdf0e10cSrcweir 247cdf0e10cSrcweir ((SwParagraphNumTabPage&)rPage).EnableNewStart(); 248cdf0e10cSrcweir ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox(); 249cdf0e10cSrcweir SfxStyleSheetBasePool* pPool = rView.GetDocShell()->GetStyleSheetPool(); 250cdf0e10cSrcweir pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL); 251cdf0e10cSrcweir const SfxStyleSheetBase* pBase = pPool->First(); 252cdf0e10cSrcweir SvStringsSortDtor aNames; 253cdf0e10cSrcweir while(pBase) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir aNames.Insert(new String(pBase->GetName())); 256cdf0e10cSrcweir pBase = pPool->Next(); 257cdf0e10cSrcweir } 258cdf0e10cSrcweir for(sal_uInt16 i = 0; i < aNames.Count(); i++) 259cdf0e10cSrcweir rBox.InsertEntry(*aNames.GetObject(i)); 260cdf0e10cSrcweir } 261cdf0e10cSrcweir 262cdf0e10cSrcweir } 263cdf0e10cSrcweir 264cdf0e10cSrcweir 265cdf0e10cSrcweir 266