merge the formfield patch from ooo-build
[ooovba.git] / sw / source / ui / app / docst.cxx
blob5168264a93cb2abef8385b26229fdb5da1f76460
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docst.cxx,v $
10 * $Revision: 1.36.136.1 $
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_sw.hxx"
33 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <com/sun/star/container/XNameAccess.hpp>
37 #include <hintids.hxx>
38 #include <sfx2/app.hxx>
39 #include <svtools/whiter.hxx>
40 #include <sfx2/templdlg.hxx>
41 #include <sfx2/tplpitem.hxx>
42 #include <sfx2/request.hxx>
43 #include <sfx2/dispatch.hxx>
44 #include <sfx2/newstyle.hxx>
45 #include <svtools/macitem.hxx>
46 #include <svx/brshitem.hxx>
47 #include <svtools/stritem.hxx>
48 #include <svtools/languageoptions.hxx>
49 #include <svx/eeitem.hxx>
50 #include <svx/htmlmode.hxx>
51 #include <swmodule.hxx>
52 #include <wdocsh.hxx>
53 #include <fmtfsize.hxx>
54 #include <fchrfmt.hxx>
55 #include <svx/htmlcfg.hxx>
56 #include <SwStyleNameMapper.hxx>
57 #include <undobj.hxx>
58 #include <swundo.hxx>
60 #include "view.hxx"
61 #include "wrtsh.hxx"
62 #include "docsh.hxx"
63 #include "uitool.hxx"
64 #include "cmdid.h"
65 #include "globals.hrc"
66 #include "viewopt.hxx"
67 #include "doc.hxx"
68 #include "swstyle.h"
69 #include "frmfmt.hxx"
70 #include "charfmt.hxx"
71 #include "poolfmt.hxx"
72 #include "pagedesc.hxx"
73 #include "docstyle.hxx"
74 #include "uiitems.hxx"
75 #include "fmtcol.hxx"
76 #include "frmmgr.hxx" //SwFrmValid
77 #include "swevent.hxx"
78 #include "edtwin.hxx"
79 #include "unochart.hxx"
81 #include "app.hrc"
82 #include <fmtui.hrc>
83 #include "swabstdlg.hxx"
84 // --> OD 2008-03-27 #refactorlists#
85 #include <list.hxx>
86 // <--
88 #include <paratr.hxx> //#outline level,add by zhaojianwei
90 using namespace ::com::sun::star;
92 /*--------------------------------------------------------------------
93 Beschreibung:
94 --------------------------------------------------------------------*/
97 void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
99 SfxWhichIter aIter(rSet);
100 USHORT nWhich = aIter.FirstWhich();
101 USHORT nActualFamily = USHRT_MAX;
103 SwWrtShell* pShell = pSh ? pSh : GetWrtShell();
104 if(!pShell)
106 while (nWhich)
108 rSet.DisableItem(nWhich);
109 nWhich = aIter.NextWhich();
111 return;
113 else
115 SfxViewFrame* pFrame = pShell->GetView().GetViewFrame();
116 const ISfxTemplateCommon* pCommon = SFX_APP()->GetCurrentTemplateCommon(pFrame->GetBindings());
117 if( pCommon )
118 nActualFamily = static_cast< USHORT >(pCommon->GetActualFamily());
121 while (nWhich)
123 // aktuelle Vorlage zu jeder Familie ermitteln
125 String aName;
126 switch (nWhich)
128 case SID_STYLE_APPLY:
129 {//hier wird die Vorlage und ihre Familie an die StyleBox
130 //uebergeben, damit diese Familie angezeigt wird
131 if(pShell->IsFrmSelected())
133 SwFrmFmt* pFmt = pShell->GetCurFrmFmt();
134 if( pFmt )
135 aName = pFmt->GetName();
137 else
139 SwTxtFmtColl* pColl = pShell->GetCurTxtFmtColl();
140 if(pColl)
141 aName = pColl->GetName();
143 rSet.Put(SfxTemplateItem(nWhich, aName));
145 break;
146 case SID_STYLE_FAMILY1:
147 if( !pShell->IsFrmSelected() )
149 SwCharFmt* pFmt = pShell->GetCurCharFmt();
150 if(pFmt)
151 aName = pFmt->GetName();
152 else
153 aName = *SwStyleNameMapper::GetTextUINameArray()[
154 RES_POOLCOLL_STANDARD - RES_POOLCOLL_TEXT_BEGIN ];
155 rSet.Put(SfxTemplateItem(nWhich, aName));
157 break;
159 case SID_STYLE_FAMILY2:
160 if(!pShell->IsFrmSelected())
162 SwTxtFmtColl* pColl = pShell->GetCurTxtFmtColl();
163 if(pColl)
164 aName = pColl->GetName();
166 SfxTemplateItem aItem(nWhich, aName);
168 USHORT nMask = 0;
169 if( pDoc->get(IDocumentSettingAccess::HTML_MODE) )
170 nMask = SWSTYLEBIT_HTML;
171 else
173 const int nSelection = pShell->GetFrmType(0,TRUE);
174 if(pShell->GetCurTOX())
175 nMask = SWSTYLEBIT_IDX ;
176 else if(nSelection & FRMTYPE_HEADER ||
177 nSelection & FRMTYPE_FOOTER ||
178 nSelection & FRMTYPE_TABLE ||
179 nSelection & FRMTYPE_FLY_ANY ||
180 nSelection & FRMTYPE_FOOTNOTE ||
181 nSelection & FRMTYPE_FTNPAGE)
182 nMask = SWSTYLEBIT_EXTRA;
183 else
184 nMask = SWSTYLEBIT_TEXT;
187 aItem.SetValue(nMask);
188 rSet.Put(aItem);
191 break;
193 case SID_STYLE_FAMILY3:
195 if( pDoc->get(IDocumentSettingAccess::HTML_MODE) )
196 rSet.DisableItem( nWhich );
197 else
199 SwFrmFmt* pFmt = pShell->GetCurFrmFmt();
200 if(pFmt && pShell->IsFrmSelected())
202 aName = pFmt->GetName();
203 rSet.Put(SfxTemplateItem(nWhich, aName));
206 break;
208 case SID_STYLE_FAMILY4:
210 SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
211 if( pDoc->get(IDocumentSettingAccess::HTML_MODE) && !pHtmlOpt->IsPrintLayoutExtension())
212 rSet.DisableItem( nWhich );
213 else
215 USHORT n = pShell->GetCurPageDesc( FALSE );
216 if( n < pShell->GetPageDescCnt() )
217 aName = pShell->GetPageDesc( n ).GetName();
219 rSet.Put(SfxTemplateItem(nWhich, aName));
222 break;
223 case SID_STYLE_FAMILY5:
225 const SwNumRule* pRule = pShell->GetCurNumRule();
226 if( pRule )
227 aName = pRule->GetName();
229 rSet.Put(SfxTemplateItem(nWhich, aName));
231 break;
233 case SID_STYLE_WATERCAN:
235 SwEditWin& rEdtWin = pShell->GetView().GetEditWin();
236 SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
237 rSet.Put(SfxBoolItem(nWhich, pApply && pApply->eType != 0));
239 break;
240 case SID_STYLE_UPDATE_BY_EXAMPLE:
241 if( pShell->IsFrmSelected()
242 ? SFX_STYLE_FAMILY_FRAME != nActualFamily
243 : ( SFX_STYLE_FAMILY_FRAME == nActualFamily ||
244 SFX_STYLE_FAMILY_PAGE == nActualFamily ||
245 (SFX_STYLE_FAMILY_PSEUDO == nActualFamily && !pShell->GetCurNumRule())) )
247 rSet.DisableItem( nWhich );
249 break;
251 case SID_STYLE_NEW_BY_EXAMPLE:
252 if( (pShell->IsFrmSelected()
253 ? SFX_STYLE_FAMILY_FRAME != nActualFamily
254 : SFX_STYLE_FAMILY_FRAME == nActualFamily) ||
255 (SFX_STYLE_FAMILY_PSEUDO == nActualFamily && !pShell->GetCurNumRule()) )
257 rSet.DisableItem( nWhich );
259 break;
261 default:
262 DBG_ERROR( "Invalid SlotId");
264 nWhich = aIter.NextWhich();
269 /*--------------------------------------------------------------------
270 Beschreibung: StyleSheet-Requeste auswerten
271 --------------------------------------------------------------------*/
274 void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
276 USHORT nSlot = rReq.GetSlot();
277 USHORT nRet = 0xffff;
279 const SfxItemSet* pArgs = rReq.GetArgs();
280 const SfxPoolItem* pItem;
281 SwWrtShell* pActShell = 0;
282 BOOL bSetReturn = TRUE;
283 switch (nSlot)
285 case SID_STYLE_NEW:
286 if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILY,
287 FALSE, &pItem ))
289 USHORT nFamily = ((const SfxUInt16Item*)pItem)->GetValue();
291 String sName;
292 USHORT nMask = 0;
293 if( SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_NEW,
294 FALSE, &pItem ))
295 sName = ((const SfxStringItem*)pItem)->GetValue();
296 if( SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_MASK,
297 FALSE, &pItem ))
298 nMask = ((const SfxUInt16Item*)pItem)->GetValue();
299 String sParent;
300 if( SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_REFERENCE,
301 FALSE, &pItem ))
302 sParent = ((const SfxStringItem*)pItem)->GetValue();
304 nRet = Edit( sName, sParent, nFamily, nMask, TRUE, FALSE, 0, rReq.IsAPI() );
306 break;
308 case SID_STYLE_APPLY:
309 if( !pArgs )
311 GetView()->GetViewFrame()->GetDispatcher()->Execute(SID_STYLE_DESIGNER, FALSE);
312 break;
314 else
316 // convert internal StyleName to DisplayName (slot implementation uses the latter)
317 SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_APPLY_STYLE, sal_False );
318 SFX_REQUEST_ARG( rReq, pFamilyItem, SfxStringItem, SID_STYLE_FAMILYNAME, sal_False );
319 if ( pFamilyItem && pNameItem )
321 uno::Reference< style::XStyleFamiliesSupplier > xModel(GetModel(), uno::UNO_QUERY);
324 uno::Reference< container::XNameAccess > xStyles;
325 uno::Reference< container::XNameAccess > xCont = xModel->getStyleFamilies();
326 xCont->getByName(pFamilyItem->GetValue()) >>= xStyles;
327 uno::Reference< beans::XPropertySet > xInfo;
328 xStyles->getByName( pNameItem->GetValue() ) >>= xInfo;
329 ::rtl::OUString aUIName;
330 xInfo->getPropertyValue( ::rtl::OUString::createFromAscii("DisplayName") ) >>= aUIName;
331 if ( aUIName.getLength() )
332 rReq.AppendItem( SfxStringItem( SID_STYLE_APPLY, aUIName ) );
334 catch( uno::Exception& )
340 // intentionally no break
342 case SID_STYLE_EDIT:
343 case SID_STYLE_DELETE:
344 case SID_STYLE_WATERCAN:
345 case SID_STYLE_FAMILY:
346 case SID_STYLE_UPDATE_BY_EXAMPLE:
347 case SID_STYLE_NEW_BY_EXAMPLE:
349 String aParam;
350 USHORT nFamily = SFX_STYLE_FAMILY_PARA;
351 USHORT nMask = 0;
353 if( !pArgs )
355 nFamily = SFX_STYLE_FAMILY_PARA;
357 switch (nSlot)
359 case SID_STYLE_NEW_BY_EXAMPLE:
361 SfxNewStyleDlg *pDlg = new SfxNewStyleDlg( 0,
362 *GetStyleSheetPool());
363 if(RET_OK == pDlg->Execute())
365 aParam = pDlg->GetName();
366 rReq.AppendItem(SfxStringItem(nSlot, aParam));
369 delete pDlg;
371 break;
373 case SID_STYLE_UPDATE_BY_EXAMPLE:
374 case SID_STYLE_EDIT:
376 SwTxtFmtColl* pColl = GetWrtShell()->GetCurTxtFmtColl();
377 if(pColl)
379 aParam = pColl->GetName();
380 rReq.AppendItem(SfxStringItem(nSlot, aParam));
383 break;
386 else
388 ASSERT( pArgs->Count(), "SfxBug ItemSet ist leer");
390 SwWrtShell* pShell = GetWrtShell();
391 if( SFX_ITEM_SET == pArgs->GetItemState(nSlot, FALSE, &pItem ))
392 aParam = ((const SfxStringItem*)pItem)->GetValue();
394 if( SFX_ITEM_SET == pArgs->GetItemState(SID_STYLE_FAMILY,
395 FALSE, &pItem ))
396 nFamily = ((const SfxUInt16Item*)pItem)->GetValue();
398 if( SFX_ITEM_SET == pArgs->GetItemState(SID_STYLE_FAMILYNAME, FALSE, &pItem ))
400 String aFamily = ((const SfxStringItem*)pItem)->GetValue();
401 if(aFamily.CompareToAscii("CharacterStyles") == COMPARE_EQUAL)
402 nFamily = SFX_STYLE_FAMILY_CHAR;
403 else
404 if(aFamily.CompareToAscii("ParagraphStyles") == COMPARE_EQUAL)
405 nFamily = SFX_STYLE_FAMILY_PARA;
406 else
407 if(aFamily.CompareToAscii("PageStyles") == COMPARE_EQUAL)
408 nFamily = SFX_STYLE_FAMILY_PAGE;
409 else
410 if(aFamily.CompareToAscii("FrameStyles") == COMPARE_EQUAL)
411 nFamily = SFX_STYLE_FAMILY_FRAME;
412 else
413 if(aFamily.CompareToAscii("NumberingStyles") == COMPARE_EQUAL)
414 nFamily = SFX_STYLE_FAMILY_PSEUDO;
417 if( SFX_ITEM_SET == pArgs->GetItemState(SID_STYLE_MASK,
418 FALSE, &pItem ))
419 nMask = ((const SfxUInt16Item*)pItem)->GetValue();
420 if( SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_WRTSHELL,
421 FALSE, &pItem ))
422 pActShell = pShell = (SwWrtShell*)((SwPtrItem*)pItem)->GetValue();
424 if( nSlot == SID_STYLE_UPDATE_BY_EXAMPLE )
426 switch( nFamily )
428 case SFX_STYLE_FAMILY_PARA:
430 SwTxtFmtColl* pColl = pShell->GetCurTxtFmtColl();
431 if(pColl)
432 aParam = pColl->GetName();
434 break;
435 case SFX_STYLE_FAMILY_FRAME:
437 SwFrmFmt* pFrm = pWrtShell->GetCurFrmFmt();
438 if( pFrm )
439 aParam = pFrm->GetName();
441 break;
442 case SFX_STYLE_FAMILY_CHAR:
444 SwCharFmt* pChar = pWrtShell->GetCurCharFmt();
445 if( pChar )
446 aParam = pChar->GetName();
448 break;
449 case SFX_STYLE_FAMILY_PSEUDO:
450 if(SFX_ITEM_SET == pArgs->GetItemState(SID_STYLE_UPD_BY_EX_NAME, FALSE, &pItem))
452 aParam = ((const SfxStringItem*)pItem)->GetValue();
454 break;
456 rReq.AppendItem(SfxStringItem(nSlot, aParam));
459 if (aParam.Len() || nSlot == SID_STYLE_WATERCAN )
461 switch(nSlot)
463 case SID_STYLE_EDIT:
464 nRet = Edit(aParam, aEmptyStr, nFamily, nMask, FALSE, FALSE, pActShell );
465 break;
466 case SID_STYLE_DELETE:
467 nRet = Delete(aParam, nFamily);
468 break;
469 case SID_STYLE_APPLY:
470 // Shellwechsel in ApplyStyles
471 nRet = ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() );
472 break;
473 case SID_STYLE_WATERCAN:
474 nRet = DoWaterCan(aParam, nFamily);
475 break;
476 case SID_STYLE_UPDATE_BY_EXAMPLE:
477 nRet = UpdateStyle(aParam, nFamily, pActShell);
478 break;
479 case SID_STYLE_NEW_BY_EXAMPLE:
481 nRet = MakeByExample(aParam, nFamily, nMask, pActShell );
482 SfxTemplateDialog* pDlg = SFX_APP()->GetTemplateDialog();
484 if(pDlg && pDlg->IsVisible())
485 pDlg->Update();
487 break;
489 default:
490 DBG_ERROR( "Falsche Slot-Id");
493 rReq.Done();
496 break;
500 if(bSetReturn)
502 if(rReq.IsAPI()) // Basic bekommt nur TRUE oder FALSE
503 rReq.SetReturnValue(SfxUInt16Item(nSlot, nRet !=0));
504 else
505 rReq.SetReturnValue(SfxUInt16Item(nSlot, nRet));
510 /*--------------------------------------------------------------------
511 Beschreibung: Edit
512 --------------------------------------------------------------------*/
515 USHORT SwDocShell::Edit( const String &rName, const String &rParent, USHORT nFamily, USHORT nMask,
516 BOOL bNew, BOOL bColumn, SwWrtShell* pActShell,
517 BOOL bBasic )
519 ASSERT(GetWrtShell(), "Keine Shell, keine Styles");
520 SfxStyleSheetBase *pStyle = 0;
522 USHORT nRet = nMask;
523 BOOL bModified = pDoc->IsModified();
525 if( bNew )
527 if( SFXSTYLEBIT_ALL != nMask && SFXSTYLEBIT_USED != nMask )
528 nMask |= SFXSTYLEBIT_USERDEF;
529 else
530 nMask = SFXSTYLEBIT_USERDEF;
532 pStyle = &mxBasePool->Make( rName, (SfxStyleFamily)nFamily, nMask );
534 // die aktuellen als Parent setzen
535 SwDocStyleSheet* pDStyle = (SwDocStyleSheet*)pStyle;
536 switch( nFamily )
538 case SFX_STYLE_FAMILY_PARA:
540 if(rParent.Len())
542 SwTxtFmtColl* pColl = pWrtShell->FindTxtFmtCollByName( rParent );
543 if(!pColl)
545 USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rParent, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL);
546 if(USHRT_MAX != nId)
547 pColl = pWrtShell->GetTxtCollFromPool( nId );
549 pDStyle->GetCollection()->SetDerivedFrom( pColl );
550 pDStyle->PresetParent( rParent );
552 //#outline level,add by zhaojianwei
553 /*When a new paragraph style is created based on a "to outline style
554 assigned" paragraph style, the outline level attribute and the list
555 style attribute of the new paragraph style have to be set to 0
556 respectively "".*/
557 if( pColl->IsAssignedToListLevelOfOutlineStyle())
559 SwNumRuleItem aItem(aEmptyStr);
560 pDStyle->GetCollection()->SetFmtAttr( aItem );
561 pDStyle->GetCollection()->SetAttrOutlineLevel( 0 );
563 //<-end,zhaojianwei
566 else
568 SwTxtFmtColl* pColl = pWrtShell->GetCurTxtFmtColl();
569 pDStyle->GetCollection()->SetDerivedFrom( pColl );
570 if( pColl )
571 pDStyle->PresetParent( pColl->GetName() );
574 break;
575 case SFX_STYLE_FAMILY_CHAR:
577 if(rParent.Len())
579 SwCharFmt* pCFmt = pWrtShell->FindCharFmtByName( rParent );
580 if(!pCFmt)
582 USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rParent, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
583 if(USHRT_MAX != nId)
584 pCFmt = pWrtShell->GetCharFmtFromPool( nId );
587 pDStyle->GetCharFmt()->SetDerivedFrom( pCFmt );
588 pDStyle->PresetParent( rParent );
590 else
592 SwCharFmt* pCFmt = pWrtShell->GetCurCharFmt();
593 pDStyle->GetCharFmt()->SetDerivedFrom( pCFmt );
594 if( pCFmt )
595 pDStyle->PresetParent( pCFmt->GetName() );
598 break;
599 case SFX_STYLE_FAMILY_FRAME :
601 if(rParent.Len())
603 SwFrmFmt* pFFmt = pWrtShell->GetDoc()->FindFrmFmtByName( rParent );
604 if(!pFFmt)
606 USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rParent, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT);
607 if(USHRT_MAX != nId)
608 pFFmt = pWrtShell->GetFrmFmtFromPool( nId );
610 pDStyle->GetFrmFmt()->SetDerivedFrom( pFFmt );
611 pDStyle->PresetParent( rParent );
614 break;
617 else
619 pStyle = mxBasePool->Find( rName, (SfxStyleFamily)nFamily );
620 ASSERT(pStyle, "Vorlage nicht gefunden");
623 if(!pStyle)
624 return FALSE;
626 // Dialoge zusammenstoepseln
628 rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *(SwDocStyleSheet*)pStyle ) );
629 if( SFX_STYLE_FAMILY_PARA == nFamily )
631 SfxItemSet& rSet = xTmp->GetItemSet();
632 ::SwToSfxPageDescAttr( rSet );
633 // erstmal nur eine Null
634 rSet.Put(SwBackgroundDestinationItem(SID_PARA_BACKGRND_DESTINATION, 0));
635 // --> OD 2008-02-13 #newlistlevelattrs#
636 // merge list level indent attributes into the item set if needed
637 xTmp->MergeIndentAttrsOfListStyle( rSet );
638 // <--
640 /* else if( SFX_STYLE_FAMILY_FRAME == nFamily )
642 // Auskommentiert wegen Bug #45776 (per default keine Breite&Groesse in Rahmenvorlagen)
643 SfxItemSet& rSet = aTmp.GetItemSet();
644 if( SFX_ITEM_SET != rSet.GetItemState( RES_FRM_SIZE ))
646 // dann sollten wir spaetesten hier eines anlegen
647 SwFrmValid aFrmDefValues;
648 rSet.Put( SwFmtFrmSize( ATT_VAR_SIZE, aFrmDefValues.nWidth,
649 aFrmDefValues.nHeight ));
652 else if( SFX_STYLE_FAMILY_CHAR == nFamily )
654 SfxItemSet& rSet = xTmp->GetItemSet();
655 const SfxPoolItem *pTmpBrush;
656 if( SFX_ITEM_SET == rSet.GetItemState( RES_CHRATR_BACKGROUND,
657 TRUE, &pTmpBrush ) )
659 SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
660 aTmpBrush.SetWhich( RES_BACKGROUND );
661 rSet.Put( aTmpBrush );
664 if (!bBasic)
666 // vor dem Dialog wird der HtmlMode an der DocShell versenkt
667 USHORT nHtmlMode = ::GetHtmlMode(this);
669 // In HTML mode, we do not always have a printer. In order to show
670 // the correct page size in the Format - Page dialog, we have to
671 // get one here.
672 SwWrtShell* pCurrShell = ( pActShell ? pActShell : pWrtShell );
673 if( ( HTMLMODE_ON & nHtmlMode ) &&
674 !pCurrShell->getIDocumentDeviceAccess()->getPrinter( false ) )
675 pCurrShell->InitPrt( pCurrShell->getIDocumentDeviceAccess()->getPrinter( true ) );
677 PutItem(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
678 FieldUnit eMetric = ::GetDfltMetric(0 != (HTMLMODE_ON&nHtmlMode));
679 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)));
680 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
681 DBG_ASSERT(pFact, "Dialogdiet fail!");
682 SfxAbstractTabDialog* pDlg = pFact->CreateTemplateDialog( DLG_TEMPLATE_BASE,
683 0, *(xTmp.get()), nFamily, bColumn,
684 pActShell ? pActShell : pWrtShell, bNew);
685 DBG_ASSERT(pDlg, "Dialogdiet fail!");
686 if(RET_OK == pDlg->Execute())
688 GetWrtShell()->StartAllAction();
690 // nur bei Absatz-Vorlagen die Maske neu setzen
691 if( bNew )
693 nRet = SFX_STYLE_FAMILY_PARA == pStyle->GetFamily()
694 ? xTmp->GetMask()
695 : SFXSTYLEBIT_USERDEF;
697 else if( pStyle->GetMask() != xTmp->GetMask() )
698 nRet = xTmp->GetMask();
700 if( SFX_STYLE_FAMILY_PARA == nFamily )
702 SfxItemSet aSet( *pDlg->GetOutputItemSet() );
703 ::SfxToSwPageDescAttr( *GetWrtShell(), aSet );
704 // --> OD 2008-02-12 #newlistlevelattrs#
705 // reset indent attributes at paragraph style, if a list style
706 // will be applied and no indent attributes will be applied.
707 xTmp->SetItemSet( aSet, true );
708 // <--
710 else
712 if(SFX_STYLE_FAMILY_PAGE == nFamily)
714 static const USHORT aInval[] = {
715 SID_IMAGE_ORIENTATION,
716 SID_ATTR_CHAR_FONT,
717 FN_INSERT_CTRL, FN_INSERT_OBJ_CTRL, 0};
718 pView->GetViewFrame()->GetBindings().Invalidate(aInval);
720 SfxItemSet aTmpSet( *pDlg->GetOutputItemSet() );
721 if( SFX_STYLE_FAMILY_CHAR == nFamily )
723 const SfxPoolItem *pTmpBrush;
724 if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND,
725 FALSE, &pTmpBrush ) )
727 SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
728 aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
729 aTmpSet.Put( aTmpBrush );
731 aTmpSet.ClearItem( RES_BACKGROUND );
733 xTmp->SetItemSet( aTmpSet );
735 if( SFX_STYLE_FAMILY_PAGE == nFamily && SvtLanguageOptions().IsCTLFontEnabled() )
737 const SfxPoolItem *pItem = NULL;
738 if( aTmpSet.GetItemState( GetPool().GetTrueWhich( SID_ATTR_FRAMEDIRECTION, FALSE ) , TRUE, &pItem ) == SFX_ITEM_SET )
739 SwChartHelper::DoUpdateAllCharts( pDoc );
742 if(SFX_STYLE_FAMILY_PAGE == nFamily)
743 pView->InvalidateRulerPos();
745 if( bNew )
746 mxBasePool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *xTmp.get() ) );
748 // JP 19.09.97:
749 // Dialog vorm EndAction zerstoeren - bei Seitenvorlagen kann
750 // muss der ItemSet zerstoert werden, damit die Cursor aus den
751 // Kopf-/Fusszeilen entfernt werden. Sonst kommts zu GPFs!!!
752 delete pDlg;
754 pDoc->SetModified();
755 if( !bModified ) // Bug 57028
756 pDoc->SetUndoNoResetModified();
758 GetWrtShell()->EndAllAction();
760 else
762 if( bNew )
764 // #116530#
765 //pBasePool->Erase( &aTmp );
766 GetWrtShell()->Undo(UNDO_EMPTY, 1);
767 pDoc->ClearRedo();
770 if( !bModified )
771 pDoc->ResetModified();
772 delete pDlg;
775 else
777 // vor dem Dialog wird der HtmlMode an der DocShell versenkt
778 PutItem(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(this)));
780 GetWrtShell()->StartAllAction();
782 // nur bei Absatz-Vorlagen die Maske neu setzen
783 if( bNew )
785 nRet = SFX_STYLE_FAMILY_PARA == pStyle->GetFamily()
786 ? xTmp->GetMask()
787 : SFXSTYLEBIT_USERDEF;
789 else if( pStyle->GetMask() != xTmp->GetMask() )
790 nRet = xTmp->GetMask();
792 if( SFX_STYLE_FAMILY_PARA == nFamily )
793 ::SfxToSwPageDescAttr( *GetWrtShell(), xTmp->GetItemSet() );
794 else
796 SfxItemSet aTmpSet( xTmp->GetItemSet() );
797 if( SFX_STYLE_FAMILY_CHAR == nFamily )
799 const SfxPoolItem *pTmpBrush;
800 if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND,
801 FALSE, &pTmpBrush ) )
803 SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
804 aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
805 aTmpSet.Put( aTmpBrush );
807 aTmpSet.ClearItem( RES_BACKGROUND );
809 xTmp->SetItemSet( aTmpSet );
811 if(SFX_STYLE_FAMILY_PAGE == nFamily)
812 pView->InvalidateRulerPos();
814 if( bNew )
815 mxBasePool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *xTmp.get() ) );
817 pDoc->SetModified();
818 if( !bModified ) // Bug 57028
819 pDoc->SetUndoNoResetModified();
820 GetWrtShell()->EndAllAction();
823 return nRet;
826 /*--------------------------------------------------------------------
827 Beschreibung: Delete
828 --------------------------------------------------------------------*/
831 USHORT SwDocShell::Delete(const String &rName, USHORT nFamily)
833 SfxStyleSheetBase *pStyle = mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
835 if(pStyle)
837 ASSERT(GetWrtShell(), "Keine Shell, keine Styles");
839 GetWrtShell()->StartAllAction();
840 mxBasePool->Remove(pStyle);
841 GetWrtShell()->EndAllAction();
843 return TRUE;
845 return FALSE;
848 /*--------------------------------------------------------------------
849 Beschreibung: Vorlage anwenden
850 --------------------------------------------------------------------*/
853 USHORT SwDocShell::ApplyStyles(const String &rName, USHORT nFamily,
854 SwWrtShell* pShell, USHORT nMode )
856 SwDocStyleSheet* pStyle =
857 (SwDocStyleSheet*)mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
859 ASSERT(pStyle, "Wo ist der StyleSheet");
860 if(!pStyle)
861 return FALSE;
863 SwWrtShell *pSh = pShell ? pShell : GetWrtShell();
865 ASSERT( pSh, "Keine Shell, keine Styles");
867 pSh->StartAllAction();
869 switch(nFamily)
871 case SFX_STYLE_FAMILY_CHAR:
873 SwFmtCharFmt aFmt(pStyle->GetCharFmt());
874 pSh->SetAttr( aFmt, (nMode & KEY_SHIFT) ?
875 nsSetAttrMode::SETATTR_DONTREPLACE : nsSetAttrMode::SETATTR_DEFAULT );
876 break;
878 case SFX_STYLE_FAMILY_PARA:
880 // --> OD 2007-11-06 #i62675#
881 // clear also list attributes at affected text nodes, if paragraph
882 // style has the list style attribute set.
883 pSh->SetTxtFmtColl( pStyle->GetCollection(), true );
884 // <--
885 break;
887 case SFX_STYLE_FAMILY_FRAME:
889 if ( pSh->IsFrmSelected() )
890 pSh->SetFrmFmt( pStyle->GetFrmFmt() );
891 break;
893 case SFX_STYLE_FAMILY_PAGE:
895 pSh->SetPageStyle(pStyle->GetPageDesc()->GetName());
896 break;
898 case SFX_STYLE_FAMILY_PSEUDO:
900 // --> OD 2008-02-08 #newlistlevelattrs#
901 // reset indent attribute on applying list style
902 // --> OD 2008-03-17 #refactorlists#
903 // continue list of list style
904 const SwNumRule* pNumRule = pStyle->GetNumRule();
905 const String sListIdForStyle =pNumRule->GetDefaultListId();
906 pSh->SetCurNumRule( *pNumRule, false, sListIdForStyle, true );
907 // <--
908 break;
910 default:
911 DBG_ERROR("Unbekannte Familie");
913 pSh->EndAllAction();
915 return nFamily;
918 /*--------------------------------------------------------------------
919 Beschreibung: Giesskanne starten
920 --------------------------------------------------------------------*/
924 USHORT SwDocShell::DoWaterCan(const String &rName, USHORT nFamily)
926 ASSERT(GetWrtShell(), "Keine Shell, keine Styles");
928 SwEditWin& rEdtWin = pView->GetEditWin();
929 SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
930 BOOL bWaterCan = !(pApply && pApply->eType != 0);
931 if( !rName.Len() )
932 bWaterCan = FALSE;
933 SwApplyTemplate aTemplate;
934 aTemplate.eType = nFamily;
936 if(bWaterCan)
938 SwDocStyleSheet* pStyle =
939 (SwDocStyleSheet*)mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
941 ASSERT(pStyle, "Wo ist der StyleSheet");
942 if(!pStyle) return nFamily;
944 switch(nFamily)
946 case SFX_STYLE_FAMILY_CHAR:
947 aTemplate.aColl.pCharFmt = pStyle->GetCharFmt();
948 break;
949 case SFX_STYLE_FAMILY_PARA:
950 aTemplate.aColl.pTxtColl = pStyle->GetCollection();
951 break;
952 case SFX_STYLE_FAMILY_FRAME:
953 aTemplate.aColl.pFrmFmt = pStyle->GetFrmFmt();
954 break;
955 case SFX_STYLE_FAMILY_PAGE:
956 aTemplate.aColl.pPageDesc = (SwPageDesc*)pStyle->GetPageDesc();
957 break;
958 case SFX_STYLE_FAMILY_PSEUDO:
959 aTemplate.aColl.pNumRule = (SwNumRule*)pStyle->GetNumRule();
960 break;
962 default:
963 DBG_ERROR( "Unbekannte Familie");
966 else
967 aTemplate.eType = 0;
969 // Template anwenden
970 pView->GetEditWin().SetApplyTemplate(aTemplate);
972 return nFamily;
975 /*--------------------------------------------------------------------
976 Beschreibung: Vorlage Updaten
977 --------------------------------------------------------------------*/
980 USHORT SwDocShell::UpdateStyle(const String &rName, USHORT nFamily, SwWrtShell* pShell)
982 SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell();
983 ASSERT(GetWrtShell(), "Keine Shell, keine Styles");
985 SwDocStyleSheet* pStyle =
986 (SwDocStyleSheet*)mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
988 if(!pStyle)
989 return nFamily;
991 switch(nFamily)
993 case SFX_STYLE_FAMILY_PARA:
995 SwTxtFmtColl* pColl = pStyle->GetCollection();
996 if(pColl && !pColl->IsDefault())
998 GetWrtShell()->StartAllAction();
1000 SwRewriter aRewriter;
1001 aRewriter.AddRule(UNDO_ARG1, pColl->GetName());
1003 GetWrtShell()->StartUndo(UNDO_INSFMTATTR, &aRewriter);
1004 GetWrtShell()->FillByEx(pColl);
1005 // Vorlage auch anwenden, um harte Attributierung
1006 // zu entfernen
1007 GetWrtShell()->SetTxtFmtColl( pColl );
1008 GetWrtShell()->EndUndo(UNDO_INSFMTATTR, NULL);
1009 GetWrtShell()->EndAllAction();
1011 break;
1013 case SFX_STYLE_FAMILY_FRAME:
1015 SwFrmFmt* pFrm = pStyle->GetFrmFmt();
1016 if( pCurrWrtShell->IsFrmSelected() && pFrm && !pFrm->IsDefault() )
1018 SfxItemSet aSet( GetPool(), aFrmFmtSetRange );
1019 pCurrWrtShell->StartAllAction();
1020 pCurrWrtShell->GetFlyFrmAttr( aSet );
1022 // JP 10.06.98: nur automatische Orientierungen uebernehmen
1023 /* #61359# jetzt auch wieder alle Orientierungen
1024 * const SfxPoolItem* pItem;
1025 if( SFX_ITEM_SET == aSet.GetItemState( RES_VERT_ORIENT,
1026 FALSE, &pItem ) &&
1027 text::VertOrientation::NONE == ((SwFmtVertOrient*)pItem)->GetVertOrient())
1028 aSet.ClearItem( RES_VERT_ORIENT );
1030 if( SFX_ITEM_SET == aSet.GetItemState( RES_HORI_ORIENT,
1031 FALSE, &pItem ) &&
1032 text::HoriOrientation::NONE == ((SwFmtHoriOrient*)pItem)->GetHoriOrient())
1033 aSet.ClearItem( RES_HORI_ORIENT );*/
1035 pFrm->SetFmtAttr( aSet );
1037 // Vorlage auch anwenden, um harte Attributierung
1038 // zu entfernen
1039 pCurrWrtShell->SetFrmFmt( pFrm, TRUE );
1040 pCurrWrtShell->EndAllAction();
1043 break;
1044 case SFX_STYLE_FAMILY_CHAR:
1046 SwCharFmt* pChar = pStyle->GetCharFmt();
1047 if( pChar && !pChar->IsDefault() )
1049 pCurrWrtShell->StartAllAction();
1050 pCurrWrtShell->FillByEx(pChar);
1051 // Vorlage auch anwenden, um harte Attributierung
1052 // zu entfernen
1053 pCurrWrtShell->EndAllAction();
1057 break;
1058 case SFX_STYLE_FAMILY_PSEUDO:
1060 const SwNumRule* pCurRule;
1061 if( pStyle->GetNumRule() &&
1062 0 != ( pCurRule = pCurrWrtShell->GetCurNumRule() ))
1064 SwNumRule aRule( *pCurRule );
1065 // --> OD 2008-07-08 #i91400#
1066 aRule.SetName( pStyle->GetNumRule()->GetName(),
1067 *(pCurrWrtShell->GetDoc()) );
1068 // <--
1069 pCurrWrtShell->ChgNumRuleFmts( aRule );
1072 break;
1074 return nFamily;
1077 /*--------------------------------------------------------------------
1078 Beschreibung: NewByExample
1079 --------------------------------------------------------------------*/
1082 USHORT SwDocShell::MakeByExample( const String &rName, USHORT nFamily,
1083 USHORT nMask, SwWrtShell* pShell )
1085 SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell();
1086 SwDocStyleSheet* pStyle = (SwDocStyleSheet*)mxBasePool->Find(
1087 rName, (SfxStyleFamily)nFamily );
1088 if(!pStyle)
1090 // JP 07.07.95: behalte die akt. Maske vom PI bei, dadurch werden
1091 // neue sofort in den sichtbaren Bereich einsortiert
1092 if( SFXSTYLEBIT_ALL == nMask || SFXSTYLEBIT_USED == nMask )
1093 nMask = SFXSTYLEBIT_USERDEF;
1094 else
1095 nMask |= SFXSTYLEBIT_USERDEF;
1097 pStyle = (SwDocStyleSheet*)&mxBasePool->Make(rName,
1098 (SfxStyleFamily)nFamily, nMask );
1101 switch(nFamily)
1103 case SFX_STYLE_FAMILY_PARA:
1105 SwTxtFmtColl* pColl = pStyle->GetCollection();
1106 if(pColl && !pColl->IsDefault())
1108 pCurrWrtShell->StartAllAction();
1109 pCurrWrtShell->FillByEx(pColl);
1110 // Vorlage auch anwenden, um harte Attributierung
1111 // zu entfernen
1112 pColl->SetDerivedFrom(pCurrWrtShell->GetCurTxtFmtColl());
1114 // setze die Maske noch an der Collection:
1115 USHORT nId = pColl->GetPoolFmtId() & 0x87ff;
1116 switch( nMask & 0x0fff )
1118 case SWSTYLEBIT_TEXT:
1119 nId |= COLL_TEXT_BITS;
1120 break;
1121 case SWSTYLEBIT_CHAPTER:
1122 nId |= COLL_DOC_BITS;
1123 break;
1124 case SWSTYLEBIT_LIST:
1125 nId |= COLL_LISTS_BITS;
1126 break;
1127 case SWSTYLEBIT_IDX:
1128 nId |= COLL_REGISTER_BITS;
1129 break;
1130 case SWSTYLEBIT_EXTRA:
1131 nId |= COLL_EXTRA_BITS;
1132 break;
1133 case SWSTYLEBIT_HTML:
1134 nId |= COLL_HTML_BITS;
1135 break;
1137 pColl->SetPoolFmtId(nId);
1139 pCurrWrtShell->SetTxtFmtColl(pColl);
1140 pCurrWrtShell->EndAllAction();
1143 break;
1144 case SFX_STYLE_FAMILY_FRAME:
1146 SwFrmFmt* pFrm = pStyle->GetFrmFmt();
1147 if(pCurrWrtShell->IsFrmSelected() && pFrm && !pFrm->IsDefault())
1149 pCurrWrtShell->StartAllAction();
1151 SfxItemSet aSet(GetPool(), aFrmFmtSetRange );
1152 pCurrWrtShell->GetFlyFrmAttr( aSet );
1154 SwFrmFmt* pFFmt = pCurrWrtShell->GetCurFrmFmt();
1155 pFrm->SetDerivedFrom( pFFmt );
1157 // JP 10.06.98: nur automatische Orientierungen uebernehmen
1158 /* #61359# jetzt auch wieder alle Orientierungen
1159 const SfxPoolItem* pItem;
1160 if( SFX_ITEM_SET == aSet.GetItemState( RES_VERT_ORIENT,
1161 FALSE, &pItem ) &&
1162 text::VertOrientation::NONE == ((SwFmtVertOrient*)pItem)->GetVertOrient())
1163 aSet.ClearItem( RES_VERT_ORIENT );
1165 if( SFX_ITEM_SET == aSet.GetItemState( RES_HORI_ORIENT,
1166 FALSE, &pItem ) &&
1167 text::HoriOrientation::NONE == ((SwFmtHoriOrient*)pItem)->GetHoriOrient())
1168 aSet.ClearItem( RES_HORI_ORIENT );
1171 pFrm->SetFmtAttr( aSet );
1172 // Vorlage auch anwenden, um harte Attributierung
1173 // zu entfernen
1174 pCurrWrtShell->SetFrmFmt( pFrm );
1175 pCurrWrtShell->EndAllAction();
1178 break;
1179 case SFX_STYLE_FAMILY_CHAR:
1181 SwCharFmt* pChar = pStyle->GetCharFmt();
1182 if(pChar && !pChar->IsDefault())
1184 pCurrWrtShell->StartAllAction();
1185 pCurrWrtShell->FillByEx( pChar );
1186 pChar->SetDerivedFrom( pCurrWrtShell->GetCurCharFmt() );
1187 SwFmtCharFmt aFmt( pChar );
1188 pCurrWrtShell->SetAttr( aFmt );
1189 pCurrWrtShell->EndAllAction();
1192 break;
1194 case SFX_STYLE_FAMILY_PAGE:
1196 pCurrWrtShell->StartAllAction();
1197 USHORT nPgDsc = pCurrWrtShell->GetCurPageDesc();
1198 SwPageDesc& rSrc = (SwPageDesc&)pCurrWrtShell->GetPageDesc( nPgDsc );
1199 SwPageDesc& rDest = *(SwPageDesc*)pStyle->GetPageDesc();
1201 USHORT nPoolId = rDest.GetPoolFmtId();
1202 USHORT nHId = rDest.GetPoolHelpId();
1203 BYTE nHFId = rDest.GetPoolHlpFileId();
1205 pCurrWrtShell->GetDoc()->CopyPageDesc( rSrc, rDest );
1207 // PoolId darf NIE kopiert werden!
1208 rDest.SetPoolFmtId( nPoolId );
1209 rDest.SetPoolHelpId( nHId );
1210 rDest.SetPoolHlpFileId( nHFId );
1212 // werden Kopf-/Fusszeilen angelegt, so gibt es kein Undo mehr!
1213 pCurrWrtShell->GetDoc()->DelAllUndoObj();
1215 pCurrWrtShell->EndAllAction();
1217 break;
1219 case SFX_STYLE_FAMILY_PSEUDO:
1221 pCurrWrtShell->StartAllAction();
1223 SwNumRule aRule( *pCurrWrtShell->GetCurNumRule() );
1224 String sOrigRule( aRule.GetName() );
1225 // --> OD 2008-07-08 #i91400#
1226 aRule.SetName( pStyle->GetNumRule()->GetName(),
1227 *(pCurrWrtShell->GetDoc()) );
1228 // <--
1229 pCurrWrtShell->ChgNumRuleFmts( aRule );
1231 pCurrWrtShell->ReplaceNumRule( sOrigRule, aRule.GetName() );
1234 pCurrWrtShell->EndAllAction();
1236 break;
1238 return nFamily;
1241 void SwDocShell::LoadStyles( SfxObjectShell& rSource )
1243 _LoadStyles(rSource, FALSE);
1245 /* -----------------16.05.2003 15:45-----------------
1246 bPreserveCurrentDocument determines whether SetFixFields() is called
1247 This call modifies the source document. This mustn't happen when the source
1248 is a document the user is working on.
1249 Calls of ::LoadStyles() normally use files especially loaded for the purpose
1250 of importing styles.
1251 --------------------------------------------------*/
1252 void SwDocShell::_LoadStyles( SfxObjectShell& rSource, BOOL bPreserveCurrentDocument )
1254 /* [Beschreibung]
1256 Diese Methode wird vom SFx gerufen, wenn aus einer Dokument-Vorlage
1257 Styles nachgeladen werden sollen. Bestehende Styles soll dabei
1258 "uberschrieben werden. Das Dokument mu"s daher neu formatiert werden.
1259 Daher werden die Applikationen in der Regel diese Methode "uberladen
1260 und in ihrer Implementierung die Implementierung der Basisklasse
1261 rufen.
1263 // ist die Source unser Document, dann uebernehmen wir das
1264 // abpruefen selbst (wesentlich schneller und laeuft nicht ueber
1265 // die Kruecke SfxStylePool
1266 if( rSource.ISA( SwDocShell ))
1268 //JP 28.05.99: damit die Kopf-/Fusszeilen nicht den fixen Inhalt
1269 // der Vorlage erhalten, einmal alle FixFelder der
1270 // Source aktualisieren
1271 if(!bPreserveCurrentDocument)
1272 ((SwDocShell&)rSource).pDoc->SetFixFields(false, NULL);
1273 if( pWrtShell )
1275 pWrtShell->StartAllAction();
1276 pDoc->ReplaceStyles( *((SwDocShell&)rSource).pDoc );
1277 pWrtShell->EndAllAction();
1279 else
1281 BOOL bModified = pDoc->IsModified();
1282 pDoc->ReplaceStyles( *((SwDocShell&)rSource).pDoc );
1283 if( !bModified && pDoc->IsModified() && !pView )
1285 // die View wird spaeter angelegt, ueberschreibt aber das
1286 // Modify-Flag. Per Undo ist sowieso nichts mehr zu machen
1287 pDoc->SetUndoNoResetModified();
1291 else
1292 SfxObjectShell::LoadStyles( rSource );
1296 void SwDocShell::FormatPage( const String& rPage, BOOL bColumn, SwWrtShell* pActShell )
1298 Edit( rPage, aEmptyStr, SFX_STYLE_FAMILY_PAGE, 0, FALSE, bColumn, pActShell);
1301 Bitmap SwDocShell::GetStyleFamilyBitmap( SfxStyleFamily eFamily, BmpColorMode eColorMode )
1303 if( SFX_STYLE_FAMILY_PSEUDO == eFamily )
1305 if ( eColorMode == BMP_COLOR_NORMAL )
1306 return Bitmap( SW_RES( BMP_STYLES_FAMILY_NUM ));
1307 else
1308 return Bitmap( SW_RES( BMP_STYLES_FAMILY_NUM_HC ));
1311 return SfxObjectShell::GetStyleFamilyBitmap( eFamily, eColorMode );