LibreOffice Module sw (master)  1
docst.cxx
Go to the documentation of this file.
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 <memory>
21 
22 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/container/XNameAccess.hpp>
25 
26 #include <comphelper/flagguard.hxx>
27 
28 #include <sal/log.hxx>
29 #include <hintids.hxx>
30 #include <sfx2/app.hxx>
31 #include <sfx2/styledlg.hxx>
32 #include <svl/whiter.hxx>
33 #include <sfx2/templdlg.hxx>
34 #include <sfx2/tplpitem.hxx>
35 #include <sfx2/request.hxx>
36 #include <sfx2/dispatch.hxx>
37 #include <sfx2/newstyle.hxx>
38 #include <sfx2/printer.hxx>
39 #include <sfx2/viewfrm.hxx>
40 #include <svl/macitem.hxx>
41 #include <svl/stritem.hxx>
42 #include <svl/languageoptions.hxx>
43 #include <editeng/eeitem.hxx>
44 #include <sfx2/htmlmode.hxx>
45 #include <swmodule.hxx>
46 #include <wdocsh.hxx>
47 #include <fmtfsize.hxx>
48 #include <fchrfmt.hxx>
49 #include <svtools/htmlcfg.hxx>
50 #include <svx/xdef.hxx>
51 #include <SwStyleNameMapper.hxx>
52 #include <SwRewriter.hxx>
53 #include <numrule.hxx>
54 #include <swundo.hxx>
55 #include <svx/svdmodel.hxx>
56 #include <svx/drawitem.hxx>
57 #include <svx/svxids.hrc>
58 #include <view.hxx>
59 #include <wrtsh.hxx>
60 #include <docsh.hxx>
61 #include <uitool.hxx>
62 #include <cmdid.h>
63 #include <globals.hrc>
64 #include <viewopt.hxx>
65 #include <doc.hxx>
66 #include <drawdoc.hxx>
68 #include <IDocumentUndoRedo.hxx>
72 #include <IDocumentListsAccess.hxx>
73 #include <IDocumentState.hxx>
74 #include <frmfmt.hxx>
75 #include <charfmt.hxx>
76 #include <poolfmt.hxx>
77 #include <pagedesc.hxx>
78 #include <docstyle.hxx>
79 #include <uiitems.hxx>
80 #include <fmtcol.hxx>
81 #include <frmmgr.hxx>
82 #include <swevent.hxx>
83 #include <edtwin.hxx>
84 #include <unochart.hxx>
85 #include <app.hrc>
86 #include <swabstdlg.hxx>
87 #include <list.hxx>
88 #include <paratr.hxx>
89 #include <tblafmt.hxx>
90 #include <sfx2/watermarkitem.hxx>
91 #include <SwUndoFmt.hxx>
92 #include <strings.hrc>
93 
94 using namespace ::com::sun::star;
95 
97 {
98  SfxWhichIter aIter(rSet);
99  sal_uInt16 nWhich = aIter.FirstWhich();
100  SfxStyleFamily nActualFamily = SfxStyleFamily(USHRT_MAX);
101 
102  SwWrtShell* pShell = pSh ? pSh : GetWrtShell();
103  if(!pShell)
104  {
105  while (nWhich)
106  {
107  rSet.DisableItem(nWhich);
108  nWhich = aIter.NextWhich();
109  }
110  return;
111  }
112  else
113  {
114  SfxViewFrame* pFrame = pShell->GetView().GetViewFrame();
115  std::unique_ptr<SfxPoolItem> pItem;
116  pFrame->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
117  SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem.get());
118  if (pFamilyItem)
119  {
120  nActualFamily = static_cast<SfxStyleFamily>(pFamilyItem->GetValue());
121  }
122  }
123 
124  while (nWhich)
125  {
126  // determine current template to every family
127  OUString aName;
128  SwTableAutoFormat aTableAutoFormat("dummy"); // needed to check if can take a table auto format at current cursor position
129  switch (nWhich)
130  {
131  case SID_STYLE_APPLY:
132  {// here the template and its family are passed to the StyleBox
133  // so that this family is being showed
134  if(pShell->IsFrameSelected())
135  {
136  SwFrameFormat* pFormat = pShell->GetSelectedFrameFormat();
137  if( pFormat )
138  aName = pFormat->GetName();
139  }
140  else
141  {
142  SwTextFormatColl* pColl = pShell->GetCurTextFormatColl();
143  if(pColl)
144  aName = pColl->GetName();
145  }
146  rSet.Put(SfxTemplateItem(nWhich, aName));
147  }
148  break;
149  case SID_STYLE_FAMILY1:
150  if( !pShell->IsFrameSelected() )
151  {
152  SwCharFormat* pFormat = pShell->GetCurCharFormat();
153  if(pFormat)
154  aName = pFormat->GetName();
155  else
158  rSet.Put(SfxTemplateItem(nWhich, aName));
159  }
160  break;
161 
162  case SID_STYLE_FAMILY2:
163  if(!pShell->IsFrameSelected())
164  {
165  SwTextFormatColl* pColl = pShell->GetCurTextFormatColl();
166  if(pColl)
167  aName = pColl->GetName();
168 
169  SfxTemplateItem aItem(nWhich, aName);
170 
171  SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto;
172  if (m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE))
173  nMask = SfxStyleSearchBits::SwHtml;
174  else
175  {
176  const FrameTypeFlags nSelection = pShell->GetFrameType(nullptr,true);
177  if(pShell->GetCurTOX())
178  nMask = SfxStyleSearchBits::SwIndex ;
179  else if(nSelection & FrameTypeFlags::HEADER ||
180  nSelection & FrameTypeFlags::FOOTER ||
181  nSelection & FrameTypeFlags::TABLE ||
182  nSelection & FrameTypeFlags::FLY_ANY ||
183  nSelection & FrameTypeFlags::FOOTNOTE ||
184  nSelection & FrameTypeFlags::FTNPAGE)
185  nMask = SfxStyleSearchBits::SwExtra;
186  else
187  nMask = SfxStyleSearchBits::SwText;
188  }
189 
190  aItem.SetValue(nMask);
191  rSet.Put(aItem);
192  }
193 
194  break;
195 
196  case SID_STYLE_FAMILY3:
197 
198  if (m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE))
199  rSet.DisableItem( nWhich );
200  else
201  {
202  SwFrameFormat* pFormat = pShell->GetSelectedFrameFormat();
203  if(pFormat && pShell->IsFrameSelected())
204  {
205  aName = pFormat->GetName();
206  rSet.Put(SfxTemplateItem(nWhich, aName));
207  }
208  }
209  break;
210 
211  case SID_STYLE_FAMILY4:
212  {
213  SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
214  if (m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) && !rHtmlOpt.IsPrintLayoutExtension())
215  rSet.DisableItem( nWhich );
216  else
217  {
218  size_t n = pShell->GetCurPageDesc( false );
219  if( n < pShell->GetPageDescCnt() )
220  aName = pShell->GetPageDesc( n ).GetName();
221 
222  rSet.Put(SfxTemplateItem(nWhich, aName));
223  }
224  }
225  break;
226  case SID_STYLE_FAMILY5:
227  {
228  const SwNumRule* pRule = pShell->GetNumRuleAtCurrCursorPos();
229  if( pRule )
230  aName = pRule->GetName();
231 
232  rSet.Put(SfxTemplateItem(nWhich, aName));
233  }
234  break;
235  case SID_STYLE_FAMILY6:
236  {
237  const SwTableNode *pTableNd = pShell->IsCursorInTable();
238  if( pTableNd )
239  aName = pTableNd->GetTable().GetTableStyleName();
240 
241  rSet.Put(SfxTemplateItem(nWhich, aName));
242  }
243  break;
244 
245  case SID_STYLE_WATERCAN:
246  {
247  SwEditWin& rEdtWin = pShell->GetView().GetEditWin();
248  SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
249  rSet.Put(SfxBoolItem(nWhich, pApply && pApply->eType != SfxStyleFamily(0)));
250  }
251  break;
252  case SID_STYLE_UPDATE_BY_EXAMPLE:
253  if( pShell->IsFrameSelected()
254  ? SfxStyleFamily::Frame != nActualFamily
255  : ( SfxStyleFamily::Frame == nActualFamily ||
256  SfxStyleFamily::Page == nActualFamily ||
257  (SfxStyleFamily::Pseudo == nActualFamily && !pShell->GetNumRuleAtCurrCursorPos()) ||
258  (SfxStyleFamily::Table == nActualFamily && !pShell->GetTableAutoFormat(aTableAutoFormat))) )
259  {
260  rSet.DisableItem( nWhich );
261  }
262  break;
263 
264  case SID_STYLE_NEW_BY_EXAMPLE:
265  if( (pShell->IsFrameSelected()
266  ? SfxStyleFamily::Frame != nActualFamily
267  : SfxStyleFamily::Frame == nActualFamily) ||
268  (SfxStyleFamily::Pseudo == nActualFamily && !pShell->GetNumRuleAtCurrCursorPos()) ||
269  (SfxStyleFamily::Table == nActualFamily && !pShell->GetTableAutoFormat(aTableAutoFormat)) )
270  {
271  rSet.DisableItem( nWhich );
272  }
273  break;
274 
275  case SID_CLASSIFICATION_APPLY:
276  // Just trigger ClassificationCategoriesController::statusChanged().
277  rSet.InvalidateItem(nWhich);
278  break;
279  case SID_CLASSIFICATION_DIALOG:
280  rSet.InvalidateItem(nWhich);
281  break;
282  case SID_STYLE_EDIT:
283  break;
284  case SID_WATERMARK:
285  if (pSh)
286  {
287  SfxWatermarkItem aItem = pSh->GetWatermark();
288  rSet.Put(aItem);
289  }
290  break;
291  default:
292  OSL_FAIL("Invalid SlotId");
293  }
294  nWhich = aIter.NextWhich();
295  }
296 }
297 
298 // evaluate StyleSheet-Requests
300 {
301  sal_uInt16 nSlot = rReq.GetSlot();
302 
303  const SfxItemSet* pArgs = rReq.GetArgs();
304  const SfxPoolItem* pItem;
305  switch (nSlot)
306  {
307  case SID_STYLE_NEW:
308  if( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY,
309  false, &pItem ))
310  {
311  const SfxStyleFamily nFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
312 
313  OUString sName;
314  SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto;
315  if( SfxItemState::SET == pArgs->GetItemState( SID_STYLE_NEW,
316  false, &pItem ))
317  sName = static_cast<const SfxStringItem*>(pItem)->GetValue();
318  if( SfxItemState::SET == pArgs->GetItemState( SID_STYLE_MASK,
319  false, &pItem ))
320  nMask = static_cast<SfxStyleSearchBits>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
321  OUString sParent;
322  if( SfxItemState::SET == pArgs->GetItemState( SID_STYLE_REFERENCE,
323  false, &pItem ))
324  sParent = static_cast<const SfxStringItem*>(pItem)->GetValue();
325 
326  if (sName.isEmpty() && m_xBasePool.get())
328 
329  Edit(sName, sParent, nFamily, nMask, true, OString(), nullptr, &rReq, nSlot);
330  }
331  break;
332 
333  case SID_STYLE_APPLY:
334  if( !pArgs )
335  {
336  GetView()->GetViewFrame()->GetDispatcher()->Execute(SID_STYLE_DESIGNER);
337  break;
338  }
339  else
340  {
341  // convert internal StyleName to DisplayName (slot implementation uses the latter)
342  const SfxStringItem* pNameItem = rReq.GetArg<SfxStringItem>(SID_APPLY_STYLE);
343  const SfxStringItem* pFamilyItem = rReq.GetArg<SfxStringItem>(SID_STYLE_FAMILYNAME);
344  if ( pFamilyItem && pNameItem )
345  {
346  uno::Reference< style::XStyleFamiliesSupplier > xModel(GetModel(), uno::UNO_QUERY);
347  try
348  {
349  uno::Reference< container::XNameAccess > xStyles;
350  uno::Reference< container::XNameAccess > xCont = xModel->getStyleFamilies();
351  xCont->getByName(pFamilyItem->GetValue()) >>= xStyles;
352  uno::Reference< beans::XPropertySet > xInfo;
353  xStyles->getByName( pNameItem->GetValue() ) >>= xInfo;
354  OUString aUIName;
355  xInfo->getPropertyValue("DisplayName") >>= aUIName;
356  if ( !aUIName.isEmpty() )
357  rReq.AppendItem( SfxStringItem( SID_STYLE_APPLY, aUIName ) );
358  }
359  catch (const uno::Exception&)
360  {
361  }
362  }
363  }
364 
365  [[fallthrough]];
366 
367  case SID_STYLE_EDIT:
368  case SID_STYLE_DELETE:
369  case SID_STYLE_HIDE:
370  case SID_STYLE_SHOW:
371  case SID_STYLE_WATERCAN:
372  case SID_STYLE_FAMILY:
373  case SID_STYLE_UPDATE_BY_EXAMPLE:
374  case SID_STYLE_NEW_BY_EXAMPLE:
375  {
376  OUString aParam;
377  SfxStyleFamily nFamily = SfxStyleFamily::Para;
378  SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto;
379  SwWrtShell* pActShell = nullptr;
380 
381  if( !pArgs )
382  {
383  nFamily = SfxStyleFamily::Para;
384 
385  switch (nSlot)
386  {
387  case SID_STYLE_NEW_BY_EXAMPLE:
388  {
390  if (aDlg.run() == RET_OK)
391  {
392  aParam = aDlg.GetName();
393  rReq.AppendItem(SfxStringItem(nSlot, aParam));
394  }
395  }
396  break;
397 
398  case SID_STYLE_UPDATE_BY_EXAMPLE:
399  case SID_STYLE_EDIT:
400  {
402  if(pColl)
403  {
404  aParam = pColl->GetName();
405  rReq.AppendItem(SfxStringItem(nSlot, aParam));
406  }
407  }
408  break;
409  }
410  }
411  else
412  {
413  SAL_WARN_IF( !pArgs->Count(), "sw.ui", "SfxBug ItemSet is empty" );
414 
415  SwWrtShell* pShell = GetWrtShell();
416  if( SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem ))
417  aParam = static_cast<const SfxStringItem*>(pItem)->GetValue();
418 
419  if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_FAMILY,
420  false, &pItem ))
421  nFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
422 
423  if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_FAMILYNAME, false, &pItem ))
424  {
425  OUString aFamily = static_cast<const SfxStringItem*>(pItem)->GetValue();
426  if(aFamily == "CharacterStyles")
427  nFamily = SfxStyleFamily::Char;
428  else
429  if(aFamily == "ParagraphStyles")
430  nFamily = SfxStyleFamily::Para;
431  else
432  if(aFamily == "PageStyles")
433  nFamily = SfxStyleFamily::Page;
434  else
435  if(aFamily == "FrameStyles")
436  nFamily = SfxStyleFamily::Frame;
437  else
438  if(aFamily == "NumberingStyles")
439  nFamily = SfxStyleFamily::Pseudo;
440  else
441  if(aFamily == "TableStyles")
442  nFamily = SfxStyleFamily::Table;
443  }
444 
445  if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_MASK,
446  false, &pItem ))
447  nMask = static_cast<SfxStyleSearchBits>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
448  if( SfxItemState::SET == pArgs->GetItemState(FN_PARAM_WRTSHELL,
449  false, &pItem ))
450  pActShell = pShell = static_cast<SwWrtShell*>(static_cast<const SwPtrItem*>(pItem)->GetValue());
451 
452  if( nSlot == SID_STYLE_UPDATE_BY_EXAMPLE && aParam.isEmpty() )
453  {
454  switch( nFamily )
455  {
456  case SfxStyleFamily::Para:
457  {
458  SwTextFormatColl* pColl = pShell->GetCurTextFormatColl();
459  if(pColl)
460  aParam = pColl->GetName();
461  }
462  break;
463  case SfxStyleFamily::Frame:
464  {
466  if( pFrame )
467  aParam = pFrame->GetName();
468  }
469  break;
470  case SfxStyleFamily::Char:
471  {
473  if( pChar )
474  aParam = pChar->GetName();
475  }
476  break;
477  case SfxStyleFamily::Pseudo:
478  if(SfxItemState::SET == pArgs->GetItemState(SID_STYLE_UPD_BY_EX_NAME, false, &pItem))
479  {
480  aParam = static_cast<const SfxStringItem*>(pItem)->GetValue();
481  }
482  break;
483  case SfxStyleFamily::Table:
484  if(SfxItemState::SET == pArgs->GetItemState(SID_STYLE_UPD_BY_EX_NAME, false, &pItem))
485  {
486  aParam = static_cast<const SfxStringItem*>(pItem)->GetValue();
487  }
488  break;
489  default: break;
490  }
491  rReq.AppendItem(SfxStringItem(nSlot, aParam));
492  }
493  }
494  if (!aParam.isEmpty() || nSlot == SID_STYLE_WATERCAN )
495  {
496  sal_uInt16 nRet = 0xffff;
497  bool bReturns = false;
498 
499  switch(nSlot)
500  {
501  case SID_STYLE_EDIT:
502  Edit(aParam, OUString(), nFamily, nMask, false, OString(), pActShell);
503  break;
504  case SID_STYLE_DELETE:
505  Delete(aParam, nFamily);
506  break;
507  case SID_STYLE_HIDE:
508  case SID_STYLE_SHOW:
509  Hide(aParam, nFamily, nSlot == SID_STYLE_HIDE);
510  break;
511  case SID_STYLE_APPLY:
512  // Shell-switch in ApplyStyles
513  nRet = static_cast<sal_uInt16>(ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() ));
514  bReturns = true;
515  break;
516  case SID_STYLE_WATERCAN:
517  nRet = static_cast<sal_uInt16>(DoWaterCan(aParam, nFamily));
518  bReturns = true;
519  break;
520  case SID_STYLE_UPDATE_BY_EXAMPLE:
521  UpdateStyle(aParam, nFamily, pActShell);
522  break;
523  case SID_STYLE_NEW_BY_EXAMPLE:
524  MakeByExample(aParam, nFamily, nMask, pActShell);
525  break;
526 
527  default:
528  OSL_FAIL("Invalid SlotId");
529  }
530 
531  if (bReturns)
532  {
533  if(rReq.IsAPI()) // Basic only gets TRUE or FALSE
534  rReq.SetReturnValue(SfxUInt16Item(nSlot, sal_uInt16(nRet !=0)));
535  else
536  rReq.SetReturnValue(SfxUInt16Item(nSlot, nRet));
537  }
538 
539  rReq.Done();
540  }
541 
542  break;
543  }
544  }
545 }
546 
548 {
549 public:
550  ApplyStyle(SwDocShell &rDocSh, bool bNew,
553  rtl::Reference< SfxStyleSheetBasePool > const & xBasePool,
554  bool bModified)
555  : m_pDlg(pDlg)
556  , m_rDocSh(rDocSh)
557  , m_bNew(bNew)
558  , m_xTmp(xTmp)
559  , m_nFamily(nFamily)
560  , m_xBasePool(xBasePool)
561  , m_bModified(bModified)
562  {
563  }
564  DECL_LINK( ApplyHdl, LinkParamNone*, void );
565  void apply()
566  {
567  ApplyHdl(nullptr);
568  }
570 private:
572  bool const m_bNew;
576  bool const m_bModified;
577 };
578 
580 {
581  SwWrtShell* pWrtShell = m_rDocSh.GetWrtShell();
582  SwDoc* pDoc = m_rDocSh.GetDoc();
583  SwView* pView = m_rDocSh.GetView();
584 
585  pWrtShell->StartAllAction();
586 
587  if( SfxStyleFamily::Para == m_nFamily )
588  {
589  SfxItemSet aSet( *m_pDlg->GetOutputItemSet() );
590  ::SfxToSwPageDescAttr( *pWrtShell, aSet );
591  // reset indent attributes at paragraph style, if a list style
592  // will be applied and no indent attributes will be applied.
593  m_xTmp->SetItemSet( aSet, true );
594  }
595  else
596  {
597  if(SfxStyleFamily::Page == m_nFamily)
598  {
599  static const sal_uInt16 aInval[] = {
600  SID_IMAGE_ORIENTATION,
601  SID_ATTR_CHAR_FONT,
603  pView->GetViewFrame()->GetBindings().Invalidate(aInval);
604  }
605  SfxItemSet aTmpSet( *m_pDlg->GetOutputItemSet() );
606  if( SfxStyleFamily::Char == m_nFamily )
607  {
608  ::ConvertAttrGenToChar(aTmpSet, m_xTmp->GetItemSet());
609  }
610 
611  m_xTmp->SetItemSet( aTmpSet );
612 
613  if( SfxStyleFamily::Page == m_nFamily && SvtLanguageOptions().IsCTLFontEnabled() )
614  {
615  const SfxPoolItem *pItem = nullptr;
616  if( aTmpSet.GetItemState( m_rDocSh.GetPool().GetTrueWhich( SID_ATTR_FRAMEDIRECTION, false ) , true, &pItem ) == SfxItemState::SET )
618  }
619  }
620 
621  if(m_bNew)
622  {
623  if(SfxStyleFamily::Frame == m_nFamily || SfxStyleFamily::Para == m_nFamily)
624  {
625  // clear FillStyle so that it works as a derived attribute
626  SfxItemSet aTmpSet(*m_pDlg->GetOutputItemSet());
627 
628  aTmpSet.ClearItem(XATTR_FILLSTYLE);
629  m_xTmp->SetItemSet(aTmpSet);
630  }
631  }
632 
633  if(SfxStyleFamily::Page == m_nFamily)
634  pView->InvalidateRulerPos();
635 
636  if( m_bNew )
637  m_xBasePool->Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetCreated, *m_xTmp));
638  else
639  m_xBasePool->Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetModified, *m_xTmp));
640 
641  pDoc->getIDocumentState().SetModified();
642  if( !m_bModified )
643  {
645  }
646 
647  pWrtShell->EndAllAction();
648 }
649 
650 namespace
651 {
654 void syncEndnoteOrientation(const uno::Reference< style::XStyleFamiliesSupplier >& xStyleFamSupp)
655 {
656  if (!xStyleFamSupp.is())
657  {
658  SAL_WARN("sw.ui", "Ref to XStyleFamiliesSupplier is null.");
659  return;
660  }
661  uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamSupp->getStyleFamilies();
662 
663  if (!xStyleFamilies.is())
664  return;
665 
666  uno::Reference<container::XNameAccess> xPageStyles(xStyleFamilies->getByName("PageStyles"),
667  uno::UNO_QUERY);
668 
669  if (!xPageStyles.is())
670  return;
671 
672  uno::Reference<css::style::XStyle> xEndnotePageStyle(xPageStyles->getByName("Endnote"),
673  uno::UNO_QUERY);
674 
675  if (!xEndnotePageStyle.is())
676  return;
677 
678  // Language-independent name of the "Default Style" is "Standard"
679  uno::Reference<css::style::XStyle> xDefaultPageStyle(xPageStyles->getByName("Standard"),
680  uno::UNO_QUERY);
681  if (!xDefaultPageStyle.is())
682  return;
683 
684  if (xEndnotePageStyle->isUserDefined() || !xEndnotePageStyle->isInUse())
685  return;
686 
687  uno::Reference<beans::XPropertySet> xEndnotePagePropSet(xPageStyles->getByName("Endnote"), uno::UNO_QUERY);
688  uno::Reference<beans::XPropertySet> xDefaultPagePropSet(xPageStyles->getByName("Standard"), uno::UNO_QUERY);
689 
690  if (!xEndnotePagePropSet.is() || !xDefaultPagePropSet.is())
691  {
692  SAL_WARN("sw.ui", "xEndnotePagePropSet or xDefaultPagePropSet is null.");
693  return;
694  }
695 
696  sal_Int32 nWidth, nHeight;
697  bool bIsDefLandScape, bIsEndLandScape;
698 
699  xDefaultPagePropSet->getPropertyValue("IsLandscape") >>= bIsDefLandScape;
700  xEndnotePagePropSet->getPropertyValue("IsLandscape") >>= bIsEndLandScape;
701 
702  if (bIsDefLandScape == bIsEndLandScape)
703  return;
704 
705  xEndnotePagePropSet->getPropertyValue("Width") >>= nWidth;
706  xEndnotePagePropSet->getPropertyValue("Height") >>= nHeight;
707 
708  xEndnotePagePropSet->setPropertyValue("IsLandscape", css::uno::toAny(bIsDefLandScape));
709  xEndnotePagePropSet->setPropertyValue("Width", css::uno::toAny(nHeight));
710  xEndnotePagePropSet->setPropertyValue("Height", css::uno::toAny(nWidth));
711 }
712 }
713 
715  const OUString &rName,
716  const OUString &rParent,
717  const SfxStyleFamily nFamily,
718  SfxStyleSearchBits nMask,
719  const bool bNew,
720  const OString& sPage,
721  SwWrtShell* pActShell,
722  SfxRequest* pReq,
723  sal_uInt16 nSlot)
724 {
725  assert( GetWrtShell() );
726  const bool bBasic = pReq && pReq->IsAPI();
727  SfxStyleSheetBase *pStyle = nullptr;
728 
729  bool bModified = m_xDoc->getIDocumentState().IsModified();
730 
731  SwUndoId nNewStyleUndoId(SwUndoId::EMPTY);
732 
733  if( bNew )
734  {
735  if (!bBasic)
736  {
737  // start undo action in order to get only one undo action for the
738  // UI new style + change style operations
740  }
741 
742  if( SfxStyleSearchBits::All != nMask && SfxStyleSearchBits::AllVisible != nMask && SfxStyleSearchBits::Used != nMask )
743  nMask |= SfxStyleSearchBits::UserDefined;
744  else
745  nMask = SfxStyleSearchBits::UserDefined;
746 
747  if ( nFamily == SfxStyleFamily::Para || nFamily == SfxStyleFamily::Char || nFamily == SfxStyleFamily::Frame )
748  {
749  // Prevent undo append from being done during paragraph, character, and frame style Make
750  // Do it after ok return from style dialog when derived from style is known
751  ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
752  pStyle = &m_xBasePool->Make( rName, nFamily, nMask );
753  }
754  else
755  {
756  pStyle = &m_xBasePool->Make( rName, nFamily, nMask );
757  }
758 
759  // set the current one as Parent
760  SwDocStyleSheet* pDStyle = static_cast<SwDocStyleSheet*>(pStyle);
761  switch( nFamily )
762  {
763  case SfxStyleFamily::Para:
764  {
765  if(!rParent.isEmpty())
766  {
768  if(!pColl)
769  {
771  if(USHRT_MAX != nId)
772  pColl = m_pWrtShell->GetTextCollFromPool( nId );
773  }
774  pDStyle->GetCollection()->SetDerivedFrom( pColl );
775  pDStyle->PresetParent( rParent );
776 
777  /*When a new paragraph style is created based on a "to outline style
778  assigned" paragraph style, the outline level attribute and the list
779  style attribute of the new paragraph style have to be set to 0
780  respectively "".*/
781  if (pColl && pColl->IsAssignedToListLevelOfOutlineStyle())
782  {
783  SwNumRuleItem aItem;
784  pDStyle->GetCollection()->SetFormatAttr( aItem );
785  pDStyle->GetCollection()->SetAttrOutlineLevel( 0 );
786  }
787  }
788  else
789  {
791  pDStyle->GetCollection()->SetDerivedFrom( pColl );
792  if( pColl )
793  pDStyle->PresetParent( pColl->GetName() );
794  }
795  }
796  break;
797  case SfxStyleFamily::Char:
798  {
799  if(!rParent.isEmpty())
800  {
801  SwCharFormat* pCFormat = m_pWrtShell->FindCharFormatByName(rParent);
802  if(!pCFormat)
803  {
805  if(USHRT_MAX != nId)
806  pCFormat = m_pWrtShell->GetCharFormatFromPool( nId );
807  }
808 
809  pDStyle->GetCharFormat()->SetDerivedFrom( pCFormat );
810  pDStyle->PresetParent( rParent );
811  }
812  else
813  {
815  pDStyle->GetCharFormat()->SetDerivedFrom( pCFormat );
816  if( pCFormat )
817  pDStyle->PresetParent( pCFormat->GetName() );
818  }
819  }
820  break;
821  case SfxStyleFamily::Frame :
822  {
823  if(!rParent.isEmpty())
824  {
825  SwFrameFormat* pFFormat = m_pWrtShell->GetDoc()->FindFrameFormatByName( rParent );
826  if(!pFFormat)
827  {
829  if(USHRT_MAX != nId)
830  pFFormat = m_pWrtShell->GetFrameFormatFromPool( nId );
831  }
832  pDStyle->GetFrameFormat()->SetDerivedFrom( pFFormat );
833  pDStyle->PresetParent( rParent );
834  }
835  }
836  break;
837  default: break;
838  }
839 
840  if (!bBasic)
841  {
842  //Get the undo id for the type of style that was created in order to re-use that comment for the grouped
843  //create style + change style operations
844  m_pWrtShell->GetLastUndoInfo(nullptr, &nNewStyleUndoId);
845  }
846  }
847  else
848  {
849  pStyle = m_xBasePool->Find( rName, nFamily );
850  SAL_WARN_IF( !pStyle, "sw.ui", "Style not found" );
851  }
852 
853  if(!pStyle)
854  return;
855 
856  // put dialogues together
857  rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *static_cast<SwDocStyleSheet*>(pStyle) ) );
858  if( SfxStyleFamily::Para == nFamily )
859  {
860  SfxItemSet& rSet = xTmp->GetItemSet();
861  ::SwToSfxPageDescAttr( rSet );
862  // merge list level indent attributes into the item set if needed
863  xTmp->MergeIndentAttrsOfListStyle( rSet );
864  }
865  else if( SfxStyleFamily::Char == nFamily )
866  {
867  ::ConvertAttrCharToGen(xTmp->GetItemSet());
868  }
869 
870  if(SfxStyleFamily::Page == nFamily || SfxStyleFamily::Para == nFamily)
871  {
872  // create needed items for XPropertyList entries from the DrawModel so that
873  // the Area TabPage can access them
874  SfxItemSet& rSet = xTmp->GetItemSet();
875  const SwDrawModel* pDrawModel = GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
876 
877  rSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE));
878  rSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST));
879  rSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST));
880  rSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST));
881  rSet.Put(SvxPatternListItem(pDrawModel->GetPatternList(), SID_PATTERN_LIST));
882  }
883 
884  if (!bBasic)
885  {
886  // prior to the dialog the HtmlMode at the DocShell is being sunk
887  sal_uInt16 nHtmlMode = ::GetHtmlMode(this);
888 
889  // In HTML mode, we do not always have a printer. In order to show
890  // the correct page size in the Format - Page dialog, we have to
891  // get one here.
892  SwWrtShell* pCurrShell = pActShell ? pActShell : m_pWrtShell;
893  if( ( HTMLMODE_ON & nHtmlMode ) &&
894  !pCurrShell->getIDocumentDeviceAccess().getPrinter( false ) )
895  pCurrShell->InitPrt( pCurrShell->getIDocumentDeviceAccess().getPrinter( true ) );
896 
897  PutItem(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
898  FieldUnit eMetric = ::GetDfltMetric(0 != (HTMLMODE_ON&nHtmlMode));
899  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
902  *xTmp, nFamily, sPage, pCurrShell, bNew));
903  std::shared_ptr<ApplyStyle> pApplyStyleHelper(new ApplyStyle(*this, bNew, xTmp, nFamily, pDlg.get(), m_xBasePool, bModified));
904  pDlg->SetApplyHdl(LINK(pApplyStyleHelper.get(), ApplyStyle, ApplyHdl));
905 
906  std::shared_ptr<SfxRequest> pRequest;
907  if (pReq)
908  {
909  pRequest.reset(new SfxRequest(*pReq));
910  pReq->Ignore(); // the 'old' request is not relevant any more
911  }
912 
913  bool bIsDefaultPage = nFamily == SfxStyleFamily::Page
914  && rName == SwResId(STR_POOLPAGE_STANDARD)
915  && pStyle->IsUsed()
916  && !pStyle->IsUserDefined();
917 
918  pDlg->StartExecuteAsync([bIsDefaultPage, bModified, bNew, nFamily, nSlot, nNewStyleUndoId, pApplyStyleHelper, pRequest, xTmp, this](sal_Int32 nResult){
919  if (RET_OK == nResult)
920  pApplyStyleHelper->apply();
921 
922  if (bNew)
923  {
924  switch( nFamily )
925  {
926  case SfxStyleFamily::Para:
927  {
928  if(!xTmp->GetParent().isEmpty())
929  {
930  SwTextFormatColl* pColl = m_pWrtShell->FindTextFormatCollByName(xTmp->GetParent());
932  {
934  std::make_unique<SwUndoTextFormatCollCreate>(xTmp->GetCollection(), pColl, GetDoc()));
935  }
936  }
937  }
938  break;
939  case SfxStyleFamily::Char:
940  {
941  if(!xTmp->GetParent().isEmpty())
942  {
943  SwCharFormat* pCFormat = m_pWrtShell->FindCharFormatByName(xTmp->GetParent());
945  {
947  std::make_unique<SwUndoCharFormatCreate>(xTmp->GetCharFormat(), pCFormat, GetDoc()));
948  }
949  }
950  }
951  break;
952  case SfxStyleFamily::Frame:
953  {
954  if(!xTmp->GetParent().isEmpty())
955  {
956  SwFrameFormat* pFFormat = m_pWrtShell->GetDoc()->FindFrameFormatByName(xTmp->GetParent());
958  {
960  std::make_unique<SwUndoFrameFormatCreate>(xTmp->GetFrameFormat(), pFFormat, GetDoc()));
961  }
962  }
963  }
964  break;
965  default: break;
966  }
967 
968  SwRewriter aRewriter;
969  aRewriter.AddRule(UndoArg1, xTmp->GetName());
970  //Group the create style and change style operations together under the
971  //one "create style" comment
972  m_pWrtShell->EndUndo(nNewStyleUndoId, &aRewriter);
973  }
974 
975  if (RET_OK != nResult)
976  {
977  if (bNew)
978  {
979  GetWrtShell()->Undo();
980  m_xDoc->GetIDocumentUndoRedo().ClearRedo();
981  }
982 
983  if (!bModified)
984  m_xDoc->getIDocumentState().ResetModified();
985  }
986 
987  // Update Watermark if new page style was created
988  if (nSlot == SID_STYLE_NEW && nFamily == SfxStyleFamily::Page)
989  {
990  SwWrtShell* pShell = GetWrtShell();
991  const SfxWatermarkItem aWatermark = pShell->GetWatermark();
992  pShell->SetWatermark(aWatermark);
993  }
994 
995  pApplyStyleHelper->m_pDlg.disposeAndClear();
996  if (pRequest)
997  pRequest->Done();
998 
999  if (bIsDefaultPage && bModified)
1000  {
1001  uno::Reference< style::XStyleFamiliesSupplier > xStyleFamSupp(GetModel(), uno::UNO_QUERY);
1002 
1003  if (!xStyleFamSupp.is())
1004  {
1005  SAL_WARN("sw.ui", "Ref to XStyleFamiliesSupplier is null.");
1006  return;
1007  }
1008 
1009  syncEndnoteOrientation(xStyleFamSupp);
1010  }
1011  });
1012  }
1013  else
1014  {
1015  // prior to the dialog the HtmlMode at the DocShell is being sunk
1016  PutItem(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(this)));
1017 
1019 
1020  if( SfxStyleFamily::Para == nFamily )
1021  ::SfxToSwPageDescAttr( *GetWrtShell(), xTmp->GetItemSet() );
1022  else
1023  {
1024  ::ConvertAttrGenToChar(xTmp->GetItemSet(), xTmp->GetItemSet());
1025  }
1026  if(SfxStyleFamily::Page == nFamily)
1028 
1029  if( bNew )
1030  m_xBasePool->Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetCreated, *xTmp));
1031 
1032  m_xDoc->getIDocumentState().SetModified();
1033  if( !bModified ) // Bug 57028
1034  {
1035  m_xDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
1036  }
1038  }
1039 }
1040 
1041 void SwDocShell::Delete(const OUString &rName, SfxStyleFamily nFamily)
1042 {
1043  SfxStyleSheetBase *pStyle = m_xBasePool->Find(rName, nFamily);
1044 
1045  if(pStyle)
1046  {
1047  assert( GetWrtShell() );
1048 
1050  m_xBasePool->Remove(pStyle);
1052  }
1053 }
1054 
1055 void SwDocShell::Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden)
1056 {
1057  SfxStyleSheetBase *pStyle = m_xBasePool->Find(rName, nFamily);
1058 
1059  if(pStyle)
1060  {
1061  assert( GetWrtShell() );
1062 
1064  rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *static_cast<SwDocStyleSheet*>(pStyle) ) );
1065  xTmp->SetHidden( bHidden );
1067  }
1068 }
1069 
1070 // apply template
1072  SwWrtShell* pShell, const sal_uInt16 nMode )
1073 {
1074  SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>( m_xBasePool->Find( rName, nFamily ) );
1075 
1076  SAL_WARN_IF( !pStyle, "sw.ui", "Style not found" );
1077 
1078  if(!pStyle)
1079  return SfxStyleFamily::None;
1080 
1081  SwWrtShell *pSh = pShell ? pShell : GetWrtShell();
1082 
1083  assert( pSh );
1084 
1085  pSh->StartAllAction();
1086 
1087  switch (nFamily)
1088  {
1089  case SfxStyleFamily::Char:
1090  {
1091  SwFormatCharFormat aFormat(pStyle->GetCharFormat());
1092  pSh->SetAttrItem( aFormat, (nMode & KEY_SHIFT) ?
1094  break;
1095  }
1096  case SfxStyleFamily::Para:
1097  {
1098  // #i62675#
1099  // clear also list attributes at affected text nodes, if paragraph
1100  // style has the list style attribute set.
1101  pSh->SetTextFormatColl( pStyle->GetCollection(), true );
1102  break;
1103  }
1104  case SfxStyleFamily::Frame:
1105  {
1106  if ( pSh->IsFrameSelected() )
1107  pSh->SetFrameFormat( pStyle->GetFrameFormat() );
1108  break;
1109  }
1110  case SfxStyleFamily::Page:
1111  {
1112  pSh->SetPageStyle(pStyle->GetPageDesc()->GetName());
1113  break;
1114  }
1115  case SfxStyleFamily::Pseudo:
1116  {
1117  // reset indent attribute on applying list style
1118  // continue list of list style
1119  const SwNumRule* pNumRule = pStyle->GetNumRule();
1120  const OUString sListIdForStyle =pNumRule->GetDefaultListId();
1121  pSh->SetCurNumRule( *pNumRule, false, sListIdForStyle, true );
1122  break;
1123  }
1124  case SfxStyleFamily::Table:
1125  {
1126  pSh->SetTableStyle(pStyle->GetName());
1127  break;
1128  }
1129  default:
1130  OSL_FAIL("Unknown family");
1131  }
1132  pSh->EndAllAction();
1133 
1134  return nFamily;
1135 }
1136 
1137 // start watering-can
1139 {
1140  assert( GetWrtShell() );
1141 
1142  SwEditWin& rEdtWin = m_pView->GetEditWin();
1143  SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1144  bool bWaterCan = !(pApply && pApply->eType != SfxStyleFamily(0));
1145 
1146  if( rName.isEmpty() )
1147  bWaterCan = false;
1148 
1149  SwApplyTemplate aTemplate;
1150  aTemplate.eType = nFamily;
1151 
1152  if(bWaterCan)
1153  {
1154  SwDocStyleSheet* pStyle =
1155  static_cast<SwDocStyleSheet*>( m_xBasePool->Find(rName, nFamily) );
1156 
1157  SAL_WARN_IF( !pStyle, "sw.ui", "Where's the StyleSheet" );
1158 
1159  if(!pStyle) return nFamily;
1160 
1161  switch(nFamily)
1162  {
1163  case SfxStyleFamily::Char:
1164  aTemplate.aColl.pCharFormat = pStyle->GetCharFormat();
1165  break;
1166  case SfxStyleFamily::Para:
1167  aTemplate.aColl.pTextColl = pStyle->GetCollection();
1168  break;
1169  case SfxStyleFamily::Frame:
1170  aTemplate.aColl.pFrameFormat = pStyle->GetFrameFormat();
1171  break;
1172  case SfxStyleFamily::Page:
1173  aTemplate.aColl.pPageDesc = const_cast<SwPageDesc*>(pStyle->GetPageDesc());
1174  break;
1175  case SfxStyleFamily::Pseudo:
1176  aTemplate.aColl.pNumRule = const_cast<SwNumRule*>(pStyle->GetNumRule());
1177  break;
1178 
1179  default:
1180  OSL_FAIL("Unknown family");
1181  }
1182  }
1183  else
1184  aTemplate.eType = SfxStyleFamily(0);
1185 
1186  m_pView->GetEditWin().SetApplyTemplate(aTemplate);
1187 
1188  return nFamily;
1189 }
1190 
1191 // update template
1192 void SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell)
1193 {
1194  SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell();
1195  assert( pCurrWrtShell );
1196 
1197  SwDocStyleSheet* pStyle =
1198  static_cast<SwDocStyleSheet*>( m_xBasePool->Find(rName, nFamily) );
1199 
1200  if (!pStyle)
1201  return;
1202 
1203  switch(nFamily)
1204  {
1205  case SfxStyleFamily::Para:
1206  {
1207  SwTextFormatColl* pColl = pStyle->GetCollection();
1208  if(pColl && !pColl->IsDefault())
1209  {
1211 
1212  SwRewriter aRewriter;
1213  aRewriter.AddRule(UndoArg1, pColl->GetName());
1214 
1215  GetWrtShell()->StartUndo(SwUndoId::INSFMTATTR, &aRewriter);
1216  GetWrtShell()->FillByEx(pColl);
1217  // also apply template to remove hard set attributes
1218  GetWrtShell()->SetTextFormatColl( pColl );
1219  GetWrtShell()->EndUndo();
1221  }
1222  break;
1223  }
1224  case SfxStyleFamily::Frame:
1225  {
1226  SwFrameFormat* pFrame = pStyle->GetFrameFormat();
1227  if( pCurrWrtShell->IsFrameSelected() && pFrame && !pFrame->IsDefault() )
1228  {
1230  pCurrWrtShell->StartAllAction();
1231  pCurrWrtShell->GetFlyFrameAttr( aSet );
1232 
1233  // #i105535#
1234  // no update of anchor attribute
1235  aSet.ClearItem( RES_ANCHOR );
1236 
1237  pFrame->SetFormatAttr( aSet );
1238 
1239  // also apply template to remove hard set attributes
1240  pCurrWrtShell->SetFrameFormat( pFrame, true );
1241  pCurrWrtShell->EndAllAction();
1242  }
1243  }
1244  break;
1245  case SfxStyleFamily::Char:
1246  {
1247  SwCharFormat* pChar = pStyle->GetCharFormat();
1248  if( pChar && !pChar->IsDefault() )
1249  {
1250  pCurrWrtShell->StartAllAction();
1251  pCurrWrtShell->FillByEx(pChar);
1252  // also apply template to remove hard set attributes
1253  pCurrWrtShell->EndAllAction();
1254  }
1255 
1256  }
1257  break;
1258  case SfxStyleFamily::Pseudo:
1259  {
1260  const SwNumRule* pCurRule;
1261  if( pStyle->GetNumRule() &&
1262  nullptr != ( pCurRule = pCurrWrtShell->GetNumRuleAtCurrCursorPos() ))
1263  {
1264  SwNumRule aRule( *pCurRule );
1265  // #i91400#
1266  aRule.SetName( pStyle->GetNumRule()->GetName(),
1267  pCurrWrtShell->GetDoc()->getIDocumentListsAccess() );
1268  pCurrWrtShell->ChgNumRuleFormats( aRule );
1269  }
1270  }
1271  break;
1272  case SfxStyleFamily::Table:
1273  {
1274 
1275  SwTableAutoFormat aFormat(rName);
1276  if (pCurrWrtShell->GetTableAutoFormat(aFormat))
1277  {
1278  pCurrWrtShell->StartAllAction();
1279  pCurrWrtShell->GetDoc()->ChgTableStyle(rName, aFormat);
1280  pCurrWrtShell->EndAllAction();
1281  }
1282 
1283  }
1284  break;
1285  default: break;
1286  }
1287 }
1288 
1289 // NewByExample
1290 void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily,
1291  SfxStyleSearchBits nMask, SwWrtShell* pShell )
1292 {
1293  SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell();
1294  SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>( m_xBasePool->Find(
1295  rName, nFamily ) );
1296  if(!pStyle)
1297  {
1298  // preserve the current mask of PI, then the new one is
1299  // immediately merged with the viewable area
1300  if( SfxStyleSearchBits::All == nMask || SfxStyleSearchBits::Used == nMask )
1301  nMask = SfxStyleSearchBits::UserDefined;
1302  else
1303  nMask |= SfxStyleSearchBits::UserDefined;
1304 
1305  if (nFamily == SfxStyleFamily::Para || nFamily == SfxStyleFamily::Char || nFamily == SfxStyleFamily::Frame)
1306  {
1307  // Prevent undo append from being done during paragraph, character, and frame style Make. Do it later
1308  ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
1309  pStyle = static_cast<SwDocStyleSheet*>(&m_xBasePool->Make(rName, nFamily, nMask));
1310  }
1311  else
1312  {
1313  pStyle = static_cast<SwDocStyleSheet*>(&m_xBasePool->Make(rName, nFamily, nMask));
1314  }
1315  }
1316 
1317  switch(nFamily)
1318  {
1319  case SfxStyleFamily::Para:
1320  {
1321  SwTextFormatColl* pColl = pStyle->GetCollection();
1322  if(pColl && !pColl->IsDefault())
1323  {
1324  pCurrWrtShell->StartAllAction();
1325  pCurrWrtShell->FillByEx(pColl);
1326  // also apply template to remove hard set attributes
1327  SwTextFormatColl * pDerivedFrom = pCurrWrtShell->GetCurTextFormatColl();
1328  pColl->SetDerivedFrom(pDerivedFrom);
1329 
1330  // set the mask at the Collection:
1331  sal_uInt16 nId = pColl->GetPoolFormatId() & 0x87ff;
1332  switch( nMask & static_cast<SfxStyleSearchBits>(0x0fff) )
1333  {
1334  case SfxStyleSearchBits::SwText:
1335  nId |= COLL_TEXT_BITS;
1336  break;
1337  case SfxStyleSearchBits::SwChapter:
1338  nId |= COLL_DOC_BITS;
1339  break;
1340  case SfxStyleSearchBits::SwList:
1341  nId |= COLL_LISTS_BITS;
1342  break;
1343  case SfxStyleSearchBits::SwIndex:
1344  nId |= COLL_REGISTER_BITS;
1345  break;
1346  case SfxStyleSearchBits::SwExtra:
1347  nId |= COLL_EXTRA_BITS;
1348  break;
1349  case SfxStyleSearchBits::SwHtml:
1350  nId |= COLL_HTML_BITS;
1351  break;
1352  default: break;
1353  }
1354  pColl->SetPoolFormatId(nId);
1355 
1356  if (GetDoc()->GetIDocumentUndoRedo().DoesUndo())
1357  {
1359  std::make_unique<SwUndoTextFormatCollCreate>(pColl, pDerivedFrom, GetDoc()));
1360  }
1361  pCurrWrtShell->SetTextFormatColl(pColl);
1362  pCurrWrtShell->EndAllAction();
1363  }
1364  }
1365  break;
1366  case SfxStyleFamily::Frame:
1367  {
1368  SwFrameFormat* pFrame = pStyle->GetFrameFormat();
1369  if(pCurrWrtShell->IsFrameSelected() && pFrame && !pFrame->IsDefault())
1370  {
1371  pCurrWrtShell->StartAllAction();
1372 
1374  pCurrWrtShell->GetFlyFrameAttr( aSet );
1375  aSet.ClearItem(RES_ANCHOR); // tdf#112574 no anchor in styles
1376 
1377  SwFrameFormat* pFFormat = pCurrWrtShell->GetSelectedFrameFormat();
1378  pFrame->SetDerivedFrom( pFFormat );
1379  pFrame->SetFormatAttr( aSet );
1380  if (GetDoc()->GetIDocumentUndoRedo().DoesUndo())
1381  {
1383  std::make_unique<SwUndoFrameFormatCreate>(pFrame, pFFormat, GetDoc()));
1384  }
1385  // also apply template to remove hard set attributes
1386  pCurrWrtShell->SetFrameFormat(pFrame);
1387  pCurrWrtShell->EndAllAction();
1388  }
1389  }
1390  break;
1391  case SfxStyleFamily::Char:
1392  {
1393  SwCharFormat* pChar = pStyle->GetCharFormat();
1394  if(pChar && !pChar->IsDefault())
1395  {
1396  pCurrWrtShell->StartAllAction();
1397  pCurrWrtShell->FillByEx( pChar );
1398  SwCharFormat * pDerivedFrom = pCurrWrtShell->GetCurCharFormat();
1399  pChar->SetDerivedFrom( pDerivedFrom );
1400  SwFormatCharFormat aFormat( pChar );
1401 
1402  if (GetDoc()->GetIDocumentUndoRedo().DoesUndo())
1403  {
1404  // Looks like sometimes pDerivedFrom can be null and this is not supported by redo code
1405  // So use default format as a derived from in such situations
1407  std::make_unique<SwUndoCharFormatCreate>(
1408  pChar, pDerivedFrom ? pDerivedFrom : GetDoc()->GetDfltCharFormat(),
1409  GetDoc()));
1410  }
1411  pCurrWrtShell->SetAttrItem(aFormat);
1412  pCurrWrtShell->EndAllAction();
1413  }
1414  }
1415  break;
1416 
1417  case SfxStyleFamily::Page:
1418  {
1419  pCurrWrtShell->StartAllAction();
1420  size_t nPgDsc = pCurrWrtShell->GetCurPageDesc();
1421  SwPageDesc& rSrc = const_cast<SwPageDesc&>(pCurrWrtShell->GetPageDesc( nPgDsc ));
1422  SwPageDesc& rDest = *const_cast<SwPageDesc*>(pStyle->GetPageDesc());
1423 
1424  sal_uInt16 nPoolId = rDest.GetPoolFormatId();
1425  sal_uInt16 nHId = rDest.GetPoolHelpId();
1426  sal_uInt8 nHFId = rDest.GetPoolHlpFileId();
1427 
1428  pCurrWrtShell->GetDoc()->CopyPageDesc( rSrc, rDest );
1429 
1430  // PoolId must NEVER be copied!
1431  rDest.SetPoolFormatId( nPoolId );
1432  rDest.SetPoolHelpId( nHId );
1433  rDest.SetPoolHlpFileId( nHFId );
1434 
1435  // when Headers/Footers are created, there is no Undo anymore!
1436  pCurrWrtShell->GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj();
1437 
1438  pCurrWrtShell->EndAllAction();
1439  }
1440  break;
1441 
1442  case SfxStyleFamily::Pseudo:
1443  {
1444  const SwNumRule* pCurRule = pCurrWrtShell->GetNumRuleAtCurrCursorPos();
1445 
1446  if (pCurRule)
1447  {
1448  pCurrWrtShell->StartAllAction();
1449 
1450  SwNumRule aRule( *pCurRule );
1451  OUString sOrigRule( aRule.GetName() );
1452  // #i91400#
1453  aRule.SetName( pStyle->GetNumRule()->GetName(),
1454  pCurrWrtShell->GetDoc()->getIDocumentListsAccess() );
1455  pCurrWrtShell->ChgNumRuleFormats( aRule );
1456 
1457  pCurrWrtShell->ReplaceNumRule( sOrigRule, aRule.GetName() );
1458 
1459  pCurrWrtShell->EndAllAction();
1460  }
1461  }
1462  break;
1463 
1464  case SfxStyleFamily::Table:
1465  {
1466  SwTableAutoFormat* pFormat = pStyle->GetTableFormat();
1467  if (pCurrWrtShell->GetTableAutoFormat(*pFormat))
1468  {
1469  pCurrWrtShell->StartAllAction();
1470 
1471  pCurrWrtShell->SetTableStyle(rName);
1472 
1473  pCurrWrtShell->EndAllAction();
1474  }
1475  }
1476  break;
1477 
1478  default: break;
1479  }
1480 }
1481 
1482 std::set<Color> SwDocShell::GetDocColors()
1483 {
1484  return m_xDoc->GetDocColors();
1485 }
1486 
1488 {
1489  LoadStyles_(rSource, false);
1490 }
1491 
1492 // bPreserveCurrentDocument determines whether SetFixFields() is called
1493 // This call modifies the source document. This mustn't happen when the source
1494 // is a document the user is working on.
1495 // Calls of ::LoadStyles() normally use files especially loaded for the purpose
1496 // of importing styles.
1497 void SwDocShell::LoadStyles_( SfxObjectShell& rSource, bool bPreserveCurrentDocument )
1498 {
1499 /* [Description]
1500 
1501  This method is called by SFx if Styles have to be reloaded from a
1502  document-template. Existing Styles should be overwritten by that.
1503  That's why the document has to be reformatted. Therefore applications
1504  will usually override this method and call the baseclass' implementation
1505  in their implementation.
1506 */
1507  // When the source is our document, we do the checking ourselves
1508  // (much quicker and doesn't use the crutch StxStylePool).
1509  if( dynamic_cast<const SwDocShell*>( &rSource) != nullptr)
1510  {
1511  // in order for the Headers/Footers not to get the fixed content
1512  // of the template, update all the Source's
1513  // FixFields once.
1514  if(!bPreserveCurrentDocument)
1515  static_cast<SwDocShell&>(rSource).m_xDoc->getIDocumentFieldsAccess().SetFixFields(nullptr);
1516  if (m_pWrtShell)
1517  {
1518  // rhbz#818557, fdo#58893: EndAllAction will call SelectShell(),
1519  // which pushes a bunch of SfxShells that are not cleared
1520  // (for unknown reasons) when closing the document, causing crash;
1521  // setting g_bNoInterrupt appears to avoid the problem.
1524  m_xDoc->ReplaceStyles( *static_cast<SwDocShell&>(rSource).m_xDoc );
1526  }
1527  else
1528  {
1529  bool bModified = m_xDoc->getIDocumentState().IsModified();
1530  m_xDoc->ReplaceStyles( *static_cast<SwDocShell&>(rSource).m_xDoc );
1531  if (!bModified && m_xDoc->getIDocumentState().IsModified() && !m_pView)
1532  {
1533  // the View is created later, but overwrites the Modify-Flag.
1534  // Undo doesn't work anymore anyways.
1535  m_xDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
1536  }
1537  }
1538  }
1539  else
1540  SfxObjectShell::LoadStyles( rSource );
1541 }
1542 
1544  const OUString& rPage,
1545  const OString& rPageId,
1546  SwWrtShell& rActShell,
1547  SfxRequest* pRequest)
1548 {
1549  Edit(rPage, OUString(), SfxStyleFamily::Page, SfxStyleSearchBits::Auto, false, rPageId, &rActShell, pRequest);
1550 }
1551 
1552 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewFrame * GetViewFrame() const
const sal_Char * pChar
bool IsPrintLayoutExtension() const
virtual bool IsUsed() const
FieldUnit
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
Definition: edattr.cxx:250
const sal_uInt16 COLL_LISTS_BITS
Definition: poolfmt.hxx:67
const sal_uInt16 COLL_DOC_BITS
Definition: poolfmt.hxx:70
static OUString GenerateUnusedName(SfxStyleSheetBasePool &rPool)
IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone *, void)
Definition: docst.cxx:579
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId)
Definition: edfmt.cxx:125
void SwToSfxPageDescAttr(SfxItemSet &rSet)
Definition: uitool.cxx:670
SfxWatermarkItem GetWatermark() const
Definition: edfcol.cxx:1383
bool IsDefault() const
Definition: format.hxx:109
SwTableAutoFormat * GetTableFormat()
Definition: docstyle.cxx:2184
SfxStyleFamily eType
Definition: view.hxx:118
SW_DLLPUBLIC void ConvertAttrCharToGen(SfxItemSet &rSet)
Convert character specific attributes to general ones used by tab pages.
Definition: uitool.cxx:127
SwUndoId
Definition: swundo.hxx:29
void SetPoolHelpId(sal_uInt16 const nId)
Definition: pagedesc.hxx:257
std::string GetValue
const SwNumRule * GetNumRuleAtCurrCursorPos() const
Definition: ednumber.cxx:727
SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)
Definition: editsh.hxx:358
SfxDispatcher * GetDispatcher()
virtual void SetModified()=0
Must be called manually at changes of format.
bool GetLastUndoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const
Definition: edws.cxx:236
#define KEY_SHIFT
const OUString & GetDefaultListId() const
Definition: numrule.hxx:191
const sal_uInt16 COLL_HTML_BITS
Definition: poolfmt.hxx:71
Definition: doc.hxx:185
SAL_DLLPRIVATE void UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell *pShell)
Definition: docst.cxx:1192
sal_uInt16 GetValue() const
void InvalidateItem(sal_uInt16 nWhich)
sal_Int16 nId
sal_uInt16 FirstWhich()
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:233
rtl::Reference< SfxStyleSheetBasePool > m_xBasePool
Definition: docst.cxx:575
const OUString & GetName() const
Definition: numrule.hxx:221
SwEditWin & GetEditWin()
Definition: view.hxx:403
void Done(bool bRemove=false)
void SetPageStyle(const OUString &rCollName)
Definition: wrtsh1.cxx:1559
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
css::uno::Reference< css::frame::XModel > GetModel() const
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
void SfxToSwPageDescAttr(const SwWrtShell &rShell, SfxItemSet &rSet)
Definition: uitool.cxx:610
virtual bool SetFormatAttr(const SfxPoolItem &rAttr) override
Override to recognize changes on the and register/unregister the paragragh style at t...
Definition: fmtcol.cxx:329
SwFrameFormat * GetFrameFormatFromPool(sal_uInt16 nId)
Definition: editsh.hxx:356
void PutItem(const SfxPoolItem &rItem)
void SetValue(SfxStyleSearchBits n)
void EndAllAction()
Definition: edws.cxx:96
void SetApplyTemplate(const SwApplyTemplate &)
Apply template.
Definition: edtwin.cxx:4936
SwPageDesc * pPageDesc
Definition: view.hxx:112
sal_uInt16 NextWhich()
XPatternListRef GetPatternList() const
const OUString & GetName() const
Definition: pagedesc.hxx:187
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:154
void SetCurNumRule(const SwNumRule &, const bool bCreateNewList, const OUString &sContinuedListId=OUString(), const bool bResetIndentAttrs=false)
Optional parameter (default value false).
Definition: ednumber.cxx:771
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
void SetWatermark(const SfxWatermarkItem &rText)
Definition: edfcol.cxx:1608
void FillByEx(SwCharFormat *)
Definition: edfmt.cxx:55
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:109
const SwView & GetView() const
Definition: wrtsh.hxx:428
const OUString & GetName() const
ApplyStyle(SwDocShell &rDocSh, bool bNew, rtl::Reference< SwDocStyleSheet > const &xTmp, SfxStyleFamily nFamily, SfxAbstractApplyTabDialog *pDlg, rtl::Reference< SfxStyleSheetBasePool > const &xBasePool, bool bModified)
Definition: docst.cxx:550
void SetPoolFormatId(sal_uInt16 nId)
Definition: format.hxx:144
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat-Id.
Definition: pagedesc.hxx:254
void ExecStyleSheet(SfxRequest &)
Definition: docst.cxx:299
SAL_DLLPRIVATE void Edit(const OUString &rName, const OUString &rParent, const SfxStyleFamily nFamily, SfxStyleSearchBits nMask, const bool bNew, const OString &sPageId, SwWrtShell *pActShell, SfxRequest *pRequest=nullptr, sal_uInt16 nSlot=0)
Methods for StyleSheets.
Definition: docst.cxx:714
bool SetTableStyle(const OUString &rStyleName)
Set table style of the current table.
Definition: fetab.cxx:1173
const OUString & GetName() const
Definition: format.hxx:111
virtual void DelAllUndoObj()=0
Delete all Undo actions.
void InitPrt(OutputDevice *pOutDev)
Definition: vprint.cxx:196
SwFrameFormat * GetFrameFormat()
Definition: docstyle.cxx:2223
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
OUString GetName() const
const SwTable & GetTable() const
Definition: node.hxx:497
void SetPoolHlpFileId(sal_uInt8 const nId)
Definition: pagedesc.hxx:259
SwDoc * GetDoc() const
Definition: viewsh.hxx:284
const SwPageDesc * GetPageDesc()
Definition: docstyle.cxx:2163
const OUString & GetTableStyleName() const
Return the table style name of this table.
Definition: swtable.hxx:188
SfxStyleFamily
const SwTOXBase * GetCurTOX() const
Get current listing before or at the Cursor.
Definition: edtox.cxx:195
virtual void LoadStyles(SfxObjectShell &rSource) override
Definition: docst.cxx:1487
const sal_uInt16 COLL_REGISTER_BITS
Definition: poolfmt.hxx:69
SwCharFormat * GetCharFormat()
Definition: docstyle.cxx:2149
virtual bool DoesUndo() const =0
Is Undo enabled?
bool SetDerivedFrom(SwFormat *pDerivedFrom=nullptr)
0 is Default.
Definition: format.cxx:326
void PresetParent(const OUString &rName)
Definition: docstyle.hxx:118
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:143
SfxItemPool & GetPool() const
bool const m_bModified
Definition: docst.cxx:576
SwFrameFormat * FindFrameFormatByName(const OUString &rName) const
Definition: doc.hxx:760
static SvxHtmlOptions & Get()
void ChgNumRuleFormats(const SwNumRule &rRule)
Definition: ednumber.cxx:821
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1023
SwDocShell & m_rDocSh
Definition: docst.cxx:571
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:20
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:203
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
Definition: viewsh.cxx:2593
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
const SwTableNode * IsCursorInTable() const
Definition: crsrsh.hxx:893
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
void SetTextFormatColl(SwTextFormatColl *, const bool bResetListAttrs=false)
Add 2nd optional parameter - see also
Definition: edfcol.cxx:2188
Style of a layout element.
Definition: frmfmt.hxx:57
DECL_LINK(ApplyHdl, LinkParamNone *, void)
SwApplyTemplate * GetApplyTemplate() const
Definition: edtwin.hxx:230
#define SW_MOD()
Definition: swmodule.hxx:256
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: edfmt.cxx:151
#define RES_ANCHOR
Definition: hintids.hxx:211
#define FN_INSERT_CTRL
Definition: cmdid.h:245
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:709
SwTextFormatColl * pTextColl
Definition: view.hxx:111
SwNumRule * pNumRule
Definition: view.hxx:115
virtual void SetUndoNoResetModified()=0
Disable (re)setting the document modified flag on Undo/Redo.
sal_uInt16 GetModifier() const
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:58
void LoadStyles_(SfxObjectShell &rSource, bool bPreserveCurrentDocument)
Definition: docst.cxx:1497
virtual std::set< Color > GetDocColors() override
Definition: docst.cxx:1482
OUString sName
SfxBindings & GetBindings()
#define FN_PARAM_WRTSHELL
Definition: cmdid.h:774
bool const m_bNew
Definition: docst.cxx:572
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:113
const OUString & GetValue() const
sal_uInt16 Count() const
const SwPageDesc & GetPageDesc(size_t i) const
Definition: fedesc.cxx:127
HTMLMODE_ON
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:62
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:340
const T * GetArg(sal_uInt16 nSlotId) const
void ChgTableStyle(const OUString &rName, const SwTableAutoFormat &rNewFormat)
Definition: ndtbl.cxx:4580
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:222
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1165
XGradientListRef GetGradientList() const
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:29
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:393
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:224
SwFrameFormat * pFrameFormat
Definition: view.hxx:113
const SwNumRule * GetNumRule()
Definition: docstyle.cxx:2170
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
SfxItemState QueryState(sal_uInt16 nSID, std::unique_ptr< SfxPoolItem > &rpState)
rtl::Reference< SwDoc > m_xDoc
Document.
Definition: docsh.hxx:71
OUString SwResId(const char *pId)
Definition: swmodule.cxx:190
void SetPoolFormatId(sal_uInt16 const nId)
Definition: pagedesc.hxx:255
#define XATTR_FILLSTYLE
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
rtl::Reference< SwDocStyleSheet > m_xTmp
Definition: docst.cxx:573
virtual void LoadStyles(SfxObjectShell &rSource)
SwFrameFormat * GetSelectedFrameFormat() const
If frame then frame style, else 0.
Definition: fefly1.cxx:1176
rtl::Reference< SfxStyleSheetBasePool > m_xBasePool
Passing through for formats.
Definition: docsh.hxx:72
sal_uInt16 const aFrameFormatSetRange[]
Definition: init.cxx:234
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
void SetReturnValue(const SfxPoolItem &)
SwCharFormat * pCharFormat
Definition: view.hxx:114
SAL_DLLPRIVATE void MakeByExample(const OUString &rName, SfxStyleFamily nFamily, SfxStyleSearchBits nMask, SwWrtShell *pShell)
Definition: docst.cxx:1290
SAL_DLLPRIVATE void Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden)
Definition: docst.cxx:1055
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
void CopyPageDesc(const SwPageDesc &rSrcDesc, SwPageDesc &rDstDesc, bool bCopyPoolIds=true)
Copy the complete PageDesc - beyond document and "deep"! Optionally copying of PoolFormatId, -HlpId can be prevented.
Definition: docfmt.cxx:1399
XHatchListRef GetHatchList() const
SwTextFormatColl * GetCollection()
Definition: docstyle.cxx:2156
void DisableItem(sal_uInt16 nWhich)
SwView * m_pView
For "historical reasons" nothing can be done without the WrtShell.
Definition: docsh.hxx:83
void ReplaceNumRule(const OUString &rOldRule, const OUString &rNewRule)
Definition: ednumber.cxx:828
#define SAL_WARN_IF(condition, area, stream)
unsigned char sal_uInt8
union SwApplyTemplate::@33 aColl
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: edfmt.cxx:156
RET_OK
SwWrtShell * m_pWrtShell
Definition: docsh.hxx:84
sal_uInt16 GetPoolHelpId() const
Definition: pagedesc.hxx:256
void SetAttrOutlineLevel(int)
Definition: fmtcol.cxx:575
void InvalidateRulerPos()
Definition: viewport.cxx:118
void SetFrameFormat(SwFrameFormat *pFormat, bool bKeepOrient=false, Point const *pDocPos=nullptr)
If frame then set frame style.
Definition: fefly1.cxx:1186
XBitmapListRef GetBitmapList() const
OString const aName
sal_uInt8 GetPoolHlpFileId() const
Definition: pagedesc.hxx:258
bool IsUserDefined() const
reference_type * get() const
SAL_DLLPRIVATE SfxStyleFamily ApplyStyles(const OUString &rName, const SfxStyleFamily nFamily, SwWrtShell *pShell, sal_uInt16 nMode)
Definition: docst.cxx:1071
SwCharFormat * GetCurCharFormat() const
Definition: edfmt.cxx:42
bool g_bNoInterrupt
Definition: swmodule.cxx:137
void AppendItem(const SfxPoolItem &)
#define SAL_WARN(area, stream)
Reference< XModel > xModel
SAL_DLLPRIVATE SfxStyleFamily DoWaterCan(const OUString &rName, SfxStyleFamily nFamily)
Definition: docst.cxx:1138
bool IsAPI() const
const SwView * GetView() const
Definition: docsh.hxx:220
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
#define FN_INSERT_OBJ_CTRL
Definition: cmdid.h:246
const sal_uInt16 COLL_TEXT_BITS
Definition: poolfmt.hxx:66
XColorListRef GetColorList() const
void FormatPage(const OUString &rPage, const OString &rPageId, SwWrtShell &rActShell, SfxRequest *pRequest=nullptr)
Show page style format dialog.
Definition: docst.cxx:1543
void SetName(const OUString &rNm, IDocumentListsAccess &rDocListAccess)
Definition: number.cxx:101
void apply()
Definition: docst.cxx:565
void StartAllAction()
For all views of this document.
Definition: edws.cxx:85
SAL_DLLPRIVATE void Delete(const OUString &rName, SfxStyleFamily nFamily)
Definition: docst.cxx:1041
IDocumentListsAccess const & getIDocumentListsAccess() const
Definition: doc.cxx:292
void Ignore()
size_t GetCurPageDesc(const bool bCalcFrame=true) const
Definition: fedesc.cxx:168
static const std::vector< OUString > & GetTextUINameArray()
void StateStyleSheet(SfxItemSet &, SwWrtShell *pSh=nullptr)
Definition: docst.cxx:96
SW_DLLPUBLIC void ConvertAttrGenToChar(SfxItemSet &rSet, const SfxItemSet &rOrigSet)
Convert general attributes to the corresponding character attributes.
Definition: uitool.cxx:161
void Undo(sal_uInt16 const nCount=1)
Definition: edundo.cxx:101
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:238
bool IsFrameSelected() const
Definition: feshview.cxx:1175
SfxStyleSearchBits
Definition: view.hxx:146
const sal_uInt16 COLL_EXTRA_BITS
Definition: poolfmt.hxx:68
VclPtr< SfxAbstractApplyTabDialog > m_pDlg
Definition: docst.cxx:569
SfxStyleFamily const m_nFamily
Definition: docst.cxx:574
static void DoUpdateAllCharts(SwDoc *pDoc)
Definition: unochart.cxx:54
bool GetTableAutoFormat(SwTableAutoFormat &rGet)
Definition: fetab.cxx:1249
virtual VclPtr< SfxAbstractApplyTabDialog > CreateTemplateDialog(weld::Window *pParent, SfxStyleSheetBase &rBase, SfxStyleFamily nRegion, const OString &sPage, SwWrtShell *pActShell, bool bNew)=0