LibreOffice Module sw (master) 1
unotxdoc.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 <sal/config.h>
21#include <officecfg/Office/Common.hxx>
22#include <comphelper/string.hxx>
23#include <AnnotationWin.hxx>
24#include <o3tl/any.hxx>
25#include <utility>
26#include <vcl/virdev.hxx>
27#include <vcl/sysdata.hxx>
28#include <vcl/svapp.hxx>
29#include <vcl/print.hxx>
30#include <sfx2/bindings.hxx>
31#include <sfx2/viewfrm.hxx>
32#include <sfx2/lokhelper.hxx>
34#include <sfx2/docfile.hxx>
35#include <sfx2/printer.hxx>
38#include <LibreOfficeKit/LibreOfficeKitEnums.h>
40#include <sfx2/ipclient.hxx>
41#include <editeng/svxacorr.hxx>
42#include <editeng/acorrcfg.hxx>
43#include <cmdid.h>
44#include <swtypes.hxx>
45#include <wdocsh.hxx>
46#include <wrtsh.hxx>
47#include <pview.hxx>
48#include <viewsh.hxx>
49#include <pvprtdat.hxx>
50#include <printdata.hxx>
51#include <pagefrm.hxx>
52#include <rootfrm.hxx>
53#include <svl/stritem.hxx>
54#include <unotxdoc.hxx>
55#include <svl/numformat.hxx>
56#include <svl/numuno.hxx>
57#include <fldbas.hxx>
58#include <unomap.hxx>
59#include <unotextbodyhf.hxx>
60#include <unotextrange.hxx>
61#include <unotextcursor.hxx>
62#include <unosett.hxx>
63#include <unocoll.hxx>
64#include <unoredlines.hxx>
65#include <unosrch.hxx>
66#include <sfx2/request.hxx>
67#include <sfx2/objsh.hxx>
68#include <unoprnms.hxx>
69#include <unostyle.hxx>
70#include <unodraw.hxx>
71#include <svl/eitem.hxx>
73#include <unotools/datetime.hxx>
74#include <unocrsr.hxx>
75#include <unofieldcoll.hxx>
76#include <unoidxcoll.hxx>
77#include <unocrsrhelper.hxx>
78#include <globdoc.hxx>
79#include <viewopt.hxx>
80#include <unochart.hxx>
81#include <charatr.hxx>
82#include <svx/xmleohlp.hxx>
83#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
84#include <com/sun/star/lang/DisposedException.hpp>
85#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
86#include <com/sun/star/lang/NoSupportException.hpp>
87#include <com/sun/star/beans/PropertyAttribute.hpp>
88#include <com/sun/star/beans/XFastPropertySet.hpp>
89#include <com/sun/star/beans/XPropertyAccess.hpp>
90#include <com/sun/star/document/RedlineDisplayType.hpp>
91#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
92#include <com/sun/star/frame/XController.hpp>
93#include <com/sun/star/frame/XFrame.hpp>
94#include <com/sun/star/script/XInvocation.hpp>
95#include <com/sun/star/view/XSelectionSupplier.hpp>
96#include <sfx2/linkmgr.hxx>
97#include <svx/unofill.hxx>
98#include <swmodule.hxx>
99#include <docstat.hxx>
100#include <modcfg.hxx>
101#include <ndtxt.hxx>
102#include <strings.hrc>
103#include <bitmaps.hlst>
104#include "unodefaults.hxx"
106#include <doc.hxx>
116#include <IDocumentState.hxx>
117#include <drawdoc.hxx>
118#include <SwStyleNameMapper.hxx>
119#include <osl/file.hxx>
120#include <comphelper/lok.hxx>
124#include <sfx2/dispatch.hxx>
125#include <swruler.hxx>
126#include <docufld.hxx>
127
129#include <numrule.hxx>
130
131#include <editeng/langitem.hxx>
132#include <docary.hxx>
134#include <i18nutil/searchopt.hxx>
135
136#include <charfmt.hxx>
137#include <fmtcol.hxx>
138#include <istyleaccess.hxx>
139
140#include <swatrset.hxx>
141#include <view.hxx>
142#include <viscrs.hxx>
143#include <srcview.hxx>
144#include <edtwin.hxx>
145#include <swdtflvr.hxx>
146#include <PostItMgr.hxx>
147
148#include <svtools/langtab.hxx>
149#include <map>
150#include <set>
151#include <vector>
152
153#include <editeng/eeitem.hxx>
154#include <editeng/editeng.hxx>
155#include <editeng/editview.hxx>
156#include <svx/svdoutl.hxx>
157#include <svx/svdview.hxx>
160#include <memory>
161#include <redline.hxx>
163#include <xmloff/odffields.hxx>
164#include <tools/json_writer.hxx>
166
167#include <svx/svdpage.hxx>
168#include <o3tl/string_view.hxx>
170
173#include <textcontentcontrol.hxx>
174#include <unocontentcontrol.hxx>
175
176using namespace ::com::sun::star;
177using namespace ::com::sun::star::text;
178using namespace ::com::sun::star::i18n;
179using namespace ::com::sun::star::uno;
180using namespace ::com::sun::star::beans;
181using namespace ::com::sun::star::lang;
182using namespace ::com::sun::star::container;
183using namespace ::com::sun::star::document;
184using ::osl::FileBase;
185
186static std::unique_ptr<SwPrintUIOptions> lcl_GetPrintUIOptions(
187 SwDocShell * pDocShell,
188 const SfxViewShell * pView )
189{
190 if (!pDocShell)
191 return nullptr;
192
193 const bool bWebDoc = nullptr != dynamic_cast< const SwWebDocShell * >(pDocShell);
194 const bool bSwSrcView = nullptr != dynamic_cast< const SwSrcView * >(pView);
195 const SwView * pSwView = dynamic_cast< const SwView * >(pView);
196 const bool bHasSelection = pSwView && pSwView->HasSelection( false ); // check for any selection, not just text selection
197 const bool bHasPostIts = sw_GetPostIts(pDocShell->GetDoc()->getIDocumentFieldsAccess(), nullptr);
198
199 // get default values to use in dialog from documents SwPrintData
200 const SwPrintData &rPrintData = pDocShell->GetDoc()->getIDocumentDeviceAccess().getPrintData();
201
202 // Get current page number
203 sal_uInt16 nCurrentPage = 1;
204 const SwWrtShell* pSh = pDocShell->GetWrtShell();
205 const SwRootFrame *pFrame = nullptr;
206 if (pSh)
207 {
208 SwPaM* pShellCursor = pSh->GetCursor();
209 nCurrentPage = pShellCursor->GetPageNum();
210 pFrame = pSh->GetLayout();
211 }
212 else if (!bSwSrcView)
213 {
214 const SwPagePreview* pPreview = dynamic_cast< const SwPagePreview* >(pView);
215 OSL_ENSURE(pPreview, "Unexpected type of the view shell");
216 if (pPreview)
217 {
218 nCurrentPage = pPreview->GetSelectedPage();
219 pFrame = pPreview->GetViewShell()->GetLayout();
220 }
221 }
222
223 // If blanks are skipped, account for them in initial page range value
224 if (pFrame && !rPrintData.IsPrintEmptyPages())
225 {
226 sal_uInt16 nMax = nCurrentPage;
227 const SwPageFrame *pPage = dynamic_cast<const SwPageFrame*>(pFrame->Lower());
228 while (pPage && nMax-- > 0)
229 {
230 if (pPage->getFrameArea().Height() == 0)
231 nCurrentPage--;
232 pPage = static_cast<const SwPageFrame*>(pPage->GetNext());
233 }
234 }
235 return std::make_unique<SwPrintUIOptions>( nCurrentPage, bWebDoc, bSwSrcView, bHasSelection, bHasPostIts, rPrintData );
236}
237
238static SwTextFormatColl *lcl_GetParaStyle(const OUString& rCollName, SwDoc& rDoc)
239{
240 SwTextFormatColl* pColl = rDoc.FindTextFormatCollByName( rCollName );
241 if( !pColl )
242 {
244 rCollName, SwGetPoolIdFromName::TxtColl );
245 if( USHRT_MAX != nId )
247 }
248 return pColl;
249}
250
251static void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell const * pDocShell )
252{
253 // check if the view frame still exists
254 SfxViewFrame* pFound = SfxViewFrame::GetFirst( pDocShell, false );
255 while(pFound)
256 {
257 if( pFound == pToClose)
258 {
259 pToClose->DoClose();
260 break;
261 }
262 pFound = SfxViewFrame::GetNext( *pFound, pDocShell, false );
263 }
264}
265
267{
268public:
269 std::mutex m_Mutex; // just for OInterfaceContainerHelper4
271};
272
273const Sequence< sal_Int8 > & SwXTextDocument::getUnoTunnelId()
274{
275 static const comphelper::UnoIdInit theSwXTextDocumentUnoTunnelId;
276 return theSwXTextDocumentUnoTunnelId.getSeq();
277}
278
279sal_Int64 SAL_CALL SwXTextDocument::getSomething( const Sequence< sal_Int8 >& rId )
280{
281 if( comphelper::isUnoTunnelId<SwXTextDocument>(rId) )
282 {
284 }
285 if( comphelper::isUnoTunnelId<SfxObjectShell>(rId) )
286 {
288 }
289
290 sal_Int64 nRet = SfxBaseModel::getSomething( rId );
291 if (nRet)
292 return nRet;
293
295 if (!m_xNumFormatAgg.is()) // may happen if not valid or no SwDoc
296 return 0;
297 Any aNumTunnel = m_xNumFormatAgg->queryAggregation(cppu::UnoType<XUnoTunnel>::get());
298 Reference<XUnoTunnel> xNumTunnel;
299 aNumTunnel >>= xNumTunnel;
300 return (xNumTunnel.is()) ? xNumTunnel->getSomething(rId) : 0;
301}
302
304{
305 Any aRet = SwXTextDocumentBaseClass::queryInterface(rType);
306 if ( !aRet.hasValue() )
307 aRet = SfxBaseModel::queryInterface(rType);
308 if ( !aRet.hasValue() &&
310 {
311 Reference<lang::XMultiServiceFactory> xTmp = this;
312 aRet <<= xTmp;
313 }
314 if ( !aRet.hasValue() &&
316 {
317 Reference<tiledrendering::XTiledRenderable> xTmp = this;
318 aRet <<= xTmp;
319 }
320
321 if ( !aRet.hasValue()
328 {
330 if(m_xNumFormatAgg.is())
331 aRet = m_xNumFormatAgg->queryAggregation(rType);
332 }
333 return aRet;
334}
335
336void SAL_CALL SwXTextDocument::acquire()noexcept
337{
339}
340
341void SAL_CALL SwXTextDocument::release()noexcept
342{
344}
345
346Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes()
347{
348 Sequence< uno::Type > aNumTypes;
350 if(m_xNumFormatAgg.is())
351 {
352 const uno::Type& rProvType = cppu::UnoType<XTypeProvider>::get();
353 Any aNumProv = m_xNumFormatAgg->queryAggregation(rProvType);
354 Reference<XTypeProvider> xNumProv;
355 if(aNumProv >>= xNumProv)
356 {
357 aNumTypes = xNumProv->getTypes();
358 }
359 }
362 SwXTextDocumentBaseClass::getTypes(),
363 aNumTypes,
364 Sequence {
367}
368
371 , m_pImpl(new Impl)
372 ,
373 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_DOCUMENT)),
374 m_pDocShell(pShell),
375 m_bObjectValid(pShell != nullptr),
376 m_pHiddenViewFrame(nullptr),
377 // #i117783#
378 m_bApplyPagePrintSettingsFromXPagePrintable( false )
379{
380}
381
383{
384 OSL_ENSURE(m_pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetOrCreateDrawModel(), "No SdrModel in SwDoc, should not happen");
386}
387
389{
390 InitNewDoc();
391 if(m_xNumFormatAgg.is())
392 {
393 Reference< XInterface > x0;
394 m_xNumFormatAgg->setDelegator(x0);
395 m_xNumFormatAgg = nullptr;
396 }
397 m_pPrintUIOptions.reset();
398 if (m_pRenderData && m_pRenderData->IsViewOptionAdjust())
399 { // rhbz#827695: this can happen if the last page is not printed
400 // the SwViewShell has been deleted already by SwView::~SwView
401 // FIXME: replace this awful implementation of XRenderable with
402 // something less insane that has its own view
403 m_pRenderData->ViewOptionAdjustCrashPreventionKludge();
404 }
405 m_pRenderData.reset();
406}
407
409{
410 if(!mxPropertyHelper.is())
411 {
413 }
414 return mxPropertyHelper.get();
415}
416
418{
419 if(!IsValid())
420 return;
421
422 if(!m_xNumFormatAgg.is())
423 {
424 if ( m_pDocShell->GetDoc() )
425 {
428 m_xNumFormatAgg = pNumFormat;
429 }
430 if(m_xNumFormatAgg.is())
431 m_xNumFormatAgg->setDelegator(static_cast<cppu::OWeakObject*>(static_cast<SwXTextDocumentBaseClass*>(this)));
432 }
433 else
434 {
435 const uno::Type& rTunnelType = cppu::UnoType<XUnoTunnel>::get();
436 Any aNumTunnel = m_xNumFormatAgg->queryAggregation(rTunnelType);
437 Reference< XUnoTunnel > xNumTunnel;
438 aNumTunnel >>= xNumTunnel;
440 = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(xNumTunnel);
441 OSL_ENSURE(pNumFormat, "No number formatter available");
442 if (pNumFormat && !pNumFormat->GetNumberFormatter())
444 }
445}
446
447Reference< XText > SwXTextDocument::getText()
448{
449 return getBodyText();
450}
451
453{
454 SolarMutexGuard aGuard;
455 if(!IsValid())
456 throw DisposedException("", static_cast< XTextDocument* >(this));
457 if(!m_xBodyText.is())
458 {
460 }
461 return m_xBodyText;
462}
463
465{
466 SolarMutexGuard aGuard;
467 if(!IsValid())
468 throw DisposedException("", static_cast< XTextDocument* >(this));
469}
470
472{
473 SolarMutexGuard aGuard;
474 if(!IsValid())
475 throw DisposedException("", static_cast< XTextDocument* >(this));
476
477 maActionArr.emplace_front(new UnoActionContext(m_pDocShell->GetDoc()));
478}
479
481{
482 SolarMutexGuard aGuard;
483 if(maActionArr.empty())
484 throw RuntimeException("Nothing to unlock");
485
486 maActionArr.pop_front();
487}
488
490{
491 SolarMutexGuard aGuard;
492 return !maActionArr.empty();
493}
494
495Reference< frame::XController > SwXTextDocument::getCurrentController()
496{
498}
499
500void SwXTextDocument::setCurrentController(const Reference< frame::XController > & xController)
501{
503}
504
506{
507 SolarMutexGuard aGuard;
508 Reference< XInterface > xRef;
509 if(IsValid())
510 {
511 SwView* pView = static_cast<SwView*>(SfxViewShell::GetFirst(true, checkSfxViewShell<SwView>));
512 while(pView && pView->GetObjectShell() != m_pDocShell)
513 {
514 pView = static_cast<SwView*>(SfxViewShell::GetNext(*pView, true, checkSfxViewShell<SwView>));
515 }
516 if(pView)
517 {
518 Any aRef = pView->GetUNOObject()->getSelection();
519 aRef >>= xRef;
520 }
521 }
522 return xRef;
523}
524
525sal_Bool SwXTextDocument::attachResource(const OUString& aURL, const Sequence< beans::PropertyValue >& aArgs)
526{
527 return SfxBaseModel::attachResource(aURL, aArgs);
528}
529
531{
532 return SfxBaseModel::getURL();
533}
534
535Sequence< beans::PropertyValue > SwXTextDocument::getArgs()
536{
537 return SfxBaseModel::getArgs();
538}
539
540void SwXTextDocument::connectController(const Reference< frame::XController > & xController)
541{
543}
544
545void SwXTextDocument::disconnectController(const Reference< frame::XController > & xController)
546{
548}
549
551{
552 // Delete UnoActionContexts before deleting the SwDoc, as the first has unowned pointers to the
553 // second.
554 maActionArr.clear();
555
557}
558
559void SwXTextDocument::close( sal_Bool bDeliverOwnership )
560{
561 if(m_pDocShell)
562 {
563 uno::Sequence< uno::Any > aArgs;
565 }
566 SolarMutexGuard aGuard;
569 SfxBaseModel::close(bDeliverOwnership);
570}
571
572void SwXTextDocument::addEventListener(const Reference< lang::XEventListener > & aListener)
573{
575}
576
577void SwXTextDocument::removeEventListener(const Reference< lang::XEventListener > & aListener)
578{
580}
581
583{
584 SolarMutexGuard aGuard;
585 if(!IsValid())
586 throw DisposedException("", static_cast< XTextDocument* >(this));
587
589 {
591 }
593}
594
596{
597 SolarMutexGuard aGuard;
598 if(!IsValid())
599 throw DisposedException("", static_cast< XTextDocument* >(this));
600 if(!mxXChapterNumbering.is())
601 {
603 }
604 return mxXChapterNumbering;
605}
606
607Reference< XIndexAccess > SwXTextDocument::getNumberingRules()
608{
609 SolarMutexGuard aGuard;
610 if(!IsValid())
611 throw DisposedException("", static_cast< XTextDocument* >(this));
612 if(!mxXNumberingRules.is() )
613 {
615 }
616 return mxXNumberingRules;
617}
618
619Reference< XIndexAccess > SwXTextDocument::getFootnotes()
620{
621 SolarMutexGuard aGuard;
622 if(!IsValid())
623 throw DisposedException("", static_cast< XTextDocument* >(this));
624 if(!mxXFootnotes.is())
625 {
627 }
628 return mxXFootnotes;
629}
630
631Reference< XPropertySet > SAL_CALL
633{
634 SolarMutexGuard aGuard;
635 if(!IsValid())
636 throw DisposedException("", static_cast< XTextDocument* >(this));
637 if(!mxXFootnoteSettings.is())
638 {
640 }
641 return mxXFootnoteSettings;
642}
643
644Reference< XIndexAccess > SwXTextDocument::getEndnotes()
645{
646 SolarMutexGuard aGuard;
647 if(!IsValid())
648 throw DisposedException("", static_cast< XTextDocument* >(this));
649 if(!mxXEndnotes.is())
650 {
652 }
653 return mxXEndnotes;
654}
655
656Reference< XPropertySet > SwXTextDocument::getEndnoteSettings()
657{
658 SolarMutexGuard aGuard;
659 if(!IsValid())
660 throw DisposedException("", static_cast< XTextDocument* >(this));
661 if(!mxXEndnoteSettings.is())
662 {
664 }
665 return mxXEndnoteSettings;
666}
667
668Reference< XIndexAccess > SwXTextDocument::getContentControls()
669{
670 SolarMutexGuard aGuard;
671 if(!IsValid())
672 throw DisposedException("", static_cast< XTextDocument* >(this));
673 if(!mxXContentControls.is())
674 {
676 }
677 return mxXContentControls;
678}
679
680Reference< util::XReplaceDescriptor > SwXTextDocument::createReplaceDescriptor()
681{
682 return new SwXTextSearch;
683}
684
685SwUnoCursor* SwXTextDocument::CreateCursorForSearch(Reference< XTextCursor > & xCursor)
686{
687 getText();
688 XText *const pText = m_xBodyText.get();
689 SwXBodyText* pBText = static_cast<SwXBodyText*>(pText);
690 rtl::Reference<SwXTextCursor> pXTextCursor = pBText->CreateTextCursor(true);
691 xCursor.set( static_cast<text::XWordCursor*>(pXTextCursor.get()) );
692
693 auto& rUnoCursor(pXTextCursor->GetCursor());
694 rUnoCursor.SetRemainInSection(false);
695 return &rUnoCursor;
696}
697
698sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor > & xDesc)
699{
700 SolarMutexGuard aGuard;
701 SwXTextSearch* pSearch;
702 if (!IsValid() || !(pSearch = dynamic_cast<SwXTextSearch*>(xDesc.get())))
703 throw DisposedException("", static_cast< XTextDocument* >(this));
704
705 Reference< XTextCursor > xCursor;
706 auto pUnoCursor(CreateCursorForSearch(xCursor));
708
709 i18nutil::SearchOptions2 aSearchOpt;
710 pSearch->FillSearchOptions( aSearchOpt );
711
714
715 // Search should take place anywhere
716 pUnoCursor->SetRemainInSection(false);
717 sal_Int32 nResult;
719 //try attribute search first
720 if(pSearch->HasSearchAttributes()||pSearch->HasReplaceAttributes())
721 {
728 pSearch->FillSearchItemSet(aSearch);
729 pSearch->FillReplaceItemSet(aReplace);
730 bool bCancel;
731 nResult = pUnoCursor->FindAttrs(aSearch, !pSearch->m_bStyles,
732 eStart, eEnd, bCancel,
733 static_cast<FindRanges>(eRanges),
734 !pSearch->m_sSearchText.isEmpty() ? &aSearchOpt : nullptr,
735 &aReplace );
736 }
737 else if(pSearch->m_bStyles)
738 {
739 SwTextFormatColl *pSearchColl = lcl_GetParaStyle(pSearch->m_sSearchText, pUnoCursor->GetDoc());
740 SwTextFormatColl *pReplaceColl = lcl_GetParaStyle(pSearch->m_sReplaceText, pUnoCursor->GetDoc());
741
742 bool bCancel;
743 nResult = pUnoCursor->FindFormat(*pSearchColl,
744 eStart, eEnd, bCancel,
745 static_cast<FindRanges>(eRanges), pReplaceColl );
746
747 }
748 else
749 {
750 //todo/mba: assuming that notes should be omitted
751 bool bCancel;
752 nResult = pUnoCursor->Find_Text(aSearchOpt, false/*bSearchInNotes*/,
753 eStart, eEnd, bCancel,
754 static_cast<FindRanges>(eRanges),
755 true );
756 }
757 return nResult;
758
759}
760
761Reference< util::XSearchDescriptor > SwXTextDocument::createSearchDescriptor()
762{
763 return new SwXTextSearch;
764}
765
766// Used for findAll/First/Next
767
768SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor > & xDesc,
769 Reference< XTextCursor > & xCursor,
770 bool bAll,
771 sal_Int32& nResult,
772 Reference< XInterface > const & xLastResult)
773{
774 const auto pSearch = dynamic_cast<SwXTextSearch*>(xDesc.get());
775 if(!IsValid() || !pSearch)
776 return nullptr;
777
778 auto pUnoCursor(CreateCursorForSearch(xCursor));
779
780 bool bParentInExtra = false;
781 if(xLastResult.is())
782 {
783 OTextCursorHelper* pPosCursor = dynamic_cast<OTextCursorHelper*>(xLastResult.get());
784 SwPaM* pCursor = pPosCursor ? pPosCursor->GetPaM() : nullptr;
785 if(pCursor)
786 {
787 *pUnoCursor->GetPoint() = *pCursor->End();
788 pUnoCursor->DeleteMark();
789 }
790 else
791 {
792 SwXTextRange* pRange = dynamic_cast<SwXTextRange*>(xLastResult.get());
793 if(!pRange)
794 return nullptr;
795 pRange->GetPositions(*pUnoCursor);
796 if(pUnoCursor->HasMark())
797 {
798 if(*pUnoCursor->GetPoint() < *pUnoCursor->GetMark())
799 pUnoCursor->Exchange();
800 pUnoCursor->DeleteMark();
801 }
802 }
803 const SwNode& rRangeNode = pUnoCursor->GetPointNode();
804 bParentInExtra = rRangeNode.FindFlyStartNode() ||
805 rRangeNode.FindFootnoteStartNode() ||
806 rRangeNode.FindHeaderStartNode() ||
807 rRangeNode.FindFooterStartNode() ;
808 }
809
810 i18nutil::SearchOptions2 aSearchOpt;
811 pSearch->FillSearchOptions( aSearchOpt );
812
822 if(bParentInExtra)
823 eRanges = FindRanges::InOther;
824 if(bAll) //always - everywhere?
825 eRanges = FindRanges::InSelAll;
827 SwDocPositions eEnd = pSearch->m_bBack ? SwDocPositions::Start : SwDocPositions::End;
828
829 nResult = 0;
830 for (int nSearchProc = 0; nSearchProc < 2; ++nSearchProc)
831 {
832 //try attribute search first
833 if(pSearch->HasSearchAttributes())
834 {
840 aSearch( m_pDocShell->GetDoc()->GetAttrPool() );
841 pSearch->FillSearchItemSet(aSearch);
842 bool bCancel;
843 nResult = pUnoCursor->FindAttrs(aSearch, !pSearch->m_bStyles,
844 eStart, eEnd, bCancel,
845 eRanges,
846 !pSearch->m_sSearchText.isEmpty() ? &aSearchOpt : nullptr );
847 }
848 else if(pSearch->m_bStyles)
849 {
850 SwTextFormatColl *pSearchColl = lcl_GetParaStyle(pSearch->m_sSearchText, pUnoCursor->GetDoc());
851 //pSearch->sReplaceText
852 SwTextFormatColl *pReplaceColl = nullptr;
853 bool bCancel;
854 nResult = pUnoCursor->FindFormat(*pSearchColl,
855 eStart, eEnd, bCancel,
856 eRanges, pReplaceColl );
857 }
858 else
859 {
860 //todo/mba: assuming that notes should be omitted
861 bool bCancel;
862 nResult = pUnoCursor->Find_Text(aSearchOpt, false/*bSearchInNotes*/,
863 eStart, eEnd, bCancel,
864 eRanges );
865 }
866 if(nResult || (eRanges&(FindRanges::InSelAll|FindRanges::InOther)))
867 break;
868 //second step - find in other
869 eRanges = FindRanges::InOther;
870 }
871 return pUnoCursor;
872}
873
874Reference< XIndexAccess >
875 SwXTextDocument::findAll(const Reference< util::XSearchDescriptor > & xDesc)
876{
877 SolarMutexGuard aGuard;
878 Reference< XInterface > xTmp;
879 sal_Int32 nResult = 0;
880 Reference< XTextCursor > xCursor;
881 auto pResultCursor(FindAny(xDesc, xCursor, true, nResult, xTmp));
882 if(!pResultCursor)
883 throw RuntimeException("No result cursor");
884 Reference< XIndexAccess > xRet = SwXTextRanges::Create( nResult ? &(*pResultCursor) : nullptr );
885 return xRet;
886}
887
888Reference< XInterface > SwXTextDocument::findFirst(const Reference< util::XSearchDescriptor > & xDesc)
889{
890 SolarMutexGuard aGuard;
891 Reference< XInterface > xTmp;
892 sal_Int32 nResult = 0;
893 Reference< XTextCursor > xCursor;
894 auto pResultCursor(FindAny(xDesc, xCursor, false, nResult, xTmp));
895 if(!pResultCursor)
896 throw RuntimeException("No result cursor");
897 Reference< XInterface > xRet;
898 if(nResult)
899 {
900 const uno::Reference< text::XText > xParent =
902 *pResultCursor->GetPoint());
903 xRet = *new SwXTextCursor(xParent, *pResultCursor);
904 }
905 return xRet;
906}
907
908Reference< XInterface > SwXTextDocument::findNext(const Reference< XInterface > & xStartAt,
909 const Reference< util::XSearchDescriptor > & xDesc)
910{
911 SolarMutexGuard aGuard;
912 sal_Int32 nResult = 0;
913 Reference< XTextCursor > xCursor;
914 if(!xStartAt.is())
915 throw RuntimeException("xStartAt missing");
916 auto pResultCursor(FindAny(xDesc, xCursor, false, nResult, xStartAt));
917 if(!pResultCursor)
918 throw RuntimeException("No result cursor");
919 Reference< XInterface > xRet;
920 if(nResult)
921 {
922 const uno::Reference< text::XText > xParent =
924 *pResultCursor->GetPoint());
925
926 xRet = *new SwXTextCursor(xParent, *pResultCursor);
927 }
928 return xRet;
929}
930
931Sequence< beans::PropertyValue > SwXTextDocument::getPagePrintSettings()
932{
933 SolarMutexGuard aGuard;
934 Sequence< beans::PropertyValue > aSeq(9);
935 if(!IsValid())
936 throw DisposedException("", static_cast< XTextDocument* >(this));
937
938 beans::PropertyValue* pArray = aSeq.getArray();
941 if(pData)
942 aData = *pData;
943 Any aVal;
944 aVal <<= aData.GetRow();
945 pArray[0] = beans::PropertyValue("PageRows", -1, aVal, PropertyState_DIRECT_VALUE);
946 aVal <<= aData.GetCol();
947 pArray[1] = beans::PropertyValue("PageColumns", -1, aVal, PropertyState_DIRECT_VALUE);
948 aVal <<= static_cast<sal_Int32>(convertTwipToMm100(aData.GetLeftSpace()));
949 pArray[2] = beans::PropertyValue("LeftMargin", -1, aVal, PropertyState_DIRECT_VALUE);
950 aVal <<= static_cast<sal_Int32>(convertTwipToMm100(aData.GetRightSpace()));
951 pArray[3] = beans::PropertyValue("RightMargin", -1, aVal, PropertyState_DIRECT_VALUE);
952 aVal <<= static_cast<sal_Int32>(convertTwipToMm100(aData.GetTopSpace()));
953 pArray[4] = beans::PropertyValue("TopMargin", -1, aVal, PropertyState_DIRECT_VALUE);
954 aVal <<= static_cast<sal_Int32>(convertTwipToMm100(aData.GetBottomSpace()));
955 pArray[5] = beans::PropertyValue("BottomMargin", -1, aVal, PropertyState_DIRECT_VALUE);
956 aVal <<= static_cast<sal_Int32>(convertTwipToMm100(aData.GetHorzSpace()));
957 pArray[6] = beans::PropertyValue("HoriMargin", -1, aVal, PropertyState_DIRECT_VALUE);
958 aVal <<= static_cast<sal_Int32>(convertTwipToMm100(aData.GetVertSpace()));
959 pArray[7] = beans::PropertyValue("VertMargin", -1, aVal, PropertyState_DIRECT_VALUE);
960 aVal <<= aData.GetLandscape();
961 pArray[8] = beans::PropertyValue("IsLandscape", -1, aVal, PropertyState_DIRECT_VALUE);
962
963 return aSeq;
964}
965
966static sal_uInt32 lcl_Any_To_ULONG(const Any& rValue, bool& bException)
967{
968 bException = false;
969 TypeClass eType = rValue.getValueType().getTypeClass();
970
971 sal_uInt32 nRet = 0;
972 if( eType == TypeClass_UNSIGNED_LONG )
973 rValue >>= nRet;
974 else
975 {
976 sal_Int32 nVal=0;
977 bException = !(rValue >>= nVal);
978 if( !bException )
979 nRet = static_cast<sal_uInt32>(nVal);
980 }
981
982 return nRet;
983}
984
985static OUString lcl_CreateOutlineString(const size_t nIndex, const SwDoc* pDoc)
986{
987 OUStringBuffer sEntry;
988 const SwOutlineNodes& rOutlineNodes = pDoc->GetNodes().GetOutLineNds();
989 const SwNumRule* pOutlRule = pDoc->GetOutlineNumRule();
990 const SwTextNode * pTextNd = rOutlineNodes[ nIndex ]->GetTextNode();
991 SwNumberTree::tNumberVector aNumVector = pTextNd->GetNumberVector();
992 if( pOutlRule && pTextNd->GetNumRule())
993 for( int nLevel = 0;
994 nLevel <= pTextNd->GetActualListLevel();
995 nLevel++ )
996 {
997 tools::Long nVal = aNumVector[nLevel];
998 nVal ++;
999 nVal -= pOutlRule->Get(nLevel).GetStart();
1000 sEntry.append( OUString::number(nVal) + ".");
1001 }
1002 OUString sOutlineText = pDoc->getIDocumentOutlineNodes().getOutlineText(
1003 nIndex, pDoc->GetDocShell()->GetWrtShell()->GetLayout(), false);
1004 sEntry.append(sOutlineText);
1005 return sEntry.makeStringAndClear();
1006}
1007
1008void SwXTextDocument::setPagePrintSettings(const Sequence< beans::PropertyValue >& aSettings)
1009{
1010 SolarMutexGuard aGuard;
1011 if(!IsValid())
1012 throw DisposedException("", static_cast< XTextDocument* >(this));
1013
1015 //if only a few properties are coming, then use the current settings
1017 if(pData)
1018 aData = *pData;
1019 for(const beans::PropertyValue& rProperty : aSettings)
1020 {
1021 OUString sName = rProperty.Name;
1022 const Any& rVal = rProperty.Value;
1023 bool bException;
1024 sal_uInt32 nVal = lcl_Any_To_ULONG(rVal, bException);
1025 if( sName == "PageRows" )
1026 {
1027 if(!nVal || nVal > 0xff)
1028 throw RuntimeException("Invalid value");
1029 aData.SetRow(nVal);
1030 }
1031 else if(sName == "PageColumns")
1032 {
1033 if(!nVal || nVal > 0xff)
1034 throw RuntimeException("Invalid value");
1035 aData.SetCol(nVal);
1036 }
1037 else if(sName == "LeftMargin")
1038 {
1039 aData.SetLeftSpace(o3tl::toTwips(nVal, o3tl::Length::mm100));
1040 }
1041 else if(sName == "RightMargin")
1042 {
1043 aData.SetRightSpace(o3tl::toTwips(nVal, o3tl::Length::mm100));
1044 }
1045 else if(sName == "TopMargin")
1046 {
1047 aData.SetTopSpace(o3tl::toTwips(nVal, o3tl::Length::mm100));
1048 }
1049 else if(sName == "BottomMargin")
1050 {
1051 aData.SetBottomSpace(o3tl::toTwips(nVal, o3tl::Length::mm100));
1052 }
1053 else if(sName == "HoriMargin")
1054 {
1055 aData.SetHorzSpace(o3tl::toTwips(nVal, o3tl::Length::mm100));
1056 }
1057 else if(sName == "VertMargin")
1058 {
1059 aData.SetVertSpace(o3tl::toTwips(nVal, o3tl::Length::mm100));
1060 }
1061 else if(sName == "IsLandscape")
1062 {
1063 auto b = o3tl::tryAccess<bool>(rVal);
1064 bException = !b;
1065 if (b)
1066 {
1067 aData.SetLandscape(*b);
1068 }
1069 }
1070 else
1071 bException = true;
1072 if(bException)
1073 throw RuntimeException();
1074 }
1076
1077}
1078
1079void SwXTextDocument::printPages(const Sequence< beans::PropertyValue >& xOptions)
1080{
1081 SolarMutexGuard aGuard;
1082 if(!IsValid())
1083 throw DisposedException("", static_cast< XTextDocument* >(this));
1084
1086 SfxRequest aReq(FN_PRINT_PAGEPREVIEW, SfxCallMode::SYNCHRON,
1089
1090 for ( const beans::PropertyValue &rProp : xOptions )
1091 {
1092 // get Property-Value from options
1093 Any aValue( rProp.Value );
1094
1095 // FileName-Property?
1096 if ( rProp.Name == UNO_NAME_FILE_NAME )
1097 {
1098 OUString sFileURL;
1099 if ( rProp.Value >>= sFileURL )
1100 {
1101 // Convert the File URL into a system dependent path, as the SalPrinter expects
1102 OUString sSystemPath;
1103 FileBase::getSystemPathFromFileURL ( sFileURL, sSystemPath );
1104 aReq.AppendItem(SfxStringItem( SID_FILE_NAME, sSystemPath ) );
1105 }
1106 else if ( rProp.Value.getValueType() != cppu::UnoType<void>::get() )
1107 throw IllegalArgumentException();
1108 }
1109
1110 // CopyCount-Property
1111 else if ( rProp.Name == UNO_NAME_COPY_COUNT )
1112 {
1113 sal_Int32 nCopies = 0;
1114 aValue >>= nCopies;
1115 aReq.AppendItem(SfxInt16Item( SID_PRINT_COPIES, static_cast<sal_Int16>(nCopies) ) );
1116 }
1117
1118 // Collate-Property
1119 else if ( rProp.Name == UNO_NAME_COLLATE )
1120 {
1121 auto b = o3tl::tryAccess<bool>(rProp.Value);
1122 if ( !b )
1123 throw IllegalArgumentException();
1124 aReq.AppendItem(SfxBoolItem( SID_PRINT_COLLATE, *b ) );
1125
1126 }
1127
1128 // Sort-Property
1129 else if ( rProp.Name == UNO_NAME_SORT )
1130 {
1131 auto b = o3tl::tryAccess<bool>(rProp.Value);
1132 if ( !b )
1133 throw IllegalArgumentException();
1134
1135 aReq.AppendItem(SfxBoolItem( SID_PRINT_SORT, *b ) );
1136 }
1137
1138 // Pages-Property
1139 else if ( rProp.Name == UNO_NAME_PAGES )
1140 {
1141 OUString sTmp;
1142 if ( !(rProp.Value >>= sTmp) )
1143 throw IllegalArgumentException();
1144
1145 aReq.AppendItem( SfxStringItem( SID_PRINT_PAGES, sTmp ) );
1146
1147 }
1148 }
1149
1150 // #i117783#
1152 pFrame->GetViewShell()->ExecuteSlot(aReq);
1153 // Frame close
1154 pFrame->DoClose();
1155
1156}
1157
1158Reference< XNameAccess > SwXTextDocument::getReferenceMarks()
1159{
1160 SolarMutexGuard aGuard;
1161 if(!IsValid())
1162 throw DisposedException("", static_cast< XTextDocument* >(this));
1163 if(!mxXReferenceMarks.is())
1164 {
1166 }
1167 return mxXReferenceMarks;
1168}
1169
1170Reference< XEnumerationAccess > SwXTextDocument::getTextFields()
1171{
1172 SolarMutexGuard aGuard;
1173 if(!IsValid())
1174 throw DisposedException("", static_cast< XTextDocument* >(this));
1175 if(!mxXTextFieldTypes.is())
1176 {
1178 }
1179 return mxXTextFieldTypes;
1180}
1181
1183{
1184 SolarMutexGuard aGuard;
1185 if(!IsValid())
1186 throw DisposedException("", static_cast< XTextDocument* >(this));
1187 if(!mxXTextFieldMasters.is())
1188 {
1190 }
1191 return mxXTextFieldMasters;
1192}
1193
1194Reference< XNameAccess > SwXTextDocument::getEmbeddedObjects()
1195{
1196 SolarMutexGuard aGuard;
1197 if(!IsValid())
1198 throw DisposedException("", static_cast< XTextDocument* >(this));
1199 if(!mxXEmbeddedObjects.is())
1200 {
1202 }
1203 return mxXEmbeddedObjects;
1204}
1205
1206Reference< XNameAccess > SwXTextDocument::getBookmarks()
1207{
1208 SolarMutexGuard aGuard;
1209 if(!IsValid())
1210 throw DisposedException("", static_cast< XTextDocument* >(this));
1211 if(!mxXBookmarks.is())
1212 {
1214 }
1215 return mxXBookmarks;
1216}
1217
1218Reference< XNameAccess > SwXTextDocument::getTextSections()
1219{
1220 SolarMutexGuard aGuard;
1221 if(!IsValid())
1222 throw DisposedException("", static_cast< XTextDocument* >(this));
1223 if(!mxXTextSections.is())
1224 {
1226 }
1227 return mxXTextSections;
1228}
1229
1230Reference< XNameAccess > SwXTextDocument::getTextTables()
1231{
1232 SolarMutexGuard aGuard;
1233 if(!IsValid())
1234 throw DisposedException("", static_cast< XTextDocument* >(this));
1235 if(!mxXTextTables.is())
1236 {
1238 }
1239 return mxXTextTables;
1240}
1241
1242Reference< XNameAccess > SwXTextDocument::getGraphicObjects()
1243{
1244 SolarMutexGuard aGuard;
1245 if(!IsValid())
1246 throw DisposedException("", static_cast< XTextDocument* >(this));
1247 if(!mxXGraphicObjects.is())
1248 {
1250 }
1251 return mxXGraphicObjects;
1252}
1253
1254Reference< XNameAccess > SwXTextDocument::getTextFrames()
1255{
1256 SolarMutexGuard aGuard;
1257 if(!IsValid())
1258 throw DisposedException("", static_cast< XTextDocument* >(this));
1259 if(!mxXTextFrames.is())
1260 {
1262 }
1263 return mxXTextFrames;
1264}
1265
1266Reference< XNameAccess > SwXTextDocument::getStyleFamilies()
1267{
1268 SolarMutexGuard aGuard;
1269 if(!IsValid())
1270 throw DisposedException("", static_cast< XTextDocument* >(this));
1271 if(!mxXStyleFamilies.is())
1272 {
1274 }
1275 return mxXStyleFamilies;
1276}
1277
1278uno::Reference< style::XAutoStyles > SwXTextDocument::getAutoStyles( )
1279{
1280 SolarMutexGuard aGuard;
1281 if(!IsValid())
1282 throw DisposedException("", static_cast< XTextDocument* >(this));
1283 if(!mxXAutoStyles.is())
1284 {
1286 }
1287 return mxXAutoStyles;
1288
1289}
1290
1291Reference< drawing::XDrawPage > SwXTextDocument::getDrawPage()
1292{
1293 SolarMutexGuard aGuard;
1294 if(!IsValid())
1295 throw DisposedException("", static_cast< XTextDocument* >(this));
1296 if(!m_xDrawPage.is())
1297 {
1298 SwDoc* pDoc = m_pDocShell->GetDoc();
1299 // #i52858#
1301 SdrPage* pPage = pModel->GetPage( 0 );
1302 m_xDrawPage = new SwFmDrawPage(pDoc, pPage);
1303 }
1304 return m_xDrawPage;
1305}
1306
1307namespace {
1308
1309class SwDrawPagesObj : public cppu::WeakImplHelper<
1310 css::drawing::XDrawPages,
1311 css::lang::XServiceInfo>
1312{
1313private:
1314 css::uno::Reference< css::drawing::XDrawPageSupplier > m_xDoc;
1315public:
1316 SwDrawPagesObj(css::uno::Reference< css::drawing::XDrawPageSupplier > xDoc) : m_xDoc(std::move(xDoc)) {}
1317
1318 // XDrawPages
1319 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL
1320 insertNewByIndex(sal_Int32 /*nIndex*/) override { throw css::lang::NoSupportException(); }
1321
1322 virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XDrawPage >& /*xPage*/) override
1323 {
1324 throw css::lang::NoSupportException();
1325 }
1326
1327 // XIndexAccess
1328 virtual sal_Int32 SAL_CALL getCount() override { return 1; }
1329
1330 virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
1331 {
1332 if (Index != 0)
1333 throw css::lang::IndexOutOfBoundsException("Writer documents have only one DrawPage!");
1334 return css::uno::Any(m_xDoc->getDrawPage());
1335 }
1336
1337 // XElementAccess
1338 virtual css::uno::Type SAL_CALL getElementType() override
1339 {
1341 }
1342
1343 virtual sal_Bool SAL_CALL hasElements() override { return true; }
1344
1345 // XServiceInfo
1346 virtual OUString SAL_CALL getImplementationName() override
1347 {
1348 return "SwDrawPagesObj";
1349 }
1350
1351 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override
1352 {
1353 return cppu::supportsService(this, ServiceName);
1354 }
1355
1356 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
1357 {
1358 return { "com.sun.star.drawing.DrawPages" };
1359 }
1360};
1361
1362}
1363
1364// XDrawPagesSupplier
1365
1366uno::Reference<drawing::XDrawPages> SAL_CALL SwXTextDocument::getDrawPages()
1367{
1368 SolarMutexGuard aGuard;
1369 return new SwDrawPagesObj(this);
1370}
1371
1373{
1374 m_bObjectValid = false;
1375 if(m_xNumFormatAgg.is())
1376 {
1377 const uno::Type& rTunnelType = cppu::UnoType<XUnoTunnel>::get();
1378 Any aNumTunnel = m_xNumFormatAgg->queryAggregation(rTunnelType);
1379 Reference< XUnoTunnel > xNumTunnel;
1380 aNumTunnel >>= xNumTunnel;
1381 SvNumberFormatsSupplierObj* pNumFormat
1382 = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(xNumTunnel);
1383 OSL_ENSURE(pNumFormat, "No number formatter available");
1384 if (pNumFormat)
1385 pNumFormat->SetNumberFormatter(nullptr);
1386 OSL_ENSURE(pNumFormat, "No number formatter available");
1387 }
1388 InitNewDoc();
1389 m_pDocShell = nullptr;
1390 lang::EventObject const ev(static_cast<SwXTextDocumentBaseClass &>(*this));
1391 std::unique_lock aGuard(m_pImpl->m_Mutex);
1392 m_pImpl->m_RefreshListeners.disposeAndClear(aGuard, ev);
1393}
1394
1396{
1397 if(m_pDocShell && m_pDocShell != pNewDocShell)
1398 Invalidate();
1399 m_pDocShell = pNewDocShell;
1400 m_bObjectValid = true;
1401}
1402
1404{
1405 // first invalidate all collections, then delete references and Set to zero
1406 if(mxXTextTables.is())
1407 {
1408 XNameAccess* pTables = mxXTextTables.get();
1409 static_cast<SwXTextTables*>(pTables)->Invalidate();
1410 mxXTextTables.clear();
1411 }
1412
1413 if(mxXTextFrames.is())
1414 {
1415 XNameAccess* pFrames = mxXTextFrames.get();
1416 static_cast<SwXTextFrames*>(pFrames)->Invalidate();
1417 mxXTextFrames.clear();
1418 }
1419
1420 if(mxXGraphicObjects.is())
1421 {
1422 XNameAccess* pFrames = mxXGraphicObjects.get();
1423 static_cast<SwXTextGraphicObjects*>(pFrames)->Invalidate();
1424 mxXGraphicObjects.clear();
1425 }
1426
1427 if(mxXEmbeddedObjects.is())
1428 {
1429 XNameAccess* pOLE = mxXEmbeddedObjects.get();
1430 static_cast<SwXTextEmbeddedObjects*>(pOLE)->Invalidate();
1431 mxXEmbeddedObjects.clear();
1432 }
1433
1434 m_xBodyText = nullptr;
1435
1436 if(m_xNumFormatAgg.is())
1437 {
1438 const uno::Type& rTunnelType = cppu::UnoType<XUnoTunnel>::get();
1439 Any aNumTunnel = m_xNumFormatAgg->queryAggregation(rTunnelType);
1440 Reference< XUnoTunnel > xNumTunnel;
1441 aNumTunnel >>= xNumTunnel;
1442 SvNumberFormatsSupplierObj* pNumFormat
1443 = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(xNumTunnel);
1444 OSL_ENSURE(pNumFormat, "No number formatter available");
1445 if (pNumFormat)
1446 pNumFormat->SetNumberFormatter(nullptr);
1447 }
1448
1449 if(mxXTextFieldTypes.is())
1450 {
1451 XEnumerationAccess* pT = mxXTextFieldTypes.get();
1452 static_cast<SwXTextFieldTypes*>(pT)->Invalidate();
1453 mxXTextFieldTypes.clear();
1454 }
1455
1456 if(mxXTextFieldMasters.is())
1457 {
1458 XNameAccess* pT = mxXTextFieldMasters.get();
1459 static_cast<SwXTextFieldMasters*>(pT)->Invalidate();
1460 mxXTextFieldMasters.clear();
1461 }
1462
1463 if(mxXTextSections.is())
1464 {
1465 XNameAccess* pSect = mxXTextSections.get();
1466 static_cast<SwXTextSections*>(pSect)->Invalidate();
1467 mxXTextSections.clear();
1468 }
1469
1470 if(m_xDrawPage.is())
1471 {
1472 // #i91798#, #i91895#
1473 // dispose XDrawPage here. We are the owner and know that it is no longer in a valid condition.
1474 Reference<XComponent>(static_cast<cppu::OWeakObject*>(m_xDrawPage.get()), UNO_QUERY_THROW)->dispose();
1475 m_xDrawPage->InvalidateSwDoc();
1476 m_xDrawPage.clear();
1477 }
1478
1479 if ( mxXNumberingRules.is() )
1480 {
1481 XIndexAccess* pNum = mxXNumberingRules.get();
1482 static_cast<SwXNumberingRulesCollection*>(pNum)->Invalidate();
1483 mxXNumberingRules.clear();
1484 }
1485
1486 if(mxXFootnotes.is())
1487 {
1488 XIndexAccess* pFootnote = mxXFootnotes.get();
1489 static_cast<SwXFootnotes*>(pFootnote)->Invalidate();
1490 mxXFootnotes.clear();
1491 }
1492
1493 if(mxXEndnotes.is())
1494 {
1495 XIndexAccess* pFootnote = mxXEndnotes.get();
1496 static_cast<SwXFootnotes*>(pFootnote)->Invalidate();
1497 mxXEndnotes.clear();
1498 }
1499
1500 if(mxXContentControls.is())
1501 {
1502 XIndexAccess* pContentControls = mxXContentControls.get();
1503 static_cast<SwXContentControls*>(pContentControls)->Invalidate();
1504 mxXContentControls.clear();
1505 }
1506
1507 if(mxXDocumentIndexes.is())
1508 {
1509 XIndexAccess* pIdxs = mxXDocumentIndexes.get();
1510 static_cast<SwXDocumentIndexes*>(pIdxs)->Invalidate();
1511 mxXDocumentIndexes.clear();
1512 }
1513
1514 if(mxXStyleFamilies.is())
1515 {
1516 XNameAccess* pStyles = mxXStyleFamilies.get();
1517 static_cast<SwXStyleFamilies*>(pStyles)->Invalidate();
1518 mxXStyleFamilies.clear();
1519 }
1520 if(mxXAutoStyles.is())
1521 {
1522 XNameAccess* pStyles = mxXAutoStyles.get();
1523 static_cast<SwXAutoStyles*>(pStyles)->Invalidate();
1524 mxXAutoStyles.clear();
1525 }
1526
1527 if(mxXBookmarks.is())
1528 {
1529 XNameAccess* pBm = mxXBookmarks.get();
1530 static_cast<SwXBookmarks*>(pBm)->Invalidate();
1531 mxXBookmarks.clear();
1532 }
1533
1534 if(mxXChapterNumbering.is())
1535 {
1536 XIndexReplace* pCh = mxXChapterNumbering.get();
1537 static_cast<SwXChapterNumbering*>(pCh)->Invalidate();
1538 mxXChapterNumbering.clear();
1539 }
1540
1541 if(mxXFootnoteSettings.is())
1542 {
1543 XPropertySet* pFntSet = mxXFootnoteSettings.get();
1544 static_cast<SwXFootnoteProperties*>(pFntSet)->Invalidate();
1545 mxXFootnoteSettings.clear();
1546 }
1547
1548 if(mxXEndnoteSettings.is())
1549 {
1550 XPropertySet* pEndSet = mxXEndnoteSettings.get();
1551 static_cast<SwXEndnoteProperties*>(pEndSet)->Invalidate();
1552 mxXEndnoteSettings.clear();
1553 }
1554
1556 {
1558 static_cast<SwXLineNumberingProperties*>(pLine)->Invalidate();
1560 }
1561 if(mxXReferenceMarks.is())
1562 {
1563 XNameAccess* pMarks = mxXReferenceMarks.get();
1564 static_cast<SwXReferenceMarks*>(pMarks)->Invalidate();
1565 mxXReferenceMarks.clear();
1566 }
1567 if(mxLinkTargetSupplier.is())
1568 {
1569 XNameAccess* pAccess = mxLinkTargetSupplier.get();
1570 static_cast<SwXLinkTargetSupplier*>(pAccess)->Invalidate();
1571 mxLinkTargetSupplier.clear();
1572 }
1573 if(mxXRedlines.is())
1574 {
1575 XEnumerationAccess* pMarks = mxXRedlines.get();
1576 static_cast<SwXRedlines*>(pMarks)->Invalidate();
1577 mxXRedlines.clear();
1578 }
1579 if(mxPropertyHelper.is())
1580 {
1581 mxPropertyHelper->Invalidate();
1582 mxPropertyHelper.clear();
1583 }
1584}
1585
1586css::uno::Reference<css::uno::XInterface> SwXTextDocument::create(
1587 OUString const & rServiceName,
1588 css::uno::Sequence<css::uno::Any> const * arguments)
1589{
1590 SolarMutexGuard aGuard;
1591 if (!IsValid())
1592 throw DisposedException("", static_cast< XTextDocument* >(this));
1593
1596 {
1598 }
1599 if (rServiceName == "com.sun.star.drawing.DashTable")
1600 {
1602 }
1603 if (rServiceName == "com.sun.star.drawing.GradientTable")
1604 {
1606 }
1607 if (rServiceName == "com.sun.star.drawing.HatchTable")
1608 {
1610 }
1611 if (rServiceName == "com.sun.star.drawing.BitmapTable")
1612 {
1614 }
1615 if (rServiceName == "com.sun.star.drawing.TransparencyGradientTable")
1616 {
1618 }
1619 if (rServiceName == "com.sun.star.drawing.MarkerTable")
1620 {
1622 }
1623 if (rServiceName == "com.sun.star.drawing.Defaults")
1624 {
1626 }
1627 if (rServiceName == "com.sun.star.document.Settings")
1628 {
1629 return Reference<XInterface>(*new SwXDocumentSettings(this));
1630 }
1631 if (rServiceName == "com.sun.star.document.ImportEmbeddedObjectResolver")
1632 {
1633 return static_cast<cppu::OWeakObject *>(
1635 *m_pDocShell, SvXMLEmbeddedObjectHelperMode::Read));
1636 }
1637 if (rServiceName == "com.sun.star.text.DocumentSettings")
1638 {
1639 return Reference<XInterface>(*new SwXDocumentSettings(this));
1640 }
1641 if (rServiceName == "com.sun.star.chart2.data.DataProvider")
1642 {
1643 return Reference<XInterface>(
1644 static_cast<chart2::data::XDataProvider *>(
1646 GetChartDataProvider()));
1647 }
1648 if (!rServiceName.startsWith("com.sun.star.")
1649 || rServiceName.endsWith(".OLE2Shape"))
1650 {
1651 // We do not want to insert OLE2 Shapes (e.g.,
1652 // "com.sun.star.drawing.OLE2Shape", ...) like this (by creating them
1653 // with the documents factory and adding the shapes to the draw page);
1654 // for inserting OLE objects the proper way is to use
1655 // "com.sun.star.text.TextEmbeddedObject":
1656 throw ServiceNotRegisteredException();
1657 }
1658 // The XML import is allowed to create instances of
1659 // "com.sun.star.drawing.OLE2Shape"; thus, a temporary service name is
1660 // introduced to make this possible:
1661 OUString aTmpServiceName(rServiceName);
1662 if (rServiceName == "com.sun.star.drawing.temporaryForXMLImportOLE2Shape")
1663 {
1664 aTmpServiceName = "com.sun.star.drawing.OLE2Shape";
1665 }
1666 Reference<XInterface> xTmp(
1667 arguments == nullptr
1668 ? SvxFmMSFactory::createInstance(aTmpServiceName)
1670 aTmpServiceName, *arguments));
1671 if (rServiceName == "com.sun.star.drawing.GroupShape"
1672 || rServiceName == "com.sun.star.drawing.Shape3DSceneObject")
1673 {
1674 return *new SwXGroupShape(xTmp, m_pDocShell->GetDoc());
1675 }
1676 if (rServiceName.startsWith("com.sun.star.drawing."))
1677 {
1678 return *new SwXShape(xTmp, m_pDocShell->GetDoc());
1679 }
1680 return xTmp;
1681}
1682
1683Reference< XInterface > SwXTextDocument::createInstance(const OUString& rServiceName)
1684{
1685 return create(rServiceName, nullptr);
1686}
1687
1689 const OUString& ServiceSpecifier,
1690 const Sequence< Any >& Arguments)
1691{
1692 return create(ServiceSpecifier, &Arguments);
1693}
1694
1696{
1697 static Sequence< OUString > aServices;
1698 if ( !aServices.hasElements() )
1699 {
1700 Sequence< OUString > aRet = SvxFmMSFactory::getAvailableServiceNames();
1701 auto i = comphelper::findValue(aRet, "com.sun.star.drawing.OLE2Shape");
1702 if (i != -1)
1703 {
1704 auto nLength = aRet.getLength();
1705 aRet.getArray()[i] = aRet[nLength - 1];
1706 aRet.realloc( nLength - 1 );
1707 }
1708 Sequence< OUString > aOwn = SwXServiceProvider::GetAllServiceNames();
1709 aServices = comphelper::concatSequences(aRet, aOwn);
1710 }
1711
1712 return aServices;
1713}
1714
1716{
1717 return "SwXTextDocument";
1718 /* // Matching the .component information:
1719 return dynamic_cast<SwGlobalDocShell*>( pDocShell ) != nullptr
1720 ? OUString("com.sun.star.comp.Writer.GlobalDocument")
1721 : dynamic_cast<SwWebDocShell*>( pDocShell ) != nullptr
1722 ? OUString("com.sun.star.comp.Writer.WebDocument")
1723 : OUString("com.sun.star.comp.Writer.TextDocument");
1724 */
1725}
1726
1727sal_Bool SwXTextDocument::supportsService(const OUString& rServiceName)
1728{
1729 return cppu::supportsService(this, rServiceName);
1730}
1731
1733{
1734 bool bWebDoc = (dynamic_cast<SwWebDocShell*>( m_pDocShell) != nullptr );
1735 bool bGlobalDoc = (dynamic_cast<SwGlobalDocShell*>( m_pDocShell) != nullptr );
1736 bool bTextDoc = (!bWebDoc && !bGlobalDoc);
1737
1738 Sequence< OUString > aRet (3);
1739 OUString* pArray = aRet.getArray();
1740
1741 pArray[0] = "com.sun.star.document.OfficeDocument";
1742 pArray[1] = "com.sun.star.text.GenericTextDocument";
1743
1744 if (bTextDoc)
1745 pArray[2] = "com.sun.star.text.TextDocument";
1746 else if (bWebDoc)
1747 pArray[2] = "com.sun.star.text.WebDocument";
1748 else if (bGlobalDoc)
1749 pArray[2] = "com.sun.star.text.GlobalDocument";
1750
1751 return aRet;
1752}
1753
1754Reference< XIndexAccess > SwXTextDocument::getDocumentIndexes()
1755{
1756 SolarMutexGuard aGuard;
1757 if(!IsValid())
1758 throw DisposedException("", static_cast< XTextDocument* >(this));
1759
1760 if(!mxXDocumentIndexes.is())
1761 {
1763 }
1764 return mxXDocumentIndexes;
1765}
1766
1767Reference< XPropertySetInfo > SwXTextDocument::getPropertySetInfo()
1768{
1769 static Reference< XPropertySetInfo > xRet = m_pPropSet->getPropertySetInfo();
1770 return xRet;
1771}
1772
1773void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any& aValue)
1774{
1775 SolarMutexGuard aGuard;
1776 if(!IsValid())
1777 throw DisposedException("", static_cast< XTextDocument* >(this));
1778
1779 const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName);
1780
1781 if(!pEntry)
1782 throw UnknownPropertyException(rPropertyName);
1783 if(pEntry->nFlags & PropertyAttribute::READONLY)
1784 throw PropertyVetoException();
1785 switch(pEntry->nWID)
1786 {
1787 case WID_DOC_CHAR_COUNT :
1788 case WID_DOC_PARA_COUNT :
1789 case WID_DOC_WORD_COUNT :
1790 throw RuntimeException(
1791 "bad WID",
1792 static_cast< cppu::OWeakObject * >(
1793 static_cast< SwXTextDocumentBaseClass * >(this)));
1795 {
1796 OUString sDelim;
1797 aValue >>= sDelim;
1798 SW_MOD()->GetModuleConfig()->SetWordDelimiter(sDelim);
1799 }
1800 break;
1803 {
1804 bool bSet = *o3tl::doAccess<bool>(aValue);
1806 if(WID_DOC_CHANGES_SHOW == pEntry->nWID)
1807 {
1809 if( !bSet )
1811 }
1812 else if(WID_DOC_CHANGES_RECORD == pEntry->nWID)
1813 {
1815 }
1817 }
1818 break;
1820 {
1821 Sequence <sal_Int8> aNew;
1822 if(aValue >>= aNew)
1823 {
1824 SwDoc* pDoc = m_pDocShell->GetDoc();
1826 if(aNew.hasElements())
1827 {
1831 }
1832 }
1833 }
1834 break;
1836 {
1837 OUString sURL;
1838 aValue >>= sURL;
1840 }
1841 break;
1842 case WID_DOC_HIDE_TIPS :
1843 SW_MOD()->GetModuleConfig()->SetHideFieldTips(*o3tl::doAccess<bool>(aValue));
1844 break;
1846 {
1848 eRedMode = eRedMode & (~RedlineFlags::ShowMask);
1849 sal_Int16 nSet = 0;
1850 aValue >>= nSet;
1851 switch(nSet)
1852 {
1853 case RedlineDisplayType::NONE: break;
1855 case RedlineDisplayType::REMOVED: eRedMode |= RedlineFlags::ShowDelete; break;
1856 case RedlineDisplayType::
1857 INSERTED_AND_REMOVED: eRedMode |= RedlineFlags::ShowInsert|RedlineFlags::ShowDelete;
1858 break;
1859 default: throw IllegalArgumentException();
1860 }
1862 }
1863 break;
1865 {
1866 sal_Int16 nYear = 0;
1867 aValue >>= nYear;
1868 SfxRequest aRequest ( SID_ATTR_YEAR2000, SfxCallMode::SLOT, m_pDocShell->GetDoc()->GetAttrPool());
1869 aRequest.AppendItem(SfxUInt16Item( SID_ATTR_YEAR2000, static_cast < sal_uInt16 > ( nYear ) ) );
1870 m_pDocShell->Execute ( aRequest );
1871 }
1872 break;
1874 {
1876 bool bAuto = *o3tl::doAccess<bool>(aValue);
1877
1878 if ( nullptr != pDrawDoc )
1879 pDrawDoc->SetAutoControlFocus( bAuto );
1880 else if (bAuto)
1881 {
1882 // if setting to true, and we don't have an
1883 // SdrModel, then we are changing the default and
1884 // must thus create an SdrModel, if we don't have an
1885 // SdrModel and we are leaving the default at false,
1886 // we don't need to make an SdrModel and can do nothing
1887 // #i52858# - method name changed
1889 pDrawDoc->SetAutoControlFocus ( bAuto );
1890 }
1891 }
1892 break;
1894 {
1896 bool bMode = *o3tl::doAccess<bool>(aValue);
1897
1898 if ( nullptr != pDrawDoc )
1899 pDrawDoc->SetOpenInDesignMode( bMode );
1900 else if (!bMode)
1901 {
1902 // if setting to false, and we don't have an
1903 // SdrModel, then we are changing the default and
1904 // must thus create an SdrModel, if we don't have an
1905 // SdrModel and we are leaving the default at true,
1906 // we don't need to make an SdrModel and can do
1907 // nothing
1908 // #i52858# - method name changed
1910 pDrawDoc->SetOpenInDesignMode ( bMode );
1911 }
1912 }
1913 break;
1914 // #i42634# New property to set the bInReading
1915 // flag at the document, used during binary import
1917 {
1918 SwDoc* pDoc = m_pDocShell->GetDoc();
1919 bool bBool (false);
1920 if( aValue >>= bBool )
1921 {
1922 pDoc->SetInReading( bBool );
1923 }
1924 }
1925 break;
1927 {
1928 SwDoc* pDoc = m_pDocShell->GetDoc();
1929 bool bBool = {};
1930 if (aValue >>= bBool)
1931 { // HACK: writerfilter has to use API to set this :(
1932 bool bOld = pDoc->IsInWriterfilterImport();
1933 pDoc->SetInWriterfilterImport(bBool);
1934 if (bOld && !bBool)
1935 {
1936 pDoc->getIDocumentFieldsAccess().SetFieldsDirty(false, nullptr, SwNodeOffset(0));
1937 }
1938 }
1939 }
1940 break;
1941 case WID_DOC_BUILDID:
1942 aValue >>= maBuildId;
1943 break;
1944
1946 {
1947 bool bDefaultPageMode( false );
1948 aValue >>= bDefaultPageMode;
1949 m_pDocShell->GetDoc()->SetDefaultPageMode( bDefaultPageMode );
1950 }
1951 break;
1953 setGrabBagItem(aValue);
1954 break;
1955
1956 default:
1957 {
1958 const SfxPoolItem& rItem = m_pDocShell->GetDoc()->GetDefault(pEntry->nWID);
1959 std::unique_ptr<SfxPoolItem> pNewItem(rItem.Clone());
1960 pNewItem->PutValue(aValue, pEntry->nMemberId);
1961 m_pDocShell->GetDoc()->SetDefault(*pNewItem);
1962 }
1963 }
1964}
1965
1966Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
1967{
1968 SolarMutexGuard aGuard;
1969 if(!IsValid())
1970 throw DisposedException("", static_cast< XTextDocument* >(this));
1971
1972 if (rPropertyName == "ODFExport_ListNodes")
1973 {
1974 // A hack to avoid writing random list ids to ODF when they are not referred later
1975 // see XMLTextParagraphExport::DocumentListNodes ctor
1976
1977 // Sequence of nodes, each of them represented by three-element sequence:
1978 // [ index, styleIntPtr, list_id ]
1979 std::vector<css::uno::Sequence<css::uno::Any>> nodes;
1980
1981 const SwDoc& rDoc = *m_pDocShell->GetDoc();
1982 for (const SwNumRule* pNumRule : rDoc.GetNumRuleTable())
1983 {
1984 SwNumRule::tTextNodeList textNodes;
1985 pNumRule->GetTextNodeList(textNodes);
1986 css::uno::Any styleIntPtr(reinterpret_cast<sal_uInt64>(pNumRule));
1987
1988 for (const SwTextNode* pTextNode : textNodes)
1989 {
1990 css::uno::Any index(pTextNode->GetIndex().get());
1991 css::uno::Any list_id(pTextNode->GetListId());
1992
1993 nodes.push_back({ index, styleIntPtr, list_id });
1994 }
1995 }
1996 return css::uno::Any(comphelper::containerToSequence(nodes));
1997 }
1998
1999 const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName);
2000
2001 if(!pEntry)
2002 throw UnknownPropertyException(rPropertyName);
2003 Any aAny;
2004 switch(pEntry->nWID)
2005 {
2007 aAny <<= m_pDocShell->IsTemplate();
2008 break;
2009 case WID_DOC_CHAR_COUNT :
2010 case WID_DOC_PARA_COUNT :
2011 case WID_DOC_WORD_COUNT :
2012 {
2013 const SwDocStat& rStat(m_pDocShell->GetDoc()->getIDocumentStatistics().GetUpdatedDocStat( false, true ));
2014 sal_Int32 nValue;
2015 switch(pEntry->nWID)
2016 {
2017 case WID_DOC_CHAR_COUNT :nValue = rStat.nChar;break;
2018 case WID_DOC_PARA_COUNT :nValue = rStat.nPara;break;
2019 case WID_DOC_WORD_COUNT :nValue = rStat.nWord;break;
2020 }
2021 aAny <<= nValue;
2022 }
2023 break;
2025 {
2026 aAny <<= SW_MOD()->GetDocStatWordDelim();
2027 }
2028 break;
2031 {
2033 bool bSet = false;
2034 if(WID_DOC_CHANGES_SHOW == pEntry->nWID)
2035 {
2037 }
2038 else if(WID_DOC_CHANGES_RECORD == pEntry->nWID)
2039 {
2040 bSet = bool(eMode & RedlineFlags::On);
2041 }
2042 aAny <<= bSet;
2043 }
2044 break;
2046 {
2047 SwDoc* pDoc = m_pDocShell->GetDoc();
2049 }
2050 break;
2052 aAny <<= m_pDocShell->GetDoc()->GetTOIAutoMarkURL();
2053 break;
2054 case WID_DOC_HIDE_TIPS :
2055 aAny <<= SW_MOD()->GetModuleConfig()->IsHideFieldTips();
2056 break;
2058 {
2060 eRedMode = eRedMode & RedlineFlags::ShowMask;
2061 sal_Int16 nRet = RedlineDisplayType::NONE;
2062 if(RedlineFlags::ShowInsert == eRedMode)
2064 else if(RedlineFlags::ShowDelete == eRedMode)
2065 nRet = RedlineDisplayType::REMOVED;
2066 else if(RedlineFlags::ShowMask == eRedMode)
2067 nRet = RedlineDisplayType::INSERTED_AND_REMOVED;
2068 aAny <<= nRet;
2069 }
2070 break;
2072 {
2074 Reference<XForbiddenCharacters> xRet = mxPropertyHelper;
2075 aAny <<= xRet;
2076 }
2077 break;
2079 {
2080 aAny <<= static_cast < sal_Int16 > (m_pDocShell->GetDoc()->GetNumberFormatter ()->GetYear2000());
2081 }
2082 break;
2084 {
2086 bool bAuto;
2087 if ( nullptr != pDrawDoc )
2088 bAuto = pDrawDoc->GetAutoControlFocus();
2089 else
2090 bAuto = false;
2091 aAny <<= bAuto;
2092 }
2093 break;
2095 {
2097 bool bMode;
2098 if ( nullptr != pDrawDoc )
2099 bMode = pDrawDoc->GetOpenInDesignMode();
2100 else
2101 bMode = true;
2102 aAny <<= bMode;
2103 }
2104 break;
2106 aAny <<= m_pDocShell->GetBasicContainer();
2107 break;
2109 aAny <<= m_pDocShell->GetDialogContainer();
2110 break;
2111 case WID_DOC_VBA_DOCOBJ:
2112 {
2113 /* #i111553# This property provides the name of the constant that
2114 will be used to store this model in the global Basic manager.
2115 That constant will be equivalent to 'ThisComponent' but for
2116 each application, so e.g. a 'ThisExcelDoc' and a 'ThisWordDoc'
2117 constant can co-exist, as required by VBA. */
2118 aAny <<= OUString( "ThisWordDoc" );
2119 }
2120 break;
2122 aAny <<= getRuntimeUID();
2123 break;
2125 aAny <<= m_pDocShell->GetDoc()->IsInReading();
2126 break;
2127 case WID_DOC_BUILDID:
2128 aAny <<= maBuildId;
2129 break;
2131 aAny <<= hasValidSignatures();
2132 break;
2134 getGrabBagItem(aAny);
2135 break;
2136
2137 default:
2138 {
2139 const SfxPoolItem& rItem = m_pDocShell->GetDoc()->GetDefault(pEntry->nWID);
2140 rItem.QueryValue(aAny, pEntry->nMemberId);
2141 }
2142 }
2143 return aAny;
2144}
2145
2146void SwXTextDocument::addPropertyChangeListener(const OUString& /*PropertyName*/,
2147 const Reference< XPropertyChangeListener > & /*aListener*/)
2148{
2149 OSL_FAIL("not implemented");
2150}
2151
2152void SwXTextDocument::removePropertyChangeListener(const OUString& /*PropertyName*/,
2153 const Reference< XPropertyChangeListener > & /*aListener*/)
2154{
2155 OSL_FAIL("not implemented");
2156}
2157
2158void SwXTextDocument::addVetoableChangeListener(const OUString& /*PropertyName*/,
2159 const Reference< XVetoableChangeListener > & /*aListener*/)
2160{
2161 OSL_FAIL("not implemented");
2162}
2163
2164void SwXTextDocument::removeVetoableChangeListener(const OUString& /*PropertyName*/,
2165 const Reference< XVetoableChangeListener > & /*aListener*/)
2166{
2167 OSL_FAIL("not implemented");
2168}
2169
2170Reference< XNameAccess > SwXTextDocument::getLinks()
2171{
2172 if(!mxLinkTargetSupplier.is())
2173 {
2175 }
2176 return mxLinkTargetSupplier;
2177}
2178
2179Reference< XEnumerationAccess > SwXTextDocument::getRedlines( )
2180{
2181 if(!mxXRedlines.is())
2182 {
2184 }
2185 return mxXRedlines;
2186}
2187
2189{
2190 // why does SwBaseShell not just call refresh? maybe because it's rSh is
2191 // (sometimes) a different shell than GetWrtShell()?
2192 lang::EventObject const ev(static_cast<SwXTextDocumentBaseClass &>(*this));
2193 std::unique_lock aGuard(m_pImpl->m_Mutex);
2194 m_pImpl->m_RefreshListeners.notifyEach(aGuard,
2195 & util::XRefreshListener::refreshed, ev);
2196}
2197
2199{
2200 SolarMutexGuard aGuard;
2201 if(!IsValid())
2202 throw DisposedException("", static_cast< XTextDocument* >(this));
2203
2204 SwViewShell *pViewShell = m_pDocShell->GetWrtShell();
2206 if(pViewShell)
2207 pViewShell->Reformat();
2208}
2209
2211 const Reference<util::XRefreshListener> & xListener)
2212{
2213 if (xListener)
2214 {
2215 std::unique_lock aGuard(m_pImpl->m_Mutex);
2216 m_pImpl->m_RefreshListeners.addInterface(aGuard, xListener);
2217 }
2218}
2219
2221 const Reference<util::XRefreshListener> & xListener)
2222{
2223 if (xListener)
2224 {
2225 std::unique_lock aGuard(m_pImpl->m_Mutex);
2226 m_pImpl->m_RefreshListeners.removeInterface(aGuard, xListener);
2227 }
2228}
2229
2231{
2232 SolarMutexGuard aGuard;
2233 if(!IsValid())
2234 throw DisposedException("", static_cast< XTextDocument* >(this));
2235
2236 SwDoc* pDoc = m_pDocShell->GetDoc();
2238 if( !rLnkMan.GetLinks().empty() )
2239 {
2240 UnoActionContext aAction(pDoc);
2241 rLnkMan.UpdateAllLinks( false, true, nullptr );
2242 }
2243}
2244
2245//XPropertyState
2246PropertyState SAL_CALL SwXTextDocument::getPropertyState( const OUString& rPropertyName )
2247{
2248 SolarMutexGuard aGuard;
2249 if(!IsValid())
2250 throw DisposedException("", static_cast< XTextDocument* >(this));
2251
2252 const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName);
2253 if(!pEntry)
2254 throw UnknownPropertyException(rPropertyName);
2255 return PropertyState_DIRECT_VALUE;
2256}
2257
2258Sequence< PropertyState > SAL_CALL SwXTextDocument::getPropertyStates( const Sequence< OUString >& rPropertyNames )
2259{
2260 const sal_Int32 nCount = rPropertyNames.getLength();
2261 Sequence < PropertyState > aRet ( nCount );
2262
2263 std::transform(rPropertyNames.begin(), rPropertyNames.end(), aRet.getArray(),
2264 [this](const OUString& rName) -> PropertyState { return getPropertyState(rName); });
2265
2266 return aRet;
2267}
2268
2269void SAL_CALL SwXTextDocument::setPropertyToDefault( const OUString& rPropertyName )
2270{
2271 SolarMutexGuard aGuard;
2272 if(!IsValid())
2273 throw DisposedException("", static_cast< XTextDocument* >(this));
2274
2275 const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName);
2276 if(!pEntry)
2277 throw UnknownPropertyException(rPropertyName);
2278 switch(pEntry->nWID)
2279 {
2280 case 0:default:break;
2281 }
2282}
2283
2284Any SAL_CALL SwXTextDocument::getPropertyDefault( const OUString& rPropertyName )
2285{
2286 SolarMutexGuard aGuard;
2287 if(!IsValid())
2288 throw DisposedException("", static_cast< XTextDocument* >(this));
2289
2290 const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName);
2291 if(!pEntry)
2292 throw UnknownPropertyException(rPropertyName);
2293 Any aAny;
2294 switch(pEntry->nWID)
2295 {
2296 case 0:default:break;
2297 }
2298 return aAny;
2299}
2300
2302{
2304
2305 uno::Any aAny( rPrintUIOptions.getValue( "RenderDevice" ));
2306 uno::Reference< awt::XDevice > xRenderDevice;
2307 aAny >>= xRenderDevice;
2308 if (xRenderDevice.is())
2309 {
2310 VCLXDevice* pDevice = dynamic_cast<VCLXDevice*>( xRenderDevice.get() );
2311 pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >();
2312 }
2313
2314 return pOut;
2315}
2316
2318 const uno::Sequence< beans::PropertyValue >& rOptions,
2319 const char *pPropName )
2320{
2321 return std::any_of(rOptions.begin(), rOptions.end(),
2322 [&pPropName](const beans::PropertyValue& rProp) {
2323 return rProp.Name.equalsAscii( pPropName ); });
2324}
2325
2327 const uno::Sequence< beans::PropertyValue >& rOptions,
2328 const char *pPropName )
2329{
2330 bool bRes = false;
2331 auto pOption = std::find_if(rOptions.begin(), rOptions.end(),
2332 [&pPropName](const beans::PropertyValue& rProp) {
2333 return rProp.Name.equalsAscii( pPropName ); });
2334 if (pOption != rOptions.end())
2335 pOption->Value >>= bRes;
2336 return bRes;
2337}
2338
2340 bool &rbIsSwSrcView,
2341 const uno::Sequence< beans::PropertyValue >& rOptions,
2342 bool bIsPDFExport )
2343{
2344 // get view shell to use
2345 SfxViewShell *pView = nullptr;
2346 if (bIsPDFExport)
2347 pView = GuessViewShell( rbIsSwSrcView );
2348 else
2349 {
2350 uno::Any aTmp;
2351 auto pOption = std::find_if(rOptions.begin(), rOptions.end(),
2352 [](const beans::PropertyValue& rProp) { return rProp.Name == "View"; });
2353 if (pOption != rOptions.end())
2354 aTmp = pOption->Value;
2355
2356 uno::Reference< frame::XController > xController;
2357 if (aTmp >>= xController)
2358 {
2359 OSL_ENSURE( xController.is(), "controller is empty!" );
2360 pView = GuessViewShell( rbIsSwSrcView, xController );
2361 }
2362 }
2363 return pView;
2364}
2365
2366/*
2367 * GetRenderDoc:
2368 * returns the document to be rendered, usually this will be the 'regular'
2369 * document but in case of PDF export of (multi-)selection it will
2370 * be a temporary document that gets created if not already done.
2371 * The rpView variable will be set (if not already done) to the used
2372 * SfxViewShell.
2373*/
2375 SfxViewShell *&rpView,
2376 const uno::Any& rSelection,
2377 bool bIsPDFExport )
2378{
2379 SwDoc *pDoc = nullptr;
2380
2381 uno::Reference< frame::XModel > xModel;
2382 rSelection >>= xModel;
2383 if (xModel == m_pDocShell->GetModel())
2384 pDoc = m_pDocShell->GetDoc();
2385 else
2386 {
2387 OSL_ENSURE( !xModel.is(), "unexpected model found" );
2388
2389 if (rSelection.hasValue()) // is anything selected ?
2390 {
2391 // this part should only be called when a temporary document needs to be created,
2392 // for example for PDF export or printing of (multi-)selection only.
2393
2394 if (!rpView)
2395 {
2396 bool bIsSwSrcView = false;
2397 // aside from maybe PDF export the view should always have been provided!
2398 OSL_ENSURE( bIsPDFExport, "view is missing, guessing one..." );
2399
2400 rpView = GuessViewShell( bIsSwSrcView );
2401 }
2402 OSL_ENSURE( rpView, "SwViewShell missing" );
2403 // the view shell should be SwView for documents PDF export.
2404 // for the page preview no selection should be possible
2405 // (the export dialog does not allow for this option)
2406 if (auto pSwView = dynamic_cast<SwView *>( rpView ))
2407 {
2408 if (!m_pRenderData)
2409 {
2410 OSL_FAIL("GetRenderDoc: no renderdata");
2411 return nullptr;
2412 }
2413 SfxObjectShellLock xDocSh(m_pRenderData->GetTempDocShell());
2414 if (!xDocSh.Is())
2415 {
2416 xDocSh = pSwView->CreateTmpSelectionDoc();
2417 m_pRenderData->SetTempDocShell(xDocSh);
2418 }
2419 if (xDocSh.Is())
2420 {
2421 pDoc = static_cast<SwDocShell*>(&xDocSh)->GetDoc();
2422 rpView = pDoc->GetDocShell()->GetView();
2423 }
2424 }
2425 else
2426 {
2427 OSL_FAIL("unexpected SwViewShell" );
2428 }
2429 }
2430 }
2431 return pDoc;
2432}
2433
2435 SwDoc &rDoc,
2436 const SwPrintUIOptions &rPrintUIOptions,
2437 bool bIsPDFEXport )
2438{
2439 SwPrintData aDocPrintData( rDoc.getIDocumentDeviceAccess().getPrintData() );
2440
2441 aDocPrintData.SetPrintGraphic( rPrintUIOptions.IsPrintGraphics() );
2442 aDocPrintData.SetPrintTable( true ); // for now it was decided that tables should always be printed
2443 aDocPrintData.SetPrintDraw( rPrintUIOptions.IsPrintDrawings() );
2444 aDocPrintData.SetPrintControl( rPrintUIOptions.IsPrintFormControls() );
2445 aDocPrintData.SetPrintLeftPage( rPrintUIOptions.IsPrintLeftPages() );
2446 aDocPrintData.SetPrintRightPage( rPrintUIOptions.IsPrintRightPages() );
2447 aDocPrintData.SetPrintReverse( false ); /*handled by print dialog now*/
2448 aDocPrintData.SetPaperFromSetup( rPrintUIOptions.IsPaperFromSetup() );
2449 aDocPrintData.SetPrintEmptyPages( rPrintUIOptions.IsPrintEmptyPages( bIsPDFEXport ) );
2450 aDocPrintData.SetPrintPostIts( rPrintUIOptions.GetPrintPostItsType() );
2451 aDocPrintData.SetPrintProspect( rPrintUIOptions.IsPrintProspect() );
2452 aDocPrintData.SetPrintProspect_RTL( rPrintUIOptions.IsPrintProspectRTL() );
2453 aDocPrintData.SetPrintPageBackground( rPrintUIOptions.IsPrintPageBackground() );
2454 aDocPrintData.SetPrintBlackFont( rPrintUIOptions.IsPrintWithBlackTextColor() );
2455 // aDocPrintData.SetPrintSingleJobs( b ); handled by File/Print dialog itself
2456 // arDocPrintData.SetFaxName( s ); n/a in File/Print dialog
2457 aDocPrintData.SetPrintHiddenText( rPrintUIOptions.IsPrintHiddenText() );
2458 aDocPrintData.SetPrintTextPlaceholder( rPrintUIOptions.IsPrintTextPlaceholders() );
2459
2460 rDoc.getIDocumentDeviceAccess().setPrintData( aDocPrintData );
2461}
2462
2464 const uno::Any& rSelection,
2465 const uno::Sequence< beans::PropertyValue >& rxOptions )
2466{
2467 SolarMutexGuard aGuard;
2468 if(!IsValid())
2469 {
2470 throw DisposedException( OUString(),
2471 static_cast< XTextDocument* >(this) );
2472 }
2473
2474 const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" );
2475 bool bIsSwSrcView = false;
2476 SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport );
2477
2478 if (!bIsSwSrcView && !m_pRenderData)
2479 m_pRenderData.reset(new SwRenderData);
2480 if (!m_pPrintUIOptions)
2482 bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions );
2483
2484 SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport );
2485 OSL_ENSURE( pDoc && pView, "doc or view shell missing!" );
2486 if (!pDoc || !pView)
2487 return 0;
2488
2489 // save current UI options from the print dialog for the next call to that dialog
2491
2492 sal_Int32 nRet = 0;
2493 if (bIsSwSrcView)
2494 {
2495 SwSrcView& rSwSrcView = dynamic_cast<SwSrcView&>(*pView);
2497 nRet = rSwSrcView.PrintSource( pOutDev, 1 /* dummy */, true /* get page count only */ );
2498 }
2499 else
2500 {
2501 SwDocShell *pRenderDocShell = pDoc->GetDocShell();
2502
2503 // TODO/mba: we really need a generic way to get the SwViewShell!
2504 SwViewShell* pViewShell = nullptr;
2505 SwView* pSwView = dynamic_cast<SwView*>( pView );
2506 if ( pSwView )
2507 {
2508 pViewShell = pSwView->GetWrtShellPtr();
2509 }
2510 else
2511 {
2512 if ( bIsPDFExport && bFormat )
2513 {
2514 //create a hidden view to be able to export as PDF also in print preview
2515 //pView and pSwView are not changed intentionally!
2517 pViewShell = static_cast<SwView*>(m_pHiddenViewFrame->GetViewShell())->GetWrtShellPtr();
2518 }
2519 else
2520 pViewShell = static_cast<SwPagePreview*>(pView)->GetViewShell();
2521 }
2522
2523 if (!pViewShell || !pViewShell->GetLayout())
2524 return 0;
2525
2526 if (bFormat)
2527 {
2528 // #i38289
2529 if( pViewShell->GetViewOptions()->getBrowseMode() ||
2530 pViewShell->GetViewOptions()->IsWhitespaceHidden() )
2531 {
2532 SwViewOption aOpt( *pViewShell->GetViewOptions() );
2533 aOpt.setBrowseMode( false );
2534 aOpt.SetHideWhitespaceMode( false );
2535 pViewShell->ApplyViewOptions( aOpt );
2536 if (pSwView)
2537 {
2538 pSwView->RecheckBrowseMode();
2539 }
2540 }
2541
2542 // reformatting the document for printing will show the changes in the view
2543 // which is likely to produce many unwanted and not nice to view actions.
2544 // We don't want that! Thus we disable updating of the view.
2545 pViewShell->StartAction();
2546
2547 if (pSwView)
2548 {
2549 if (m_pRenderData && m_pRenderData->NeedNewViewOptionAdjust( *pViewShell ) )
2550 m_pRenderData->ViewOptionAdjustStop();
2551 if (m_pRenderData && !m_pRenderData->IsViewOptionAdjust())
2552 {
2553 m_pRenderData->ViewOptionAdjustStart(
2554 *pViewShell, *pViewShell->GetViewOptions() );
2555 }
2556 }
2557
2558 m_pRenderData->MakeSwPrtOptions( pRenderDocShell,
2559 m_pPrintUIOptions.get(), bIsPDFExport );
2560
2561 if (pSwView)
2562 {
2563 // PDF export should not make use of the SwPrtOptions
2564 const SwPrintData *pPrtOptions = bIsPDFExport
2565 ? nullptr : m_pRenderData->GetSwPrtOptions();
2566 bool setShowPlaceHoldersInPDF = false;
2567 if(bIsPDFExport)
2568 setShowPlaceHoldersInPDF = lcl_GetBoolProperty( rxOptions, "ExportPlaceholders" );
2569 m_pRenderData->ViewOptionAdjust( pPrtOptions, setShowPlaceHoldersInPDF );
2570 }
2571
2572 // since printing now also use the API for PDF export this option
2573 // should be set for printing as well ...
2574 pViewShell->SetPDFExportOption( true );
2575
2576 // there is some redundancy between those two function calls, but right now
2577 // there is no time to sort this out.
2578 //TODO: check what exactly needs to be done and make just one function for that
2579 pViewShell->CalcLayout();
2580
2581 // #122919# Force field update before PDF export, but after layout init (tdf#121962)
2582 bool bStateChanged = false;
2583 // check configuration: shall update of printing information in DocInfo set the document to "modified"?
2585 {
2586 pRenderDocShell->EnableSetModified( false );
2587 bStateChanged = true;
2588 }
2589 pViewShell->SwViewShell::UpdateFields(true);
2590 if( bStateChanged )
2591 pRenderDocShell->EnableSetModified();
2592
2593 pViewShell->CalcPagesForPrint( pViewShell->GetPageCount() );
2594
2595 pViewShell->SetPDFExportOption( false );
2596
2597 // enable view again
2598 pViewShell->EndAction();
2599 }
2600
2601 const sal_Int32 nPageCount = pViewShell->GetPageCount();
2602
2603 // get number of pages to be rendered
2604
2605 const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect" );
2606 if (bPrintProspect)
2607 {
2609 nRet = m_pRenderData->GetPagePairsForProspectPrinting().size();
2610 }
2611 else
2612 {
2613 const SwPostItMode nPostItMode = static_cast<SwPostItMode>( m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 ) );
2614 if (nPostItMode != SwPostItMode::NONE)
2615 {
2617 m_pRenderData->CreatePostItData(*pDoc, pViewShell->GetViewOptions(), pOutDev);
2618 }
2619
2620 // get set of valid document pages (according to the current settings)
2621 // and their start frames
2622 SwDoc::CalculatePagesForPrinting( *pViewShell->GetLayout(), *m_pRenderData, *m_pPrintUIOptions, bIsPDFExport, nPageCount );
2623
2624 if (nPostItMode != SwPostItMode::NONE)
2625 {
2627 *m_pPrintUIOptions, nPageCount );
2628 }
2629
2630 nRet = m_pRenderData->GetPagesToPrint().size();
2631 }
2632 }
2633 OSL_ENSURE( nRet >= 0, "negative number of pages???" );
2634 // tdf#144989 the layout is complete now - prevent DoIdleJobs() from
2635 // messing it up, particulary SwDocUpdateField::MakeFieldList_() unhiding
2636 // sections
2638
2639 return nRet;
2640}
2641
2642uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
2643 sal_Int32 nRenderer,
2644 const uno::Any& rSelection,
2645 const uno::Sequence< beans::PropertyValue >& rxOptions )
2646{
2647 SolarMutexGuard aGuard;
2648 if(!IsValid())
2649 {
2650 throw DisposedException("", static_cast< XTextDocument* >(this));
2651 }
2652
2653 const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" );
2654 bool bIsSwSrcView = false;
2655 SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport );
2656
2657 // m_pRenderData should NOT be created here!
2658 // That should only be done in getRendererCount. If this function is called before
2659 // getRendererCount was called then the caller will probably just retrieve the extra UI options
2660 // and is not interested in getting valid information about the other data that would
2661 // otherwise be provided here!
2662// if( ! m_pRenderData )
2663// m_pRenderData = new SwRenderData;
2664 if (!m_pPrintUIOptions)
2666 m_pPrintUIOptions->processProperties( rxOptions );
2667 const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect" );
2668 const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport );
2669 const bool bPrintPaperFromSetup = m_pPrintUIOptions->getBoolValue( "PrintPaperFromSetup" );
2670
2671 SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport );
2672 OSL_ENSURE( pDoc && pView, "doc or view shell missing!" );
2673 if (!pDoc || !pView)
2674 return uno::Sequence< beans::PropertyValue >();
2675
2676 // due to #110067# (document page count changes sometimes during
2677 // PDF export/printing) we can not check for the upper bound properly.
2678 // Thus instead of throwing the exception we silently return.
2679 if (0 > nRenderer)
2680 throw IllegalArgumentException();
2681
2682 sal_Int32 nMaxRenderer = 0;
2683 if (!bIsSwSrcView && m_pRenderData)
2684 {
2685 OSL_ENSURE( m_pRenderData, "m_pRenderData missing!!" );
2686 nMaxRenderer = bPrintProspect?
2687 m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 :
2688 m_pRenderData->GetPagesToPrint().size() - 1;
2689 }
2690 // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print
2691 // we obmit checking of the upper bound in this case.
2692 if (!bIsSwSrcView && m_pRenderData && nRenderer > nMaxRenderer)
2693 return uno::Sequence< beans::PropertyValue >();
2694
2695 uno::Sequence< beans::PropertyValue > aRenderer;
2696 if (m_pRenderData)
2697 {
2698 // #i114210#
2699 // determine the correct page number from the renderer index
2700 // #i114875
2701 // consider brochure print
2702 const sal_Int32 nPage = bPrintProspect
2703 ? nRenderer + 1
2704 : m_pRenderData->GetPagesToPrint()[ nRenderer ];
2705
2706 // get paper tray to use ...
2707 sal_Int32 nPrinterPaperTray = -1;
2708 if (! bPrintPaperFromSetup)
2709 {
2710 // ... from individual page style (see the page tab in Format/Page dialog)
2711 const std::map< sal_Int32, sal_Int32 > &rPaperTrays = m_pRenderData->GetPrinterPaperTrays();
2712 std::map< sal_Int32, sal_Int32 >::const_iterator aIt( rPaperTrays.find( nPage ) );
2713 if (aIt != rPaperTrays.end())
2714 nPrinterPaperTray = aIt->second;
2715 }
2716
2717 awt::Size aPageSize;
2718 awt::Point aPagePos;
2719 awt::Size aPreferredPageSize;
2720 Size aTmpSize;
2721 if (bIsSwSrcView || bPrintProspect)
2722 {
2723 // for printing of HTML source code and prospect printing we should use
2724 // the printers paper size since
2725 // a) HTML source view has no page size
2726 // b) prospect printing has a different page size from the documents page
2727 // since two document pages will get rendered on one printer page
2728
2729 // since PageIncludesNonprintableArea will be set to true we can return the
2730 // printers paper size here.
2731 // Sometimes 'getRenderer' is only called to get "ExtraPrintUIOptions", in this
2732 // case we won't get an OutputDevice here, but then the caller also has no need
2733 // for the correct PageSize right now...
2734 VclPtr< Printer > pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions ).get());
2735 if (pPrinter)
2736 {
2737 // HTML source view and prospect adapt to the printer's paper size
2738 aTmpSize = pPrinter->GetPaperSize();
2739 aTmpSize = OutputDevice::LogicToLogic( aTmpSize,
2740 pPrinter->GetMapMode(), MapMode( MapUnit::Map100thMM ));
2741 aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() );
2742 #if 0
2743 // #i115048# it seems users didn't like getting double the formatted page size
2744 // revert to "old" behavior scaling to the current paper size of the printer
2745 if (bPrintProspect)
2746 {
2747 // we just state what output size we would need
2748 // which may cause vcl to set that page size on the printer
2749 // (if available and not overridden by the user)
2750 aTmpSize = pVwSh->GetPageSize( nPage, bIsSkipEmptyPages );
2751 aPreferredPageSize = awt::Size ( convertTwipToMm100( 2 * aTmpSize.Width() ),
2752 convertTwipToMm100( aTmpSize.Height() ));
2753 }
2754 #else
2755 if( bPrintProspect )
2756 {
2757 // just switch to an appropriate portrait/landscape format
2758 // FIXME: brochure printing with landscape pages puts the
2759 // pages next to each other, so landscape is currently always
2760 // the better choice
2761 if( aPageSize.Width < aPageSize.Height )
2762 {
2763 aPreferredPageSize.Width = aPageSize.Height;
2764 aPreferredPageSize.Height = aPageSize.Width;
2765 }
2766 }
2767 #endif
2768 }
2769 }
2770 else
2771 {
2772 // TODO/mba: we really need a generic way to get the SwViewShell!
2773 SwViewShell* pVwSh = nullptr;
2774 SwView* pSwView = dynamic_cast<SwView*>( pView );
2775 if ( pSwView )
2776 pVwSh = pSwView->GetWrtShellPtr();
2777 else
2778 pVwSh = static_cast<SwPagePreview*>(pView)->GetViewShell();
2779
2780 if (pVwSh)
2781 {
2782 aTmpSize = pVwSh->GetPageSize( nPage, bIsSkipEmptyPages );
2783 aPageSize = awt::Size ( convertTwipToMm100( aTmpSize.Width() ),
2784 convertTwipToMm100( aTmpSize.Height() ));
2785 Point aPoint = pVwSh->GetPagePos(nPage);
2786 aPagePos = awt::Point(convertTwipToMm100(aPoint.X()), convertTwipToMm100(aPoint.Y()));
2787 }
2788 }
2789
2790 sal_Int32 nLen = 3;
2791 aRenderer = { comphelper::makePropertyValue("PageSize", aPageSize),
2792 comphelper::makePropertyValue("PageIncludesNonprintableArea", true),
2793 comphelper::makePropertyValue("PagePos", aPagePos) };
2794 if (aPreferredPageSize.Width && aPreferredPageSize.Height)
2795 {
2796 ++nLen;
2797 aRenderer.realloc( nLen );
2798 auto pRenderer = aRenderer.getArray();
2799 pRenderer[ nLen - 1 ].Name = "PreferredPageSize";
2800 pRenderer[ nLen - 1 ].Value <<= aPreferredPageSize;
2801 }
2802 if (nPrinterPaperTray >= 0)
2803 {
2804 ++nLen;
2805 aRenderer.realloc( nLen );
2806 auto pRenderer = aRenderer.getArray();
2807 pRenderer[ nLen - 1 ].Name = "PrinterPaperTray";
2808 pRenderer[ nLen - 1 ].Value <<= nPrinterPaperTray;
2809 }
2810 }
2811
2812 // #i117783#
2814 {
2815 const SwPagePreviewPrtData* pPagePrintSettings =
2817 if ( pPagePrintSettings &&
2818 ( pPagePrintSettings->GetRow() > 1 ||
2819 pPagePrintSettings->GetCol() > 1 ) )
2820 {
2821 // extend render data by page print settings attributes
2822 sal_Int32 nLen = aRenderer.getLength();
2823 const sal_Int32 nRenderDataIdxStart = nLen;
2824 nLen += 9;
2825 aRenderer.realloc( nLen );
2826 auto pRenderer = aRenderer.getArray();
2827 // put page print settings attribute into render data
2828 const sal_Int32 nRow = pPagePrintSettings->GetRow();
2829 pRenderer[ nRenderDataIdxStart + 0 ].Name = "NUpRows";
2830 pRenderer[ nRenderDataIdxStart + 0 ].Value <<= std::max<sal_Int32>( nRow, 1);
2831 const sal_Int32 nCol = pPagePrintSettings->GetCol();
2832 pRenderer[ nRenderDataIdxStart + 1 ].Name = "NUpColumns";
2833 pRenderer[ nRenderDataIdxStart + 1 ].Value <<= std::max<sal_Int32>( nCol, 1);
2834 pRenderer[ nRenderDataIdxStart + 2 ].Name = "NUpPageMarginLeft";
2835 pRenderer[ nRenderDataIdxStart + 2 ].Value <<= pPagePrintSettings->GetLeftSpace();
2836 pRenderer[ nRenderDataIdxStart + 3 ].Name = "NUpPageMarginRight";
2837 pRenderer[ nRenderDataIdxStart + 3 ].Value <<= pPagePrintSettings->GetRightSpace();
2838 pRenderer[ nRenderDataIdxStart + 4 ].Name = "NUpPageMarginTop";
2839 pRenderer[ nRenderDataIdxStart + 4 ].Value <<= pPagePrintSettings->GetTopSpace();
2840 pRenderer[ nRenderDataIdxStart + 5 ].Name = "NUpPageMarginBottom";
2841 pRenderer[ nRenderDataIdxStart + 5 ].Value <<= pPagePrintSettings->GetBottomSpace();
2842 pRenderer[ nRenderDataIdxStart + 6 ].Name = "NUpHorizontalSpacing";
2843 pRenderer[ nRenderDataIdxStart + 6 ].Value <<= pPagePrintSettings->GetHorzSpace();
2844 pRenderer[ nRenderDataIdxStart + 7 ].Name = "NUpVerticalSpacing";
2845 pRenderer[ nRenderDataIdxStart + 7 ].Value <<= pPagePrintSettings->GetVertSpace();
2846 {
2848 if ( pPrinter )
2849 {
2850 awt::Size aNewPageSize;
2851 const Size aPageSize = pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), MapMode( MapUnit::Map100thMM ) );
2852 aNewPageSize = awt::Size( aPageSize.Width(), aPageSize.Height() );
2853 if ( ( pPagePrintSettings->GetLandscape() &&
2854 aPageSize.Width() < aPageSize.Height() ) ||
2855 ( !pPagePrintSettings->GetLandscape() &&
2856 aPageSize.Width() > aPageSize.Height() ) )
2857 {
2858 aNewPageSize = awt::Size( aPageSize.Height(), aPageSize.Width() );
2859 }
2860 pRenderer[ nRenderDataIdxStart + 8 ].Name = "NUpPaperSize";
2861 pRenderer[ nRenderDataIdxStart + 8 ].Value <<= aNewPageSize;
2862 }
2863 }
2864 }
2865
2867 }
2868
2869 m_pPrintUIOptions->appendPrintUIOptions( aRenderer );
2870
2871 return aRenderer;
2872}
2873
2875 /* out */ bool &rbIsSwSrcView,
2876 const uno::Reference< css::frame::XController >& rController )
2877{
2878 // #130810# SfxViewShell::Current() / SfxViewShell::GetObjectShell()
2879 // must not be used (see comment from MBA)
2880
2881 SfxViewShell *pView = nullptr;
2882 SwView *pSwView = nullptr;
2883 SwPagePreview *pSwPagePreview = nullptr;
2884 SwSrcView *pSwSrcView = nullptr;
2886
2887 // look for the view shell with the same controller in use,
2888 // otherwise look for a suitable view, preferably a SwView,
2889 // if that one is not found use a SwPagePreview if found.
2890 while (pFrame)
2891 {
2892 pView = pFrame->GetViewShell();
2893 pSwView = dynamic_cast< SwView * >(pView);
2894 pSwSrcView = dynamic_cast< SwSrcView * >(pView);
2895 if (!pSwPagePreview)
2896 pSwPagePreview = dynamic_cast< SwPagePreview * >(pView);
2897 if (rController.is())
2898 {
2899 if (pView && pView->GetController() == rController)
2900 break;
2901 }
2902 else if (pSwView || pSwSrcView)
2903 break;
2904 pFrame = SfxViewFrame::GetNext( *pFrame, m_pDocShell, false );
2905 }
2906
2907 OSL_ENSURE( pSwView || pSwPagePreview || pSwSrcView, "failed to get view shell" );
2908 if (pView)
2909 rbIsSwSrcView = pSwSrcView != nullptr;
2910 return pView;
2911}
2912
2914 sal_Int32 nRenderer,
2915 const uno::Any& rSelection,
2916 const uno::Sequence< beans::PropertyValue >& rxOptions )
2917{
2918 SolarMutexGuard aGuard;
2919 if(!IsValid())
2920 {
2921 throw DisposedException( OUString(),
2922 static_cast< XTextDocument* >(this) );
2923 }
2924
2925 // due to #110067# (document page count changes sometimes during
2926 // PDF export/printing) we can not check for the upper bound properly.
2927 // Thus instead of throwing the exception we silently return.
2928 if (0 > nRenderer)
2929 throw IllegalArgumentException();
2930
2931 // tdf#135244: prevent jumping to cursor at any temporary modification
2932 auto aLock = m_pDocShell->LockAllViews();
2933
2934 const bool bHasPDFExtOutDevData = lcl_SeqHasProperty( rxOptions, "HasPDFExtOutDevData" );
2935 const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" ) || bHasPDFExtOutDevData;
2936 bool bIsSwSrcView = false;
2937 SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport );
2938
2939 OSL_ENSURE( m_pRenderData, "data should have been created already in getRendererCount..." );
2940 OSL_ENSURE( m_pPrintUIOptions, "data should have been created already in getRendererCount..." );
2941 if (!bIsSwSrcView && !m_pRenderData)
2942 m_pRenderData.reset(new SwRenderData);
2943 if (!m_pPrintUIOptions)
2945 m_pPrintUIOptions->processProperties( rxOptions );
2946 const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect" );
2947 const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage" );
2948
2949 SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport );
2950 OSL_ENSURE( pDoc && pView, "doc or view shell missing!" );
2951 if (pDoc && pView)
2952 {
2953 sal_Int32 nMaxRenderer = 0;
2954 if (!bIsSwSrcView)
2955 {
2956 OSL_ENSURE( m_pRenderData, "m_pRenderData missing!!" );
2957 nMaxRenderer = bPrintProspect?
2958 m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 :
2959 m_pRenderData->GetPagesToPrint().size() - 1;
2960 }
2961 // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print
2962 // we obmit checking of the upper bound in this case.
2963 if (bIsSwSrcView || nRenderer <= nMaxRenderer)
2964 {
2965 if (bIsSwSrcView)
2966 {
2967 SwSrcView& rSwSrcView = dynamic_cast<SwSrcView&>(*pView);
2969 rSwSrcView.PrintSource(pOutDev, nRenderer + 1, false);
2970 }
2971 else
2972 {
2973 // the view shell should be SwView for documents PDF export
2974 // or SwPagePreview for PDF export of the page preview
2975 SwViewShell* pVwSh = nullptr;
2976 // TODO/mba: we really need a generic way to get the SwViewShell!
2977 const SwView* pSwView = dynamic_cast<const SwView*>(pView);
2978 if (pSwView)
2979 pVwSh = pSwView->GetWrtShellPtr();
2980 else
2981 pVwSh = static_cast<SwPagePreview*>(pView)->GetViewShell();
2982
2983 // get output device to use
2985
2986 if(pVwSh && pOut && m_pRenderData->HasSwPrtOptions())
2987 {
2988 const OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange" );
2989 const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage" );
2990 bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport );
2991
2992 OSL_ENSURE((pSwView && m_pRenderData->IsViewOptionAdjust())
2993 || (!pSwView && !m_pRenderData->IsViewOptionAdjust()),
2994 "SwView / SwViewOptionAdjust_Impl availability mismatch" );
2995
2996 // since printing now also use the API for PDF export this option
2997 // should be set for printing as well ...
2998 pVwSh->SetPDFExportOption( true );
2999
3000 // #i12836# enhanced pdf export
3001
3002 // First, we have to export hyperlinks, notes, and outline to pdf.
3003 // During this process, additional information required for tagging
3004 // the pdf file are collected, which are evaluated during painting.
3005
3006 SwWrtShell* pWrtShell = pSwView ? pSwView->GetWrtShellPtr() : nullptr;
3007
3008 SwPrintData rSwPrtOptions = *m_pRenderData->GetSwPrtOptions();
3009 if (bIsPDFExport)
3010 {
3011 rSwPrtOptions.SetPrintPostIts(
3012 lcl_GetBoolProperty(rxOptions, "ExportNotesInMargin")
3015 }
3016
3017 if (bIsPDFExport && (bFirstPage || bHasPDFExtOutDevData) && pWrtShell)
3018 {
3019 SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, false, rSwPrtOptions );
3020 }
3021
3022 if (bPrintProspect)
3023 pVwSh->PrintProspect( pOut, rSwPrtOptions, nRenderer );
3024 else // normal printing and PDF export
3025 pVwSh->PrintOrPDFExport( pOut, rSwPrtOptions, nRenderer, bIsPDFExport );
3026
3027 // #i35176#
3028
3029 // After printing the last page, we take care for the links coming
3030 // from the EditEngine. The links are generated during the painting
3031 // process, but the destinations are still missing.
3032
3033 if (bIsPDFExport && bLastPage && pWrtShell)
3034 {
3035 SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, true, rSwPrtOptions );
3036 }
3037
3038 pVwSh->SetPDFExportOption( false );
3039
3040 // last page to be rendered? (not necessarily the last page of the document)
3041 // -> do clean-up of data
3042 if (bLastPage)
3043 {
3044 // #i96167# haggai: delete ViewOptionsAdjust here because it makes use
3045 // of the shell, which might get destroyed in lcl_DisposeView!
3046 if (m_pRenderData->IsViewOptionAdjust())
3047 m_pRenderData->ViewOptionAdjustStop();
3048
3049 if (m_pRenderData->HasPostItData())
3050 m_pRenderData->DeletePostItData();
3052 {
3054 m_pHiddenViewFrame = nullptr;
3055
3056 // prevent crash described in #i108805
3057 SwDocShell *pRenderDocShell = pDoc->GetDocShell();
3058 pRenderDocShell->GetMedium()->GetItemSet().Put( SfxBoolItem( SID_HIDDEN, false ) );
3059
3060 }
3061 }
3062 }
3063 }
3064 }
3065 }
3066 if( bLastPage )
3067 {
3068 // tdf#144989 enable DoIdleJobs() again after last page
3070 m_pRenderData.reset();
3071 m_pPrintUIOptions.reset();
3072 }
3073}
3074
3075// xforms::XFormsSupplier
3076Reference<XNameContainer> SAL_CALL SwXTextDocument::getXForms()
3077{
3078 SolarMutexGuard aGuard;
3079 if ( !m_pDocShell )
3080 throw DisposedException( OUString(), static_cast< XTextDocument* >( this ) );
3081 SwDoc* pDoc = m_pDocShell->GetDoc();
3082 return pDoc->getXForms();
3083}
3084
3085uno::Reference< text::XFlatParagraphIterator > SAL_CALL SwXTextDocument::getFlatParagraphIterator(::sal_Int32 nTextMarkupType, sal_Bool bAutomatic)
3086{
3087 SolarMutexGuard aGuard;
3088 if (!IsValid())
3089 {
3090 throw DisposedException("SwXTextDocument not valid",
3091 static_cast<XTextDocument*>(this));
3092 }
3093
3095 *m_pDocShell->GetDoc(), nTextMarkupType, bAutomatic);
3096}
3097
3098uno::Reference< util::XCloneable > SwXTextDocument::createClone( )
3099{
3100 SolarMutexGuard aGuard;
3101 if(!IsValid())
3102 throw DisposedException("", static_cast< XTextDocument* >(this));
3103
3104 // create a new document - hidden - copy the storage and return it
3105 // SfxObjectShellRef is used here, since the model should control object lifetime after creation
3106 // and thus SfxObjectShellLock is not allowed here
3107 // the model holds reference to the shell, so the shell will not destructed at the end of method
3108 SfxObjectShellRef pShell = m_pDocShell->GetDoc()->CreateCopy(false, false);
3109 uno::Reference< frame::XModel > xNewModel = pShell->GetModel();
3110 uno::Reference< embed::XStorage > xNewStorage = ::comphelper::OStorageHelper::GetTemporaryStorage( );
3111 uno::Sequence< beans::PropertyValue > aTempMediaDescriptor;
3112 storeToStorage( xNewStorage, aTempMediaDescriptor );
3113 uno::Reference< document::XStorageBasedDocument > xStorageDoc( xNewModel, uno::UNO_QUERY );
3114 xStorageDoc->loadFromStorage( xNewStorage, aTempMediaDescriptor );
3115 return uno::Reference< util::XCloneable >( xNewModel, UNO_QUERY );
3116}
3117
3118void SwXTextDocument::addPasteEventListener(const uno::Reference<text::XPasteListener>& xListener)
3119{
3120 SolarMutexGuard aGuard;
3121
3122 if (IsValid() && xListener.is())
3124}
3125
3127 const uno::Reference<text::XPasteListener>& xListener)
3128{
3129 SolarMutexGuard aGuard;
3130
3131 if (IsValid() && xListener.is())
3133}
3134
3136 int nOutputWidth, int nOutputHeight,
3137 int nTilePosX, int nTilePosY,
3138 tools::Long nTileWidth, tools::Long nTileHeight )
3139{
3140 SwViewShell* pViewShell = m_pDocShell->GetWrtShell();
3141 pViewShell->PaintTile(rDevice, nOutputWidth, nOutputHeight,
3142 nTilePosX, nTilePosY, nTileWidth, nTileHeight);
3143
3144 LokChartHelper::PaintAllChartsOnTile(rDevice, nOutputWidth, nOutputHeight,
3145 nTilePosX, nTilePosY, nTileWidth, nTileHeight);
3146
3147 // Draw Form controls
3150 SdrPage* pPage = pDrawLayer->GetPage(sal_uInt16(0));
3151 SdrView* pDrawView = pViewShell->GetDrawView();
3152 SwEditWin& rEditWin = m_pDocShell->GetView()->GetEditWin();
3153 tools::Rectangle aTileRect(Point(nTilePosX, nTilePosY), Size(nTileWidth, nTileHeight));
3154 Size aOutputSize(nOutputWidth, nOutputHeight);
3155 LokControlHandler::paintControlTile(pPage, pDrawView, rEditWin, rDevice, aOutputSize, aTileRect);
3157}
3158
3160{
3161 SwViewShell* pViewShell = m_pDocShell->GetWrtShell();
3162 Size aDocSize = pViewShell->GetDocSize();
3163
3164 return Size(aDocSize.Width() + 2 * DOCUMENTBORDER,
3165 aDocSize.Height() + 2 * DOCUMENTBORDER);
3166}
3167
3168void SwXTextDocument::setPart(int nPart, bool /*bAllowChangeFocus*/)
3169{
3170 SolarMutexGuard aGuard;
3171
3172 SwWrtShell* pWrtShell = m_pDocShell->GetWrtShell();
3173 if (!pWrtShell)
3174 return;
3175
3176 pWrtShell->GotoPage(nPart + 1, true);
3177}
3178
3180{
3181 SolarMutexGuard aGuard;
3182
3183 SwWrtShell* pWrtShell = m_pDocShell->GetWrtShell();
3184 if (!pWrtShell)
3185 return 0;
3186
3187 return pWrtShell->GetPageCnt();
3188}
3189
3191{
3192 SolarMutexGuard aGuard;
3193
3194 SwWrtShell* pWrtShell = m_pDocShell->GetWrtShell();
3195 if (!pWrtShell)
3196 return OUString();
3197
3198 return pWrtShell->getPageRectangles();
3199}
3200
3201void SwXTextDocument::setClipboard(const uno::Reference<datatransfer::clipboard::XClipboard>& xClipboard)
3202{
3203 SolarMutexGuard aGuard;
3204
3205 SwView* pView = m_pDocShell->GetView();
3206 if (pView)
3207 pView->GetEditWin().SetClipboard(xClipboard);
3208}
3209
3211{
3212 SolarMutexGuard aGuard;
3213
3214 SwWrtShell* pWrtShell = m_pDocShell->GetWrtShell();
3215 if (!pWrtShell)
3216 return false;
3217
3219 if (SdrView* pSdrView = pWrtShell->GetDrawView())
3220 {
3221 if (pSdrView->GetTextEditObject())
3222 // Editing shape text
3223 return EditEngine::HasValidData(aDataHelper.GetTransferable());
3224 }
3225
3226 return aDataHelper.GetXTransferable().is() && SwTransferable::IsPaste(*pWrtShell, aDataHelper);
3227}
3228
3230{
3231 if (SwView* pView = m_pDocShell->GetView())
3232 {
3233 // set the PgUp/PgDown offset
3234 pView->ForcePageUpDownOffset(2 * rRectangle.GetHeight() / 3);
3235 }
3236
3237 if (SwViewShell* pViewShell = m_pDocShell->GetWrtShell())
3238 {
3239 pViewShell->setLOKVisibleArea(rRectangle);
3240 }
3241}
3242
3243void SwXTextDocument::setClientZoom(int nTilePixelWidth_, int /*nTilePixelHeight_*/,
3244 int nTileTwipWidth_, int /*nTileTwipHeight_*/)
3245{
3246 // Here we set the zoom value as it has been set by the user in the client.
3247 // This value is used in postMouseEvent and setGraphicSelection methods
3248 // for in place chart editing. We assume that x and y scale is roughly
3249 // the same.
3251 if (!pIPClient)
3252 return;
3253
3254 SwViewShell* pWrtViewShell = m_pDocShell->GetWrtShell();
3255 double fScale = 100.0 * nTilePixelWidth_ / nTileTwipWidth_
3257 SwViewOption aOption(*(pWrtViewShell->GetViewOptions()));
3258 if (aOption.GetZoom() != fScale)
3259 {
3260 aOption.SetZoom(fScale);
3261 pWrtViewShell->ApplyViewOptions(aOption);
3262
3263 // Changing the zoom value doesn't always trigger the updating of
3264 // the client ole object area, so we call it directly.
3265 pIPClient->VisAreaChanged();
3266 }
3267}
3268
3270{
3271 SolarMutexGuard aGuard;
3272
3273 SwWrtShell* pWrtShell = m_pDocShell->GetWrtShell();
3274 if (!pWrtShell)
3275 return PointerStyle::Arrow;
3276
3277 return pWrtShell->GetView().GetEditWin().GetPointer();
3278}
3279
3281{
3282 auto redlinesNode = rJson.startArray("redlines");
3283
3284 // Disable since usability is very low beyond some small number of changes.
3285 static bool bDisableRedlineComments = getenv("DISABLE_REDLINE") != nullptr;
3286 if (bDisableRedlineComments)
3287 return;
3288
3289 const SwRedlineTable& rRedlineTable
3291 for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i)
3292 {
3293 auto redlineNode = rJson.startStruct();
3294 rJson.put("index", rRedlineTable[i]->GetId());
3295 rJson.put("author", rRedlineTable[i]->GetAuthorString(1));
3296 rJson.put("type", SwRedlineTypeToOUString(
3297 rRedlineTable[i]->GetRedlineData().GetType()));
3298 rJson.put("comment",
3299 rRedlineTable[i]->GetRedlineData().GetComment());
3300 rJson.put("description", rRedlineTable[i]->GetDescr());
3301 OUString sDateTime = utl::toISO8601(
3302 rRedlineTable[i]->GetRedlineData().GetTimeStamp().GetUNODateTime());
3303 rJson.put("dateTime", sDateTime);
3304
3305 SwContentNode* pContentNd = rRedlineTable[i]->GetPointContentNode();
3306 SwView* pView = dynamic_cast<SwView*>(SfxViewShell::Current());
3307 if (pView && pContentNd)
3308 {
3309 SwShellCursor aCursor(pView->GetWrtShell(), *(rRedlineTable[i]->Start()));
3310 aCursor.SetMark();
3311 aCursor.GetMark()->Assign(*pContentNd, rRedlineTable[i]->End()->GetContentIndex());
3312
3313 aCursor.FillRects();
3314
3315 SwRects* pRects(&aCursor);
3316 std::vector<OString> aRects;
3317 for (const SwRect& rNextRect : *pRects)
3318 aRects.push_back(rNextRect.SVRect().toString());
3319
3320 const OString sRects = comphelper::string::join("; ", aRects);
3321 rJson.put("textRange", sRects);
3322 }
3323 }
3324}
3325
3327{
3328 SW_MOD()->GetRedlineAuthorInfo(rJsonWriter);
3329}
3330
3332{
3333 SwView* pView = m_pDocShell->GetView();
3334 dynamic_cast<SwCommentRuler&>(pView->GetHRuler()).CreateJsonNotification(rJsonWriter);
3335}
3336
3338{
3339 SolarMutexGuard aGuard;
3340 auto commentsNode = rJsonWriter.startArray("comments");
3341 for (auto const& sidebarItem : *m_pDocShell->GetView()->GetPostItMgr())
3342 {
3343 sw::annotation::SwAnnotationWin* pWin = sidebarItem->mpPostIt.get();
3344
3345 if (!pWin)
3346 {
3347 continue;
3348 }
3349
3350 const SwPostItField* pField = pWin->GetPostItField();
3351 const SwRect& aRect = pWin->GetAnchorRect();
3352 tools::Rectangle aSVRect(aRect.Pos().getX(),
3353 aRect.Pos().getY(),
3354 aRect.Pos().getX() + aRect.SSize().Width(),
3355 aRect.Pos().getY() + aRect.SSize().Height());
3356
3357 if (!sidebarItem->maLayoutInfo.mPositionFromCommentAnchor)
3358 {
3359 // Comments on frames: anchor position is the corner position, not the whole frame.
3360 aSVRect.SetSize(Size(0, 0));
3361 }
3362
3363 std::vector<OString> aRects;
3364 for (const basegfx::B2DRange& aRange : pWin->GetAnnotationTextRanges())
3365 {
3366 const SwRect rect(aRange.getMinX(), aRange.getMinY(), aRange.getWidth(), aRange.getHeight());
3367 aRects.push_back(rect.SVRect().toString());
3368 }
3369 const OString sRects = comphelper::string::join("; ", aRects);
3370
3371 auto commentNode = rJsonWriter.startStruct();
3372 rJsonWriter.put("id", pField->GetPostItId());
3373 rJsonWriter.put("parent", pWin->CalcParent());
3374 rJsonWriter.put("paraIdParent", pField->GetParentId());
3375 rJsonWriter.put("author", pField->GetPar1());
3376 rJsonWriter.put("text", pField->GetPar2());
3377 rJsonWriter.put("resolved", pField->GetResolved() ? "true" : "false");
3378 rJsonWriter.put("dateTime", utl::toISO8601(pField->GetDateTime().GetUNODateTime()));
3379 rJsonWriter.put("anchorPos", aSVRect.toString());
3380 rJsonWriter.put("textRange", sRects);
3381 }
3382}
3383
3385{
3386 auto aIter = aArguments.find("type");
3387 if (aIter == aArguments.end() || aIter->second != "drop-down")
3388 return;
3389
3390 aIter = aArguments.find("cmd");
3391 if (aIter == aArguments.end() || aIter->second != "selected")
3392 return;
3393
3394 aIter = aArguments.find("data");
3395 if (aIter == aArguments.end())
3396 return;
3397
3398 sal_Int32 nSelection = aIter->second.toInt32();
3400 sw::mark::IFieldmark* pFieldBM = m_pDocShell->GetWrtShell()->getIDocumentMarkAccess()->getInnerFieldmarkFor(aPos);
3401 if ( !pFieldBM )
3402 {
3403 aPos.AdjustContent(-1);
3405 }
3406 if (pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDROPDOWN)
3407 {
3408 if (nSelection >= 0)
3409 {
3410 (*pFieldBM->GetParameters())[ODF_FORMDROPDOWN_RESULT] <<= nSelection;
3411 pFieldBM->Invalidate();
3414 }
3415 }
3416}
3417
3418std::vector<basegfx::B2DRange>
3420{
3421 SwDoc* pDoc = m_pDocShell->GetDoc();
3422 if (!pDoc)
3423 return std::vector<basegfx::B2DRange>();
3424
3425 sw::search::SearchResultLocator aLocator(pDoc);
3426 sw::search::LocationResult aResult = aLocator.findForPayload(pPayload);
3427 if (aResult.mbFound)
3428 {
3429 return aResult.maRectangles;
3430 }
3431 return std::vector<basegfx::B2DRange>();
3432}
3433
3435{
3436 OStringBuffer aState;
3437 SwView* pView = m_pDocShell->GetView();
3438 if (pView && pView->GetWrtShellPtr())
3439 {
3440 const SwViewOption* pVOpt = pView->GetWrtShell().GetViewOptions();
3441 if (pVOpt)
3442 {
3443 if (pVOpt->IsViewMetaChars())
3444 aState.append('P');
3445 if (pVOpt->IsOnlineSpell())
3446 aState.append('S');
3447 aState.append(';');
3448
3449 OString aThemeName = OUStringToOString(pVOpt->GetThemeName(), RTL_TEXTENCODING_UTF8);
3450 aState.append(aThemeName);
3451 }
3452 }
3453 return aState.makeStringAndClear();
3454}
3455
3456namespace
3457{
3458inline constexpr OUStringLiteral SELECTED_DATE_FORMAT = u"YYYY-MM-DD";
3459}
3460
3462{
3463 auto it = rArguments.find("type");
3464 if (it == rArguments.end())
3465 {
3466 return;
3467 }
3468
3469 if (it->second == "drop-down")
3470 {
3471 SwWrtShell* pWrtShell = m_pDocShell->GetWrtShell();
3472 const SwPosition* pStart = pWrtShell->GetCursor()->Start();
3473 SwTextNode* pTextNode = pStart->GetNode().GetTextNode();
3474 if (!pTextNode)
3475 {
3476 return;
3477 }
3478
3479 SwTextAttr* pAttr = pTextNode->GetTextAttrAt(pStart->GetContentIndex(),
3481 if (!pAttr)
3482 {
3483 return;
3484 }
3485
3486 auto pTextContentControl = static_txtattr_cast<SwTextContentControl*>(pAttr);
3487 const SwFormatContentControl& rFormatContentControl = pTextContentControl->GetContentControl();
3488 std::shared_ptr<SwContentControl> pContentControl = rFormatContentControl.GetContentControl();
3489 if (!pContentControl->GetComboBox() && !pContentControl->GetDropDown())
3490 {
3491 return;
3492 }
3493
3494 it = rArguments.find("selected");
3495 if (it == rArguments.end())
3496 {
3497 return;
3498 }
3499
3500 sal_Int32 nSelection = it->second.toInt32();
3501 pContentControl->SetSelectedListItem(nSelection);
3502 pWrtShell->GotoContentControl(rFormatContentControl);
3503 }
3504 else if (it->second == "picture")
3505 {
3506 it = rArguments.find("changed");
3507 if (it == rArguments.end())
3508 {
3509 return;
3510 }
3511
3512 SwView* pView = m_pDocShell->GetView();
3513 if (!pView)
3514 {
3515 return;
3516 }
3517
3518 // The current placeholder is selected, so this will replace, not insert.
3519 SfxStringItem aItem(SID_INSERT_GRAPHIC, it->second);
3520 pView->GetViewFrame().GetDispatcher()->ExecuteList(SID_CHANGE_PICTURE,
3521 SfxCallMode::SYNCHRON, { &aItem });
3522 }
3523 else if (it->second == "date")
3524 {
3525 SwWrtShell* pWrtShell = m_pDocShell->GetWrtShell();
3526 const SwPosition* pStart = pWrtShell->GetCursor()->Start();
3527 SwTextNode* pTextNode = pStart->GetNode().GetTextNode();
3528 if (!pTextNode)
3529 {
3530 return;
3531 }
3532
3533 SwTextAttr* pAttr = pTextNode->GetTextAttrAt(pStart->GetContentIndex(),
3535 if (!pAttr)
3536 {
3537 return;
3538 }
3539
3540 auto pTextContentControl = static_txtattr_cast<SwTextContentControl*>(pAttr);
3541 const SwFormatContentControl& rFormatContentControl
3542 = pTextContentControl->GetContentControl();
3543 std::shared_ptr<SwContentControl> pContentControl
3544 = rFormatContentControl.GetContentControl();
3545 if (!pContentControl->GetDate())
3546 {
3547 return;
3548 }
3549
3550 it = rArguments.find("selected");
3551 if (it == rArguments.end())
3552 {
3553 return;
3554 }
3555
3556 OUString aSelectedDate = it->second.replaceAll("T00:00:00Z", "");
3557 SwDoc& rDoc = pTextNode->GetDoc();
3558 SvNumberFormatter* pNumberFormatter = rDoc.GetNumberFormatter();
3559 sal_uInt32 nFormat
3560 = pNumberFormatter->GetEntryKey(SELECTED_DATE_FORMAT, LANGUAGE_ENGLISH_US);
3561 if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
3562 {
3563 sal_Int32 nCheckPos = 0;
3565 OUString sFormat = SELECTED_DATE_FORMAT;
3566 pNumberFormatter->PutEntry(sFormat, nCheckPos, nType, nFormat, LANGUAGE_ENGLISH_US);
3567 }
3568
3569 if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
3570 {
3571 return;
3572 }
3573
3574 double dCurrentDate = 0;
3575 pNumberFormatter->IsNumberFormat(aSelectedDate, nFormat, dCurrentDate);
3576 pContentControl->SetSelectedDate(dCurrentDate);
3577 pWrtShell->GotoContentControl(rFormatContentControl);
3578 }
3579}
3580
3582{
3583 SolarMutexGuard aGuard;
3584
3585 SwView* pView = m_pDocShell->GetView();
3586 if (!pView)
3587 return 0;
3588
3589 return pView->getPart();
3590}
3591
3593{
3594 return SwResId(STR_PAGE) + OUString::number(nPart + 1);
3595}
3596
3598{
3599 OUString sPart(SwResId(STR_PAGE) + OUString::number(nPart + 1));
3600
3601 return OUString::number(sPart.hashCode());
3602}
3603
3605{
3606 SolarMutexGuard aGuard;
3607 SwView* pView = m_pDocShell->GetView();
3608 if (!pView)
3609 return {};
3610
3612 return pWindow;
3613
3614 return &(pView->GetEditWin());
3615}
3616
3617void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
3618{
3619 SolarMutexGuard aGuard;
3620
3621 SwViewShell* pViewShell = m_pDocShell->GetWrtShell();
3622
3623 SwView* pView = m_pDocShell->GetView();
3624 if (!pView)
3625 return;
3626
3627 pView->SetViewLayout(1/*nColumns*/, false/*bBookMode*/, true);
3628
3629 // Tiled rendering defaults.
3630 SwViewOption aViewOption(*pViewShell->GetViewOptions());
3631 aViewOption.SetHardBlank(false);
3632
3633 // Disable field shadings: the result would depend on the cursor position.
3635 // The fancy header/footer controls don't work in tiled mode anyway, so
3636 // explicitly disable them to enable skipping invalidating the view for
3637 // the case of clicking in the header area of a document with no headers
3638 aViewOption.SetUseHeaderFooterMenu(false);
3639
3640 OUString sOrigAuthor = SW_MOD()->GetRedlineAuthor(SW_MOD()->GetRedlineAuthor());
3641 OUString sAuthor;
3642
3643 for (const beans::PropertyValue& rValue : rArguments)
3644 {
3645 if (rValue.Name == ".uno:HideWhitespace" && rValue.Value.has<bool>())
3646 aViewOption.SetHideWhitespaceMode(rValue.Value.get<bool>());
3647 else if (rValue.Name == ".uno:ShowBorderShadow" && rValue.Value.has<bool>())
3648 aViewOption.SetAppearanceFlag(ViewOptFlags::Shadow , rValue.Value.get<bool>());
3649 else if (rValue.Name == ".uno:Author" && rValue.Value.has<OUString>())
3650 {
3651 sAuthor = rValue.Value.get<OUString>();
3652 // Store the author name in the view.
3653 pView->SetRedlineAuthor(sAuthor);
3654 // Let the actual author name pick up the value from the current
3655 // view, which would normally happen only during the next view
3656 // switch.
3657 m_pDocShell->SetView(pView);
3658 }
3659 else if (rValue.Name == ".uno:SpellOnline" && rValue.Value.has<bool>())
3660 aViewOption.SetOnlineSpell(rValue.Value.get<bool>());
3661 }
3662
3663 if (!sAuthor.isEmpty() && sAuthor != sOrigAuthor)
3664 {
3665 SwView* pFirstView = static_cast<SwView*>(SfxViewShell::GetFirst());
3666 if (pFirstView && SfxViewShell::GetNext(*pFirstView) == nullptr)
3667 {
3668 if (SwEditShell* pShell = &pFirstView->GetWrtShell())
3669 {
3670 pShell->SwViewShell::UpdateFields(true);
3671 pShell->ResetModified();
3672 }
3673 }
3674 }
3675
3676 // Set the initial zoom value to 1; usually it is set in setClientZoom and
3677 // SwViewShell::PaintTile; zoom value is used for chart in place
3678 // editing, see postMouseEvent and setGraphicSelection methods.
3679 aViewOption.SetZoom(1 * 100);
3680
3682 pViewShell->ApplyViewOptions(aViewOption);
3683
3684 // position the pages again after setting view options. Eg: if postit
3685 // rendering is false, then there would be no sidebar, so width of the
3686 // document needs to be adjusted
3687 pViewShell->GetLayout()->CheckViewLayout( pViewShell->GetViewOptions(), nullptr );
3688
3689 // Disable map mode, so that it's possible to send mouse event coordinates
3690 // directly in twips.
3691 SwEditWin& rEditWin = m_pDocShell->GetView()->GetEditWin();
3692 rEditWin.EnableMapMode(false);
3693
3694 // when the "This document may contain formatting or content that cannot
3695 // be saved..." dialog appears, it is auto-cancelled with tiled rendering,
3696 // causing 'Save' being disabled; so let's always save to the original
3697 // format
3699 officecfg::Office::Common::Save::Document::WarnAlienFormat::set(false, xChanges);
3700 xChanges->commit();
3701
3702 // disable word auto-completion suggestions, the tooltips are not visible,
3703 // and the editeng-like auto-completion is annoying
3705
3706 // don't change the whitespace at the beginning of paragraphs, this is
3707 // annoying when taking minutes without further formatting
3709}
3710
3711void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)
3712{
3713 SolarMutexGuard aGuard;
3714 SfxLokHelper::postKeyEventAsync(getDocWindow(), nType, nCharCode, nKeyCode);
3715}
3716
3717void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
3718{
3719 SolarMutexGuard aGuard;
3720
3721 SwViewShell* pWrtViewShell = m_pDocShell->GetWrtShell();
3722 if (!pWrtViewShell)
3723 {
3724 return;
3725 }
3726
3727 SwViewOption aOption(*(pWrtViewShell->GetViewOptions()));
3728 double fScale = aOption.GetZoom() / o3tl::convert(100.0, o3tl::Length::px, o3tl::Length::twip);
3729
3731 m_pDocShell->GetView(), nType, nX, nY, nCount, nButtons, nModifier, fScale, fScale))
3732 return;
3733
3734 // try to forward mouse event to controls
3736 SdrPage* pPage = pDrawLayer->GetPage(sal_uInt16(0));
3737 SdrView* pDrawView = pWrtViewShell->GetDrawView();
3738 SwEditWin& rEditWin = m_pDocShell->GetView()->GetEditWin();
3739 Point aPointTwip(nX, nY);
3740 Point aPointHMMDraw = o3tl::convert(aPointTwip, o3tl::Length::twip, o3tl::Length::mm100);
3741 if (LokControlHandler::postMouseEvent(pPage, pDrawView, rEditWin, nType, aPointHMMDraw, nCount, nButtons, nModifier))
3742 return;
3743
3744 LokMouseEventData aMouseEventData(nType, Point(nX, nY), nCount,
3745 MouseEventModifiers::SIMPLECLICK,
3746 nButtons, nModifier);
3747 SfxLokHelper::postMouseEventAsync(&rEditWin, aMouseEventData);
3748}
3749
3750void SwXTextDocument::setTextSelection(int nType, int nX, int nY)
3751{
3752 SolarMutexGuard aGuard;
3753
3754 SfxViewShell* pViewShell = m_pDocShell->GetView();
3755 LokChartHelper aChartHelper(pViewShell);
3756 if (aChartHelper.setTextSelection(nType, nX, nY))
3757 return;
3758
3759 SwEditWin& rEditWin = m_pDocShell->GetView()->GetEditWin();
3760 switch (nType)
3761 {
3762 case LOK_SETTEXTSELECTION_START:
3763 rEditWin.SetCursorTwipPosition(Point(nX, nY), /*bPoint=*/false, /*bClearMark=*/false);
3764 break;
3765 case LOK_SETTEXTSELECTION_END:
3766 rEditWin.SetCursorTwipPosition(Point(nX, nY), /*bPoint=*/true, /*bClearMark=*/false);
3767 break;
3768 case LOK_SETTEXTSELECTION_RESET:
3769 rEditWin.SetCursorTwipPosition(Point(nX, nY), /*bPoint=*/true, /*bClearMark=*/true);
3770 break;
3771 default:
3772 assert(false);
3773 break;
3774 }
3775}
3776
3777uno::Reference<datatransfer::XTransferable> SwXTextDocument::getSelection()
3778{
3779 SolarMutexGuard aGuard;
3780
3781 uno::Reference<datatransfer::XTransferable> xTransferable;
3782
3783 SwWrtShell* pWrtShell = m_pDocShell->GetWrtShell();
3784 if (SdrView* pSdrView = pWrtShell ? pWrtShell->GetDrawView() : nullptr)
3785 {
3786 if (pSdrView->GetTextEditObject())
3787 {
3788 // Editing shape text
3789 EditView& rEditView = pSdrView->GetTextEditOutlinerView()->GetEditView();
3790 xTransferable = rEditView.GetEditEngine()->CreateTransferable(rEditView.GetSelection());
3791 }
3792 }
3793
3794 if (SwPostItMgr* pPostItMgr = m_pDocShell->GetView()->GetPostItMgr())
3795 {
3796 if (sw::annotation::SwAnnotationWin* pWin = pPostItMgr->GetActiveSidebarWin())
3797 {
3798 // Editing postit text.
3799 EditView& rEditView = pWin->GetOutlinerView()->GetEditView();
3800 xTransferable = rEditView.GetEditEngine()->CreateTransferable(rEditView.GetSelection());
3801 }
3802 }
3803
3804 if (!xTransferable.is() && pWrtShell)
3805 xTransferable = new SwTransferable(*pWrtShell);
3806
3807 return xTransferable;
3808}
3809
3810void SwXTextDocument::setGraphicSelection(int nType, int nX, int nY)
3811{
3812 SolarMutexGuard aGuard;
3813
3814 SwViewShell* pWrtViewShell = m_pDocShell->GetWrtShell();
3815 SwViewOption aOption(*(pWrtViewShell->GetViewOptions()));
3816 double fScale = aOption.GetZoom() / o3tl::convert(100.0, o3tl::Length::px, o3tl::Length::twip);
3817
3818 SfxViewShell* pViewShell = m_pDocShell->GetView();
3819 LokChartHelper aChartHelper(pViewShell);
3820 if (aChartHelper.setGraphicSelection(nType, nX, nY, fScale, fScale))
3821 return;
3822
3823 SwEditWin& rEditWin = m_pDocShell->GetView()->GetEditWin();
3824 switch (nType)
3825 {
3826 case LOK_SETGRAPHICSELECTION_START:
3827 rEditWin.SetGraphicTwipPosition(/*bStart=*/true, Point(nX, nY));
3828 break;
3829 case LOK_SETGRAPHICSELECTION_END:
3830 rEditWin.SetGraphicTwipPosition(/*bStart=*/false, Point(nX, nY));
3831 break;
3832 default:
3833 assert(false);
3834 break;
3835 }
3836}
3837
3839{
3840 SolarMutexGuard aGuard;
3841
3842 SwWrtShell* pWrtShell = m_pDocShell->GetWrtShell();
3843 pWrtShell->ResetSelect(nullptr, false);
3844}
3845
3846void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight )
3847{
3849 aData.nSize = sizeof(SystemGraphicsData);
3850 #if defined(_WIN32)
3851 sal_Int64 nWindowHandle;
3852 Parent >>= nWindowHandle;
3853 aData.hWnd = reinterpret_cast<HWND>(nWindowHandle);
3854 ScopedVclPtrInstance<VirtualDevice> xDevice(aData, Size(1, 1), DeviceFormat::WITHOUT_ALPHA);
3855 paintTile(*xDevice, nOutputWidth, nOutputHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
3856 #else
3857 // TODO: support other platforms
3858 (void)Parent;
3859 (void)nOutputWidth;
3860 (void)nOutputHeight;
3861 (void)nTilePosX;
3862 (void)nTilePosY;
3863 (void)nTileWidth;
3864 (void)nTileHeight;
3865 #endif
3866}
3867
3871uno::Sequence< lang::Locale > SAL_CALL SwXTextDocument::getDocumentLanguages(
3872 ::sal_Int16 nScriptTypes,
3873 ::sal_Int16 nMaxCount )
3874{
3875 SolarMutexGuard aGuard;
3876
3877 // possible canonical values for nScriptTypes
3878 // any bit wise combination is allowed
3879 const sal_Int16 nLatin = 0x001;
3880 const sal_Int16 nAsian = 0x002;
3881 const sal_Int16 nComplex = 0x004;
3882
3883 // script types for which to get the languages
3884 const bool bLatin = 0 != (nScriptTypes & nLatin);
3885 const bool bAsian = 0 != (nScriptTypes & nAsian);
3886 const bool bComplex = 0 != (nScriptTypes & nComplex);
3887
3888 if (nScriptTypes < nLatin || nScriptTypes > (nLatin | nAsian | nComplex))
3889 throw IllegalArgumentException("nScriptTypes ranges from 1 to 7!", Reference< XInterface >(), 1);
3890 if (!m_pDocShell)
3891 throw DisposedException();
3892 SwDoc* pDoc = m_pDocShell->GetDoc();
3893
3894 // avoid duplicate values
3895 std::set< LanguageType > aAllLangs;
3896
3897 //USER STYLES
3898
3899 const SwCharFormats *pFormats = pDoc->GetCharFormats();
3900 for(size_t i = 0; i < pFormats->size(); ++i)
3901 {
3902 const SwAttrSet &rAttrSet = (*pFormats)[i]->GetAttrSet();
3904 if (bLatin)
3905 {
3906 nLang = rAttrSet.GetLanguage( false ).GetLanguage();
3908 aAllLangs.insert( nLang );
3909 }
3910 if (bAsian)
3911 {
3912 nLang = rAttrSet.GetCJKLanguage( false ).GetLanguage();
3914 aAllLangs.insert( nLang );
3915 }
3916 if (bComplex)
3917 {
3918 nLang = rAttrSet.GetCTLLanguage( false ).GetLanguage();
3920 aAllLangs.insert( nLang );
3921 }
3922 }
3923
3924 const SwTextFormatColls *pColls = pDoc->GetTextFormatColls();
3925 for (size_t i = 0; i < pColls->size(); ++i)
3926 {
3927 const SwAttrSet &rAttrSet = (*pColls)[i]->GetAttrSet();
3929 if (bLatin)
3930 {
3931 nLang = rAttrSet.GetLanguage( false ).GetLanguage();
3933 aAllLangs.insert( nLang );
3934 }
3935 if (bAsian)
3936 {
3937 nLang = rAttrSet.GetCJKLanguage( false ).GetLanguage();
3939 aAllLangs.insert( nLang );
3940 }
3941 if (bComplex)
3942 {
3943 nLang = rAttrSet.GetCTLLanguage( false ).GetLanguage();
3945 aAllLangs.insert( nLang );
3946 }
3947 }
3948
3949 //AUTO STYLES
3950 const IStyleAccess::SwAutoStyleFamily aFam[2] =
3951 {
3954 };
3956 {
3957 std::vector< std::shared_ptr<SfxItemSet> > rStyles;
3958 pDoc->GetIStyleAccess().getAllStyles(rStyles, i);
3959 while (!rStyles.empty())
3960 {
3961 std::shared_ptr<SfxItemSet> pStyle = rStyles.back();
3962 rStyles.pop_back();
3963 const SfxItemSet *pSet = pStyle.get();
3964
3966 if (bLatin)
3967 {
3968 assert(pSet);
3969 nLang = pSet->Get( RES_CHRATR_LANGUAGE, false ).GetLanguage();
3971 aAllLangs.insert( nLang );
3972 }
3973 if (bAsian)
3974 {
3975 assert(pSet);
3976 nLang = pSet->Get( RES_CHRATR_CJK_LANGUAGE, false ).GetLanguage();
3978 aAllLangs.insert( nLang );
3979 }
3980 if (bComplex)
3981 {
3982 assert(pSet);
3983 nLang = pSet->Get( RES_CHRATR_CTL_LANGUAGE, false ).GetLanguage();
3985 aAllLangs.insert( nLang );
3986 }
3987 }
3988 }
3989
3990 //TODO/mba: it's a strange concept that a view is needed to retrieve core data
3991 SwWrtShell *pWrtSh = m_pDocShell->GetWrtShell();
3992 SdrView *pSdrView = pWrtSh->GetDrawView();
3993
3994 if( pSdrView )
3995 {
3996 SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner();
3997 if(pOutliner)
3998 {
3999 EditEngine& rEditEng = const_cast<EditEngine&>(pOutliner->GetEditEngine());
4000 sal_Int32 nParCount = pOutliner->GetParagraphCount();
4001 for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
4002 {
4003 //every paragraph
4004 std::vector<sal_Int32> aPortions;
4005 rEditEng.GetPortions( nPar, aPortions );
4006
4007 for ( size_t nPos = aPortions.size(); nPos; )
4008 {
4009 //every position
4010 --nPos;
4011 sal_Int32 nEnd = aPortions[ nPos ];
4012 sal_Int32 nStart = nPos ? aPortions[ nPos - 1 ] : 0;
4013 ESelection aSelection( nPar, nStart, nPar, nEnd );
4014 SfxItemSet aAttr = rEditEng.GetAttribs( aSelection );
4015
4017 if (bLatin)
4018 {
4019 nLang = aAttr.Get( EE_CHAR_LANGUAGE, false ).GetLanguage();
4021 aAllLangs.insert( nLang );
4022 }
4023 if (bAsian)
4024 {
4025 nLang = aAttr.Get( EE_CHAR_LANGUAGE_CJK, false ).GetLanguage();
4027 aAllLangs.insert( nLang );
4028 }
4029 if (bComplex)
4030 {
4031 nLang = aAttr.Get( EE_CHAR_LANGUAGE_CTL, false ).GetLanguage();
4033 aAllLangs.insert( nLang );
4034 }
4035 }
4036 }
4037 }
4038 }
4039 // less than nMaxCount languages
4040 if (nMaxCount > static_cast< sal_Int16 >( aAllLangs.size() ))
4041 nMaxCount = static_cast< sal_Int16 >( aAllLangs.size() );
4042
4043 // build return value
4044 uno::Sequence< lang::Locale > aLanguages( nMaxCount );
4045 lang::Locale* pLanguage = aLanguages.getArray();
4046 if (nMaxCount > 0)
4047 {
4048 sal_Int32 nCount = 0;
4049 for (const auto& rLang : aAllLangs)
4050 {
4051 if (nCount >= nMaxCount)
4052 break;
4053 if (LANGUAGE_NONE != rLang)
4054 {
4055 pLanguage[nCount] = LanguageTag::convertToLocale( rLang );
4056 pLanguage[nCount].Language = SvtLanguageTable::GetLanguageString( rLang );
4057 nCount += 1;
4058 }
4059 }
4060 }
4061
4062 return aLanguages;
4063}
4064
4066 m_pxDoc(&rxDoc)
4067{
4068 m_sTables = SwResId(STR_CONTENT_TYPE_TABLE);
4069 m_sFrames = SwResId(STR_CONTENT_TYPE_FRAME);
4070 m_sGraphics = SwResId(STR_CONTENT_TYPE_GRAPHIC);
4071 m_sOLEs = SwResId(STR_CONTENT_TYPE_OLE);
4072 m_sSections = SwResId(STR_CONTENT_TYPE_REGION);
4073 m_sOutlines = SwResId(STR_CONTENT_TYPE_OUTLINE);
4074 m_sBookmarks = SwResId(STR_CONTENT_TYPE_BOOKMARK);
4075 m_sDrawingObjects = SwResId(STR_CONTENT_TYPE_DRAWOBJECT);
4076}
4077
4079{
4080}
4081
4083{
4084 Any aRet;
4085 if(!m_pxDoc)
4086 throw RuntimeException("No document available");
4087 OUString sSuffix("|");
4088 if(rName == m_sTables)
4089 {
4090 sSuffix += "table";
4091
4092 Reference< XNameAccess > xTables = new SwXLinkNameAccessWrapper(
4093 m_pxDoc->getTextTables(), rName, sSuffix );
4094 aRet <<= Reference< XPropertySet >(xTables, UNO_QUERY);
4095 }
4096 else if(rName == m_sFrames)
4097 {
4098 sSuffix += "frame";
4099 Reference< XNameAccess > xTables = new SwXLinkNameAccessWrapper(
4100 m_pxDoc->getTextFrames(), rName, sSuffix );
4101 aRet <<= Reference< XPropertySet >(xTables, UNO_QUERY);
4102 }
4103 else if(rName == m_sSections)
4104 {
4105 sSuffix += "region";
4106 Reference< XNameAccess > xTables = new SwXLinkNameAccessWrapper(
4107 m_pxDoc->getTextSections(), rName, sSuffix );
4108 aRet <<= Reference< XPropertySet >(xTables, UNO_QUERY);
4109 }
4110 else if(rName == m_sGraphics)
4111 {
4112 sSuffix += "graphic";
4113 Reference< XNameAccess > xTables = new SwXLinkNameAccessWrapper(
4114 m_pxDoc->getGraphicObjects(), rName, sSuffix );
4115 aRet <<= Reference< XPropertySet >(xTables, UNO_QUERY);
4116 }
4117 else if(rName == m_sOLEs)
4118 {
4119 sSuffix += "ole";
4120 Reference< XNameAccess > xTables = new SwXLinkNameAccessWrapper(
4121 m_pxDoc->getEmbeddedObjects(), rName, sSuffix );
4122 aRet <<= Reference< XPropertySet >(xTables, UNO_QUERY);
4123 }
4124 else if(rName == m_sOutlines)
4125 {
4126 sSuffix += "outline";
4127 Reference< XNameAccess > xTables = new SwXLinkNameAccessWrapper(
4128 *m_pxDoc, rName, sSuffix );
4129 aRet <<= Reference< XPropertySet >(xTables, UNO_QUERY);
4130 }
4131 else if(rName == m_sBookmarks)
4132 {
4133 sSuffix.clear();
4134 Reference< XNameAccess > xBkms = new SwXLinkNameAccessWrapper(
4135 m_pxDoc->getBookmarks(), rName, sSuffix );
4136 aRet <<= Reference< XPropertySet >(xBkms, UNO_QUERY);
4137 }
4138 else if(rName == m_sDrawingObjects)
4139 {
4140 sSuffix += "drawingobject";
4141 Reference<XNameAccess> xDrawingObjects = new SwXLinkNameAccessWrapper(
4142 *m_pxDoc, rName, sSuffix);
4143 aRet <<= Reference<XPropertySet>(xDrawingObjects, UNO_QUERY);
4144 }
4145 else
4146 throw NoSuchElementException();
4147 return aRet;
4148}
4149
4151{
4152 return { m_sTables,
4153 m_sFrames,
4155 m_sOLEs,
4160}
4161
4163{
4164 if( rName == m_sTables ||
4165 rName == m_sFrames ||
4166 rName == m_sGraphics||
4167 rName == m_sOLEs ||
4168 rName == m_sSections ||
4169 rName == m_sOutlines ||
4170 rName == m_sBookmarks ||
4171 rName == m_sDrawingObjects )
4172 return true;
4173 return false;
4174}
4175
4177{
4179
4180}
4181
4183{
4184 return nullptr != m_pxDoc;
4185}
4186
4188{
4189 return "SwXLinkTargetSupplier";
4190}
4191
4193{
4194 return cppu::supportsService(this, rServiceName);
4195}
4196
4198{
4199 Sequence< OUString > aRet { "com.sun.star.document.LinkTargets" };
4200 return aRet;
4201}
4202
4204 Reference< XNameAccess > const & xAccess, OUString aLinkDisplayName, OUString sSuffix ) :
4205 m_xRealAccess(xAccess),
4206 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_LINK_TARGET)),
4207 m_sLinkSuffix(std::move(sSuffix)),
4208 m_sLinkDisplayName(std::move(aLinkDisplayName)),
4209 m_pxDoc(nullptr)
4210{
4211}
4212
4214 OUString aLinkDisplayName, OUString sSuffix) :
4215 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_LINK_TARGET)),
4216 m_sLinkSuffix(std::move(sSuffix)),
4217 m_sLinkDisplayName(std::move(aLinkDisplayName)),
4218 m_pxDoc(&rxDoc)
4219{
4220}
4221
4223{
4224}
4225
4227{
4228 Any aRet;
4229 bool bFound = false;
4230 //cut link extension and call the real NameAccess
4231 OUString sParam = rName;
4232 OUString sSuffix(m_sLinkSuffix);
4233 if(sParam.getLength() > sSuffix.getLength() )
4234 {
4235 std::u16string_view sCmp = sParam.subView(sParam.getLength() - sSuffix.getLength(),
4236 sSuffix.getLength());
4237 if(sCmp == sSuffix)
4238 {
4239 if(m_pxDoc)
4240 {
4241 sParam = sParam.copy(0, sParam.getLength() - sSuffix.getLength());
4242 if(!m_pxDoc->GetDocShell())
4243 throw RuntimeException("No document shell available");
4244 SwDoc* pDoc = m_pxDoc->GetDocShell()->GetDoc();
4245
4246 if (sSuffix == "|outline")
4247 {
4248 const size_t nOutlineCount = pDoc->GetNodes().GetOutLineNds().size();
4249
4250 for (size_t i = 0; i < nOutlineCount && !bFound; ++i)
4251 {
4252 if(sParam == lcl_CreateOutlineString(i, pDoc))
4253 {
4254 OUString sOutlineText =
4256 i, pDoc->GetDocShell()->GetWrtShell()->GetLayout());
4257 sal_Int32 nOutlineLevel = pDoc->getIDocumentOutlineNodes().getOutlineLevel(i);
4258 Reference<XPropertySet> xOutline =
4259 new SwXOutlineTarget(sParam, sOutlineText, nOutlineLevel);
4260 aRet <<= xOutline;
4261 bFound = true;
4262 }
4263 }
4264 }
4265 else if (sSuffix == "|drawingobject")
4266 {
4268 if (pModel)
4269 {
4270 SdrPage* pPage = pModel->GetPage(0);
4271 for (size_t i = 0; i < pPage->GetObjCount() && !bFound; ++i)
4272 {
4273 SdrObject* pObj = pPage->GetObj(i);
4274 if (sParam == pObj->GetName())
4275 {
4276 Reference<XPropertySet> xDrawingObject = new SwXDrawingObjectTarget(sParam);
4277 aRet <<= xDrawingObject;
4278 bFound = true;
4279 }
4280 }
4281 }
4282 }
4283 }
4284 else
4285 {
4286 aRet = m_xRealAccess->getByName(sParam.copy(0, sParam.getLength() - sSuffix.getLength()));
4287 Reference< XInterface > xInt;
4288 if(!(aRet >>= xInt))
4289 throw RuntimeException("Could not retrieve property");
4290 Reference< XPropertySet > xProp(xInt, UNO_QUERY);
4291 aRet <<= xProp;
4292 bFound = true;
4293 }
4294 }
4295 }
4296 if(!bFound)
4297 throw NoSuchElementException();
4298 return aRet;
4299}
4300
4302{
4303 Sequence< OUString > aRet;
4304 if(m_pxDoc)
4305 {
4306 if(!m_pxDoc->GetDocShell())
4307 throw RuntimeException("No document shell available");
4308 SwDoc* pDoc = m_pxDoc->GetDocShell()->GetDoc();
4309 if (m_sLinkSuffix == "|outline")
4310 {
4311 const SwOutlineNodes& rOutlineNodes = pDoc->GetNodes().GetOutLineNds();
4312 const size_t nOutlineCount = rOutlineNodes.size();
4313 aRet.realloc(nOutlineCount);
4314 OUString* pResArr = aRet.getArray();
4315 for (size_t i = 0; i < nOutlineCount; ++i)
4316 {
4317 OUString sEntry = lcl_CreateOutlineString(i, pDoc) + "|outline";
4318 pResArr[i] = sEntry;
4319 }
4320 }
4321 else if (m_sLinkSuffix == "|drawingobject")
4322 {
4324 if(pModel)
4325 {
4326 SdrPage* pPage = pModel->GetPage(0);
4327 const size_t nObjCount = pPage->GetObjCount();
4328 aRet.realloc(nObjCount);
4329 OUString* pResArr = aRet.getArray();
4330 auto j = 0;
4331 for (size_t i = 0; i < nObjCount; ++i)
4332 {
4333 SdrObject* pObj = pPage->GetObj(i);
4334 if (!pObj->GetName().isEmpty())
4335 pResArr[j++] = pObj->GetName() + "|drawingobject";
4336 }
4337 }
4338 }
4339 }
4340 else
4341 {
4342 const Sequence< OUString > aOrg = m_xRealAccess->getElementNames();
4343 aRet.realloc(aOrg.getLength());
4344 std::transform(aOrg.begin(), aOrg.end(), aRet.getArray(),
4345 [this](const OUString& rOrg) -> OUString { return rOrg + m_sLinkSuffix; });
4346 }
4347 return aRet;
4348}
4349
4351{
4352 bool bRet = false;
4353 OUString sParam(rName);
4354 if(sParam.getLength() > m_sLinkSuffix.getLength() )
4355 {
4356 std::u16string_view sCmp = sParam.subView(sParam.getLength() - m_sLinkSuffix.getLength(),
4357 m_sLinkSuffix.getLength());
4358 if(sCmp == m_sLinkSuffix)
4359 {
4360 sParam = sParam.copy(0, sParam.getLength() - m_sLinkSuffix.getLength());
4361 if(m_pxDoc)
4362 {
4363 if(!m_pxDoc->GetDocShell())
4364 throw RuntimeException("No document shell available");
4365 SwDoc* pDoc = m_pxDoc->GetDocShell()->GetDoc();
4366 if (m_sLinkSuffix == "|outline")
4367 {
4368 const size_t nOutlineCount = pDoc->GetNodes().GetOutLineNds().size();
4369
4370 for (size_t i = 0; i < nOutlineCount && !bRet; ++i)
4371 {
4372 if(sParam == lcl_CreateOutlineString(i, pDoc))
4373 {
4374 bRet = true;
4375 }
4376 }
4377 }
4378 else if (m_sLinkSuffix == "|drawingobject")
4379 {
4381 if (pModel)
4382 {
4383 SdrPage* pPage = pModel->GetPage(0);
4384 const size_t nObjCount = pPage->GetObjCount();
4385 for (size_t i = 0; i < nObjCount && !bRet; ++i)
4386 {
4387 if (sParam == pPage->GetObj(i)->GetName())
4388 bRet = true;
4389 }
4390 }
4391 }
4392 }
4393 else
4394 {
4395 bRet = m_xRealAccess->hasByName(sParam);
4396 }
4397 }
4398 }
4399 return bRet;
4400}
4401
4403{
4405}
4406
4408{
4409 bool bRet = false;
4410 if(m_pxDoc)
4411 {
4412 OSL_FAIL("not implemented");
4413 }
4414 else
4415 {
4416 bRet = m_xRealAccess->hasElements();
4417 }
4418 return bRet;
4419}
4420
4422{
4423 static Reference< XPropertySetInfo > xRet = m_pPropSet->getPropertySetInfo();
4424 return xRet;
4425}
4426
4428 const OUString& rPropName, const Any& )
4429{
4430 throw UnknownPropertyException(rPropName);
4431}
4432
4433static Any lcl_GetDisplayBitmap(std::u16string_view sLinkSuffix)
4434{
4435 Any aRet;
4436 if(!sLinkSuffix.empty())
4437 sLinkSuffix = sLinkSuffix.substr(1);
4438 OUString sImgId;
4439
4440 if(sLinkSuffix == u"outline")
4441 sImgId = RID_BMP_NAVI_OUTLINE;
4442 else if(sLinkSuffix == u"table")
4443 sImgId = RID_BMP_NAVI_TABLE;
4444 else if(sLinkSuffix == u"frame")
4445 sImgId = RID_BMP_NAVI_FRAME;
4446 else if(sLinkSuffix == u"graphic")
4447 sImgId = RID_BMP_NAVI_GRAPHIC;
4448 else if(sLinkSuffix == u"ole")
4449 sImgId = RID_BMP_NAVI_OLE;
4450 else if(sLinkSuffix.empty())
4451 sImgId = RID_BMP_NAVI_BOOKMARK;
4452 else if(sLinkSuffix == u"region")
4453 sImgId = RID_BMP_NAVI_REGION;
4454 else if(sLinkSuffix == u"drawingobject")
4455 sImgId = RID_BMP_NAVI_DRAWOBJECT;
4456
4457 if (!sImgId.isEmpty())
4458 {
4459 aRet <<= VCLUnoHelper::CreateBitmap(BitmapEx(sImgId));
4460 }
4461 return aRet;
4462}
4463
4465{
4466 Any aRet;
4467 if( rPropertyName == UNO_LINK_DISPLAY_NAME )
4468 {
4469 aRet <<= m_sLinkDisplayName;
4470 }
4471 else if( rPropertyName == UNO_LINK_DISPLAY_BITMAP )
4472 {
4474 }
4475 else
4476 throw UnknownPropertyException(rPropertyName);
4477 return aRet;
4478}
4479
4481 const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
4482{}
4483
4485 const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
4486{}
4487
4489 const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
4490{}
4491
4493 const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
4494{}
4495
4496Reference< XNameAccess > SwXLinkNameAccessWrapper::getLinks()
4497{
4498 return this;
4499}
4500
4502{
4503 return "SwXLinkNameAccessWrapper";
4504}
4505
4507{
4508 return cppu::supportsService(this, rServiceName);
4509}
4510
4512{
4513 Sequence< OUString > aRet { "com.sun.star.document.LinkTargets" };
4514 return aRet;
4515}
4516
4517SwXOutlineTarget::SwXOutlineTarget(OUString aOutlineText, OUString aActualText,
4518 const sal_Int32 nOutlineLevel) :
4519 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_LINK_TARGET)),
4520 m_sOutlineText(std::move(aOutlineText)),
4521 m_sActualText(std::move(aActualText)),
4522 m_nOutlineLevel(nOutlineLevel)
4523{
4524}
4525
4527{
4528}
4529
4530Reference< XPropertySetInfo > SwXOutlineTarget::getPropertySetInfo()
4531{
4532 static Reference< XPropertySetInfo > xRet = m_pPropSet->getPropertySetInfo();
4533 return xRet;
4534}
4535
4537 const OUString& rPropertyName, const Any& /*aValue*/)
4538{
4539 throw UnknownPropertyException(rPropertyName);
4540}
4541
4542Any SwXOutlineTarget::getPropertyValue(const OUString& rPropertyName)
4543{
4544 if (rPropertyName != UNO_LINK_DISPLAY_NAME && rPropertyName != "ActualOutlineName" &&
4545 rPropertyName != "OutlineLevel")
4546 throw UnknownPropertyException(rPropertyName);
4547
4548 if (rPropertyName == "ActualOutlineName")
4549 return Any(m_sActualText);
4550
4551 if (rPropertyName == "OutlineLevel")
4552 return Any(m_nOutlineLevel);
4553
4554 return Any(m_sOutlineText);
4555}
4556
4558 const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
4559{
4560}
4561
4563 const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
4564{
4565}
4566
4568 const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
4569{
4570}
4571
4573 const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
4574{
4575}
4576
4578{
4579 return "SwXOutlineTarget";
4580}
4581
4583{
4584 return cppu::supportsService(this, ServiceName);
4585}
4586
4588{
4589 Sequence<OUString> aRet { "com.sun.star.document.LinkTarget" };
4590
4591 return aRet;
4592}
4593
4595 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_LINK_TARGET)),
4596 m_sDrawingObjectText(std::move(aDrawingObjectText))
4597{
4598}
4599
4601{
4602}
4603
4604Reference< XPropertySetInfo > SwXDrawingObjectTarget::getPropertySetInfo()
4605{
4606 static Reference< XPropertySetInfo > xRet = m_pPropSet->getPropertySetInfo();
4607 return xRet;
4608}
4609
4611 const OUString& rPropertyName, const Any& /*aValue*/)
4612{
4613 throw UnknownPropertyException(rPropertyName);
4614}
4615
4616Any SwXDrawingObjectTarget::getPropertyValue(const OUString& rPropertyName)
4617{
4618 if(rPropertyName != UNO_LINK_DISPLAY_NAME)
4619 throw UnknownPropertyException(rPropertyName);
4620
4621 return Any(m_sDrawingObjectText);
4622}
4623
4625 const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
4626{
4627}
4628
4630 const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
4631{
4632}
4633
4635 const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
4636{
4637}
4638
4640 const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
4641{
4642}
4643
4645{
4646 return "SwXDrawingObjectTarget";
4647}
4648
4650{
4651 return cppu::supportsService(this, ServiceName);
4652}
4653
4655{
4656 Sequence<OUString> aRet { "com.sun.star.document.LinkTarget" };
4657
4658 return aRet;
4659}
4660
4662SvxUnoForbiddenCharsTable ( rDoc.getIDocumentSettingAccess().getForbiddenCharacterTable() )
4663,m_pDoc(&rDoc)
4664{
4665}
4666
4668{
4669}
4670
4672{
4673 Reference<XInterface> xRet;
4674 if(m_pDoc)
4675 {
4676 switch(nWhich)
4677 {
4678 // #i52858#
4679 // assure that Draw model is created, if it doesn't exist.
4681 if(!m_xDashTable.is())
4683 xRet = m_xDashTable;
4684 break;
4686 if(!m_xGradientTable.is())
4688 xRet = m_xGradientTable;
4689 break;
4691 if(!m_xHatchTable.is())
4693 xRet = m_xHatchTable;
4694 break;
4696 if(!m_xBitmapTable.is())
4698 xRet = m_xBitmapTable;
4699 break;
4701 if(!m_xTransGradientTable.is())
4703 xRet = m_xTransGradientTable;
4704 break;
4706 if(!m_xMarkerTable.is())
4708 xRet = m_xMarkerTable;
4709 break;
4711 if(!m_xDrawDefaults.is())
4713 xRet = m_xDrawDefaults;
4714 break;
4715#if OSL_DEBUG_LEVEL > 0
4716 default: OSL_FAIL("which table?");
4717#endif
4718 }
4719 }
4720 return xRet;
4721}
4722
4724{
4725 m_xDashTable = nullptr;
4726 m_xGradientTable = nullptr;
4727 m_xHatchTable = nullptr;
4728 m_xBitmapTable = nullptr;
4729 m_xTransGradientTable = nullptr;
4730 m_xMarkerTable = nullptr;
4731 m_xDrawDefaults = nullptr;
4732 m_pDoc = nullptr;
4734}
4735
4737{
4738 if(m_pDoc)
4740}
4741
4743 SwViewShell& rSh, const SwViewOption &rViewOptions)
4744 : m_pShell(&rSh)
4745 , m_aOldViewOptions( rViewOptions )
4746{
4747}
4748
4750{
4751 if (m_pShell)
4752 {
4754 }
4755}
4756
4757void
4758SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions, bool setShowPlaceHoldersInPDF)
4759{
4760 // to avoid unnecessary reformatting the view options related to the content
4761 // below should only change if necessary, that is if respective content is present
4762 const bool bContainsHiddenChars = m_pShell->GetDoc()->ContainsHiddenChars();
4764 const bool bContainsHiddenFields = pFieldType && pFieldType->HasWriterListeners();
4766 const bool bContainsHiddenParagraphs = pFieldType && pFieldType->HasWriterListeners();
4768 const bool bContainsPlaceHolders = pFieldType && pFieldType->HasWriterListeners();
4769 const bool bContainsFields = m_pShell->IsAnyFieldInDoc();
4770
4771 SwViewOption aRenderViewOptions( m_aOldViewOptions );
4772
4773 // disable anything in the view that should not be printed (or exported to PDF) by default
4774 // (see also dialog "Tools/Options - StarOffice Writer - Formatting Aids"
4775 // in section "Display of ...")
4776 aRenderViewOptions.SetParagraph( false ); // paragraph end
4777 aRenderViewOptions.SetSoftHyph( false ); // aka custom hyphens
4778 aRenderViewOptions.SetBlank( false ); // spaces
4779 aRenderViewOptions.SetHardBlank( false ); // non-breaking spaces
4780 aRenderViewOptions.SetTab( false ); // tabs
4781 aRenderViewOptions.SetShowBookmarks( false ); // bookmarks
4782 aRenderViewOptions.SetLineBreak( false ); // breaks (type 1)
4783 aRenderViewOptions.SetPageBreak( false ); // breaks (type 2)
4784 aRenderViewOptions.SetColumnBreak( false ); // breaks (type 3)
4785 bool bVal = pPrtOptions && pPrtOptions->m_bPrintHiddenText;
4786 if (bContainsHiddenChars)
4787 aRenderViewOptions.SetShowHiddenChar( bVal ); // hidden text
4788 if (bContainsHiddenFields)
4789 aRenderViewOptions.SetShowHiddenField( bVal );
4790 if (bContainsHiddenParagraphs)
4791 aRenderViewOptions.SetShowHiddenPara( bVal );
4792
4793 if (bContainsPlaceHolders)
4794 {
4795 // should always be printed in PDF export!
4796 bVal = !pPrtOptions ? setShowPlaceHoldersInPDF : pPrtOptions->m_bPrintTextPlaceholder;
4797 aRenderViewOptions.SetShowPlaceHolderFields( bVal );
4798 }
4799
4800 if (bContainsFields)
4801 aRenderViewOptions.SetFieldName( false );
4802
4803 // we need to set this flag in order to get to see the visible effect of
4804 // some of the above settings (needed for correct rendering)
4805 aRenderViewOptions.SetViewMetaChars( true );
4806
4807 if (m_aOldViewOptions != aRenderViewOptions) // check if reformatting is necessary
4808 {
4809 aRenderViewOptions.SetPrinting( pPrtOptions != nullptr );
4810 m_pShell->ApplyViewOptions( aRenderViewOptions );
4811 }
4812}
4813
4814/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
@ ShowDelete
show all deletes
@ On
RedlineFlags on.
@ ShowInsert
show all inserts
OUString SwRedlineTypeToOUString(RedlineType eType)
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
constexpr auto convertTwipToMm100(N n)
css::util::DateTime GetUNODateTime() const
void GetPortions(sal_Int32 nPara, std::vector< sal_Int32 > &rList)
css::uno::Reference< css::datatransfer::XTransferable > CreateTransferable(const ESelection &rSelection) const
SfxItemSet GetAttribs(sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags=GetAttribsFlags::ALL) const
static bool HasValidData(const css::uno::Reference< css::datatransfer::XTransferable > &rTransferable)
ESelection GetSelection() const
EditEngine * GetEditEngine() const
bool GetAutoControlFocus() const
void SetOpenInDesignMode(bool _bOpenDesignMode)
void SetAutoControlFocus(bool _bAutoControlFocus)
bool GetOpenInDesignMode() const
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
virtual void setPrintData(const SwPrintData &rPrtData)=0
Sets the PrintData.
virtual const SwPrintData & getPrintData() const =0
Returns the PrintData.
virtual SwDrawModel * GetOrCreateDrawModel()=0
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual bool SetFieldsDirty(bool b, const SwNode *pChk, SwNodeOffset nLen)=0
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
virtual sfx2::LinkManager & GetLinkManager()=0
virtual sw::mark::IFieldmark * getInnerFieldmarkFor(const SwPosition &pos) const =0
virtual OUString getOutlineText(const tSortedOutlineNodeList::size_type nIdx, SwRootFrame const *pLayout, const bool bWithNumber=true, const bool bWithSpacesForLevel=false, const bool bWithFootnote=true) const =0
virtual int getOutlineLevel(const tSortedOutlineNodeList::size_type nIdx) const =0
virtual void SetRedlinePassword(const css::uno::Sequence< sal_Int8 > &rNewPassword)=0
static bool IsShowChanges(const RedlineFlags eM)
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual const css::uno::Sequence< sal_Int8 > & GetRedlinePassword() const =0
virtual void SetModified()=0
Must be called manually at changes of format.
virtual const SwDocStat & GetUpdatedDocStat(bool bCompleteAsync, bool bFields)=0
Updates the document statistics if the document has been modified and returns a reference to the resu...
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
virtual void BlockIdling()=0
Increment block count.
virtual void UnblockIdling()=0
Decrement block count.
virtual void getAllStyles(std::vector< std::shared_ptr< SfxItemSet > > &rStyles, SwAutoStyleFamily eFamily)=0
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
bool setGraphicSelection(int nType, int nX, int nY, double fScaleX=1.0, double fScaleY=1.0)
bool setTextSelection(int nType, int nX, int nY)
static void PaintAllChartsOnTile(VirtualDevice &rDevice, int nOutputWidth, int nOutputHeight, int nTilePosX, int nTilePosY, tools::Long nTileWidth, tools::Long nTileHeight, bool bNegativeX=false)
static void paintControlTile(const SdrPage *pPage, const SdrView *pDrawView, vcl::Window const &rMainWindow, VirtualDevice &rDevice, Size aOutputSize, tools::Rectangle const &rTileRect)
static bool postMouseEvent(const SdrPage *pPage, const SdrView *pDrawView, vcl::DocWindow &rMainWindow, int nType, Point aPointHmm, int nCount, int nButtons, int nModifier)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long Y() const
constexpr tools::Long X() const
const Size & GetPaperSizePixel() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
const SdrOutliner * GetTextEditOutliner() const
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual const OUString & GetName() const
virtual sal_Bool SAL_CALL attachResource(const OUString &sURL, const css::uno::Sequence< css::beans::PropertyValue > &aArgs) override
virtual void SAL_CALL close(sal_Bool bDeliverOwnership) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual void SAL_CALL connectController(const css::uno::Reference< css::frame::XController > &xController) override
virtual void SAL_CALL setCurrentController(const css::uno::Reference< css::frame::XController > &xController) override
virtual css::uno::Reference< css::frame::XController > SAL_CALL getCurrentController() override
virtual OUString SAL_CALL getURL() override
virtual void SAL_CALL disconnectController(const css::uno::Reference< css::frame::XController > &xController) override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL release() noexcept override
virtual void SAL_CALL dispose() override
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
const SfxItemPropertyMap & getPropertyMap() const
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
static void postKeyEventAsync(const VclPtr< vcl::Window > &xWindow, int nType, int nCharCode, int nKeyCode, int nRepeat=0)
static bool testInPlaceComponentMouseEventHit(SfxViewShell *pViewShell, int nType, int nX, int nY, int nCount, int nButtons, int nModifier, double fScaleX, double fScaleY, bool bNegativeX=false)
static VclPtr< vcl::Window > getInPlaceDocWindow(SfxViewShell *pViewShell)
static void postMouseEventAsync(const VclPtr< vcl::Window > &xWindow, LokMouseEventData const &rLokMouseEventData)
SfxItemSet & GetItemSet() const
bool Is() const
css::uno::Reference< css::script::XLibraryContainer > GetBasicContainer()
bool IsEnableSetModified() const
css::uno::Reference< css::script::XLibraryContainer > GetDialogContainer()
SfxMedium * GetMedium() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
void EnableSetModified(bool bEnable=true)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
void AppendItem(const SfxPoolItem &)
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
SfxViewShell * GetViewShell() const
bool DoClose()
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SfxDispatcher * GetDispatcher()
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
static SfxViewFrame * LoadHiddenDocument(SfxObjectShell const &i_rDoc, SfxInterfaceId i_nViewId)
css::uno::Reference< css::frame::XController > GetController() const
SfxViewFrame & GetViewFrame() const
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
virtual SfxObjectShell * GetObjectShell() override
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
SfxInPlaceClient * GetIPClient() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
SvNumberFormatter * GetNumberFormatter() const
void SetNumberFormatter(SvNumberFormatter *pNew)
bool PutEntry(OUString &rString, sal_Int32 &nCheckPos, SvNumFormatType &nType, sal_uInt32 &nKey, LanguageType eLnge=LANGUAGE_DONTKNOW, bool bReplaceBooleanEquivalent=true)
sal_uInt32 GetEntryKey(std::u16string_view sStr, LanguageType eLnge=LANGUAGE_DONTKNOW)
sal_uInt16 GetYear2000() const
bool IsNumberFormat(const OUString &sString, sal_uInt32 &F_Index, double &fOutNumber, SvNumInputOptions eInputOptions=SvNumInputOptions::NONE)
static OUString GetLanguageString(const LanguageType eType)
SvxAutoCorrect * GetAutoCorrect()
static SvxAutoCorrCfg & Get()
SvxSwAutoFormatFlags & GetSwFlags()
virtual ::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface > SAL_CALL createInstance(const OUString &ServiceSpecifier) override
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override
LanguageType GetLanguage() const
sal_uInt16 GetStart() const
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const OUString &ServiceSpecifier, const css::uno::Sequence< css::uno::Any > &Arguments) override
std::shared_ptr< SvxForbiddenCharactersTable > mxForbiddenChars
const SvxLanguageItem & GetCJKLanguage(bool=true) const
Definition: charatr.hxx:93
const SvxLanguageItem & GetLanguage(bool=true) const
Definition: charatr.hxx:91
const SvxLanguageItem & GetCTLLanguage(bool=true) const
Definition: charatr.hxx:95
size_t size() const
Definition: charformats.hxx:71
An horizontal ruler with a control for comment panel visibility for Writer.
Definition: swruler.hxx:29
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
OUString getPageRectangles()
Implementation of lok::Document::getPartPageRectangles() for Writer.
Definition: crsrsh.cxx:1598
sal_uInt16 GetPageCnt()
Definition: crsrsh.cxx:1591
IDocumentChartDataProviderAccess & getIDocumentChartDataProviderAccess()
Definition: docshini.cxx:706
void CallAutomationDocumentEventSinks(const OUString &Method, css::uno::Sequence< css::uno::Any > &Arguments)
Definition: docsh.cxx:1420
void SetView(SwView *pVw)
Set View for actions via Shell.
Definition: docsh.cxx:1162
SAL_DLLPRIVATE bool IsTemplate() const
Definition: docsh.hxx:310
const SwView * GetView() const
Definition: docsh.hxx:221
void Execute(SfxRequest &)
Dispatcher.
Definition: docsh2.cxx:397
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:225
virtual std::unique_ptr< LockAllViewsGuard > LockAllViews() override
Definition: docsh.cxx:366
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
Definition: doc.hxx:197
bool IsInReading() const
Definition: doc.hxx:969
void SetInReading(bool bNew)
Definition: doc.hxx:970
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:408
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:252
SfxObjectShell * CreateCopy(bool bCallInitNew, bool bEmpty) const
Definition: docnew.cxx:893
bool ContainsHiddenChars() const
Checks if any of the text node contains hidden characters.
Definition: doc.cxx:1798
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in current document.
Definition: docfmt.cxx:548
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1081
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1039
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:755
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:274
SwNodes & GetNodes()
Definition: doc.hxx:422
IStyleAccess & GetIStyleAccess()
Definition: doc.hxx:772
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:371
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:349
IDocumentOutlineNodes const & getIDocumentOutlineNodes() const
Definition: doc.cxx:318
void SetTOIAutoMarkURL(const OUString &rSet)
Definition: doc.hxx:967
static void UpdatePagesForPrintingWithPostItData(SwRenderData &rData, const SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount)
Definition: doc.cxx:772
const css::uno::Reference< css::container::XNameContainer > & getXForms() const
Definition: doc.hxx:1630
const OUString & GetTOIAutoMarkURL() const
Definition: doc.hxx:966
::sw::DocumentRedlineManager const & GetDocumentRedlineManager() const
Definition: doc.cxx:359
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:672
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:793
const SwPagePreviewPrtData * GetPreviewPrtData() const
Definition: doc.hxx:1477
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:440
void SetInWriterfilterImport(bool const b)
Definition: doc.hxx:988
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: doc.hxx:814
static void CalculatePagesForPrinting(const SwRootFrame &rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport, sal_Int32 nDocPageCount)
get the set of printable pages for the XRenderable API by evaluating the respective settings (see imp...
Definition: doc.cxx:678
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1337
void SetPreviewPrtData(const SwPagePreviewPrtData *pData)
Definition: docnew.cxx:776
void SetDefaultPageMode(bool bSquaredPageMode)
Definition: docdesc.cxx:1013
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:169
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1429
IDocumentTimerAccess const & getIDocumentTimerAccess() const
Definition: doc.cxx:263
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
bool IsInWriterfilterImport() const
Definition: doc.hxx:987
IDocumentStatistics const & getIDocumentStatistics() const
Definition: doc.cxx:387
static void CalculatePagePairsForProspectPrinting(const SwRootFrame &rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount)
Definition: doc.cxx:912
static SvxSwAutoFormatFlags * GetAutoFormatFlags()
Definition: autofmt.cxx:2813
void SetModified()
Definition: edws.cxx:70
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
void LogicInvalidate(const tools::Rectangle *pRectangle) override
Definition: edtwin.cxx:6759
void SetCursorTwipPosition(const Point &rPosition, bool bPoint, bool bClearMark)
Allows adjusting the point or mark of the selection to a document coordinate.
Definition: edtwin.cxx:6764
void SetGraphicTwipPosition(bool bStart, const Point &rPosition)
Allows starting or ending a graphic move or resize action.
Definition: edtwin.cxx:6814
comphelper::OInterfaceContainerHelper3< css::text::XPasteListener > & GetPasteListeners()
Definition: fecopy.cxx:1224
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:247
SfxPoolItem subclass that wraps an SwContentControl.
const std::shared_ptr< SwContentControl > & GetContentControl() const
const SwRect & getFrameArea() const
Definition: frame.hxx:179
SwFrame * GetNext()
Definition: frame.hxx:682
const SwFrame * Lower() const
Definition: layfrm.hxx:101
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
const SwStartNode * FindFooterStartNode() const
Definition: node.hxx:226
const SwStartNode * FindHeaderStartNode() const
Definition: node.hxx:224
SwDoc & GetDoc()
Definition: node.hxx:233
const SwStartNode * FindFlyStartNode() const
Definition: node.hxx:220
const SwStartNode * FindFootnoteStartNode() const
Definition: node.hxx:222
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:236
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:87
std::vector< SwTextNode * > tTextNodeList
Definition: numrule.hxx:97
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
const SwPosition * GetMark() const
Definition: pam.hxx:255
const SwPosition * End() const
Definition: pam.hxx:263
sal_uInt16 GetPageNum(bool bAtPoint=true, const Point *pLayPos=nullptr)
Get number of page which contains cursor.
Definition: pam.cxx:700
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const SwPosition * Start() const
Definition: pam.hxx:258
A page of the document layout.
Definition: pagefrm.hxx:60
sal_Int16 GetRow() const
Definition: pvprtdat.hxx:57
sal_Int16 GetCol() const
Definition: pvprtdat.hxx:60
sal_Int32 GetRightSpace() const
Definition: pvprtdat.hxx:42
sal_Int32 GetBottomSpace() const
Definition: pvprtdat.hxx:48
sal_Int32 GetVertSpace() const
Definition: pvprtdat.hxx:54
sal_Int32 GetLeftSpace() const
Definition: pvprtdat.hxx:39
sal_Int32 GetTopSpace() const
Definition: pvprtdat.hxx:45
bool GetLandscape() const
Definition: pvprtdat.hxx:63
sal_Int32 GetHorzSpace() const
Definition: pvprtdat.hxx:51
View of a document.
Definition: pview.hxx:162
sal_uInt16 GetSelectedPage() const
Definition: pview.hxx:253
SwViewShell * GetViewShell() const
Definition: pview.hxx:236
sal_uInt32 GetPostItId() const
Definition: docufld.hxx:487
bool GetResolved() const
Definition: docufld.cxx:1794
virtual OUString GetPar1() const override
Author.
Definition: docufld.cxx:1818
const DateTime & GetDateTime() const
Definition: docufld.hxx:484
sal_uInt32 GetParentId() const
Definition: docufld.hxx:489
virtual OUString GetPar2() const override
Text.
Definition: docufld.cxx:1830
void SetPrintReverse(bool b)
Definition: printdata.hxx:156
bool m_bPrintTextPlaceholder
Definition: printdata.hxx:61
void SetPrintHiddenText(bool b)
Definition: printdata.hxx:166
void SetPrintTable(bool b)
Definition: printdata.hxx:151
void SetPrintRightPage(bool b)
Definition: printdata.hxx:155
void SetPrintBlackFont(bool b)
Definition: printdata.hxx:163
void SetPrintLeftPage(bool b)
Definition: printdata.hxx:154
void SetPaperFromSetup(bool b)
Definition: printdata.hxx:157
void SetPrintProspect_RTL(bool b)
Definition: printdata.hxx:161
void SetPrintDraw(bool b)
Definition: printdata.hxx:152
void SetPrintTextPlaceholder(bool b)
Definition: printdata.hxx:167
void SetPrintGraphic(bool b)
Definition: printdata.hxx:150
bool IsPrintEmptyPages() const
Definition: printdata.hxx:139
void SetPrintControl(bool b)
Definition: printdata.hxx:153
void SetPrintPostIts(SwPostItMode n)
Definition: printdata.hxx:159
void SetPrintProspect(bool b)
Definition: printdata.hxx:160
void SetPrintEmptyPages(bool b)
Definition: printdata.hxx:158
void SetPrintPageBackground(bool b)
Definition: printdata.hxx:162
bool m_bPrintHiddenText
Definition: printdata.hxx:61
bool IsPrintLeftPages() const
Definition: printdata.cxx:371
bool IsPrintGraphics() const
Definition: printdata.cxx:406
bool IsPrintRightPages() const
Definition: printdata.cxx:385
bool IsPrintEmptyPages(bool bIsPDFExport) const
Definition: printdata.cxx:396
bool IsPrintFormControls() const
Definition: printdata.hxx:183
bool IsPrintHiddenText() const
Definition: printdata.hxx:188
bool IsPrintProspect() const
Definition: printdata.hxx:185
bool IsPrintDrawings() const
Definition: printdata.cxx:416
bool IsPrintTextPlaceholders() const
Definition: printdata.hxx:187
SwPostItMode GetPrintPostItsType() const
Definition: printdata.hxx:190
bool IsPaperFromSetup() const
Definition: printdata.hxx:191
bool IsPrintPageBackground() const
Definition: printdata.hxx:184
bool IsPrintWithBlackTextColor() const
Definition: printdata.hxx:189
bool IsPrintProspectRTL() const
Definition: printdata.hxx:186
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Height(tools::Long nNew)
Definition: swrect.hxx:193
void Pos(const Point &rNew)
Definition: swrect.hxx:171
void SSize(const Size &rNew)
Definition: swrect.hxx:180
tools::Rectangle SVRect() const
Definition: swrect.hxx:292
size_type size() const
Definition: docary.hxx:268
vector_type::size_type size_type
Definition: docary.hxx:223
A class that stores temporary data that is needed for rendering the document.
Definition: printdata.hxx:204
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
void CheckViewLayout(const SwViewOption *pViewOpt, const SwRect *pVisArea)
Definition: pagechg.cxx:2128
Represents the current text cursor of one opened edit window.
Definition: viscrs.hxx:140
virtual void FillRects() override
Definition: viscrs.cxx:948
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:939
sal_Int32 PrintSource(OutputDevice *pOutDev, sal_Int32 nPage, bool bCalcNumPagesOnly)
Definition: srcview.cxx:654
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
SwNumberTree::tNumberVector GetNumberVector(SwRootFrame const *pLayout=nullptr, SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Definition: ndtxt.cxx:4125
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2921
int GetActualListLevel(SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4248
SwTextAttr * GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, ::sw::GetTextAttrMode const eMode=::sw::GetTextAttrMode::Default) const
get the innermost text attribute covering position nIndex.
Definition: ndtxt.cxx:1804
static bool IsPaste(const SwWrtShell &, const TransferableDataHelper &)
Definition: swdtflvr.cxx:1367
size_t size() const
Definition: docary.hxx:88
void AdjustViewOptions(SwPrintData const *const pPrtOptions, bool setShowPlaceHoldersInPDF)
Definition: unotxdoc.cxx:4758
SwViewOption m_aOldViewOptions
Definition: unotxdoc.hxx:665
SwViewShell * m_pShell
Definition: unotxdoc.hxx:664
SwViewOptionAdjust_Impl(SwViewShell &rSh, const SwViewOption &rViewOptions)
Definition: unotxdoc.cxx:4742
void SetLineBreak(bool b)
Definition: viewopt.hxx:394
void SetHideWhitespaceMode(bool bMode)
Definition: viewopt.hxx:648
void SetTab(bool b)
Definition: viewopt.hxx:346
void SetPrinting(bool b)
Definition: viewopt.hxx:597
void SetShowHiddenChar(bool b)
Definition: viewopt.hxx:491
void SetHardBlank(bool b)
Definition: viewopt.hxx:364
void SetColumnBreak(bool b)
Definition: viewopt.hxx:404
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:669
void SetPostIts(bool b)
Definition: viewopt.hxx:430
void SetPageBreak(bool b)
Definition: viewopt.hxx:399
OUString GetThemeName() const
Definition: viewopt.hxx:321
void SetZoom(sal_uInt16 n)
Definition: viewopt.hxx:670
void SetParagraph(bool b)
Definition: viewopt.hxx:374
void SetSoftHyph(bool b)
Definition: viewopt.hxx:412
void SetUseHeaderFooterMenu(bool b)
Definition: viewopt.hxx:475
void SetShowHiddenField(bool b)
Definition: viewopt.hxx:496
void SetShowBookmarks(bool const b)
Definition: viewopt.hxx:379
void SetBlank(bool b)
Definition: viewopt.hxx:355
bool getBrowseMode() const
Definition: viewopt.hxx:636
void SetOnlineSpell(bool b)
Definition: viewopt.hxx:541
void SetShowPlaceHolderFields(bool bSet)
Definition: viewopt.hxx:806
bool IsViewMetaChars() const
Definition: viewopt.hxx:546
void SetShowHiddenPara(bool b)
Definition: viewopt.hxx:571
bool IsOnlineSpell() const
Definition: viewopt.hxx:537
void SetFieldName(bool b)
Definition: viewopt.hxx:420
bool IsWhitespaceHidden() const
Definition: viewopt.hxx:652
void SetAppearanceFlag(ViewOptFlags nFlag, bool bSet, bool bSaveInConfig=false)
Definition: viewopt.cxx:542
void setBrowseMode(bool bSet)
Definition: viewopt.hxx:637
void SetViewMetaChars(bool b)
Definition: viewopt.hxx:548
void PaintTile(VirtualDevice &rDevice, int contextWidth, int contextHeight, int tilePosX, int tilePosY, tools::Long tileWidth, tools::Long tileHeight)
Paint tile.
Definition: viewsh.cxx:1985
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:452
void SetPDFExportOption(bool bSet)
Definition: viewsh.cxx:2508
void StartAction()
Definition: viewsh.hxx:619
virtual void ApplyViewOptions(const SwViewOption &rOpt)
Definition: viewsh.cxx:2205
void Reformat()
Invalidates complete Layout (ApplyViewOption).
Definition: viewsh.cxx:1050
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2821
void EndAction(const bool bIdleEnd=false)
Definition: viewsh.hxx:625
bool IsAnyFieldInDoc() const
Check if the DocNodesArray contains fields.
Definition: vprint.cxx:600
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2163
void PrintProspect(OutputDevice *pOutDev, const SwPrintData &rPrintData, sal_Int32 nRenderer)
print brochure
Definition: viewpg.cxx:64
Size GetDocSize() const
Definition: viewsh.cxx:2190
SwDoc * GetDoc() const
Definition: viewsh.hxx:308
Size GetPageSize(sal_uInt16 nPageNum, bool bSkipEmptyPages) const
Definition: viewsh.cxx:2679
virtual void CalcLayout()
Definition: viewsh.cxx:1075
sal_uInt16 GetPageCount() const
Definition: viewsh.cxx:2674
bool PrintOrPDFExport(OutputDevice *pOutDev, SwPrintData const &rPrintData, sal_Int32 nRenderer, bool bIsPDFExport)
Definition: vprint.cxx:443
Point GetPagePos(sal_uInt16 nPageNum) const
Definition: viewsh.cxx:699
SdrView * GetDrawView()
Definition: vnew.cxx:386
void CalcPagesForPrint(sal_uInt16 nMax)
Definition: vprint.cxx:276
Definition: view.hxx:146
int getPart() const override
See SfxViewShell::getPart().
Definition: viewprt.cxx:265
virtual bool HasSelection(bool bText=true) const override
Definition: view.cxx:1668
SwWrtShell & GetWrtShell() const
Definition: view.hxx:423
void SetViewLayout(sal_uInt16 nColumns, bool bBookMode, bool bViewOnly=false)
Definition: viewmdi.cxx:225
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:650
void SetRedlineAuthor(const OUString &rAuthor)
Definition: viewprt.cxx:279
css::view::XSelectionSupplier * GetUNOObject()
Definition: view0.cxx:113
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:424
SwEditWin & GetEditWin()
Definition: view.hxx:426
SvxRuler & GetHRuler()
Definition: view.hxx:505
void RecheckBrowseMode()
Definition: view0.cxx:173
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
bool GotoPage(sal_uInt16 nPage, bool bRecord)
Definition: move.cxx:611
bool GotoContentControl(const SwFormatContentControl &rContentControl, bool bOnlyRefresh=false)
Definition: wrtsh3.cxx:96
tools::Long ResetSelect(const Point *, bool)
Definition: select.cxx:342
const SwView & GetView() const
Definition: wrtsh.hxx:443
rtl::Reference< SwXTextCursor > CreateTextCursor(const bool bIgnoreTables=false)
Definition: unotext.cxx:2478
UNO wrapper around SwContentControlManager.
SwXDocumentPropertyHelper(SwDoc &rDoc)
Definition: unotxdoc.cxx:4661
css::uno::Reference< css::uno::XInterface > m_xBitmapTable
Definition: unotxdoc.hxx:642
css::uno::Reference< css::uno::XInterface > m_xTransGradientTable
Definition: unotxdoc.hxx:643
css::uno::Reference< css::uno::XInterface > m_xHatchTable
Definition: unotxdoc.hxx:641
virtual void onChange() override
Definition: unotxdoc.cxx:4736
css::uno::Reference< css::uno::XInterface > GetDrawTable(SwCreateDrawTable nWhich)
Definition: unotxdoc.cxx:4671
css::uno::Reference< css::uno::XInterface > m_xDrawDefaults
Definition: unotxdoc.hxx:645
css::uno::Reference< css::uno::XInterface > m_xDashTable
Definition: unotxdoc.hxx:639
virtual ~SwXDocumentPropertyHelper() override
Definition: unotxdoc.cxx:4667
css::uno::Reference< css::uno::XInterface > m_xGradientTable
Definition: unotxdoc.hxx:640
css::uno::Reference< css::uno::XInterface > m_xMarkerTable
Definition: unotxdoc.hxx:644
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unotxdoc.cxx:4610
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unotxdoc.cxx:4604
OUString m_sDrawingObjectText
Definition: unotxdoc.hxx:611
const SfxItemPropertySet * m_pPropSet
Definition: unotxdoc.hxx:610
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxdoc.cxx:4634
virtual ~SwXDrawingObjectTarget() override
Definition: unotxdoc.cxx:4600
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unotxdoc.cxx:4624
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unotxdoc.cxx:4629
virtual OUString SAL_CALL getImplementationName() override
Definition: unotxdoc.cxx:4644
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unotxdoc.cxx:4616
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxdoc.cxx:4639
SwXDrawingObjectTarget(OUString aDrawingObjectText)
Definition: unotxdoc.cxx:4594
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unotxdoc.cxx:4649
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unotxdoc.cxx:4654
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unotxdoc.cxx:4301
virtual sal_Bool SAL_CALL hasElements() override
Definition: unotxdoc.cxx:4407
SwXTextDocument * m_pxDoc
Definition: unotxdoc.hxx:536
const SfxItemPropertySet * m_pPropSet
Definition: unotxdoc.hxx:533
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unotxdoc.cxx:4350
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unotxdoc.cxx:4480
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unotxdoc.cxx:4427
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unotxdoc.cxx:4421
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override
Definition: unotxdoc.cxx:4496
const OUString m_sLinkDisplayName
Definition: unotxdoc.hxx:535
css::uno::Reference< css::container::XNameAccess > m_xRealAccess
Definition: unotxdoc.hxx:532
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unotxdoc.cxx:4226
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unotxdoc.cxx:4511
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxdoc.cxx:4488
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unotxdoc.cxx:4402
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unotxdoc.cxx:4506
const OUString m_sLinkSuffix
Definition: unotxdoc.hxx:534
SwXLinkNameAccessWrapper(css::uno::Reference< css::container::XNameAccess > const &xAccess, OUString aLinkDisplayName, OUString sSuffix)
virtual ~SwXLinkNameAccessWrapper() override
Definition: unotxdoc.cxx:4222
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unotxdoc.cxx:4484
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxdoc.cxx:4492
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unotxdoc.cxx:4464
virtual OUString SAL_CALL getImplementationName() override
Definition: unotxdoc.cxx:4501
virtual ~SwXLinkTargetSupplier() override
Definition: unotxdoc.cxx:4078
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unotxdoc.cxx:4192
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unotxdoc.cxx:4197
OUString m_sDrawingObjects
Definition: unotxdoc.hxx:501
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unotxdoc.cxx:4162
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unotxdoc.cxx:4176
SwXTextDocument * m_pxDoc
Definition: unotxdoc.hxx:493
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unotxdoc.cxx:4082
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unotxdoc.cxx:4150
virtual sal_Bool SAL_CALL hasElements() override
Definition: unotxdoc.cxx:4182
SwXLinkTargetSupplier(SwXTextDocument &rxDoc)
Definition: unotxdoc.cxx:4065
virtual OUString SAL_CALL getImplementationName() override
Definition: unotxdoc.cxx:4187
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxdoc.cxx:4572
OUString m_sActualText
Definition: unotxdoc.hxx:581
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unotxdoc.cxx:4542
const sal_Int32 m_nOutlineLevel
Definition: unotxdoc.hxx:582
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unotxdoc.cxx:4562
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unotxdoc.cxx:4587
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unotxdoc.cxx:4530
const SfxItemPropertySet * m_pPropSet
Definition: unotxdoc.hxx:579
OUString m_sOutlineText
Definition: unotxdoc.hxx:580
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxdoc.cxx:4567
SwXOutlineTarget(OUString aOutlineText, OUString aActualText, const sal_Int32 nOutlineLevel)
Definition: unotxdoc.cxx:4517
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unotxdoc.cxx:4557
virtual OUString SAL_CALL getImplementationName() override
Definition: unotxdoc.cxx:4577
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unotxdoc.cxx:4582
virtual ~SwXOutlineTarget() override
Definition: unotxdoc.cxx:4526
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unotxdoc.cxx:4536
static SwServiceType GetProviderType(std::u16string_view rServiceName)
Definition: unocoll.cxx:505
static css::uno::Sequence< OUString > GetAllServiceNames()
Definition: unocoll.cxx:485
static css::uno::Reference< css::uno::XInterface > MakeInstance(SwServiceType nObjectType, SwDoc &rDoc)
Definition: unocoll.cxx:516
::comphelper::OInterfaceContainerHelper4< css::util::XRefreshListener > m_RefreshListeners
Definition: unotxdoc.cxx:270
std::deque< std::unique_ptr< UnoActionContext, o3tl::default_delete< UnoActionContext > > > maActionArr
Definition: unotxdoc.hxx:144
css::uno::Reference< css::container::XNameAccess > mxXTextFrames
Definition: unotxdoc.hxx:168
css::uno::Reference< css::container::XNameAccess > mxXBookmarks
Definition: unotxdoc.hxx:166
virtual ~SwXTextDocument() override
Definition: unotxdoc.cxx:388
virtual void SAL_CALL connectController(const css::uno::Reference< css::frame::XController > &xController) override
Definition: unotxdoc.cxx:540
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGraphicObjects() override
Definition: unotxdoc.cxx:1242
virtual void SAL_CALL acquire() noexcept override
Definition: unotxdoc.cxx:336
virtual css::uno::Reference< css::frame::XController > SAL_CALL getCurrentController() override
Definition: unotxdoc.cxx:495
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const OUString &ServiceSpecifier) override
Definition: unotxdoc.cxx:1683
css::uno::Reference< css::beans::XPropertySet > mxXLineNumberingProperties
Definition: unotxdoc.hxx:176
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &rPropertyNames) override
Definition: unotxdoc.cxx:2258
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPagePrintSettings() override
Definition: unotxdoc.cxx:931
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unotxdoc.cxx:273
rtl::Reference< SwFmDrawPage > m_xDrawPage
Definition: unotxdoc.hxx:151
css::uno::Reference< css::container::XNameAccess > mxXReferenceMarks
Definition: unotxdoc.hxx:162
virtual void SAL_CALL setPagePrintSettings(const css::uno::Sequence< css::beans::PropertyValue > &aSettings) override
Definition: unotxdoc.cxx:1008
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs() override
Definition: unotxdoc.cxx:535
virtual void SAL_CALL render(sal_Int32 nRenderer, const css::uno::Any &aSelection, const css::uno::Sequence< css::beans::PropertyValue > &xOptions) override
Definition: unotxdoc.cxx:2913
virtual sal_Int32 SAL_CALL getRendererCount(const css::uno::Any &aSelection, const css::uno::Sequence< css::beans::PropertyValue > &xOptions) override
Definition: unotxdoc.cxx:2463
void SAL_CALL addPasteEventListener(const ::css::uno::Reference<::css::text::XPasteListener > &xListener) override
Definition: unotxdoc.cxx:3118
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getBookmarks() override
Definition: unotxdoc.cxx:1206
virtual OUString SAL_CALL getURL() override
Definition: unotxdoc.cxx:530
SwDoc * GetRenderDoc(SfxViewShell *&rpView, const css::uno::Any &rSelection, bool bIsPDFExport)
Definition: unotxdoc.cxx:2374
css::uno::Reference< css::container::XNameAccess > mxXTextFieldMasters
Definition: unotxdoc.hxx:164
virtual void SAL_CALL release() noexcept override
Definition: unotxdoc.cxx:341
virtual css::uno::Reference< css::drawing::XDrawPages > SAL_CALL getDrawPages() override
Definition: unotxdoc.cxx:1366
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getCurrentSelection() override
Definition: unotxdoc.cxx:505
virtual OUString SAL_CALL getImplementationName() override
Definition: unotxdoc.cxx:1715
SfxViewShell * GuessViewShell(bool &rbIsSwSrcView, const css::uno::Reference< css::frame::XController > &rController=css::uno::Reference< css::frame::XController >())
Definition: unotxdoc.cxx:2874
void getPostIts(tools::JsonWriter &rJsonWriter) override
Definition: unotxdoc.cxx:3337
virtual void SAL_CALL updateLinks() override
Definition: unotxdoc.cxx:2230
virtual css::uno::Reference< css::text::XFlatParagraphIterator > SAL_CALL getFlatParagraphIterator(::sal_Int32 nTextMarkupType, sal_Bool bAutomatic) override
Definition: unotxdoc.cxx:3085
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unotxdoc.cxx:2152
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: unotxdoc.cxx:346
const SfxItemPropertySet * m_pPropSet
Definition: unotxdoc.hxx:146
css::uno::Reference< css::container::XIndexAccess > mxXFootnotes
Definition: unotxdoc.hxx:157
virtual css::uno::Reference< css::util::XSearchDescriptor > SAL_CALL createSearchDescriptor() override
Definition: unotxdoc.cxx:761
css::uno::Reference< css::container::XNameAccess > mxXTextTables
Definition: unotxdoc.hxx:167
virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getRedlines() override
Definition: unotxdoc.cxx:2179
virtual void SAL_CALL lockControllers() override
Definition: unotxdoc.cxx:471
virtual int getPart() override
Definition: unotxdoc.cxx:3581
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getReferenceMarks() override
Definition: unotxdoc.cxx:1158
css::uno::Reference< css::beans::XPropertySet > mxXEndnoteSettings
Definition: unotxdoc.hxx:160
SfxViewFrame * m_pHiddenViewFrame
Definition: unotxdoc.hxx:181
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: unotxdoc.cxx:2210
css::uno::Reference< css::container::XNameAccess > mxXEmbeddedObjects
Definition: unotxdoc.hxx:170
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getEmbeddedObjects() override
Definition: unotxdoc.cxx:1194
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unotxdoc.cxx:577
virtual PointerStyle getPointer() override
Definition: unotxdoc.cxx:3269
virtual css::uno::Reference< css::container::XIndexReplace > SAL_CALL getChapterNumberingRules() override
Definition: unotxdoc.cxx:595
bool IsValid() const
Definition: unotxdoc.hxx:474
void executeContentControlEvent(const StringMap &aArguments) override
Definition: unotxdoc.cxx:3461
css::uno::Reference< css::container::XIndexAccess > SAL_CALL getContentControls() override
Definition: unotxdoc.cxx:668
void SAL_CALL removePasteEventListener(const ::css::uno::Reference<::css::text::XPasteListener > &xListener) override
Definition: unotxdoc.cxx:3126
std::unique_ptr< SwRenderData > m_pRenderData
Definition: unotxdoc.hxx:185
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getLineNumberingProperties() override
Definition: unotxdoc.cxx:582
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL findFirst(const css::uno::Reference< css::util::XSearchDescriptor > &xDesc) override
Definition: unotxdoc.cxx:888
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getFootnoteSettings() override
Definition: unotxdoc.cxx:632
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unotxdoc.cxx:279
virtual sal_Bool SAL_CALL attachResource(const OUString &aURL, const css::uno::Sequence< css::beans::PropertyValue > &aArgs) override
Definition: unotxdoc.cxx:525
void getTrackedChanges(tools::JsonWriter &) override
Definition: unotxdoc.cxx:3280
rtl::Reference< SwXBodyText > getBodyText()
Definition: unotxdoc.cxx:452
virtual bool isMimeTypeSupported() override
Definition: unotxdoc.cxx:3210
virtual void setGraphicSelection(int nType, int nX, int nY) override
Definition: unotxdoc.cxx:3810
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: unotxdoc.cxx:447
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextSections() override
Definition: unotxdoc.cxx:1218
virtual VclPtr< vcl::Window > getDocWindow() override
Definition: unotxdoc.cxx:3604
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getStyleFamilies() override
Definition: unotxdoc.cxx:1266
virtual sal_Int32 SAL_CALL replaceAll(const css::uno::Reference< css::util::XSearchDescriptor > &xDesc) override
Definition: unotxdoc.cxx:698
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
Definition: unotxdoc.cxx:3098
virtual void SAL_CALL dispose() override
Definition: unotxdoc.cxx:550
virtual css::uno::Reference< css::style::XAutoStyles > SAL_CALL getAutoStyles() override
Definition: unotxdoc.cxx:1278
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const OUString &ServiceSpecifier, const css::uno::Sequence< css::uno::Any > &Arguments) override
Definition: unotxdoc.cxx:1688
SwXDocumentPropertyHelper * GetPropertyHelper()
Definition: unotxdoc.cxx:408
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
Definition: unotxdoc.cxx:2220
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getEndnotes() override
Definition: unotxdoc.cxx:644
virtual void paintTile(VirtualDevice &rDevice, int nOutputWidth, int nOutputHeight, int nTilePosX, int nTilePosY, tools::Long nTileWidth, tools::Long nTileHeight) override
Definition: unotxdoc.cxx:3135
std::vector< basegfx::B2DRange > getSearchResultRectangles(const char *pPayload) override
Definition: unotxdoc.cxx:3419
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unotxdoc.cxx:1767
virtual SdrModel & getSdrModelFromUnoModel() const override
abstract SdrModel provider
Definition: unotxdoc.cxx:382
css::uno::Reference< css::container::XNameAccess > mxXGraphicObjects
Definition: unotxdoc.hxx:169
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unotxdoc.cxx:1727
virtual void setPart(int nPart, bool bAllowChangeFocus=true) override
Definition: unotxdoc.cxx:3168
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getDrawPage() override
Definition: unotxdoc.cxx:1291
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
Definition: unotxdoc.cxx:303
virtual void SAL_CALL close(sal_Bool bDeliverOwnership) override
Definition: unotxdoc.cxx:559
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unotxdoc.cxx:1966
virtual Size getDocumentSize() override
Definition: unotxdoc.cxx:3159
SwDocShell * m_pDocShell
Definition: unotxdoc.hxx:148
virtual OUString getPartName(int nPart) override
Definition: unotxdoc.cxx:3592
virtual void SAL_CALL setCurrentController(const css::uno::Reference< css::frame::XController > &xController) override
Definition: unotxdoc.cxx:500
css::uno::Reference< css::container::XNameAccess > mxXTextSections
Definition: unotxdoc.hxx:165
rtl::Reference< SwXDocumentPropertyHelper > mxPropertyHelper
Definition: unotxdoc.hxx:182
std::unique_ptr< SwPrintUIOptions > m_pPrintUIOptions
Definition: unotxdoc.hxx:184
css::uno::Reference< css::container::XNameAccess > mxLinkTargetSupplier
Definition: unotxdoc.hxx:177
virtual void SAL_CALL disconnectController(const css::uno::Reference< css::frame::XController > &xController) override
Definition: unotxdoc.cxx:545
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextFieldMasters() override
Definition: unotxdoc.cxx:1182
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getNumberingRules() override
Definition: unotxdoc.cxx:607
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getFootnotes() override
Definition: unotxdoc.cxx:619
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &rPropertyName) override
Definition: unotxdoc.cxx:2284
css::uno::Reference< css::container::XNameAccess > mxXStyleFamilies
Definition: unotxdoc.hxx:171
virtual void setClipboard(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &xClipboard) override
Definition: unotxdoc.cxx:3201
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unotxdoc.cxx:2146
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override
Definition: unotxdoc.cxx:1695
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unotxdoc.cxx:1732
virtual void setClientVisibleArea(const tools::Rectangle &rRectangle) override
Definition: unotxdoc.cxx:3229
OUString maBuildId
Definition: unotxdoc.hxx:198
void NotifyRefreshListeners()
Definition: unotxdoc.cxx:2188
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &rPropertyName) override
Definition: unotxdoc.cxx:2246
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getDocumentIndexes() override
Definition: unotxdoc.cxx:1754
void Reactivate(SwDocShell *pNewDocShell)
Definition: unotxdoc.cxx:1395
virtual css::uno::Reference< css::util::XReplaceDescriptor > SAL_CALL createReplaceDescriptor() override
Definition: unotxdoc.cxx:680
virtual void executeFromFieldEvent(const StringMap &aArguments) override
Definition: unotxdoc.cxx:3384
virtual void setTextSelection(int nType, int nX, int nY) override
Definition: unotxdoc.cxx:3750
css::uno::Reference< css::container::XIndexAccess > mxXNumberingRules
Definition: unotxdoc.hxx:156
virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getTextFields() override
Definition: unotxdoc.cxx:1170
SwXTextDocument(SwDocShell *pShell)
Definition: unotxdoc.cxx:369
virtual int getParts() override
Definition: unotxdoc.cxx:3179
SfxViewShell * GetRenderView(bool &rbIsSwSrcView, const css::uno::Sequence< css::beans::PropertyValue > &rxOptions, bool bIsPDFExport)
Definition: unotxdoc.cxx:2339
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL findAll(const css::uno::Reference< css::util::XSearchDescriptor > &xDesc) override
Definition: unotxdoc.cxx:875
virtual void initializeForTiledRendering(const css::uno::Sequence< css::beans::PropertyValue > &rArguments) override
Definition: unotxdoc.cxx:3617
css::uno::Reference< css::style::XAutoStyles > mxXAutoStyles
Definition: unotxdoc.hxx:172
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextTables() override
Definition: unotxdoc.cxx:1230
css::uno::Reference< css::container::XEnumerationAccess > mxXRedlines
Definition: unotxdoc.hxx:178
virtual void SAL_CALL refresh() override
Definition: unotxdoc.cxx:2198
virtual void resetSelection() override
Definition: unotxdoc.cxx:3838
css::uno::Reference< css::container::XEnumerationAccess > mxXTextFieldTypes
Definition: unotxdoc.hxx:163
css::uno::Reference< css::container::XIndexAccess > mxXDocumentIndexes
Definition: unotxdoc.hxx:174
css::uno::Reference< css::container::XIndexAccess > mxXContentControls
Definition: unotxdoc.hxx:161
void GetNumberFormatter()
Definition: unotxdoc.cxx:417
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unotxdoc.cxx:572
css::uno::Reference< css::beans::XPropertySet > mxXFootnoteSettings
Definition: unotxdoc.hxx:158
virtual css::uno::Reference< css::datatransfer::XTransferable > getSelection() override
Definition: unotxdoc.cxx:3777
virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) override
Definition: unotxdoc.cxx:3717
virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getDocumentLanguages(::sal_Int16 nScriptTypes, ::sal_Int16 nCount) override
retrieve languages already used in current document
Definition: unotxdoc.cxx:3871
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unotxdoc.hxx:141
OString getViewRenderState() override
Definition: unotxdoc.cxx:3434
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getRenderer(sal_Int32 nRenderer, const css::uno::Any &aSelection, const css::uno::Sequence< css::beans::PropertyValue > &xOptions) override
Definition: unotxdoc.cxx:2642
SwUnoCursor * CreateCursorForSearch(css::uno::Reference< css::text::XTextCursor > &xCursor)
Definition: unotxdoc.cxx:685
void getTrackedChangeAuthors(tools::JsonWriter &rJsonWriter) override
Definition: unotxdoc.cxx:3326
css::uno::Reference< css::uno::XInterface > create(OUString const &rServiceName, css::uno::Sequence< css::uno::Any > const *arguments)
Definition: unotxdoc.cxx:1586
virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getXForms() override
Definition: unotxdoc.cxx:3076
virtual void SAL_CALL reformat() override
Definition: unotxdoc.cxx:464
virtual void SAL_CALL unlockControllers() override
Definition: unotxdoc.cxx:480
css::uno::Reference< css::container::XIndexReplace > mxXChapterNumbering
Definition: unotxdoc.hxx:173
virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) override
Definition: unotxdoc.cxx:3711
virtual void setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int nTileTwipWidth_, int nTileTwipHeight_) override
Definition: unotxdoc.cxx:3243
virtual void SAL_CALL printPages(const css::uno::Sequence< css::beans::PropertyValue > &xOptions) override
Definition: unotxdoc.cxx:1079
virtual OUString getPartPageRectangles() override
Definition: unotxdoc.cxx:3190
bool m_bApplyPagePrintSettingsFromXPagePrintable
Definition: unotxdoc.hxx:204
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override
Definition: unotxdoc.cxx:2170
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxdoc.cxx:2164
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getEndnoteSettings() override
Definition: unotxdoc.cxx:656
css::uno::Reference< css::container::XIndexAccess > mxXEndnotes
Definition: unotxdoc.hxx:159
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextFrames() override
Definition: unotxdoc.cxx:1254
void getRulerState(tools::JsonWriter &rJsonWriter) override
Definition: unotxdoc.cxx:3331
virtual OUString getPartHash(int nPart) override
Definition: unotxdoc.cxx:3597
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL findNext(const css::uno::Reference< css::uno::XInterface > &xStartAt, const css::uno::Reference< css::util::XSearchDescriptor > &xDesc) override
Definition: unotxdoc.cxx:908
SwDocShell * GetDocShell()
Definition: unotxdoc.hxx:484
css::uno::Reference< css::uno::XAggregation > m_xNumFormatAgg
Definition: unotxdoc.hxx:154
virtual sal_Bool SAL_CALL hasControllersLocked() override
Definition: unotxdoc.cxx:489
rtl::Reference< SwXBodyText > m_xBodyText
Definition: unotxdoc.hxx:153
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unotxdoc.cxx:1773
SwUnoCursor * FindAny(const css::uno::Reference< css::util::XSearchDescriptor > &xDesc, css::uno::Reference< css::text::XTextCursor > &xCursor, bool bAll, sal_Int32 &nResult, css::uno::Reference< css::uno::XInterface > const &xLastResult)
Definition: unotxdoc.cxx:768
virtual void SAL_CALL setPropertyToDefault(const OUString &rPropertyName) override
Definition: unotxdoc.cxx:2269
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unotxdoc.cxx:2158
bool GetPositions(SwPaM &rToFill, ::sw::TextRangeMode eMode=::sw::TextRangeMode::RequireTextNode) const
Definition: unoobj2.cxx:1050
bool m_bStyles
Definition: unosrch.hxx:56
void FillSearchItemSet(SfxItemSet &rSet) const
Definition: unosrch.cxx:533
void FillSearchOptions(i18nutil::SearchOptions2 &rSearchOpt) const
Definition: unosrch.cxx:568
bool m_bBack
Definition: unosrch.hxx:53
void FillReplaceItemSet(SfxItemSet &rSet) const
Definition: unosrch.cxx:538
bool HasReplaceAttributes() const
Definition: unosrch.cxx:548
OUString m_sReplaceText
Definition: unosrch.hxx:45
bool HasSearchAttributes() const
Definition: unosrch.cxx:543
OUString m_sSearchText
Definition: unosrch.hxx:44
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
css::uno::Reference< css::datatransfer::XTransferable > GetXTransferable() const
static css::uno::Reference< css::awt::XBitmap > CreateBitmap(const BitmapEx &rBitmap)
const VclPtr< OutputDevice > & GetOutputDevice() const
reference_type * get() const
static std::shared_ptr< ConfigurationChanges > create()
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
static css::uno::Reference< css::embed::XStorage > GetTemporaryStorage(const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
const css::uno::Sequence< sal_Int8 > & getSeq() const
css::uno::Type const & get()
size_type size() const
void UpdateAllLinks(bool bAskUpdate, bool bUpdateGrfLinks, weld::Window *pParentWin)
const SvBaseLinks & GetLinks() const
void SetHideRedlines(bool const bHideRedlines)
const SwRect & GetAnchorRect() const
const std::vector< basegfx::B2DRange > & GetAnnotationTextRanges() const
sal_uInt32 CalcParent()
Calculate parent postit id of current annotation window.
const SwPostItField * GetPostItField() const
LocationResult findForPayload(const char *pPayload)
void put(std::u16string_view pPropName, const OUString &rPropValue)
ScopedJsonWriterStruct startStruct()
ScopedJsonWriterArray startArray(std::string_view)
void SetSize(const Size &)
constexpr tools::Long GetHeight() const
rtl::OString toString() const
static bool IsFuzzing()
css::uno::Any getValue(const OUString &i_rPropertyName) const
void SetClipboard(css::uno::Reference< css::datatransfer::clipboard::XClipboard > const &xClipboard)
void EnableMapMode(bool bEnable=true)
PointerStyle GetPointer() const
#define FN_PRINT_PAGEPREVIEW
Definition: cmdid.h:877
SwDocPositions
Definition: cshtyp.hxx:104
FindRanges
Definition: cshtyp.hxx:91
@ InSelAll
All (only in non-body and selections).
@ InOther
Find "all" in Footer/Header/Fly...
@ InBody
Find "one" only in body text.
int nCount
URL aURL
virtual sal_uInt32 GetId() const override
bool sw_GetPostIts(const IDocumentFieldsAccess &rIDFA, SetGetExpFields *pSrtLst)
Definition: doc.cxx:529
float u
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CTL(EE_CHAR_START+16)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CJK(EE_CHAR_START+15)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
Any aHelper
DocumentType eType
sal_Int16 nValue
OUString sName
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr sal_uInt16 RES_CHRATR_END(46)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr sal_uInt16 RES_PARATR_END(82)
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SwFormatContentControl > RES_TXTATR_CONTENTCONTROL(56)
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
Shell * m_pShell
Sequence< PropertyValue > aArguments
sal_Int32 nIndex
Mode eMode
#define LANGUAGE_SYSTEM
#define LANGUAGE_NONE
#define LANGUAGE_DONTKNOW
#define LANGUAGE_ENGLISH_US
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
OUString sSuffix
std::unique_ptr< sal_Int32[]> pData
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
std::vector< tSwNumTreeNumber > tNumberVector
uno::Reference< text::XFlatParagraphIterator > CreateFlatParagraphIterator(SwDoc &rDoc, sal_Int32 const nTextMarkupType, bool const bAutomatic)
Definition: unoflatpara.cxx:60
@ Sequence
class SAL_NO_VTABLE XPropertySet
void setTiledPainting(bool bTiledPainting)
OString join(std::string_view rSeparator, const std::vector< OString > &rSequence)
OUStringBuffer & remove(OUStringBuffer &rIn, sal_Unicode c)
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
sal_Int64 getSomething_cast(void *p)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
int i
index
detail::Optional< bool >::type tryAccess< bool >(css::uno::Any const &any)
constexpr auto toTwips(N number, Length from)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
uno::Reference< text::XText > CreateParentXText(SwDoc &rDoc, const SwPosition &rPos)
Definition: unoobj2.cxx:1240
@ Parent
EXPAND : (Start < nIndex <= End)
long Long
OUString toISO8601(const css::util::DateTime &rDateTime)
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
constexpr OUStringLiteral ODF_FORMDROPDOWN_RESULT
constexpr OUStringLiteral ODF_FORMDROPDOWN
sal_Int16 nId
SwPostItMode
this must match the definitions in css::text::NotePrintMode
Definition: printdata.hxx:43
PointerStyle
QPRO_FUNC_TYPE nType
constexpr auto SFX_INTERFACE_SFXDOCSH
static LanguageType nLang
Definition: srtdlg.cxx:51
bool bAFormatByInpDelSpacesAtSttEnd
sal_uLong nWord
Definition: docstat.hxx:35
sal_uLong nPara
paragraphs for document statistic: non-empty and non-hidden ones
Definition: docstat.hxx:32
sal_uLong nChar
Definition: docstat.hxx:37
Marks a position in the document model.
Definition: pam.hxx:38
SwNode & GetNode() const
Definition: pam.hxx:81
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:231
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
void AdjustContent(sal_Int32 nDelta)
Adjust content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:262
static rtl::Reference< SwXTextRanges > Create(SwPaM *const pCursor)
Definition: unoobj2.cxx:1623
std::vector< basegfx::B2DRange > maRectangles
bool hasValue()
Object Value
Reference< XController > xController
Reference< XModel > xModel
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
#define SW_MOD()
Definition: swmodule.hxx:254
std::vector< SwRect > SwRects
Definition: swregion.hxx:26
constexpr SwTwips DOCUMENTBORDER
Definition: swtypes.hxx:79
unsigned char sal_Bool
SwServiceType
entries in this enum are mapped in an array in unocoll.cxx
Definition: unocoll.hxx:63
SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxUnoDashTable_createInstance(SdrModel *pModel)
SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxUnoGradientTable_createInstance(SdrModel *pModel)
SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxUnoBitmapTable_createInstance(SdrModel *pModel)
SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxUnoMarkerTable_createInstance(SdrModel *pModel)
SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxUnoHatchTable_createInstance(SdrModel *pModel)
SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxUnoTransGradientTable_createInstance(SdrModel *pModel)
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:88
#define PROPERTY_MAP_TEXT_DOCUMENT
Definition: unomap.hxx:57
#define WID_DOC_BASIC_LIBRARIES
Definition: unomap.hxx:247
#define WID_DOC_DEFAULT_PAGE_MODE
Definition: unomap.hxx:255
#define WID_DOC_CHAR_COUNT
Definition: unomap.hxx:233
#define WID_DOC_HAS_VALID_SIGNATURES
Definition: unomap.hxx:250
#define WID_DOC_PARA_COUNT
Definition: unomap.hxx:234
#define WID_DOC_BUILDID
Definition: unomap.hxx:253
#define WID_DOC_CHANGES_SHOW
Definition: unomap.hxx:237
#define WID_DOC_RUNTIME_UID
Definition: unomap.hxx:248
#define WID_DOC_HIDE_TIPS
Definition: unomap.hxx:240
#define WID_DOC_VBA_DOCOBJ
Definition: unomap.hxx:297
#define WID_DOC_TWO_DIGIT_YEAR
Definition: unomap.hxx:244
#define WID_DOC_WRITERFILTER
Definition: unomap.hxx:252
#define PROPERTY_MAP_LINK_TARGET
Definition: unomap.hxx:58
#define WID_DOC_AUTOMATIC_CONTROL_FOCUS
Definition: unomap.hxx:245
#define WID_DOC_CHANGES_PASSWORD
Definition: unomap.hxx:243
#define WID_DOC_FORBIDDEN_CHARS
Definition: unomap.hxx:242
#define WID_DOC_REDLINE_DISPLAY
Definition: unomap.hxx:241
#define WID_DOC_LOCK_UPDATES
Definition: unomap.hxx:249
#define WID_DOC_APPLY_FORM_DESIGN_MODE
Definition: unomap.hxx:246
#define WID_DOC_ISTEMPLATEID
Definition: unomap.hxx:254
#define WID_DOC_AUTO_MARK_URL
Definition: unomap.hxx:239
#define WID_DOC_DIALOG_LIBRARIES
Definition: unomap.hxx:296
#define WID_DOC_WORD_SEPARATOR
Definition: unomap.hxx:236
#define WID_DOC_WORD_COUNT
Definition: unomap.hxx:235
#define WID_DOC_CHANGES_RECORD
Definition: unomap.hxx:238
#define WID_DOC_INTEROP_GRAB_BAG
Definition: unomap.hxx:251
constexpr OUStringLiteral UNO_LINK_DISPLAY_NAME
Definition: unoprnms.hxx:488
constexpr OUStringLiteral UNO_NAME_FILE_NAME
Definition: unoprnms.hxx:433
constexpr OUStringLiteral UNO_NAME_PAGES
Definition: unoprnms.hxx:437
constexpr OUStringLiteral UNO_NAME_COPY_COUNT
Definition: unoprnms.hxx:434
constexpr OUStringLiteral UNO_NAME_SORT
Definition: unoprnms.hxx:436
constexpr OUStringLiteral UNO_LINK_DISPLAY_BITMAP
Definition: unoprnms.hxx:489
constexpr OUStringLiteral UNO_NAME_COLLATE
Definition: unoprnms.hxx:435
static void lcl_SavePrintUIOptionsToDocumentPrintData(SwDoc &rDoc, const SwPrintUIOptions &rPrintUIOptions, bool bIsPDFEXport)
Definition: unotxdoc.cxx:2434
static SwTextFormatColl * lcl_GetParaStyle(const OUString &rCollName, SwDoc &rDoc)
Definition: unotxdoc.cxx:238
static OUString lcl_CreateOutlineString(const size_t nIndex, const SwDoc *pDoc)
Definition: unotxdoc.cxx:985
static std::unique_ptr< SwPrintUIOptions > lcl_GetPrintUIOptions(SwDocShell *pDocShell, const SfxViewShell *pView)
Definition: unotxdoc.cxx:186
static bool lcl_GetBoolProperty(const uno::Sequence< beans::PropertyValue > &rOptions, const char *pPropName)
Definition: unotxdoc.cxx:2326
static Any lcl_GetDisplayBitmap(std::u16string_view sLinkSuffix)
Definition: unotxdoc.cxx:4433
static bool lcl_SeqHasProperty(const uno::Sequence< beans::PropertyValue > &rOptions, const char *pPropName)
Definition: unotxdoc.cxx:2317
static void lcl_DisposeView(SfxViewFrame *pToClose, SwDocShell const *pDocShell)
Definition: unotxdoc.cxx:251
static VclPtr< OutputDevice > lcl_GetOutputDevice(const SwPrintUIOptions &rPrintUIOptions)
Definition: unotxdoc.cxx:2301
static sal_uInt32 lcl_Any_To_ULONG(const Any &rValue, bool &bException)
Definition: unotxdoc.cxx:966
cppu::ImplInheritanceHelper< SfxBaseModel, css::text::XTextDocument, css::text::XLineNumberingProperties, css::text::XChapterNumberingSupplier, css::text::XNumberingRulesSupplier, css::text::XFootnotesSupplier, css::text::XEndnotesSupplier, css::text::XContentControlsSupplier, css::util::XReplaceable, css::text::XPagePrintable, css::text::XReferenceMarksSupplier, css::text::XTextTablesSupplier, css::text::XTextFramesSupplier, css::text::XBookmarksSupplier, css::text::XTextSectionsSupplier, css::text::XTextGraphicObjectsSupplier, css::text::XTextEmbeddedObjectsSupplier, css::text::XTextFieldsSupplier, css::style::XStyleFamiliesSupplier, css::style::XAutoStylesSupplier, css::lang::XServiceInfo, css::drawing::XDrawPageSupplier, css::drawing::XDrawPagesSupplier, css::text::XDocumentIndexesSupplier, css::beans::XPropertySet, css::beans::XPropertyState, css::document::XLinkTargetSupplier, css::document::XRedlinesSupplier, css::util::XRefreshable, css::util::XLinkUpdate, css::view::XRenderable, css::xforms::XFormsSupplier, css::text::XFlatParagraphIteratorProvider, css::document::XDocumentLanguages, css::util::XCloneable, css::text::XPasteBroadcaster > SwXTextDocumentBaseClass
Definition: unotxdoc.hxx:133
SwCreateDrawTable
Definition: unotxdoc.hxx:633
oslFileHandle & pOut
std::map< OUString, OUString > StringMap
sal_Int32 nLength
SvNumFormatType
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND