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