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