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