LibreOffice Module sd (master) 1
unomodel.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <memory>
21
22#include <com/sun/star/presentation/XPresentation2.hpp>
23
24#include <com/sun/star/lang/DisposedException.hpp>
25#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
26#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
27#include <com/sun/star/lang/Locale.hpp>
28#include <com/sun/star/awt/XDevice.hpp>
29#include <com/sun/star/document/IndexedPropertyValues.hpp>
30#include <com/sun/star/beans/PropertyAttribute.hpp>
31#include <com/sun/star/util/XTheme.hpp>
32
33#include <com/sun/star/embed/Aspects.hpp>
34
35#include <officecfg/Office/Common.hxx>
37#include <comphelper/lok.hxx>
44
45#include <sal/log.hxx>
46#include <editeng/unofield.hxx>
48#include <tpaction.hxx>
49#include <unomodel.hxx>
50#include "unopool.hxx"
51#include <sfx2/lokhelper.hxx>
52#include <sfx2/dispatch.hxx>
53#include <vcl/svapp.hxx>
54#include <LibreOfficeKit/LibreOfficeKitEnums.h>
55
57#include <svx/svdoutl.hxx>
58#include <o3tl/safeint.hxx>
59#include <o3tl/string_view.hxx>
62#include <svx/svdlayer.hxx>
63#include <svx/svdsob.hxx>
64#include <svx/svdundo.hxx>
65#include <svx/unoapi.hxx>
66#include <svx/unofill.hxx>
67#include <svx/sdrpagewindow.hxx>
69#include <editeng/fontitem.hxx>
71#include <svx/svdpool.hxx>
72#include <svx/svdpagv.hxx>
73#include <svtools/unoimap.hxx>
75#include <svx/unoshape.hxx>
76#include <editeng/unonrule.hxx>
77#include <editeng/eeitem.hxx>
78#include <unotools/datetime.hxx>
79#include <xmloff/autolayout.hxx>
80
81// Support creation of GraphicStorageHandler and EmbeddedObjectResolver
82#include <svx/xmleohlp.hxx>
83#include <svx/xmlgrhlp.hxx>
84#include <DrawDocShell.hxx>
85#include <ViewShellBase.hxx>
87
88#include <Annotation.hxx>
89#include <drawdoc.hxx>
90#include <sdmod.hxx>
91#include <sdresid.hxx>
92#include <sdpage.hxx>
93
94#include <strings.hrc>
95#include <strings.hxx>
96#include "unolayer.hxx"
97#include <unopage.hxx>
98#include "unocpres.hxx"
99#include "unoobj.hxx"
100#include <stlpool.hxx>
101#include "unopback.hxx"
102#include <unokywds.hxx>
103
104#include <FrameView.hxx>
105#include <ClientView.hxx>
106#include <DrawViewShell.hxx>
107#include <ViewShell.hxx>
108#include <Window.hxx>
109#include <optsitem.hxx>
110
112#include <com/sun/star/presentation/AnimationSpeed.hpp>
113#include <com/sun/star/presentation/ClickAction.hpp>
117
118#include <com/sun/star/office/XAnnotation.hpp>
119#include <com/sun/star/office/XAnnotationAccess.hpp>
120#include <com/sun/star/office/XAnnotationEnumeration.hpp>
121#include <com/sun/star/geometry/RealPoint2D.hpp>
122#include <com/sun/star/util/DateTime.hpp>
123
125
128#include <tools/gen.hxx>
129#include <tools/debug.hxx>
131#include <tools/json_writer.hxx>
133#include <svx/ColorSets.hxx>
135
136#include <app.hrc>
137
138using namespace ::cppu;
139using namespace ::com::sun::star;
140using namespace ::sd;
141
143{
144 STR_SD_PAGE, // SdLinkTargetType::Page
145 STR_NOTES_MODE, // SdLinkTargetType::Notes
146 STR_HANDOUT, // SdLinkTargetType::Handout
147 STR_MASTERPAGE_NAME, // SdLinkTargetType::MasterPage
148};
149
150TranslateId SdTPAction::GetClickActionSdResId( presentation::ClickAction eCA )
151{
152 switch( eCA )
153 {
154 case presentation::ClickAction_NONE: return STR_CLICK_ACTION_NONE;
155 case presentation::ClickAction_PREVPAGE: return STR_CLICK_ACTION_PREVPAGE;
156 case presentation::ClickAction_NEXTPAGE: return STR_CLICK_ACTION_NEXTPAGE;
157 case presentation::ClickAction_FIRSTPAGE: return STR_CLICK_ACTION_FIRSTPAGE;
158 case presentation::ClickAction_LASTPAGE: return STR_CLICK_ACTION_LASTPAGE;
159 case presentation::ClickAction_BOOKMARK: return STR_CLICK_ACTION_BOOKMARK;
160 case presentation::ClickAction_DOCUMENT: return STR_CLICK_ACTION_DOCUMENT;
161 case presentation::ClickAction_PROGRAM: return STR_CLICK_ACTION_PROGRAM;
162 case presentation::ClickAction_MACRO: return STR_CLICK_ACTION_MACRO;
163 case presentation::ClickAction_SOUND: return STR_CLICK_ACTION_SOUND;
164 case presentation::ClickAction_VERB: return STR_CLICK_ACTION_VERB;
165 case presentation::ClickAction_STOPPRESENTATION: return STR_CLICK_ACTION_STOPPRESENTATION;
166 default: OSL_FAIL( "No StringResource for ClickAction available!" );
167 }
168 return {};
169}
170
171namespace {
172
173class SdUnoForbiddenCharsTable : public SvxUnoForbiddenCharsTable,
174 public SfxListener
175{
176public:
177 explicit SdUnoForbiddenCharsTable(SdrModel* pModel);
178 virtual ~SdUnoForbiddenCharsTable() override;
179
180 // SfxListener
181 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) noexcept override;
182protected:
183 virtual void onChange() override;
184
185private:
186 SdrModel* mpModel;
187};
188
189}
190
191SdUnoForbiddenCharsTable::SdUnoForbiddenCharsTable( SdrModel* pModel )
192: SvxUnoForbiddenCharsTable( pModel->GetForbiddenCharsTable() ), mpModel( pModel )
193{
194 StartListening( *pModel );
195}
196
197void SdUnoForbiddenCharsTable::onChange()
198{
199 if( mpModel )
200 {
201 mpModel->ReformatAllTextObjects();
202 }
203}
204
205SdUnoForbiddenCharsTable::~SdUnoForbiddenCharsTable()
206{
208
209 if( mpModel )
210 EndListening( *mpModel );
211}
212
213void SdUnoForbiddenCharsTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) noexcept
214{
215 if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
216 return;
217 const SdrHint* pSdrHint = static_cast<const SdrHint*>( &rHint );
218 if( SdrHintKind::ModelCleared == pSdrHint->GetKind() )
219 {
220 mpModel = nullptr;
221 }
222}
223
224const sal_uInt16 WID_MODEL_LANGUAGE = 1;
225const sal_uInt16 WID_MODEL_TABSTOP = 2;
226const sal_uInt16 WID_MODEL_VISAREA = 3;
227const sal_uInt16 WID_MODEL_MAPUNIT = 4;
228const sal_uInt16 WID_MODEL_FORBCHARS = 5;
229const sal_uInt16 WID_MODEL_CONTFOCUS = 6;
230const sal_uInt16 WID_MODEL_DSGNMODE = 7;
231const sal_uInt16 WID_MODEL_BASICLIBS = 8;
232const sal_uInt16 WID_MODEL_RUNTIMEUID = 9;
233const sal_uInt16 WID_MODEL_BUILDID = 10;
234const sal_uInt16 WID_MODEL_HASVALIDSIGNATURES = 11;
235const sal_uInt16 WID_MODEL_DIALOGLIBS = 12;
236const sal_uInt16 WID_MODEL_FONTS = 13;
237const sal_uInt16 WID_MODEL_INTEROPGRABBAG = 14;
238const sal_uInt16 WID_MODEL_THEME = 15;
239
241{
242 // Attention: the first parameter HAS TO BE sorted!!!
243 const static SfxItemPropertyMapEntry aDrawModelPropertyMap_Impl[] =
244 {
249 { sUNO_Prop_MapUnit, WID_MODEL_MAPUNIT, ::cppu::UnoType<sal_Int16>::get(), beans::PropertyAttribute::READONLY, 0},
253 { u"BasicLibraries", WID_MODEL_BASICLIBS, cppu::UnoType<script::XLibraryContainer>::get(), beans::PropertyAttribute::READONLY, 0},
254 { u"DialogLibraries", WID_MODEL_DIALOGLIBS, cppu::UnoType<script::XLibraryContainer>::get(), beans::PropertyAttribute::READONLY, 0},
255 { sUNO_Prop_RuntimeUID, WID_MODEL_RUNTIMEUID, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0},
257 { u"Fonts", WID_MODEL_FONTS, cppu::UnoType<uno::Sequence<uno::Any>>::get(), beans::PropertyAttribute::READONLY, 0},
260 };
261 static SvxItemPropertySet aDrawModelPropertySet_Impl( aDrawModelPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
262 return &aDrawModelPropertySet_Impl;
263}
264
265// this ctor is used from the DocShell
267: SfxBaseModel( pShell ),
268 mpDocShell( pShell ),
269 mpDoc( pShell ? pShell->GetDoc() : nullptr ),
270 mbDisposed(false),
271 mbImpressDoc( pShell && pShell->GetDoc() && pShell->GetDoc()->GetDocumentType() == DocumentType::Impress ),
272 mbClipBoard( bClipBoard ),
273 mpPropSet( ImplGetDrawModelPropertySet() ),
274 mbPaintTextEdit( true )
275{
276 if( mpDoc )
277 {
279 }
280 else
281 {
282 OSL_FAIL("DocShell is invalid");
283 }
284}
285
287: SfxBaseModel( nullptr ),
288 mpDocShell( nullptr ),
289 mpDoc( pDoc ),
290 mbDisposed(false),
291 mbImpressDoc( pDoc && pDoc->GetDocumentType() == DocumentType::Impress ),
292 mbClipBoard( bClipBoard ),
293 mpPropSet( ImplGetDrawModelPropertySet() ),
294 mbPaintTextEdit( true )
295{
296 if( mpDoc )
297 {
299 }
300 else
301 {
302 OSL_FAIL("SdDrawDocument is invalid");
303 }
304}
305
306/***********************************************************************
307* *
308***********************************************************************/
310{
311}
312
313// XInterface
315{
316 uno::Any aAny;
317
319 aAny <<= uno::Reference<lang::XServiceInfo>(this);
320 else if (rType == cppu::UnoType<beans::XPropertySet>::get())
321 aAny <<= uno::Reference<beans::XPropertySet>(this);
323 aAny <<= uno::Reference<lang::XMultiServiceFactory>(this);
325 aAny <<= uno::Reference<drawing::XDrawPageDuplicator>(this);
327 aAny <<= uno::Reference<drawing::XLayerSupplier>(this);
329 aAny <<= uno::Reference<drawing::XMasterPagesSupplier>(this);
331 aAny <<= uno::Reference<drawing::XDrawPagesSupplier>(this);
333 aAny <<= uno::Reference<presentation::XHandoutMasterSupplier>(this);
335 aAny <<= uno::Reference<document::XLinkTargetSupplier>(this);
337 aAny <<= uno::Reference<style::XStyleFamiliesSupplier>(this);
339 aAny <<= uno::Reference<css::ucb::XAnyCompareFactory>(this);
340 else if (rType == cppu::UnoType<view::XRenderable>::get())
341 aAny <<= uno::Reference<view::XRenderable>(this);
343 aAny <<= uno::Reference< presentation::XPresentationSupplier >(this);
345 aAny <<= uno::Reference< presentation::XCustomPresentationSupplier >(this);
346 else
347 return SfxBaseModel::queryInterface(rType);
348
349 return aAny;
350}
351
352void SAL_CALL SdXImpressDocument::acquire() noexcept
353{
355}
356
357void SAL_CALL SdXImpressDocument::release() noexcept
358{
359 if (osl_atomic_decrement( &m_refCount ) != 0)
360 return;
361
362 // restore reference count:
363 osl_atomic_increment( &m_refCount );
364 if(!mbDisposed)
365 {
366 try
367 {
368 dispose();
369 }
370 catch (const uno::RuntimeException&)
371 {
372 // don't break throw ()
373 TOOLS_WARN_EXCEPTION( "sd", "" );
374 }
375 }
377}
378
379// XUnoTunnel
380const css::uno::Sequence< sal_Int8 > & SdXImpressDocument::getUnoTunnelId() noexcept
381{
382 static const comphelper::UnoIdInit theSdXImpressDocumentUnoTunnelId;
383 return theSdXImpressDocumentUnoTunnelId.getSeq();
384}
385
386sal_Int64 SAL_CALL SdXImpressDocument::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier )
387{
388 if (comphelper::isUnoTunnelId<SdrModel>(rIdentifier))
390
391 return comphelper::getSomethingImpl(rIdentifier, this,
393}
394
395// XTypeProvider
396uno::Sequence< uno::Type > SAL_CALL SdXImpressDocument::getTypes( )
397{
398 ::SolarMutexGuard aGuard;
399
400 if( !maTypeSequence.hasElements() )
401 {
402 uno::Sequence< uno::Type > aTypes( SfxBaseModel::getTypes() );
404 uno::Sequence {
416 if( mbImpressDoc )
417 {
419 uno::Sequence {
423 }
425 }
426
427 return maTypeSequence;
428}
429
430uno::Sequence< sal_Int8 > SAL_CALL SdXImpressDocument::getImplementationId( )
431{
432 return css::uno::Sequence<sal_Int8>();
433}
434
435/***********************************************************************
436* *
437***********************************************************************/
439{
440 if( mpDoc )
441 {
442 if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
443 {
444 const SdrHint* pSdrHint = static_cast<const SdrHint*>( &rHint );
445 if( hasEventListeners() )
446 {
447 document::EventObject aEvent;
450 }
451
452 if( pSdrHint->GetKind() == SdrHintKind::ModelCleared )
453 {
454 if( mpDoc )
455 EndListening( *mpDoc );
456 mpDoc = nullptr;
457 mpDocShell = nullptr;
458 }
459 }
460 else
461 {
462 // did our SdDrawDocument just died?
463 if(rHint.GetId() == SfxHintId::Dying)
464 {
465 // yes, so we ask for a new one
466 if( mpDocShell )
467 {
468 SdDrawDocument *pNewDoc = mpDocShell->GetDoc();
469
470 // is there a new one?
471 if( pNewDoc != mpDoc )
472 {
473 mpDoc = pNewDoc;
474 if(mpDoc)
476 }
477 }
478 }
479 }
480 }
481 SfxBaseModel::Notify( rBC, rHint );
482}
483
484/******************************************************************************
485* *
486******************************************************************************/
487SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, bool bDuplicate )
488{
489 sal_uInt16 nPageCount = mpDoc->GetSdPageCount( PageKind::Standard );
490 SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
491 SdrLayerID aBckgrnd = rLayerAdmin.GetLayerID(sUNO_LayerName_background);
493
494 rtl::Reference<SdPage> pStandardPage;
495
496 if( 0 == nPageCount )
497 {
498 // this is only used for clipboard where we only have one page
499 pStandardPage = mpDoc->AllocSdPage(false);
500
501 Size aDefSize(21000, 29700); // A4 portrait orientation
502 pStandardPage->SetSize( aDefSize );
503 mpDoc->InsertPage(pStandardPage.get(), 0);
504 }
505 else
506 {
507 // here we determine the page after which we should insert
508 SdPage* pPreviousStandardPage = mpDoc->GetSdPage( std::min( static_cast<sal_uInt16>(nPageCount - 1), nPage ), PageKind::Standard );
509 SdrLayerIDSet aVisibleLayers = pPreviousStandardPage->TRG_GetMasterPageVisibleLayers();
510 bool bIsPageBack = aVisibleLayers.IsSet( aBckgrnd );
511 bool bIsPageObj = aVisibleLayers.IsSet( aBckgrndObj );
512
513 // AutoLayouts must be ready
515
516 /* First we create a standard page and then a notes page. It is
517 guaranteed, that after a standard page the corresponding notes page
518 follows. */
519
520 sal_uInt16 nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2;
521 SdPage* pPreviousNotesPage = static_cast<SdPage*>( mpDoc->GetPage( nStandardPageNum - 1 ) );
522 sal_uInt16 nNotesPageNum = nStandardPageNum + 1;
523
524 /**************************************************************
525 * standard page
526 **************************************************************/
527 if( bDuplicate )
528 pStandardPage = static_cast<SdPage*>( pPreviousStandardPage->CloneSdrPage(*mpDoc).get() );
529 else
530 pStandardPage = mpDoc->AllocSdPage(false);
531
532 pStandardPage->SetSize( pPreviousStandardPage->GetSize() );
533 pStandardPage->SetBorder( pPreviousStandardPage->GetLeftBorder(),
534 pPreviousStandardPage->GetUpperBorder(),
535 pPreviousStandardPage->GetRightBorder(),
536 pPreviousStandardPage->GetLowerBorder() );
537 pStandardPage->SetOrientation( pPreviousStandardPage->GetOrientation() );
538 pStandardPage->SetName(OUString());
539
540 // insert page after current page
541 mpDoc->InsertPage(pStandardPage.get(), nStandardPageNum);
542
543 if( !bDuplicate )
544 {
545 // use MasterPage of the current page
546 pStandardPage->TRG_SetMasterPage(pPreviousStandardPage->TRG_GetMasterPage());
547 pStandardPage->SetLayoutName( pPreviousStandardPage->GetLayoutName() );
548 pStandardPage->SetAutoLayout(AUTOLAYOUT_NONE, true );
549 }
550
551 aBckgrnd = rLayerAdmin.GetLayerID(sUNO_LayerName_background);
552 aBckgrndObj = rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects);
553 aVisibleLayers.Set(aBckgrnd, bIsPageBack);
554 aVisibleLayers.Set(aBckgrndObj, bIsPageObj);
555 pStandardPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
556
557 /**************************************************************
558 * notes page
559 **************************************************************/
560 rtl::Reference<SdPage> pNotesPage;
561
562 if( bDuplicate )
563 pNotesPage = static_cast<SdPage*>( pPreviousNotesPage->CloneSdrPage(*mpDoc).get() );
564 else
565 pNotesPage = mpDoc->AllocSdPage(false);
566
567 pNotesPage->SetSize( pPreviousNotesPage->GetSize() );
568 pNotesPage->SetBorder( pPreviousNotesPage->GetLeftBorder(),
569 pPreviousNotesPage->GetUpperBorder(),
570 pPreviousNotesPage->GetRightBorder(),
571 pPreviousNotesPage->GetLowerBorder() );
572 pNotesPage->SetOrientation( pPreviousNotesPage->GetOrientation() );
573 pNotesPage->SetName(OUString());
574 pNotesPage->SetPageKind(PageKind::Notes);
575
576 // insert page after current page
577 mpDoc->InsertPage(pNotesPage.get(), nNotesPageNum);
578
579 if( !bDuplicate )
580 {
581 // use MasterPage of the current page
582 pNotesPage->TRG_SetMasterPage(pPreviousNotesPage->TRG_GetMasterPage());
583 pNotesPage->SetLayoutName( pPreviousNotesPage->GetLayoutName() );
584 pNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, true );
585 }
586 }
587
588 SetModified();
589
590 return pStandardPage.get();
591}
592
594{
595 if( mpDoc )
596 mpDoc->SetChanged();
597}
598
599// XModel
601{
602 ::SolarMutexGuard aGuard;
603
604 if( nullptr == mpDoc )
605 throw lang::DisposedException();
606
607 mpDoc->setLock(true);
608}
609
611{
612 ::SolarMutexGuard aGuard;
613
614 if( nullptr == mpDoc )
615 throw lang::DisposedException();
616
617 if( mpDoc->isLocked() )
618 {
619 mpDoc->setLock(false);
620 }
621}
622
624{
625 ::SolarMutexGuard aGuard;
626
627 if( nullptr == mpDoc )
628 throw lang::DisposedException();
629
630 return mpDoc->isLocked();
631}
632
633uno::Reference < container::XIndexAccess > SAL_CALL SdXImpressDocument::getViewData()
634{
635 ::SolarMutexGuard aGuard;
636
637 if( nullptr == mpDoc )
638 throw lang::DisposedException();
639
640 uno::Reference < container::XIndexAccess > xRet( SfxBaseModel::getViewData() );
641
642 if( !xRet.is() )
643 {
644 const std::vector<std::unique_ptr<sd::FrameView>> &rList = mpDoc->GetFrameViewList();
645
646 if( !rList.empty() )
647 {
649
650 uno::Reference < container::XIndexContainer > xCont( xRet, uno::UNO_QUERY );
651 DBG_ASSERT( xCont.is(), "SdXImpressDocument::getViewData() failed for OLE object" );
652 if( xCont.is() )
653 {
654 for( sal_uInt32 i = 0, n = rList.size(); i < n; i++ )
655 {
656 ::sd::FrameView* pFrameView = rList[ i ].get();
657
658 uno::Sequence< beans::PropertyValue > aSeq;
659 pFrameView->WriteUserDataSequence( aSeq );
660 xCont->insertByIndex( i, uno::Any( aSeq ) );
661 }
662 }
663 }
664 }
665
666 return xRet;
667}
668
669void SAL_CALL SdXImpressDocument::setViewData( const uno::Reference < container::XIndexAccess >& xData )
670{
671 ::SolarMutexGuard aGuard;
672
673 if( nullptr == mpDoc )
674 throw lang::DisposedException();
675
677 if( !(mpDocShell && (mpDocShell->GetCreateMode() == SfxObjectCreateMode::EMBEDDED) && xData.is()) )
678 return;
679
680 const sal_Int32 nCount = xData->getCount();
681
682 std::vector<std::unique_ptr<sd::FrameView>> &rViews = mpDoc->GetFrameViewList();
683
684 rViews.clear();
685
686 uno::Sequence< beans::PropertyValue > aSeq;
687 for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
688 {
689 if( xData->getByIndex( nIndex ) >>= aSeq )
690 {
691 std::unique_ptr<::sd::FrameView> pFrameView(new ::sd::FrameView( mpDoc ));
692 pFrameView->ReadUserDataSequence( aSeq );
693 rViews.push_back( std::move(pFrameView) );
694 }
695 }
696}
697
698// XDrawPageDuplicator
699uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::duplicate( const uno::Reference< drawing::XDrawPage >& xPage )
700{
701 ::SolarMutexGuard aGuard;
702
703 if( nullptr == mpDoc )
704 throw lang::DisposedException();
705
706 // get pPage from xPage and determine the Id (nPos ) afterwards
707 SvxDrawPage* pSvxPage = comphelper::getFromUnoTunnel<SvxDrawPage>( xPage );
708 if( pSvxPage )
709 {
710 SdPage* pPage = static_cast<SdPage*>( pSvxPage->GetSdrPage() );
711 sal_uInt16 nPos = pPage->GetPageNum();
712 nPos = ( nPos - 1 ) / 2;
713 pPage = InsertSdPage( nPos, true );
714 if( pPage )
715 {
716 uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
717 return xDrawPage;
718 }
719 }
720
721 uno::Reference< drawing::XDrawPage > xDrawPage;
722 return xDrawPage;
723}
724
725// XDrawPagesSupplier
726uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getDrawPages()
727{
728 ::SolarMutexGuard aGuard;
729
730 if( nullptr == mpDoc )
731 throw lang::DisposedException();
732
733 uno::Reference< drawing::XDrawPages > xDrawPages( mxDrawPagesAccess );
734
735 if( !xDrawPages.is() )
736 {
738 mxDrawPagesAccess = xDrawPages = new SdDrawPagesAccess(*this);
739 }
740
741 return xDrawPages;
742}
743
744// XMasterPagesSupplier
745uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getMasterPages()
746{
747 ::SolarMutexGuard aGuard;
748
749 if( nullptr == mpDoc )
750 throw lang::DisposedException();
751
752 uno::Reference< drawing::XDrawPages > xMasterPages( mxMasterPagesAccess );
753
754 if( !xMasterPages.is() )
755 {
756 if ( !hasControllersLocked() )
758 mxMasterPagesAccess = xMasterPages = new SdMasterPagesAccess(*this);
759 }
760
761 return xMasterPages;
762}
763
764// XLayerManagerSupplier
765uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLayerManager( )
766{
767 ::SolarMutexGuard aGuard;
768
769 if( nullptr == mpDoc )
770 throw lang::DisposedException();
771
772 uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager );
773
774 if( !xLayerManager.is() )
775 mxLayerManager = xLayerManager = new SdLayerManager(*this);
776
777 return xLayerManager;
778}
779
780// XCustomPresentationSupplier
781uno::Reference< container::XNameContainer > SAL_CALL SdXImpressDocument::getCustomPresentations()
782{
783 ::SolarMutexGuard aGuard;
784
785 if( nullptr == mpDoc )
786 throw lang::DisposedException();
787
788 uno::Reference< container::XNameContainer > xCustomPres( mxCustomPresentationAccess );
789
790 if( !xCustomPres.is() )
792
793 return xCustomPres;
794}
795
796// XPresentationSupplier
797uno::Reference< presentation::XPresentation > SAL_CALL SdXImpressDocument::getPresentation()
798{
799 ::SolarMutexGuard aGuard;
800
801 if( nullptr == mpDoc )
802 throw lang::DisposedException();
803
804 return mpDoc->getPresentation();
805}
806
807// XHandoutMasterSupplier
808uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::getHandoutMasterPage()
809{
810 ::SolarMutexGuard aGuard;
811
812 if( nullptr == mpDoc )
813 throw lang::DisposedException();
814
815 uno::Reference< drawing::XDrawPage > xPage;
816
819 if (pPage)
820 xPage.set(pPage->getUnoPage(), uno::UNO_QUERY);
821 return xPage;
822}
823
824// XMultiServiceFactory ( SvxFmMSFactory )
825
826css::uno::Reference<css::uno::XInterface> SdXImpressDocument::create(
827 OUString const & aServiceSpecifier, OUString const & referer)
828{
829 ::SolarMutexGuard aGuard;
830
831 if( nullptr == mpDoc )
832 throw lang::DisposedException();
833
834 if( aServiceSpecifier == "com.sun.star.drawing.DashTable" )
835 {
836 if( !mxDashTable.is() )
838
839 return mxDashTable;
840 }
841 if( aServiceSpecifier == "com.sun.star.drawing.GradientTable" )
842 {
843 if( !mxGradientTable.is() )
845
846 return mxGradientTable;
847 }
848 if( aServiceSpecifier == "com.sun.star.drawing.HatchTable" )
849 {
850 if( !mxHatchTable.is() )
852
853 return mxHatchTable;
854 }
855 if( aServiceSpecifier == "com.sun.star.drawing.BitmapTable" )
856 {
857 if( !mxBitmapTable.is() )
859
860 return mxBitmapTable;
861 }
862 if( aServiceSpecifier == "com.sun.star.drawing.TransparencyGradientTable" )
863 {
864 if( !mxTransGradientTable.is() )
866
868 }
869 if( aServiceSpecifier == "com.sun.star.drawing.MarkerTable" )
870 {
871 if( !mxMarkerTable.is() )
873
874 return mxMarkerTable;
875 }
876 if( aServiceSpecifier == "com.sun.star.text.NumberingRules" )
877 {
878 return uno::Reference< uno::XInterface >( SvxCreateNumRule( mpDoc ), uno::UNO_QUERY );
879 }
880 if( aServiceSpecifier == "com.sun.star.drawing.Background" )
881 {
882 return uno::Reference< uno::XInterface >(
883 static_cast<uno::XWeak*>(new SdUnoPageBackground( mpDoc )));
884 }
885
886 if( aServiceSpecifier == "com.sun.star.drawing.Defaults" )
887 {
888 if( !mxDrawingPool.is() )
890
891 return mxDrawingPool;
892
893 }
894
895 if ( aServiceSpecifier == sUNO_Service_ImageMapRectangleObject )
896 {
898 }
899
900 if ( aServiceSpecifier == sUNO_Service_ImageMapCircleObject )
901 {
903 }
904
905 if ( aServiceSpecifier == sUNO_Service_ImageMapPolygonObject )
906 {
908 }
909
910 if( aServiceSpecifier == "com.sun.star.document.Settings" ||
911 ( !mbImpressDoc && ( aServiceSpecifier == "com.sun.star.drawing.DocumentSettings" ) ) ||
912 ( mbImpressDoc && ( aServiceSpecifier == "com.sun.star.presentation.DocumentSettings" ) ) )
913 {
915 }
916
917 if( aServiceSpecifier == "com.sun.star.text.TextField.DateTime" ||
918 aServiceSpecifier == "com.sun.star.text.textfield.DateTime" )
919 {
920 return static_cast<cppu::OWeakObject *>(new SvxUnoTextField( text::textfield::Type::DATE ));
921 }
922
923 if( aServiceSpecifier == "com.sun.star.presentation.TextField.Header" ||
924 aServiceSpecifier == "com.sun.star.presentation.textfield.Header" )
925 {
927 }
928
929 if( aServiceSpecifier == "com.sun.star.presentation.TextField.Footer" ||
930 aServiceSpecifier == "com.sun.star.presentation.textfield.Footer" )
931 {
933 }
934
935 if( aServiceSpecifier == "com.sun.star.presentation.TextField.DateTime" ||
936 aServiceSpecifier == "com.sun.star.presentation.textfield.DateTime" )
937 {
938 return static_cast<cppu::OWeakObject *>(new SvxUnoTextField( text::textfield::Type::PRESENTATION_DATE_TIME ));
939 }
940
941 if( aServiceSpecifier == "com.sun.star.text.TextField.PageName" ||
942 aServiceSpecifier == "com.sun.star.text.textfield.PageName" )
943 {
944 return static_cast<cppu::OWeakObject *>(new SvxUnoTextField( text::textfield::Type::PAGE_NAME ));
945 }
946
947 if (aServiceSpecifier == "com.sun.star.text.TextField.DocInfo.Custom" ||
948 aServiceSpecifier == "com.sun.star.text.textfield.DocInfo.Custom")
949 {
950 return static_cast<cppu::OWeakObject *>(new SvxUnoTextField(text::textfield::Type::DOCINFO_CUSTOM));
951 }
952
953 if( aServiceSpecifier == "com.sun.star.xml.NamespaceMap" )
954 {
955 static sal_uInt16 aWhichIds[] = { SDRATTR_XMLATTRIBUTES, EE_CHAR_XMLATTRIBS, EE_PARA_XMLATTRIBS, 0 };
956
957 return svx::NamespaceMap_createInstance( aWhichIds, &mpDoc->GetItemPool() );
958 }
959
960 // Support creation of GraphicStorageHandler and EmbeddedObjectResolver
961 if (aServiceSpecifier == "com.sun.star.document.ExportGraphicStorageHandler")
962 {
963 return static_cast<cppu::OWeakObject *>(new SvXMLGraphicHelper( SvXMLGraphicHelperMode::Write ));
964 }
965
966 if (aServiceSpecifier == "com.sun.star.document.ImportGraphicStorageHandler")
967 {
968 return static_cast<cppu::OWeakObject *>(new SvXMLGraphicHelper( SvXMLGraphicHelperMode::Read ));
969 }
970
971 if( aServiceSpecifier == "com.sun.star.document.ExportEmbeddedObjectResolver" )
972 {
974 if( nullptr == pPersist )
975 throw lang::DisposedException();
976
977 return static_cast<cppu::OWeakObject *>(new SvXMLEmbeddedObjectHelper( *pPersist, SvXMLEmbeddedObjectHelperMode::Write ));
978 }
979
980 if( aServiceSpecifier == "com.sun.star.document.ImportEmbeddedObjectResolver" )
981 {
983 if( nullptr == pPersist )
984 throw lang::DisposedException();
985
986 return static_cast<cppu::OWeakObject *>(new SvXMLEmbeddedObjectHelper( *pPersist, SvXMLEmbeddedObjectHelperMode::Read ));
987 }
988
989 uno::Reference< uno::XInterface > xRet;
990
991 if( aServiceSpecifier.startsWith( "com.sun.star.presentation.") )
992 {
993 const std::u16string_view aType( aServiceSpecifier.subView(26) );
995
996 SdrObjKind nType = SdrObjKind::Text;
997 // create a shape wrapper
998 if( o3tl::starts_with(aType, u"TitleTextShape" ) )
999 {
1000 nType = SdrObjKind::Text;
1001 }
1002 else if( o3tl::starts_with(aType, u"OutlinerShape" ) )
1003 {
1004 nType = SdrObjKind::Text;
1005 }
1006 else if( o3tl::starts_with(aType, u"SubtitleShape" ) )
1007 {
1008 nType = SdrObjKind::Text;
1009 }
1010 else if( o3tl::starts_with(aType, u"GraphicObjectShape" ) )
1011 {
1012 nType = SdrObjKind::Graphic;
1013 }
1014 else if( o3tl::starts_with(aType, u"PageShape" ) )
1015 {
1016 nType = SdrObjKind::Page;
1017 }
1018 else if( o3tl::starts_with(aType, u"OLE2Shape" ) )
1019 {
1020 nType = SdrObjKind::OLE2;
1021 }
1022 else if( o3tl::starts_with(aType, u"ChartShape" ) )
1023 {
1024 nType = SdrObjKind::OLE2;
1025 }
1026 else if( o3tl::starts_with(aType, u"CalcShape" ) )
1027 {
1028 nType = SdrObjKind::OLE2;
1029 }
1030 else if( o3tl::starts_with(aType, u"TableShape" ) )
1031 {
1032 nType = SdrObjKind::Table;
1033 }
1034 else if( o3tl::starts_with(aType, u"OrgChartShape" ) )
1035 {
1036 nType = SdrObjKind::OLE2;
1037 }
1038 else if( o3tl::starts_with(aType, u"NotesShape" ) )
1039 {
1040 nType = SdrObjKind::Text;
1041 }
1042 else if( o3tl::starts_with(aType, u"HandoutShape" ) )
1043 {
1044 nType = SdrObjKind::Page;
1045 }
1046 else if( o3tl::starts_with(aType, u"FooterShape" ) )
1047 {
1048 nType = SdrObjKind::Text;
1049 }
1050 else if( o3tl::starts_with(aType, u"HeaderShape" ) )
1051 {
1052 nType = SdrObjKind::Text;
1053 }
1054 else if( o3tl::starts_with(aType, u"SlideNumberShape" ) )
1055 {
1056 nType = SdrObjKind::Text;
1057 }
1058 else if( o3tl::starts_with(aType, u"DateTimeShape" ) )
1059 {
1060 nType = SdrObjKind::Text;
1061 }
1062 else if( o3tl::starts_with(aType, u"MediaShape" ) )
1063 {
1064 nType = SdrObjKind::Media;
1065 }
1066 else
1067 {
1068 throw lang::ServiceNotRegisteredException();
1069 }
1070
1071 // create the API wrapper
1072 pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor::Default, referer );
1073
1074 // set shape type
1075 if( pShape && !mbClipBoard )
1076 pShape->SetShapeType(aServiceSpecifier);
1077
1078 xRet = static_cast<uno::XWeak*>(pShape.get());
1079 }
1080 else if ( aServiceSpecifier == "com.sun.star.drawing.TableShape" )
1081 {
1082 rtl::Reference<SvxShape> pShape = CreateSvxShapeByTypeAndInventor( SdrObjKind::Table, SdrInventor::Default, referer );
1083 if( pShape && !mbClipBoard )
1084 pShape->SetShapeType(aServiceSpecifier);
1085
1086 xRet = static_cast<uno::XWeak*>(pShape.get());
1087 }
1088 else
1089 {
1090 xRet = SvxFmMSFactory::createInstance( aServiceSpecifier );
1091 }
1092
1093 uno::Reference< drawing::XShape > xShape( xRet, uno::UNO_QUERY );
1094 SvxShape* pShape = xShape.is() ? comphelper::getFromUnoTunnel<SvxShape>(xShape) : nullptr;
1095 if (pShape)
1096 {
1097 xRet.clear();
1098 new SdXShape( pShape, this );
1099 xRet = xShape;
1100 xShape.clear();
1101 }
1102
1103 return xRet;
1104}
1105
1106uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( const OUString& aServiceSpecifier )
1107{
1108 return create(aServiceSpecifier, "");
1109}
1110
1111css::uno::Reference<css::uno::XInterface>
1113 OUString const & ServiceSpecifier,
1114 css::uno::Sequence<css::uno::Any> const & Arguments)
1115{
1116 OUString arg;
1117 if ((ServiceSpecifier == "com.sun.star.drawing.GraphicObjectShape"
1118 || ServiceSpecifier == "com.sun.star.drawing.MediaShape"
1119 || ServiceSpecifier == "com.sun.star.presentation.MediaShape")
1120 && Arguments.getLength() == 1 && (Arguments[0] >>= arg))
1121 {
1122 return create(ServiceSpecifier, arg);
1123 }
1125 ServiceSpecifier, Arguments);
1126}
1127
1128uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getAvailableServiceNames()
1129{
1130 ::SolarMutexGuard aGuard;
1131
1132 if( nullptr == mpDoc )
1133 throw lang::DisposedException();
1134
1135 const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() );
1136
1137 uno::Sequence< OUString > aSNS_Common{ "com.sun.star.drawing.DashTable",
1138 "com.sun.star.drawing.GradientTable",
1139 "com.sun.star.drawing.HatchTable",
1140 "com.sun.star.drawing.BitmapTable",
1141 "com.sun.star.drawing.TransparencyGradientTable",
1142 "com.sun.star.drawing.MarkerTable",
1143 "com.sun.star.text.NumberingRules",
1144 "com.sun.star.drawing.Background",
1145 "com.sun.star.document.Settings",
1149 "com.sun.star.xml.NamespaceMap",
1150
1151 // Support creation of GraphicStorageHandler and EmbeddedObjectResolver
1152 "com.sun.star.document.ExportGraphicStorageHandler",
1153 "com.sun.star.document.ImportGraphicStorageHandler",
1154 "com.sun.star.document.ExportEmbeddedObjectResolver",
1155 "com.sun.star.document.ImportEmbeddedObjectResolver",
1156 "com.sun.star.drawing.TableShape" };
1157
1158 uno::Sequence< OUString > aSNS_Specific;
1159
1160 if(mbImpressDoc)
1161 aSNS_Specific = { "com.sun.star.presentation.TitleTextShape",
1162 "com.sun.star.presentation.OutlinerShape",
1163 "com.sun.star.presentation.SubtitleShape",
1164 "com.sun.star.presentation.GraphicObjectShape",
1165 "com.sun.star.presentation.ChartShape",
1166 "com.sun.star.presentation.PageShape",
1167 "com.sun.star.presentation.OLE2Shape",
1168 "com.sun.star.presentation.TableShape",
1169 "com.sun.star.presentation.OrgChartShape",
1170 "com.sun.star.presentation.NotesShape",
1171 "com.sun.star.presentation.HandoutShape",
1172 "com.sun.star.presentation.DocumentSettings",
1173 "com.sun.star.presentation.FooterShape",
1174 "com.sun.star.presentation.HeaderShape",
1175 "com.sun.star.presentation.SlideNumberShape",
1176 "com.sun.star.presentation.DateTimeShape",
1177 "com.sun.star.presentation.CalcShape",
1178 "com.sun.star.presentation.MediaShape" };
1179 else
1180 aSNS_Specific = { "com.sun.star.drawing.DocumentSettings" };
1181
1182 return comphelper::concatSequences( aSNS_ORG, aSNS_Common, aSNS_Specific );
1183}
1184
1185// lang::XServiceInfo
1187{
1188 return "SdXImpressDocument";
1189 /* // Matching the .component information:
1190 return mbImpressDoc
1191 ? OUString("com.sun.star.comp.Draw.PresentationDocument")
1192 : OUString("com.sun.star.comp.Draw.DrawingDocument");
1193 */
1194}
1195
1196sal_Bool SAL_CALL SdXImpressDocument::supportsService( const OUString& ServiceName )
1197{
1198 return cppu::supportsService(this, ServiceName);
1199}
1200
1201uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getSupportedServiceNames()
1202{
1203 ::SolarMutexGuard aGuard;
1204
1205 return { "com.sun.star.document.OfficeDocument",
1206 "com.sun.star.drawing.GenericDrawingDocument",
1207 "com.sun.star.drawing.DrawingDocumentFactory",
1208 mbImpressDoc?OUString("com.sun.star.presentation.PresentationDocument"):OUString("com.sun.star.drawing.DrawingDocument") };
1209}
1210
1211// XPropertySet
1212uno::Reference< beans::XPropertySetInfo > SAL_CALL SdXImpressDocument::getPropertySetInfo( )
1213{
1214 ::SolarMutexGuard aGuard;
1215 return mpPropSet->getPropertySetInfo();
1216}
1217
1218void SAL_CALL SdXImpressDocument::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
1219{
1220 ::SolarMutexGuard aGuard;
1221
1222 if( nullptr == mpDoc )
1223 throw lang::DisposedException();
1224
1225 const SfxItemPropertyMapEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
1226
1227 switch( pEntry ? pEntry->nWID : -1 )
1228 {
1229 case WID_MODEL_LANGUAGE:
1230 {
1231 lang::Locale aLocale;
1232 if(!(aValue >>= aLocale))
1233 throw lang::IllegalArgumentException();
1234
1236 break;
1237 }
1238 case WID_MODEL_TABSTOP:
1239 {
1240 sal_Int32 nValue = 0;
1241 if(!(aValue >>= nValue) || nValue < 0 )
1242 throw lang::IllegalArgumentException();
1243
1244 mpDoc->SetDefaultTabulator(static_cast<sal_uInt16>(nValue));
1245 break;
1246 }
1247 case WID_MODEL_VISAREA:
1248 {
1249 SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
1250 if( !pEmbeddedObj )
1251 break;
1252
1253 awt::Rectangle aVisArea;
1254 if( !(aValue >>= aVisArea) || (aVisArea.Width < 0) || (aVisArea.Height < 0) )
1255 throw lang::IllegalArgumentException();
1256
1257 sal_Int32 nRight, nTop;
1258 if (o3tl::checked_add(aVisArea.X, aVisArea.Width, nRight) || o3tl::checked_add(aVisArea.Y, aVisArea.Height, nTop))
1259 throw lang::IllegalArgumentException();
1260
1261 pEmbeddedObj->SetVisArea(::tools::Rectangle(aVisArea.X, aVisArea.Y, nRight, nTop));
1262 }
1263 break;
1265 {
1266 bool bFocus = false;
1267 if( !(aValue >>= bFocus ) )
1268 throw lang::IllegalArgumentException();
1269 mpDoc->SetAutoControlFocus( bFocus );
1270 }
1271 break;
1272 case WID_MODEL_DSGNMODE:
1273 {
1274 bool bMode = false;
1275 if( !(aValue >>= bMode ) )
1276 throw lang::IllegalArgumentException();
1277 mpDoc->SetOpenInDesignMode( bMode );
1278 }
1279 break;
1280 case WID_MODEL_BUILDID:
1281 aValue >>= maBuildId;
1282 return;
1283 case WID_MODEL_MAPUNIT:
1285 case WID_MODEL_RUNTIMEUID: // is read-only
1287 case WID_MODEL_FONTS:
1288 throw beans::PropertyVetoException();
1290 setGrabBagItem(aValue);
1291 break;
1292 case WID_MODEL_THEME:
1293 {
1295 std::shared_ptr<model::Theme> pTheme = model::Theme::FromAny(aValue);
1296 rModel.setTheme(pTheme);
1297 }
1298 break;
1299 default:
1300 throw beans::UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this));
1301 }
1302
1303 SetModified();
1304}
1305
1306uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& PropertyName )
1307{
1308 ::SolarMutexGuard aGuard;
1309
1310 uno::Any aAny;
1311 if( nullptr == mpDoc )
1312 throw lang::DisposedException();
1313
1314 const SfxItemPropertyMapEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
1315
1316 switch( pEntry ? pEntry->nWID : -1 )
1317 {
1318 case WID_MODEL_LANGUAGE:
1319 {
1321 aAny <<= LanguageTag::convertToLocale( eLang);
1322 break;
1323 }
1324 case WID_MODEL_TABSTOP:
1325 aAny <<= static_cast<sal_Int32>(mpDoc->GetDefaultTabulator());
1326 break;
1327 case WID_MODEL_VISAREA:
1328 {
1329 SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
1330 if( !pEmbeddedObj )
1331 break;
1332
1333 const ::tools::Rectangle& aRect = pEmbeddedObj->GetVisArea();
1334 awt::Rectangle aVisArea( aRect.Left(), aRect.Top(), aRect.getOpenWidth(), aRect.getOpenHeight() );
1335 aAny <<= aVisArea;
1336 }
1337 break;
1338 case WID_MODEL_MAPUNIT:
1339 {
1340 SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
1341 if( !pEmbeddedObj )
1342 break;
1343
1344 sal_Int16 nMeasureUnit = 0;
1345 SvxMapUnitToMeasureUnit( pEmbeddedObj->GetMapUnit(), nMeasureUnit );
1346 aAny <<= nMeasureUnit;
1347 }
1348 break;
1350 {
1351 aAny <<= getForbiddenCharsTable();
1352 }
1353 break;
1355 aAny <<= mpDoc->GetAutoControlFocus();
1356 break;
1357 case WID_MODEL_DSGNMODE:
1358 aAny <<= mpDoc->GetOpenInDesignMode();
1359 break;
1361 aAny <<= mpDocShell->GetBasicContainer();
1362 break;
1364 aAny <<= mpDocShell->GetDialogContainer();
1365 break;
1367 aAny <<= getRuntimeUID();
1368 break;
1369 case WID_MODEL_BUILDID:
1370 return uno::Any( maBuildId );
1372 aAny <<= hasValidSignatures();
1373 break;
1374 case WID_MODEL_FONTS:
1375 {
1376 uno::Sequence<uno::Any> aSeq;
1377 int nSeqIndex = 0;
1378
1379 sal_uInt16 const aWhichIds[] { EE_CHAR_FONTINFO, EE_CHAR_FONTINFO_CJK,
1381
1382 const SfxItemPool& rPool = mpDoc->GetPool();
1383
1384 for(sal_uInt16 nWhichId : aWhichIds)
1385 {
1386 sal_uInt32 nItems = rPool.GetItemCount2( nWhichId );
1387
1388 aSeq.realloc( aSeq.getLength() + nItems*5 + 5 );
1389 auto pSeq = aSeq.getArray();
1390
1391 for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nWhichId))
1392 {
1393 const SvxFontItem *pFont = static_cast<const SvxFontItem *>(pItem);
1394
1395 pSeq[nSeqIndex++] <<= pFont->GetFamilyName();
1396 pSeq[nSeqIndex++] <<= pFont->GetStyleName();
1397 pSeq[nSeqIndex++] <<= sal_Int16(pFont->GetFamily());
1398 pSeq[nSeqIndex++] <<= sal_Int16(pFont->GetPitch());
1399 pSeq[nSeqIndex++] <<= sal_Int16(pFont->GetCharSet());
1400 }
1401
1402 const SvxFontItem& rFont = static_cast<const SvxFontItem&>(rPool.GetDefaultItem( nWhichId ));
1403
1404 pSeq[nSeqIndex++] <<= rFont.GetFamilyName();
1405 pSeq[nSeqIndex++] <<= rFont.GetStyleName();
1406 pSeq[nSeqIndex++] <<= sal_Int16(rFont.GetFamily());
1407 pSeq[nSeqIndex++] <<= sal_Int16(rFont.GetPitch());
1408 pSeq[nSeqIndex++] <<= sal_Int16(rFont.GetCharSet());
1409
1410 }
1411
1412 aSeq.realloc( nSeqIndex );
1413 aAny <<= aSeq;
1414 break;
1415 }
1417 getGrabBagItem(aAny);
1418 break;
1419 case WID_MODEL_THEME:
1420 {
1422 auto const& pTheme = rModel.getTheme();
1423 if (pTheme)
1424 {
1425 pTheme->ToAny(aAny);
1426 }
1427 else
1428 {
1429 beans::PropertyValues aValues;
1430 aAny <<= aValues;
1431 }
1432 break;
1433 }
1434 default:
1435 throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
1436 }
1437
1438 return aAny;
1439}
1440
1441void SAL_CALL SdXImpressDocument::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) {}
1442void SAL_CALL SdXImpressDocument::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) {}
1443void SAL_CALL SdXImpressDocument::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) {}
1444void SAL_CALL SdXImpressDocument::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) {}
1445
1446// XLinkTargetSupplier
1447uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLinks()
1448{
1449 ::SolarMutexGuard aGuard;
1450
1451 if( nullptr == mpDoc )
1452 throw lang::DisposedException();
1453
1454 uno::Reference< container::XNameAccess > xLinks( mxLinks );
1455 if( !xLinks.is() )
1456 mxLinks = xLinks = new SdDocLinkTargets( *this );
1457 return xLinks;
1458}
1459
1460// XStyleFamiliesSupplier
1461uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getStyleFamilies( )
1462{
1463 ::SolarMutexGuard aGuard;
1464
1465 if( nullptr == mpDoc )
1466 throw lang::DisposedException();
1467
1468 uno::Reference< container::XNameAccess > xStyles( static_cast< OWeakObject* >( mpDoc->GetStyleSheetPool() ), css::uno::UNO_QUERY );
1469 return xStyles;
1470}
1471
1472// XAnyCompareFactory
1473uno::Reference< css::ucb::XAnyCompare > SAL_CALL SdXImpressDocument::createAnyCompareByName( const OUString& )
1474{
1475 return SvxCreateNumRuleCompare();
1476}
1477
1478// XRenderable
1479sal_Int32 SAL_CALL SdXImpressDocument::getRendererCount( const uno::Any& rSelection,
1480 const uno::Sequence< beans::PropertyValue >& )
1481{
1482 ::SolarMutexGuard aGuard;
1483 sal_Int32 nRet = 0;
1484
1485 if( nullptr == mpDoc )
1486 throw lang::DisposedException();
1487
1488 if (mpDocShell)
1489 {
1490 uno::Reference< frame::XModel > xModel;
1491
1492 rSelection >>= xModel;
1493
1494 if( xModel == mpDocShell->GetModel() )
1496 else
1497 {
1498 uno::Reference< drawing::XShapes > xShapes;
1499
1500 rSelection >>= xShapes;
1501
1502 if( xShapes.is() && xShapes->getCount() )
1503 nRet = 1;
1504 }
1505 }
1506 return nRet;
1507}
1508
1509uno::Sequence< beans::PropertyValue > SAL_CALL SdXImpressDocument::getRenderer( sal_Int32 , const uno::Any& ,
1510 const uno::Sequence< beans::PropertyValue >& rxOptions )
1511{
1512 ::SolarMutexGuard aGuard;
1513
1514 if( nullptr == mpDoc )
1515 throw lang::DisposedException();
1516
1517 bool bExportNotesPages = false;
1518 for( const auto& rOption : rxOptions )
1519 {
1520 if ( rOption.Name == "ExportNotesPages" )
1521 rOption.Value >>= bExportNotesPages;
1522 }
1523 uno::Sequence< beans::PropertyValue > aRenderer;
1524 if (mpDocShell)
1525 {
1526 awt::Size aPageSize;
1527 if ( bExportNotesPages )
1528 {
1529 Size aNotesPageSize = mpDoc->GetSdPage( 0, PageKind::Notes )->GetSize();
1530 aPageSize = awt::Size( aNotesPageSize.Width(), aNotesPageSize.Height() );
1531 }
1532 else
1533 {
1534 const ::tools::Rectangle aVisArea( mpDocShell->GetVisArea( embed::Aspects::MSOLE_DOCPRINT ) );
1535 aPageSize = awt::Size( aVisArea.GetWidth(), aVisArea.GetHeight() );
1536 }
1537 aRenderer = { comphelper::makePropertyValue("PageSize", aPageSize) };
1538 }
1539 return aRenderer;
1540}
1541
1542namespace {
1543
1544class ImplRenderPaintProc : public sdr::contact::ViewObjectContactRedirector
1545{
1546 const SdrLayerAdmin& rLayerAdmin;
1547 SdrPageView* pSdrPageView;
1548
1549public:
1550 bool IsVisible ( const SdrObject* pObj ) const;
1551 bool IsPrintable( const SdrObject* pObj ) const;
1552
1553 ImplRenderPaintProc(const SdrLayerAdmin& rLA, SdrPageView* pView);
1554
1555 // all default implementations just call the same methods at the original. To do something
1556 // different, override the method and at least do what the method does.
1558 const sdr::contact::ViewObjectContact& rOriginal,
1559 const sdr::contact::DisplayInfo& rDisplayInfo,
1561};
1562
1563}
1564
1565ImplRenderPaintProc::ImplRenderPaintProc(const SdrLayerAdmin& rLA, SdrPageView *const pView)
1566 : rLayerAdmin(rLA)
1567 , pSdrPageView(pView)
1568{
1569}
1570
1571static sal_Int32 ImplPDFGetBookmarkPage( const OUString& rBookmark, SdDrawDocument const & rDoc )
1572{
1573 sal_Int32 nPage = -1;
1574
1575 OUString aBookmark( rBookmark );
1576
1577 if( rBookmark.startsWith("#") )
1578 aBookmark = rBookmark.copy( 1 );
1579
1580 // is the bookmark a page ?
1581 bool bIsMasterPage;
1582 sal_uInt16 nPgNum = rDoc.GetPageByName( aBookmark, bIsMasterPage );
1583
1584 if ( nPgNum == SDRPAGE_NOTFOUND )
1585 {
1586 // is the bookmark an object ?
1587 SdrObject* pObj = rDoc.GetObj( aBookmark );
1588 if (pObj)
1589 nPgNum = pObj->getSdrPageFromSdrObject()->GetPageNum();
1590 }
1591 if ( nPgNum != SDRPAGE_NOTFOUND )
1592 nPage = ( nPgNum - 1 ) / 2;
1593 return nPage;
1594}
1595
1596static void ImplPDFExportComments( const uno::Reference< drawing::XDrawPage >& xPage, vcl::PDFExtOutDevData& rPDFExtOutDevData )
1597{
1598 try
1599 {
1600 uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW );
1601 uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
1602
1603 while( xAnnotationEnumeration->hasMoreElements() )
1604 {
1605 uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() );
1606
1607 geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() );
1608 geometry::RealSize2D aRealSize2D(xAnnotation->getSize());
1609 uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
1610
1611 vcl::PDFNote aNote;
1612 aNote.Title = xAnnotation->getAuthor();
1613 aNote.Contents = xText->getString();
1614 aNote.maModificationDate = xAnnotation->getDateTime();
1615 auto* pAnnotation = dynamic_cast<sd::Annotation*>(xAnnotation.get());
1616 aNote.isFreeText = pAnnotation && pAnnotation->isFreeText();
1617 if (pAnnotation && pAnnotation->hasCustomAnnotationMarker())
1618 {
1619 aNote.maPolygons = pAnnotation->getCustomAnnotationMarker().maPolygons;
1620 aNote.annotColor = pAnnotation->getCustomAnnotationMarker().maLineColor;
1621 aNote.interiorColor = pAnnotation->getCustomAnnotationMarker().maFillColor;
1622 }
1623
1624 rPDFExtOutDevData.CreateNote(
1625 ::tools::Rectangle(Point(static_cast<::tools::Long>(aRealPoint2D.X * 100),
1626 static_cast<::tools::Long>(aRealPoint2D.Y * 100)),
1627 Size(static_cast<::tools::Long>(aRealSize2D.Width * 100),
1628 static_cast<::tools::Long>(aRealSize2D.Height * 100))),
1629 aNote);
1630 }
1631 }
1632 catch (const uno::Exception&)
1633 {
1634 }
1635}
1636
1637static void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape >& xShape, SdDrawDocument& rDoc, vcl::PDFExtOutDevData& rPDFExtOutDevData )
1638{
1639 if ( xShape->getShapeType() == "com.sun.star.drawing.GroupShape" )
1640 {
1641 uno::Reference< container::XIndexAccess > xIndexAccess( xShape, uno::UNO_QUERY );
1642 if ( xIndexAccess.is() )
1643 {
1644 sal_Int32 i, nCount = xIndexAccess->getCount();
1645 for ( i = 0; i < nCount; i++ )
1646 {
1647 uno::Reference< drawing::XShape > xSubShape( xIndexAccess->getByIndex( i ), uno::UNO_QUERY );
1648 if ( xSubShape.is() )
1649 ImplPDFExportShapeInteraction( xSubShape, rDoc, rPDFExtOutDevData );
1650 }
1651 }
1652 }
1653 else
1654 {
1655 uno::Reference< beans::XPropertySet > xShapePropSet( xShape, uno::UNO_QUERY );
1656 if( xShapePropSet.is() )
1657 {
1658 Size aPageSize( rDoc.GetSdPage( 0, PageKind::Standard )->GetSize() );
1659 Point aPoint( 0, 0 );
1660 ::tools::Rectangle aPageRect( aPoint, aPageSize );
1661
1662 awt::Point aShapePos( xShape->getPosition() );
1663 awt::Size aShapeSize( xShape->getSize() );
1664 ::tools::Rectangle aLinkRect( Point( aShapePos.X, aShapePos.Y ), Size( aShapeSize.Width, aShapeSize.Height ) );
1665
1666 // Handle linked videos.
1667 if (xShape->getShapeType() == "com.sun.star.drawing.MediaShape" || xShape->getShapeType() == "com.sun.star.presentation.MediaShape")
1668 {
1669 OUString title;
1670 xShapePropSet->getPropertyValue("Title") >>= title;
1671 OUString description;
1672 xShapePropSet->getPropertyValue("Description") >>= description;
1673 OUString const altText(title.isEmpty()
1674 ? description
1675 : description.isEmpty()
1676 ? title
1677 : OUString::Concat(title) + OUString::Concat("\n") + OUString::Concat(description));
1678
1679 OUString aMediaURL;
1680 xShapePropSet->getPropertyValue("MediaURL") >>= aMediaURL;
1681 if (!aMediaURL.isEmpty())
1682 {
1683 SdrObject const*const pSdrObj(SdrObject::getSdrObjectFromXShape(xShape));
1684 OUString const mimeType(xShapePropSet->getPropertyValue("MediaMimeType").get<OUString>());
1685 sal_Int32 nScreenId = rPDFExtOutDevData.CreateScreen(aLinkRect, altText, mimeType, rPDFExtOutDevData.GetCurrentPageNumber(), pSdrObj);
1686 if (aMediaURL.startsWith("vnd.sun.star.Package:"))
1687 {
1688 OUString aTempFileURL;
1689 xShapePropSet->getPropertyValue("PrivateTempFileURL") >>= aTempFileURL;
1690 rPDFExtOutDevData.SetScreenStream(nScreenId, aTempFileURL);
1691 }
1692 else
1693 rPDFExtOutDevData.SetScreenURL(nScreenId, aMediaURL);
1694 }
1695 }
1696
1697 presentation::ClickAction eCa;
1698 uno::Any aAny( xShapePropSet->getPropertyValue( "OnClick" ) );
1699 if ( aAny >>= eCa )
1700 {
1701 OUString const actionName(SdResId(SdTPAction::GetClickActionSdResId(eCa)));
1702 switch ( eCa )
1703 {
1704 case presentation::ClickAction_LASTPAGE :
1705 {
1706 sal_Int32 nCount = rDoc.GetSdPageCount( PageKind::Standard );
1707 sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nCount - 1, vcl::PDFWriter::DestAreaType::FitRectangle );
1708 sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink(aLinkRect, actionName);
1709 rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
1710 }
1711 break;
1712 case presentation::ClickAction_FIRSTPAGE :
1713 {
1714 sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, 0, vcl::PDFWriter::DestAreaType::FitRectangle );
1715 sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink(aLinkRect, actionName);
1716 rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
1717 }
1718 break;
1719 case presentation::ClickAction_PREVPAGE :
1720 {
1721 sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber();
1722 if ( nDestPage )
1723 nDestPage--;
1724 sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::DestAreaType::FitRectangle );
1725 sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink(aLinkRect, actionName);
1726 rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
1727 }
1728 break;
1729 case presentation::ClickAction_NEXTPAGE :
1730 {
1731 sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber() + 1;
1732 sal_Int32 nLastPage = rDoc.GetSdPageCount( PageKind::Standard ) - 1;
1733 if ( nDestPage > nLastPage )
1734 nDestPage = nLastPage;
1735 sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::DestAreaType::FitRectangle );
1736 sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink(aLinkRect, actionName);
1737 rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
1738 }
1739 break;
1740
1741 case presentation::ClickAction_PROGRAM :
1742 case presentation::ClickAction_BOOKMARK :
1743 case presentation::ClickAction_DOCUMENT :
1744 {
1745 OUString aBookmark;
1746 xShapePropSet->getPropertyValue( "Bookmark" ) >>= aBookmark;
1747 if( !aBookmark.isEmpty() )
1748 {
1749 switch( eCa )
1750 {
1751 case presentation::ClickAction_DOCUMENT :
1752 case presentation::ClickAction_PROGRAM :
1753 {
1754 sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink(aLinkRect, actionName);
1755 rPDFExtOutDevData.SetLinkURL( nLinkId, aBookmark );
1756 }
1757 break;
1758 case presentation::ClickAction_BOOKMARK :
1759 {
1760 sal_Int32 nPage = ImplPDFGetBookmarkPage( aBookmark, rDoc );
1761 if ( nPage != -1 )
1762 {
1763 sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nPage, vcl::PDFWriter::DestAreaType::FitRectangle );
1764 sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink(aLinkRect, actionName);
1765 rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
1766 }
1767 }
1768 break;
1769 default:
1770 break;
1771 }
1772 }
1773 }
1774 break;
1775
1776 case presentation::ClickAction_STOPPRESENTATION :
1777 case presentation::ClickAction_SOUND :
1778 case presentation::ClickAction_INVISIBLE :
1779 case presentation::ClickAction_VERB :
1780 case presentation::ClickAction_VANISH :
1781 case presentation::ClickAction_MACRO :
1782 default :
1783 break;
1784 }
1785 }
1786 }
1787 }
1788}
1789
1790void ImplRenderPaintProc::createRedirectedPrimitive2DSequence(
1791 const sdr::contact::ViewObjectContact& rOriginal,
1792 const sdr::contact::DisplayInfo& rDisplayInfo,
1794{
1796 if(!pObject)
1797 {
1798 // not an object, maybe a page
1800 return;
1801 }
1802 SdrPage* pSdrPage(pObject->getSdrPageFromSdrObject());
1803 if(!pSdrPage)
1804 return;
1805 if(!pSdrPage->checkVisibility(rOriginal, rDisplayInfo, false))
1806 return;
1807 if(!IsVisible(pObject) || !IsPrintable(pObject))
1808 return;
1809
1811}
1812
1813bool ImplRenderPaintProc::IsVisible( const SdrObject* pObj ) const
1814{
1815 bool bVisible = true;
1816 SdrLayerID nLayerId = pObj->GetLayer();
1817 if( pSdrPageView )
1818 {
1819 const SdrLayer* pSdrLayer = rLayerAdmin.GetLayerPerID( nLayerId );
1820 if ( pSdrLayer )
1821 {
1822 const OUString& aLayerName = pSdrLayer->GetName();
1823 bVisible = pSdrPageView->IsLayerVisible( aLayerName );
1824 }
1825 }
1826 return bVisible;
1827}
1828bool ImplRenderPaintProc::IsPrintable( const SdrObject* pObj ) const
1829{
1830 bool bPrintable = true;
1831 SdrLayerID nLayerId = pObj->GetLayer();
1832 if( pSdrPageView )
1833 {
1834 const SdrLayer* pSdrLayer = rLayerAdmin.GetLayerPerID( nLayerId );
1835 if ( pSdrLayer )
1836 {
1837 const OUString& aLayerName = pSdrLayer->GetName();
1838 bPrintable = pSdrPageView->IsLayerPrintable( aLayerName );
1839 }
1840 }
1841 return bPrintable;
1842
1843}
1844
1845namespace
1846{
1847 sal_Int16 CalcOutputPageNum(vcl::PDFExtOutDevData const * pPDFExtOutDevData, SdDrawDocument const *pDoc, sal_Int16 nPageNumber)
1848 {
1849 //export all pages, simple one to one case
1850 if (pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportHiddenSlides())
1851 return nPageNumber-1;
1852 //check all preceding pages, and only count non-hidden ones
1853 sal_Int16 nRet = 0;
1854 for (sal_Int16 i = 0; i < nPageNumber-1; ++i)
1855 {
1856 if (!pDoc->GetSdPage(i, PageKind::Standard)->IsExcluded())
1857 ++nRet;
1858 }
1859 return nRet;
1860 }
1861}
1862
1863void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& rSelection,
1864 const uno::Sequence< beans::PropertyValue >& rxOptions )
1865{
1866 ::SolarMutexGuard aGuard;
1867
1868 if( nullptr == mpDoc )
1869 throw lang::DisposedException();
1870
1871 if (!mpDocShell)
1872 return;
1873
1874 uno::Reference< awt::XDevice > xRenderDevice;
1875 const sal_Int32 nPageNumber = nRenderer + 1;
1876 PageKind ePageKind = PageKind::Standard;
1877 bool bExportNotesPages = false;
1878
1879 for( const auto& rOption : rxOptions )
1880 {
1881 if ( rOption.Name == "RenderDevice" )
1882 rOption.Value >>= xRenderDevice;
1883 else if ( rOption.Name == "ExportNotesPages" )
1884 {
1885 rOption.Value >>= bExportNotesPages;
1886 if ( bExportNotesPages )
1887 ePageKind = PageKind::Notes;
1888 }
1889 }
1890
1891 if( !(xRenderDevice.is() && nPageNumber && ( nPageNumber <= mpDoc->GetSdPageCount( ePageKind ) )) )
1892 return;
1893
1894 VCLXDevice* pDevice = dynamic_cast<VCLXDevice*>( xRenderDevice.get() );
1896
1897 if( !pOut )
1898 return;
1899
1900 vcl::PDFExtOutDevData* pPDFExtOutDevData = dynamic_cast<vcl::PDFExtOutDevData* >( pOut->GetExtOutDevData() );
1901
1902 if ( mpDoc->GetSdPage(static_cast<sal_Int16>(nPageNumber)-1, PageKind::Standard)->IsExcluded() &&
1903 !(pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportHiddenSlides()) )
1904 return;
1905
1906 if (pPDFExtOutDevData)
1907 {
1908 css::lang::Locale const docLocale(Application::GetSettings().GetLanguageTag().getLocale());
1909 pPDFExtOutDevData->SetDocumentLocale(docLocale);
1910 }
1911
1913 ::tools::Rectangle aVisArea( Point(), mpDoc->GetSdPage( static_cast<sal_uInt16>(nPageNumber) - 1, ePageKind )->GetSize() );
1914 vcl::Region aRegion( aVisArea );
1915
1916 ::sd::ViewShell* pOldViewSh = mpDocShell->GetViewShell();
1917 ::sd::View* pOldSdView = pOldViewSh ? pOldViewSh->GetView() : nullptr;
1918
1919 if ( pOldSdView )
1920 pOldSdView->SdrEndTextEdit();
1921
1922 aView.SetHlplVisible( false );
1923 aView.SetGridVisible( false );
1924 aView.SetBordVisible( false );
1925 aView.SetPageVisible( false );
1926 aView.SetGlueVisible( false );
1927
1928 pOut->SetMapMode(MapMode(MapUnit::Map100thMM));
1929 pOut->IntersectClipRegion( aVisArea );
1930
1931 uno::Reference< frame::XModel > xModel;
1932 rSelection >>= xModel;
1933
1934 if( xModel == mpDocShell->GetModel() )
1935 {
1936 aView.ShowSdrPage( mpDoc->GetSdPage( static_cast<sal_uInt16>(nPageNumber) - 1, ePageKind ));
1937 SdrPageView* pPV = aView.GetSdrPageView();
1938
1939 if( pOldSdView )
1940 {
1941 SdrPageView* pOldPV = pOldSdView->GetSdrPageView();
1942 if( pPV && pOldPV )
1943 {
1944 pPV->SetVisibleLayers( pOldPV->GetVisibleLayers() );
1945 pPV->SetPrintableLayers( pOldPV->GetPrintableLayers() );
1946 }
1947 }
1948
1949 ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(),
1950 pPV);
1951
1952 // background color for outliner :o
1953 SdPage* pPage = pPV ? static_cast<SdPage*>(pPV->GetPage()) : nullptr;
1954 if( pPage )
1955 {
1956 SdrOutliner& rOutl = mpDoc->GetDrawOutliner();
1957 bool bScreenDisplay(true);
1958
1959 // #i75566# printing; suppress AutoColor BackgroundColor generation
1960 // for visibility reasons by giving GetPageBackgroundColor()
1961 // the needed hint
1962 // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see printing)
1963 if (pOut && ((OUTDEV_PRINTER == pOut->GetOutDevType())
1964 || (OUTDEV_PDF == pOut->GetOutDevType())))
1965 bScreenDisplay = false;
1966
1967 // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and
1968 // hint value if screen display. Only then the AutoColor mechanisms shall be applied
1969 rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor( pPV, bScreenDisplay ) );
1970 }
1971
1972 // produce link annots for media shapes before painting them
1973 if ( pPDFExtOutDevData && pPage )
1974 {
1975 try
1976 {
1977 uno::Any aAny;
1978 uno::Reference< drawing::XDrawPage > xPage( uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() ) );
1979 if ( xPage.is() )
1980 {
1981 if ( pPDFExtOutDevData->GetIsExportNotes() )
1982 ImplPDFExportComments( xPage, *pPDFExtOutDevData );
1983 uno::Reference< beans::XPropertySet > xPagePropSet( xPage, uno::UNO_QUERY );
1984 if( xPagePropSet.is() )
1985 {
1986 // exporting object interactions to pdf
1987
1988 // if necessary, the master page interactions will be exported first
1989 bool bIsBackgroundObjectsVisible = false; // #i39428# IsBackgroundObjectsVisible not available for Draw
1990 if ( mbImpressDoc && xPagePropSet->getPropertySetInfo()->hasPropertyByName( "IsBackgroundObjectsVisible" ) )
1991 xPagePropSet->getPropertyValue( "IsBackgroundObjectsVisible" ) >>= bIsBackgroundObjectsVisible;
1992 if ( bIsBackgroundObjectsVisible && !pPDFExtOutDevData->GetIsExportNotesPages() )
1993 {
1994 uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( xPage, uno::UNO_QUERY );
1995 if ( xMasterPageTarget.is() )
1996 {
1997 uno::Reference< drawing::XDrawPage > xMasterPage = xMasterPageTarget->getMasterPage();
1998 if ( xMasterPage.is() )
1999 {
2000 sal_Int32 i, nCount = xMasterPage->getCount();
2001 for ( i = 0; i < nCount; i++ )
2002 {
2003 aAny = xMasterPage->getByIndex( i );
2004 uno::Reference< drawing::XShape > xShape;
2005 if ( aAny >>= xShape )
2006 ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData );
2007 }
2008 }
2009 }
2010 }
2011
2012 // exporting slide page object interactions
2013 sal_Int32 i, nCount = xPage->getCount();
2014 for ( i = 0; i < nCount; i++ )
2015 {
2016 aAny = xPage->getByIndex( i );
2017 uno::Reference< drawing::XShape > xShape;
2018 if ( aAny >>= xShape )
2019 ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData );
2020 }
2021
2022 // exporting transition effects to pdf
2023 if ( mbImpressDoc && !pPDFExtOutDevData->GetIsExportNotesPages() && pPDFExtOutDevData->GetIsExportTransitionEffects() )
2024 {
2025 static constexpr OUStringLiteral sEffect( u"Effect" );
2026 static constexpr OUStringLiteral sSpeed ( u"Speed" );
2027 sal_Int32 nTime = 800;
2028 presentation::AnimationSpeed aAs;
2029 if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) )
2030 {
2031 aAny = xPagePropSet->getPropertyValue( sSpeed );
2032 if ( aAny >>= aAs )
2033 {
2034 switch( aAs )
2035 {
2036 case presentation::AnimationSpeed_SLOW : nTime = 1500; break;
2037 case presentation::AnimationSpeed_FAST : nTime = 300; break;
2038 default:
2039 case presentation::AnimationSpeed_MEDIUM : nTime = 800;
2040 }
2041 }
2042 }
2043 presentation::FadeEffect eFe;
2044 vcl::PDFWriter::PageTransition eType = vcl::PDFWriter::PageTransition::Regular;
2045 if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sEffect ) )
2046 {
2047 aAny = xPagePropSet->getPropertyValue( sEffect );
2048 if ( aAny >>= eFe )
2049 {
2050 switch( eFe )
2051 {
2052 case presentation::FadeEffect_HORIZONTAL_LINES :
2053 case presentation::FadeEffect_HORIZONTAL_CHECKERBOARD :
2054 case presentation::FadeEffect_HORIZONTAL_STRIPES : eType = vcl::PDFWriter::PageTransition::BlindsHorizontal; break;
2055
2056 case presentation::FadeEffect_VERTICAL_LINES :
2057 case presentation::FadeEffect_VERTICAL_CHECKERBOARD :
2058 case presentation::FadeEffect_VERTICAL_STRIPES : eType = vcl::PDFWriter::PageTransition::BlindsVertical; break;
2059
2060 case presentation::FadeEffect_UNCOVER_TO_RIGHT :
2061 case presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT :
2062 case presentation::FadeEffect_ROLL_FROM_LEFT :
2063 case presentation::FadeEffect_FADE_FROM_UPPERLEFT :
2064 case presentation::FadeEffect_MOVE_FROM_UPPERLEFT :
2065 case presentation::FadeEffect_FADE_FROM_LEFT :
2066 case presentation::FadeEffect_MOVE_FROM_LEFT : eType = vcl::PDFWriter::PageTransition::WipeLeftToRight; break;
2067
2068 case presentation::FadeEffect_UNCOVER_TO_BOTTOM :
2069 case presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT :
2070 case presentation::FadeEffect_ROLL_FROM_TOP :
2071 case presentation::FadeEffect_FADE_FROM_UPPERRIGHT :
2072 case presentation::FadeEffect_MOVE_FROM_UPPERRIGHT :
2073 case presentation::FadeEffect_FADE_FROM_TOP :
2074 case presentation::FadeEffect_MOVE_FROM_TOP : eType = vcl::PDFWriter::PageTransition::WipeTopToBottom; break;
2075
2076 case presentation::FadeEffect_UNCOVER_TO_LEFT :
2077 case presentation::FadeEffect_UNCOVER_TO_LOWERLEFT :
2078 case presentation::FadeEffect_ROLL_FROM_RIGHT :
2079
2080 case presentation::FadeEffect_FADE_FROM_LOWERRIGHT :
2081 case presentation::FadeEffect_MOVE_FROM_LOWERRIGHT :
2082 case presentation::FadeEffect_FADE_FROM_RIGHT :
2083 case presentation::FadeEffect_MOVE_FROM_RIGHT : eType = vcl::PDFWriter::PageTransition::WipeRightToLeft; break;
2084
2085 case presentation::FadeEffect_UNCOVER_TO_TOP :
2086 case presentation::FadeEffect_UNCOVER_TO_UPPERLEFT :
2087 case presentation::FadeEffect_ROLL_FROM_BOTTOM :
2088 case presentation::FadeEffect_FADE_FROM_LOWERLEFT :
2089 case presentation::FadeEffect_MOVE_FROM_LOWERLEFT :
2090 case presentation::FadeEffect_FADE_FROM_BOTTOM :
2091 case presentation::FadeEffect_MOVE_FROM_BOTTOM : eType = vcl::PDFWriter::PageTransition::WipeBottomToTop; break;
2092
2093 case presentation::FadeEffect_OPEN_VERTICAL : eType = vcl::PDFWriter::PageTransition::SplitHorizontalInward; break;
2094 case presentation::FadeEffect_CLOSE_HORIZONTAL : eType = vcl::PDFWriter::PageTransition::SplitHorizontalOutward; break;
2095
2096 case presentation::FadeEffect_OPEN_HORIZONTAL : eType = vcl::PDFWriter::PageTransition::SplitVerticalInward; break;
2097 case presentation::FadeEffect_CLOSE_VERTICAL : eType = vcl::PDFWriter::PageTransition::SplitVerticalOutward; break;
2098
2099 case presentation::FadeEffect_FADE_TO_CENTER : eType = vcl::PDFWriter::PageTransition::BoxInward; break;
2100 case presentation::FadeEffect_FADE_FROM_CENTER : eType = vcl::PDFWriter::PageTransition::BoxOutward; break;
2101
2102 case presentation::FadeEffect_NONE : eType = vcl::PDFWriter::PageTransition::Regular; break;
2103
2104 case presentation::FadeEffect_RANDOM :
2105 case presentation::FadeEffect_DISSOLVE :
2106 default: eType = vcl::PDFWriter::PageTransition::Dissolve; break;
2107 }
2108 }
2109 }
2110
2111 if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sEffect ) ||
2112 xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) )
2113 {
2114 pPDFExtOutDevData->SetPageTransition( eType, nTime );
2115 }
2116 }
2117 }
2118 }
2119 }
2120 catch (const uno::Exception&)
2121 {
2122 }
2123 }
2124
2125 aView.SdrPaintView::CompleteRedraw(pOut, aRegion, &aImplRenderPaintProc);
2126
2127 if (pPDFExtOutDevData && pPage)
2128 {
2129 try
2130 {
2131 Size aPageSize( mpDoc->GetSdPage( 0, PageKind::Standard )->GetSize() );
2132 Point aPoint( 0, 0 );
2133 ::tools::Rectangle aPageRect( aPoint, aPageSize );
2134
2135 // resolving links found in this page by the method ImpEditEngine::Paint
2136 std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->GetBookmarks();
2137 for ( const auto& rBookmark : rBookmarks )
2138 {
2139 sal_Int32 nPage = ImplPDFGetBookmarkPage( rBookmark.aBookmark, *mpDoc );
2140 if ( nPage != -1 )
2141 {
2142 if ( rBookmark.nLinkId != -1 )
2143 pPDFExtOutDevData->SetLinkDest( rBookmark.nLinkId, pPDFExtOutDevData->CreateDest( aPageRect, nPage, vcl::PDFWriter::DestAreaType::FitRectangle ) );
2144 else
2145 pPDFExtOutDevData->DescribeRegisteredDest( rBookmark.nDestId, aPageRect, nPage, vcl::PDFWriter::DestAreaType::FitRectangle );
2146 }
2147 else
2148 pPDFExtOutDevData->SetLinkURL( rBookmark.nLinkId, rBookmark.aBookmark );
2149 }
2150 rBookmarks.clear();
2151 //---> #i56629, #i40318
2152 //get the page name, will be used as outline element in PDF bookmark pane
2153 OUString aPageName = mpDoc->GetSdPage( static_cast<sal_uInt16>(nPageNumber) - 1 , PageKind::Standard )->GetName();
2154 if( !aPageName.isEmpty() )
2155 {
2156 // Destination PageNum
2157 const sal_Int32 nDestPageNum = CalcOutputPageNum(pPDFExtOutDevData, mpDoc, nPageNumber);
2158
2159 // insert the bookmark to this page into the NamedDestinations
2160 if( pPDFExtOutDevData->GetIsExportNamedDestinations() )
2161 pPDFExtOutDevData->CreateNamedDest(aPageName, aPageRect, nDestPageNum);
2162
2163 // add the name to the outline, (almost) same code as in sc/source/ui/unoobj/docuno.cxx
2164 // issue #i40318.
2165
2166 if( pPDFExtOutDevData->GetIsExportBookmarks() )
2167 {
2168 // Destination Export
2169 const sal_Int32 nDestId =
2170 pPDFExtOutDevData->CreateDest(aPageRect , nDestPageNum);
2171
2172 // Create a new outline item:
2173 pPDFExtOutDevData->CreateOutlineItem( -1 , aPageName, nDestId );
2174 }
2175 }
2176 //<--- #i56629, #i40318
2177 }
2178 catch (const uno::Exception&)
2179 {
2180 }
2181
2182 }
2183 }
2184 else
2185 {
2186 uno::Reference< drawing::XShapes > xShapes;
2187 rSelection >>= xShapes;
2188
2189 if( xShapes.is() && xShapes->getCount() )
2190 {
2191 SdrPageView* pPV = nullptr;
2192
2193 ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(),
2194 pOldSdView ? pOldSdView->GetSdrPageView() : nullptr);
2195
2196 for( sal_uInt32 i = 0, nCount = xShapes->getCount(); i < nCount; i++ )
2197 {
2198 uno::Reference< drawing::XShape > xShape;
2199 xShapes->getByIndex( i ) >>= xShape;
2200
2201 if( xShape.is() )
2202 {
2204 if( pObj && pObj->getSdrPageFromSdrObject()
2205 && aImplRenderPaintProc.IsVisible( pObj )
2206 && aImplRenderPaintProc.IsPrintable( pObj ) )
2207 {
2208 if( !pPV )
2209 pPV = aView.ShowSdrPage( pObj->getSdrPageFromSdrObject() );
2210
2211 if( pPV )
2212 aView.MarkObj( pObj, pPV );
2213 }
2214 }
2215 }
2216 aView.DrawMarkedObj(*pOut);
2217 }
2218 }
2219}
2220
2222{
2223 DrawViewShell* pViewSh = dynamic_cast<DrawViewShell*>(mpDocShell->GetViewShell());
2224 if (!pViewSh)
2225 {
2226 SAL_WARN("sd", "DrawViewShell not available!");
2227 return nullptr;
2228 }
2229 return pViewSh;
2230}
2231
2233 int nOutputWidth, int nOutputHeight,
2234 int nTilePosX, int nTilePosY,
2235 ::tools::Long nTileWidth, ::tools::Long nTileHeight )
2236{
2237 DrawViewShell* pViewSh = GetViewShell();
2238 if (!pViewSh)
2239 return;
2240
2241 // we need to skip tile invalidation for controls on rendering
2243
2244 // Setup drawing layer to work properly. Since we use a custom VirtualDevice
2245 // for the drawing, SdrPaintView::BeginCompleteRedraw() will call FindPaintWindow()
2246 // unsuccessfully and use a temporary window that doesn't keep state. So patch
2247 // the existing SdrPageWindow to use a temporary, and this way the state will be kept.
2248 // Well, at least that's how I understand it based on Writer's RenderContextGuard,
2249 // as the drawing layer classes lack documentation.
2250 SdrPageWindow* patchedPageWindow = nullptr;
2251 SdrPaintWindow* previousPaintWindow = nullptr;
2252 std::unique_ptr<SdrPaintWindow> temporaryPaintWindow;
2253 if(SdrView* pDrawView = pViewSh->GetDrawView())
2254 {
2255 if(SdrPageView* pSdrPageView = pDrawView->GetSdrPageView())
2256 {
2257 pSdrPageView->SetApplicationDocumentColor(pViewSh->GetViewOptions().mnDocBackgroundColor);
2258 patchedPageWindow = pSdrPageView->FindPageWindow(*getDocWindow()->GetOutDev());
2259 temporaryPaintWindow.reset(new SdrPaintWindow(*pDrawView, rDevice));
2260 if (patchedPageWindow)
2261 previousPaintWindow = patchedPageWindow->patchPaintWindow(*temporaryPaintWindow);
2262 }
2263 }
2264
2265 // Scaling. Must convert from pixels to twips. We know
2266 // that VirtualDevices use a DPI of 96.
2267 // We specifically calculate these scales first as we're still
2268 // in TWIPs, and might as well minimize the number of conversions.
2270 Fraction scaleX = Fraction(nOutputWidth, nTileWidth) * scale;
2271 Fraction scaleY = Fraction(nOutputHeight, nTileHeight) * scale;
2272
2273 // svx seems to be the only component that works natively in
2274 // 100th mm rather than TWIP. It makes most sense just to
2275 // convert here and in getDocumentSize, and leave the tiled
2276 // rendering API working in TWIPs.
2277 ::tools::Long nTileWidthHMM = convertTwipToMm100( nTileWidth );
2278 ::tools::Long nTileHeightHMM = convertTwipToMm100( nTileHeight );
2279 int nTilePosXHMM = convertTwipToMm100( nTilePosX );
2280 int nTilePosYHMM = convertTwipToMm100( nTilePosY );
2281
2282 MapMode aMapMode = rDevice.GetMapMode();
2283 aMapMode.SetMapUnit( MapUnit::Map100thMM );
2284 aMapMode.SetOrigin( Point( -nTilePosXHMM,
2285 -nTilePosYHMM) );
2286 aMapMode.SetScaleX( scaleX );
2287 aMapMode.SetScaleY( scaleY );
2288
2289 rDevice.SetMapMode( aMapMode );
2290
2291 rDevice.SetOutputSizePixel( Size(nOutputWidth, nOutputHeight) );
2292
2293 Point aPoint(nTilePosXHMM, nTilePosYHMM);
2294 Size aSize(nTileWidthHMM, nTileHeightHMM);
2295 ::tools::Rectangle aRect(aPoint, aSize);
2296
2297 SdrView* pView = pViewSh->GetDrawView();
2300
2301 pViewSh->GetView()->CompleteRedraw(&rDevice, vcl::Region(aRect));
2302
2304 pView->SetPaintTextEdit(true);
2305
2306 LokChartHelper::PaintAllChartsOnTile(rDevice, nOutputWidth, nOutputHeight,
2307 nTilePosX, nTilePosY, nTileWidth, nTileHeight);
2308 LokStarMathHelper::PaintAllInPlaceOnTile(rDevice, nOutputWidth, nOutputHeight, nTilePosX,
2309 nTilePosY, nTileWidth, nTileHeight);
2310
2311 if(patchedPageWindow != nullptr)
2312 patchedPageWindow->unpatchPaintWindow(previousPaintWindow);
2313
2314 // Draw Form controls
2315 SdrView* pDrawView = pViewSh->GetDrawView();
2316 SdrPageView* pPageView = pDrawView->GetSdrPageView();
2317 if (pPageView != nullptr)
2318 {
2319 SdrPage* pPage = pPageView->GetPage();
2320 ::sd::Window* pActiveWin = pViewSh->GetActiveWindow();
2321 ::tools::Rectangle aTileRect(Point(nTilePosX, nTilePosY), Size(nTileWidth, nTileHeight));
2322 Size aOutputSize(nOutputWidth, nOutputHeight);
2323 LokControlHandler::paintControlTile(pPage, pDrawView, *pActiveWin, rDevice, aOutputSize, aTileRect);
2324 }
2325
2327}
2328
2330{
2331 OStringBuffer aState;
2332 DrawViewShell* pView = GetViewShell();
2333 if (pView)
2334 {
2335 const SdViewOptions& pVOpt = pView->GetViewOptions();
2336 aState.append(';');
2337
2338 OString aThemeName = OUStringToOString(pVOpt.msColorSchemeName, RTL_TEXTENCODING_UTF8);
2339 aState.append(aThemeName);
2340 }
2341 return aState.makeStringAndClear();
2342}
2343
2344void SdXImpressDocument::selectPart(int nPart, int nSelect)
2345{
2346 DrawViewShell* pViewSh = GetViewShell();
2347 if (!pViewSh)
2348 return;
2349
2350 pViewSh->SelectPage(nPart, nSelect);
2351}
2352
2353void SdXImpressDocument::moveSelectedParts(int nPosition, bool bDuplicate)
2354{
2355 // Duplicating is currently unsupported.
2356 if (!bDuplicate)
2357 mpDoc->MovePages(nPosition);
2358}
2359
2361{
2362 DrawViewShell* pViewSh = GetViewShell();
2363 if (!pViewSh)
2364 return OUString();
2365
2366 const bool bIsVisible = !pViewSh->GetDoc()->GetSdPage(nPart, pViewSh->GetPageKind())->IsExcluded();
2367 const bool bIsSelected = pViewSh->IsSelected(nPart);
2368 const sal_Int16 nMasterPageCount= pViewSh->GetDoc()->GetMasterSdPageCount(pViewSh->GetPageKind());
2369
2370 OUString aPartInfo = "{ \"visible\": \"" +
2371 OUString::number(static_cast<unsigned int>(bIsVisible)) +
2372 "\", \"selected\": \"" +
2373 OUString::number(static_cast<unsigned int>(bIsSelected)) +
2374 "\", \"masterPageCount\": \"" +
2375 OUString::number(nMasterPageCount) +
2376 "\", \"mode\": \"" +
2377 OUString::number(getEditMode()) +
2378 "\" }";
2379
2380 return aPartInfo;
2381}
2382
2383void SdXImpressDocument::setPart( int nPart, bool bAllowChangeFocus )
2384{
2385 DrawViewShell* pViewSh = GetViewShell();
2386 if (!pViewSh)
2387 return;
2388
2389 pViewSh->SwitchPage( nPart, bAllowChangeFocus );
2390}
2391
2393{
2394 if (!mpDoc)
2395 return 0;
2396
2397 if (isMasterViewMode())
2399
2401}
2402
2404{
2405 DrawViewShell* pViewSh = GetViewShell();
2406 if (!pViewSh)
2407 return 0;
2408
2409 return pViewSh->GetViewShellBase().getPart();
2410}
2411
2413{
2414 SdPage* pPage;
2415 if (isMasterViewMode())
2416 pPage = mpDoc->GetMasterSdPage(nPart, PageKind::Standard);
2417 else
2418 pPage = mpDoc->GetSdPage(nPart, PageKind::Standard);
2419
2420 if (!pPage)
2421 {
2422 SAL_WARN("sd", "DrawViewShell not available!");
2423 return OUString();
2424 }
2425
2426 return pPage->GetName();
2427}
2428
2430{
2431 SdPage* pPage;
2432 if (isMasterViewMode())
2433 pPage = mpDoc->GetMasterSdPage(nPart, PageKind::Standard);
2434 else
2435 pPage = mpDoc->GetSdPage(nPart, PageKind::Standard);
2436
2437 if (!pPage)
2438 {
2439 SAL_WARN("sd", "DrawViewShell not available!");
2440 return OUString();
2441 }
2442
2443 return OUString::number(pPage->GetHashCode());
2444}
2445
2447{
2448 DrawViewShell* pViewSh = GetViewShell();
2449 if (!pViewSh)
2450 return false;
2451
2452 if (pViewSh->GetDispatcher())
2453 {
2454 const SfxBoolItem* isMasterViewMode = nullptr;
2455 pViewSh->GetDispatcher()->QueryState(SID_SLIDE_MASTER_MODE, isMasterViewMode);
2456 if (isMasterViewMode && isMasterViewMode->GetValue())
2457 return true;
2458 }
2459 return false;
2460}
2461
2463{
2464 SolarMutexGuard aGuard;
2465 DrawViewShell* pViewShell = GetViewShell();
2466 if (!pViewShell)
2467 return {};
2468
2469 if (VclPtr<vcl::Window> pWindow = SfxLokHelper::getInPlaceDocWindow(pViewShell->GetViewShell()))
2470 return pWindow;
2471
2472 return pViewShell->GetActiveWindow();
2473}
2474
2476{
2477 DrawViewShell* pViewSh = GetViewShell();
2478 if (!pViewSh)
2479 return;
2480
2481 PageKind aPageKind( PageKind::Standard );
2482 switch ( nPartMode )
2483 {
2484 case LOK_PARTMODE_SLIDES:
2485 break;
2486 case LOK_PARTMODE_NOTES:
2487 aPageKind = PageKind::Notes;
2488 break;
2489 }
2490 pViewSh->SetPageKind( aPageKind );
2491}
2492
2494{
2495 DrawViewShell* pViewSh = GetViewShell();
2496 if (!pViewSh)
2497 return 0;
2498
2499 return pViewSh->GetViewShellBase().getEditMode();
2500}
2501
2503{
2504 SolarMutexGuard aGuard;
2505
2506 DrawViewShell* pViewSh = GetViewShell();
2507 if (!pViewSh)
2508 return;
2509
2510 pViewSh->GetViewShellBase().setEditMode(nMode);
2511}
2512
2514{
2515 DrawViewShell* pViewSh = GetViewShell();
2516 if (!pViewSh)
2517 return Size();
2518
2519 SdrView *pSdrView = pViewSh->GetView();
2520 if (!pSdrView)
2521 return Size();
2522
2523 SdrPageView* pCurPageView = pSdrView->GetSdrPageView();
2524 if (!pCurPageView)
2525 return Size();
2526
2527 Size aSize = pCurPageView->GetPageRect().GetSize();
2528 // Convert the size in 100th mm to TWIP
2529 // See paintTile above for further info.
2531}
2532
2534{
2535 auto commentsNode = rJsonWriter.startNode("comments");
2536 // Return annotations on master pages too ?
2537 const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
2538 SdPage* pPage;
2539 for (sal_uInt16 nPage = 0; nPage < nMaxPages; ++nPage)
2540 {
2541 pPage = static_cast<SdPage*>(mpDoc->GetPage(nPage));
2542 const sd::AnnotationVector& aPageAnnotations = pPage->getAnnotations();
2543
2544 for (const uno::Reference<office::XAnnotation>& xAnnotation : aPageAnnotations)
2545 {
2546 sal_uInt32 nID = sd::getAnnotationId(xAnnotation);
2547 OString nodeName = "comment" + OString::number(nID);
2548 auto commentNode = rJsonWriter.startNode(nodeName);
2549 rJsonWriter.put("id", nID);
2550 rJsonWriter.put("author", xAnnotation->getAuthor());
2551 rJsonWriter.put("dateTime", utl::toISO8601(xAnnotation->getDateTime()));
2552 uno::Reference<text::XText> xText(xAnnotation->getTextRange());
2553 rJsonWriter.put("text", xText->getString());
2554 rJsonWriter.put("parthash", pPage->GetHashCode());
2555 geometry::RealPoint2D const & rPoint = xAnnotation->getPosition();
2556 geometry::RealSize2D const & rSize = xAnnotation->getSize();
2557 ::tools::Rectangle aRectangle(Point(rPoint.X * 100.0, rPoint.Y * 100.0), Size(rSize.Width * 100.0, rSize.Height * 100.0));
2558 aRectangle = o3tl::toTwips(aRectangle, o3tl::Length::mm100);
2559 OString sRectangle = aRectangle.toString();
2560 rJsonWriter.put("rectangle", sRectangle.getStr());
2561 }
2562 }
2563}
2564
2565void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
2566{
2567 SolarMutexGuard aGuard;
2568
2569 if (DrawViewShell* pViewShell = GetViewShell())
2570 {
2571 DrawView* pDrawView = pViewShell->GetDrawView();
2572 for (const beans::PropertyValue& rValue : rArguments)
2573 {
2574 if (rValue.Name == ".uno:ShowBorderShadow" && rValue.Value.has<bool>())
2575 pDrawView->SetPageShadowVisible(rValue.Value.get<bool>());
2576 else if (rValue.Name == ".uno:Author" && rValue.Value.has<OUString>())
2577 pDrawView->SetAuthor(rValue.Value.get<OUString>());
2578 else if (rValue.Name == ".uno:SpellOnline" && rValue.Value.has<bool>())
2579 mpDoc->SetOnlineSpell(rValue.Value.get<bool>());
2580 }
2581
2582 // Disable comments if requested
2583 SdOptions* pOptions = SD_MOD()->GetSdOptions(mpDoc->GetDocumentType());
2585
2586 pViewShell->SetRuler(false);
2587 pViewShell->SetScrollBarsVisible(false);
2588
2589 if (sd::Window* pWindow = pViewShell->GetActiveWindow())
2590 {
2591 // get the full page size in pixels
2592 pWindow->EnableMapMode();
2593 Size aSize(pWindow->LogicToPixel(pDrawView->GetSdrPageView()->GetPage()->GetSize()));
2594 // Disable map mode, so that it's possible to send mouse event
2595 // coordinates in logic units
2596 pWindow->EnableMapMode(false);
2597
2598 // arrange UI elements again with new view size
2599 pViewShell->GetParentWindow()->SetSizePixel(aSize);
2600 pViewShell->Resize();
2601 }
2602
2603 // Forces all images to be swapped in synchronously, this
2604 // ensures that images are available when paintTile is called
2605 // (whereas with async loading images start being loaded after
2606 // we have painted the tile, resulting in an invalidate, followed
2607 // by the tile being rerendered - which is wasteful and ugly).
2608 pDrawView->SetSwapAsynchron(false);
2609 }
2610
2611 // when the "This document may contain formatting or content that cannot
2612 // be saved..." dialog appears, it is auto-cancelled with tiled rendering,
2613 // causing 'Save' being disabled; so let's always save to the original
2614 // format
2616 officecfg::Office::Common::Save::Document::WarnAlienFormat::set(false, xChanges);
2617 xChanges->commit();
2618
2619 if (!getenv("LO_TESTNAME"))
2621}
2622
2623void SdXImpressDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)
2624{
2625 SolarMutexGuard aGuard;
2626 SfxLokHelper::postKeyEventAsync(getDocWindow(), nType, nCharCode, nKeyCode);
2627}
2628
2629void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
2630{
2631 SolarMutexGuard aGuard;
2632
2633 DrawViewShell* pViewShell = GetViewShell();
2634 if (!pViewShell)
2635 return;
2636
2637 constexpr double fScale = o3tl::convert(1.0, o3tl::Length::twip, o3tl::Length::px);
2638
2640 pViewShell->GetViewShell(), nType, nX, nY, nCount, nButtons, nModifier, fScale, fScale))
2641 return;
2642
2643 // try to forward mouse event to control
2644 const Point aPointTwip(nX, nY);
2645 const Point aPointHMM = o3tl::convert(aPointTwip, o3tl::Length::twip, o3tl::Length::mm100);
2646 SdrView* pDrawView = pViewShell->GetDrawView();
2647 SdrPageView* pPageView = pDrawView->GetSdrPageView();
2648 SdrPage* pPage = pPageView->GetPage();
2649 ::sd::Window* pActiveWin = pViewShell->GetActiveWindow();
2650 if (!pActiveWin)
2651 {
2652 return;
2653 }
2654
2655 if (LokControlHandler::postMouseEvent(pPage, pDrawView, *pActiveWin, nType, aPointHMM, nCount, nButtons, nModifier))
2656 return;
2657
2658 LokMouseEventData aMouseEventData(nType, aPointHMM, nCount, MouseEventModifiers::SIMPLECLICK,
2659 nButtons, nModifier);
2660 SfxLokHelper::postMouseEventAsync(pViewShell->GetActiveWindow(), aMouseEventData);
2661}
2662
2663void SdXImpressDocument::setTextSelection(int nType, int nX, int nY)
2664{
2665 SolarMutexGuard aGuard;
2666
2667 DrawViewShell* pViewShell = GetViewShell();
2668 if (!pViewShell)
2669 return;
2670
2671 LokChartHelper aChartHelper(pViewShell->GetViewShell());
2672 if (aChartHelper.setTextSelection(nType, nX, nY))
2673 return;
2674
2676 switch (nType)
2677 {
2678 case LOK_SETTEXTSELECTION_START:
2679 pViewShell->SetCursorMm100Position(aPoint, /*bPoint=*/false, /*bClearMark=*/false);
2680 break;
2681 case LOK_SETTEXTSELECTION_END:
2682 pViewShell->SetCursorMm100Position(aPoint, /*bPoint=*/true, /*bClearMark=*/false);
2683 break;
2684 case LOK_SETTEXTSELECTION_RESET:
2685 pViewShell->SetCursorMm100Position(aPoint, /*bPoint=*/true, /*bClearMark=*/true);
2686 break;
2687 default:
2688 assert(false);
2689 break;
2690 }
2691}
2692
2693uno::Reference<datatransfer::XTransferable> SdXImpressDocument::getSelection()
2694{
2695 SolarMutexGuard aGuard;
2696
2697 DrawViewShell* pViewShell = GetViewShell();
2698 if (!pViewShell)
2699 return uno::Reference<datatransfer::XTransferable>();
2700
2701 return pViewShell->GetSelectionTransferable();
2702}
2703
2704void SdXImpressDocument::setGraphicSelection(int nType, int nX, int nY)
2705{
2706 SolarMutexGuard aGuard;
2707
2708 DrawViewShell* pViewShell = GetViewShell();
2709 if (!pViewShell)
2710 return;
2711
2712 constexpr double fScale = o3tl::convert(1.0, o3tl::Length::twip, o3tl::Length::px);
2713
2714 LokChartHelper aChartHelper(pViewShell->GetViewShell());
2715 if (aChartHelper.setGraphicSelection(nType, nX, nY, fScale, fScale))
2716 return;
2717
2719 switch (nType)
2720 {
2721 case LOK_SETGRAPHICSELECTION_START:
2722 pViewShell->SetGraphicMm100Position(/*bStart=*/true, aPoint);
2723 break;
2724 case LOK_SETGRAPHICSELECTION_END:
2725 pViewShell->SetGraphicMm100Position(/*bStart=*/false, aPoint);
2726 break;
2727 default:
2728 assert(false);
2729 break;
2730 }
2731}
2732
2734{
2735 SolarMutexGuard aGuard;
2736
2737 DrawViewShell* pViewShell = GetViewShell();
2738 if (!pViewShell)
2739 return;
2740
2741 SdrView* pSdrView = pViewShell->GetView();
2742 if (!pSdrView)
2743 return;
2744
2745 if (pSdrView->IsTextEdit())
2746 {
2747 // Reset the editeng selection.
2748 pSdrView->UnmarkAll();
2749 // Finish editing.
2750 pSdrView->SdrEndTextEdit();
2751 }
2752 // Reset graphic selection.
2753 pSdrView->UnmarkAll();
2754}
2755
2756void SdXImpressDocument::setClientVisibleArea(const ::tools::Rectangle& rRectangle)
2757{
2758 SolarMutexGuard aGuard;
2759
2760 DrawViewShell* pViewShell = GetViewShell();
2761 if (!pViewShell)
2762 return;
2763
2764 pViewShell->GetViewShellBase().setLOKVisibleArea(rRectangle);
2765}
2766
2767void SdXImpressDocument::setClipboard(const uno::Reference<datatransfer::clipboard::XClipboard>& xClipboard)
2768{
2769 SolarMutexGuard aGuard;
2770
2771 DrawViewShell* pViewShell = GetViewShell();
2772 if (!pViewShell)
2773 return;
2774
2775 pViewShell->GetActiveWindow()->SetClipboard(xClipboard);
2776}
2777
2779{
2780 SolarMutexGuard aGuard;
2781 DrawViewShell* pViewShell = GetViewShell();
2782 if (!pViewShell)
2783 return false;
2784
2785 TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromSystemClipboard(pViewShell->GetActiveWindow()));
2786 return EditEngine::HasValidData(aDataHelper.GetTransferable());
2787}
2788
2790{
2791 SolarMutexGuard aGuard;
2792 DrawViewShell* pViewShell = GetViewShell();
2793 if (!pViewShell)
2794 return PointerStyle::Arrow;
2795
2796 Window* pWindow = pViewShell->GetActiveWindow();
2797 if (!pWindow)
2798 return PointerStyle::Arrow;
2799
2800 return pWindow->GetPointer();
2801}
2802
2803uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
2804{
2805 uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbiddenCharacters);
2806
2807 if( !xForb.is() )
2808 mxForbiddenCharacters = xForb = new SdUnoForbiddenCharsTable( mpDoc );
2809
2810 return xForb;
2811}
2812
2814{
2815 if( mbClipBoard )
2816 return;
2817
2818 switch( mpDoc->GetPageCount() )
2819 {
2820 case 1:
2821 {
2822 // nasty hack to detect clipboard document
2823 mbClipBoard = true;
2824 break;
2825 }
2826 case 0:
2827 {
2830 break;
2831 }
2832 }
2833}
2834
2836{
2837 OSL_ENSURE(GetDoc(), "No SdrModel in draw/Impress, should not happen");
2838 return *GetDoc(); // TTTT should be reference
2839}
2840
2842{
2843 if( mbDisposed )
2844 return;
2845
2846 ::SolarMutexGuard aGuard;
2847
2848 if( mpDoc )
2849 {
2850 EndListening( *mpDoc );
2851 mpDoc = nullptr;
2852 }
2853
2854 // Call the base class dispose() before setting the mbDisposed flag
2855 // to true. The reason for this is that if close() has not yet been
2856 // called this is done in SfxBaseModel::dispose(). At the end of
2857 // that dispose() is called again. It is important to forward this
2858 // second dispose() to the base class, too.
2859 // As a consequence the following code has to be able to be run twice.
2861 mbDisposed = true;
2862
2863 uno::Reference< container::XNameAccess > xLinks( mxLinks );
2864 if( xLinks.is() )
2865 {
2866 uno::Reference< lang::XComponent > xComp( xLinks, uno::UNO_QUERY );
2867 if( xComp.is() )
2868 xComp->dispose();
2869
2870 xLinks = nullptr;
2871 }
2872
2873 uno::Reference< drawing::XDrawPages > xDrawPagesAccess( mxDrawPagesAccess );
2874 if( xDrawPagesAccess.is() )
2875 {
2876 uno::Reference< lang::XComponent > xComp( xDrawPagesAccess, uno::UNO_QUERY );
2877 if( xComp.is() )
2878 xComp->dispose();
2879
2880 xDrawPagesAccess = nullptr;
2881 }
2882
2883 uno::Reference< drawing::XDrawPages > xMasterPagesAccess( mxMasterPagesAccess );
2884 if( xDrawPagesAccess.is() )
2885 {
2886 uno::Reference< lang::XComponent > xComp( xMasterPagesAccess, uno::UNO_QUERY );
2887 if( xComp.is() )
2888 xComp->dispose();
2889
2890 xDrawPagesAccess = nullptr;
2891 }
2892
2893 uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager );
2894 if( xLayerManager.is() )
2895 {
2896 uno::Reference< lang::XComponent > xComp( xLayerManager, uno::UNO_QUERY );
2897 if( xComp.is() )
2898 xComp->dispose();
2899
2900 xLayerManager = nullptr;
2901 }
2902
2903 uno::Reference< container::XNameContainer > xCustomPresentationAccess( mxCustomPresentationAccess );
2904 if( xCustomPresentationAccess.is() )
2905 {
2906 uno::Reference< lang::XComponent > xComp( xCustomPresentationAccess, uno::UNO_QUERY );
2907 if( xComp.is() )
2908 xComp->dispose();
2909
2910 xCustomPresentationAccess = nullptr;
2911 }
2912
2913 mxDashTable = nullptr;
2914 mxGradientTable = nullptr;
2915 mxHatchTable = nullptr;
2916 mxBitmapTable = nullptr;
2917 mxTransGradientTable = nullptr;
2918 mxMarkerTable = nullptr;
2919 mxDrawingPool = nullptr;
2920}
2921
2922
2924: mpModel( &rMyModel)
2925{
2926}
2927
2929{
2930}
2931
2932// XIndexAccess
2934{
2935 ::SolarMutexGuard aGuard;
2936
2937 if( nullptr == mpModel )
2938 throw lang::DisposedException();
2939
2941}
2942
2944{
2945 ::SolarMutexGuard aGuard;
2946
2947 if( nullptr == mpModel )
2948 throw lang::DisposedException();
2949
2950 uno::Any aAny;
2951
2952 if( (Index < 0) || (Index >= mpModel->mpDoc->GetSdPageCount( PageKind::Standard ) ) )
2953 throw lang::IndexOutOfBoundsException();
2954
2955 SdPage* pPage = mpModel->mpDoc->GetSdPage( static_cast<sal_uInt16>(Index), PageKind::Standard );
2956 if( pPage )
2957 {
2958 uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
2959 aAny <<= xDrawPage;
2960 }
2961
2962 return aAny;
2963}
2964
2965// XNameAccess
2966uno::Any SAL_CALL SdDrawPagesAccess::getByName( const OUString& aName )
2967{
2968 ::SolarMutexGuard aGuard;
2969
2970 if( nullptr == mpModel )
2971 throw lang::DisposedException();
2972
2973 if( !aName.isEmpty() )
2974 {
2975 const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PageKind::Standard );
2976 sal_uInt16 nPage;
2977 for( nPage = 0; nPage < nCount; nPage++ )
2978 {
2979 SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PageKind::Standard );
2980 if(nullptr == pPage)
2981 continue;
2982
2983 if( aName == SdDrawPage::getPageApiName( pPage ) )
2984 {
2985 uno::Any aAny;
2986 uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
2987 aAny <<= xDrawPage;
2988 return aAny;
2989 }
2990 }
2991 }
2992
2993 throw container::NoSuchElementException();
2994}
2995
2996uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getElementNames()
2997{
2998 ::SolarMutexGuard aGuard;
2999
3000 if( nullptr == mpModel )
3001 throw lang::DisposedException();
3002
3003 const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PageKind::Standard );
3004 uno::Sequence< OUString > aNames( nCount );
3005 OUString* pNames = aNames.getArray();
3006
3007 sal_uInt16 nPage;
3008 for( nPage = 0; nPage < nCount; nPage++ )
3009 {
3010 SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PageKind::Standard );
3011 *pNames++ = SdDrawPage::getPageApiName( pPage );
3012 }
3013
3014 return aNames;
3015}
3016
3017sal_Bool SAL_CALL SdDrawPagesAccess::hasByName( const OUString& aName )
3018{
3019 ::SolarMutexGuard aGuard;
3020
3021 if( nullptr == mpModel )
3022 throw lang::DisposedException();
3023
3024 const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PageKind::Standard );
3025 sal_uInt16 nPage;
3026 for( nPage = 0; nPage < nCount; nPage++ )
3027 {
3028 SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PageKind::Standard );
3029 if(nullptr == pPage)
3030 continue;
3031
3032 if( aName == SdDrawPage::getPageApiName( pPage ) )
3033 return true;
3034 }
3035
3036 return false;
3037}
3038
3039// XElementAccess
3041{
3043}
3044
3046{
3047 return getCount() > 0;
3048}
3049
3050// XDrawPages
3051
3056uno::Reference< drawing::XDrawPage > SAL_CALL SdDrawPagesAccess::insertNewByIndex( sal_Int32 nIndex )
3057{
3058 ::SolarMutexGuard aGuard;
3059 comphelper::ProfileZone aZone("insertNewByIndex");
3060
3061 if( nullptr == mpModel )
3062 throw lang::DisposedException();
3063
3064 if( mpModel->mpDoc )
3065 {
3066 SdPage* pPage = mpModel->InsertSdPage( static_cast<sal_uInt16>(nIndex), false );
3067 if( pPage )
3068 {
3069 uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
3070 return xDrawPage;
3071 }
3072 }
3073 uno::Reference< drawing::XDrawPage > xDrawPage;
3074 return xDrawPage;
3075}
3076
3082void SAL_CALL SdDrawPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage )
3083{
3084 ::SolarMutexGuard aGuard;
3085
3086 if( nullptr == mpModel || mpModel->mpDoc == nullptr )
3087 throw lang::DisposedException();
3088
3089 SdDrawDocument& rDoc = *mpModel->mpDoc;
3090
3091 sal_uInt16 nPageCount = rDoc.GetSdPageCount( PageKind::Standard );
3092 if( nPageCount > 1 )
3093 {
3094 // get pPage from xPage and determine the Id (nPos ) afterwards
3095 SdDrawPage* pSvxPage = comphelper::getFromUnoTunnel<SdDrawPage>( xPage );
3096 if( pSvxPage )
3097 {
3098 SdPage* pPage = static_cast<SdPage*>(pSvxPage->GetSdrPage());
3099 if(pPage && ( pPage->GetPageKind() == PageKind::Standard ) )
3100 {
3101 sal_uInt16 nPage = pPage->GetPageNum();
3102
3103 SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetPage( nPage+1 ) );
3104
3105 bool bUndo = rDoc.IsUndoEnabled();
3106 if( bUndo )
3107 {
3108 // Add undo actions and delete the pages. The order of adding
3109 // the undo actions is important.
3110 rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) );
3111 rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage));
3112 rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
3113 }
3114
3115 rDoc.RemovePage( nPage ); // the page
3116 rDoc.RemovePage( nPage ); // the notes page
3117
3118 if( bUndo )
3119 {
3120 rDoc.EndUndo();
3121 }
3122 }
3123 }
3124 }
3125
3127}
3128
3129// XServiceInfo
3130
3132{
3133 return "SdDrawPagesAccess";
3134}
3135
3136sal_Bool SAL_CALL SdDrawPagesAccess::supportsService( const OUString& ServiceName )
3137{
3138 return cppu::supportsService(this, ServiceName);
3139}
3140
3141uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getSupportedServiceNames( )
3142{
3143 return { "com.sun.star.drawing.DrawPages" };
3144}
3145
3146// XComponent
3148{
3149 mpModel = nullptr;
3150}
3151
3152void SAL_CALL SdDrawPagesAccess::addEventListener( const uno::Reference< lang::XEventListener >& )
3153{
3154 OSL_FAIL( "not implemented!" );
3155}
3156
3157void SAL_CALL SdDrawPagesAccess::removeEventListener( const uno::Reference< lang::XEventListener >& )
3158{
3159 OSL_FAIL( "not implemented!" );
3160}
3161
3162
3164: mpModel(&rMyModel)
3165{
3166}
3167
3169{
3170}
3171
3172// XComponent
3174{
3175 mpModel = nullptr;
3176}
3177
3178void SAL_CALL SdMasterPagesAccess::addEventListener( const uno::Reference< lang::XEventListener >& )
3179{
3180 OSL_FAIL( "not implemented!" );
3181}
3182
3183void SAL_CALL SdMasterPagesAccess::removeEventListener( const uno::Reference< lang::XEventListener >& )
3184{
3185 OSL_FAIL( "not implemented!" );
3186}
3187
3188// XIndexAccess
3190{
3191 ::SolarMutexGuard aGuard;
3192
3193 if( nullptr == mpModel->mpDoc )
3194 throw lang::DisposedException();
3195
3197}
3198
3204{
3205 ::SolarMutexGuard aGuard;
3206 comphelper::ProfileZone aZone("SdMasterPagesAccess::getByIndex");
3207
3208 if( nullptr == mpModel )
3209 throw lang::DisposedException();
3210
3211 uno::Any aAny;
3212
3214 throw lang::IndexOutOfBoundsException();
3215
3216 SdPage* pPage = mpModel->mpDoc->GetMasterSdPage( static_cast<sal_uInt16>(Index), PageKind::Standard );
3217 if( pPage )
3218 {
3219 uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
3220 aAny <<= xDrawPage;
3221 }
3222
3223 return aAny;
3224}
3225
3226// XElementAccess
3228{
3230}
3231
3233{
3234 return getCount() > 0;
3235}
3236
3237// XDrawPages
3238uno::Reference< drawing::XDrawPage > SAL_CALL SdMasterPagesAccess::insertNewByIndex( sal_Int32 nInsertPos )
3239{
3240 ::SolarMutexGuard aGuard;
3241
3242 if( nullptr == mpModel )
3243 throw lang::DisposedException();
3244
3245 uno::Reference< drawing::XDrawPage > xDrawPage;
3246
3247 SdDrawDocument* pDoc = mpModel->mpDoc;
3248 if( pDoc )
3249 {
3250 // calculate internal index and check for range errors
3251 const sal_Int32 nMPageCount = pDoc->GetMasterPageCount();
3252 nInsertPos = nInsertPos * 2 + 1;
3253 if( nInsertPos < 0 || nInsertPos > nMPageCount )
3254 nInsertPos = nMPageCount;
3255
3256 // now generate a unique name for the new masterpage
3257 const OUString aStdPrefix( SdResId(STR_LAYOUT_DEFAULT_NAME) );
3258 OUString aPrefix( aStdPrefix );
3259
3260 bool bUnique = true;
3261
3262 std::vector<OUString> aPageNames;
3263 for (sal_Int32 nMaster = 1; nMaster < nMPageCount; ++nMaster)
3264 {
3265 const SdPage* pPage = static_cast<const SdPage*>(pDoc->GetMasterPage(static_cast<sal_uInt16>(nMaster)));
3266 if (!pPage)
3267 continue;
3268 aPageNames.push_back(pPage->GetName());
3269 if (aPageNames.back() == aPrefix)
3270 bUnique = false;
3271 }
3272
3273 sal_Int32 i = 0;
3274 while (!bUnique)
3275 {
3276 aPrefix = aStdPrefix + " " + OUString::number(++i);
3277 bUnique = std::find(aPageNames.begin(), aPageNames.end(), aPrefix) == aPageNames.end();
3278 }
3279
3280 OUString aLayoutName = aPrefix + SD_LT_SEPARATOR + STR_LAYOUT_OUTLINE;
3281
3282 // create styles
3283 static_cast<SdStyleSheetPool*>(pDoc->GetStyleSheetPool())->CreateLayoutStyleSheets( aPrefix );
3284
3285 // get the first page for initial size and border settings
3286 SdPage* pPage = mpModel->mpDoc->GetSdPage( sal_uInt16(0), PageKind::Standard );
3287 SdPage* pRefNotesPage = mpModel->mpDoc->GetSdPage( sal_uInt16(0), PageKind::Notes);
3288
3289 // create and insert new draw masterpage
3291 pMPage->SetSize( pPage->GetSize() );
3292 pMPage->SetBorder( pPage->GetLeftBorder(),
3293 pPage->GetUpperBorder(),
3294 pPage->GetRightBorder(),
3295 pPage->GetLowerBorder() );
3296 pMPage->SetLayoutName( aLayoutName );
3297 pDoc->InsertMasterPage(pMPage.get(), static_cast<sal_uInt16>(nInsertPos));
3298
3299 {
3300 // ensure default MasterPage fill
3301 pMPage->EnsureMasterPageDefaultBackground();
3302 }
3303
3304 xDrawPage.set( pMPage->getUnoPage(), uno::UNO_QUERY );
3305
3306 // create and insert new notes masterpage
3307 rtl::Reference<SdPage> pMNotesPage = mpModel->mpDoc->AllocSdPage(true);
3308 pMNotesPage->SetSize( pRefNotesPage->GetSize() );
3309 pMNotesPage->SetPageKind(PageKind::Notes);
3310 pMNotesPage->SetBorder( pRefNotesPage->GetLeftBorder(),
3311 pRefNotesPage->GetUpperBorder(),
3312 pRefNotesPage->GetRightBorder(),
3313 pRefNotesPage->GetLowerBorder() );
3314 pMNotesPage->SetLayoutName( aLayoutName );
3315 pDoc->InsertMasterPage(pMNotesPage.get(), static_cast<sal_uInt16>(nInsertPos) + 1);
3316 pMNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, true, true);
3318 }
3319
3320 return xDrawPage;
3321}
3322
3328void SAL_CALL SdMasterPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage )
3329{
3330 ::SolarMutexGuard aGuard;
3331
3332 if( nullptr == mpModel || mpModel->mpDoc == nullptr )
3333 throw lang::DisposedException();
3334
3335 SdMasterPage* pSdPage = comphelper::getFromUnoTunnel<SdMasterPage>( xPage );
3336 if(pSdPage == nullptr)
3337 return;
3338
3339 SdPage* pPage = dynamic_cast< SdPage* > (pSdPage->GetSdrPage());
3340
3341 DBG_ASSERT( pPage && pPage->IsMasterPage(), "SdMasterPage is not masterpage?");
3342
3343 if( !pPage || !pPage->IsMasterPage() || (mpModel->mpDoc->GetMasterPageUserCount(pPage) > 0))
3344 return; //Todo: this should be excepted
3345
3346 // only standard pages can be removed directly
3347 if( pPage->GetPageKind() != PageKind::Standard )
3348 return;
3349
3350 sal_uInt16 nPage = pPage->GetPageNum();
3351
3352 SdDrawDocument& rDoc = *mpModel->mpDoc;
3353
3354 SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetMasterPage( nPage+1 ) );
3355
3356 bool bUndo = rDoc.IsUndoEnabled();
3357 if( bUndo )
3358 {
3359 // Add undo actions and delete the pages. The order of adding
3360 // the undo actions is important.
3361 rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) );
3362 rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage));
3363 rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
3364 }
3365
3366 // remove both pages
3367 rDoc.RemoveMasterPage( nPage );
3368 rDoc.RemoveMasterPage( nPage );
3369
3370 if( bUndo )
3371 {
3372 rDoc.EndUndo();
3373 }
3374}
3375
3376// XServiceInfo
3377
3379{
3380 return "SdMasterPagesAccess";
3381}
3382
3383sal_Bool SAL_CALL SdMasterPagesAccess::supportsService( const OUString& ServiceName )
3384{
3385 return cppu::supportsService(this, ServiceName);
3386}
3387
3388uno::Sequence< OUString > SAL_CALL SdMasterPagesAccess::getSupportedServiceNames( )
3389{
3390 return { "com.sun.star.drawing.MasterPages" };
3391}
3392
3394 : mpModel(&rMyModel)
3395{
3396 for (sal_uInt16 i=0; i < SdLinkTargetType::Count; i++)
3398}
3399
3401{
3402}
3403
3404// XComponent
3406{
3407 mpModel = nullptr;
3408}
3409
3410void SAL_CALL SdDocLinkTargets::addEventListener( const uno::Reference< lang::XEventListener >& )
3411{
3412 OSL_FAIL( "not implemented!" );
3413}
3414
3415void SAL_CALL SdDocLinkTargets::removeEventListener( const uno::Reference< lang::XEventListener >& )
3416{
3417 OSL_FAIL( "not implemented!" );
3418}
3419
3420// XNameAccess
3421uno::Any SAL_CALL SdDocLinkTargets::getByName( const OUString& aName )
3422{
3423 if (mpModel)
3424 {
3425 for (sal_uInt16 i=0; i < SdLinkTargetType::Count; i++)
3426 if ( aNames[i] == aName )
3427 return uno::Any(uno::Reference< beans::XPropertySet >(new SdDocLinkTargetType( mpModel, i )));
3428 }
3429
3430 throw container::NoSuchElementException();
3431}
3432
3433uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getElementNames()
3434{
3435 uno::Sequence<OUString> aRet(SdLinkTargetType::Count);
3436 OUString* pArray = aRet.getArray();
3437 for (sal_uInt16 i=0; i < SdLinkTargetType::Count; i++)
3438 pArray[i] = aNames[i];
3439 return aRet;
3440}
3441
3442sal_Bool SAL_CALL SdDocLinkTargets::hasByName( const OUString& aName )
3443{
3444 for (const auto & i : aNames)
3445 if ( i == aName )
3446 return true;
3447 return false;
3448}
3449
3450// container::XElementAccess
3452{
3454}
3455
3457{
3458 return true;
3459}
3460
3461SdPage* SdDocLinkTarget::FindPage( std::u16string_view rName ) const
3462{
3463 SdDrawDocument* pDoc = mpModel->GetDoc();
3464 if( pDoc == nullptr )
3465 return nullptr;
3466
3467 const sal_uInt16 nMaxPages = pDoc->GetPageCount();
3468 const sal_uInt16 nMaxMasterPages = pDoc->GetMasterPageCount();
3469
3470 sal_uInt16 nPage;
3471 SdPage* pPage;
3472
3473 const bool bDraw = pDoc->GetDocumentType() == DocumentType::Draw;
3474
3475 // standard pages
3476 for( nPage = 0; nPage < nMaxPages; nPage++ )
3477 {
3478 pPage = static_cast<SdPage*>(pDoc->GetPage( nPage ));
3479 if( (pPage->GetName() == rName) && (!bDraw || (pPage->GetPageKind() == PageKind::Standard)) )
3480 return pPage;
3481 }
3482
3483 // master pages
3484 for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
3485 {
3486 pPage = static_cast<SdPage*>(pDoc->GetMasterPage( nPage ));
3487 if( (pPage->GetName() == rName) && (!bDraw || (pPage->GetPageKind() == PageKind::Standard)) )
3488 return pPage;
3489 }
3490
3491 return nullptr;
3492}
3493
3494// XServiceInfo
3496{
3497 return "SdDocLinkTargets";
3498}
3499
3500sal_Bool SAL_CALL SdDocLinkTargets::supportsService( const OUString& ServiceName )
3501{
3502 return cppu::supportsService( this, ServiceName );
3503}
3504
3505uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getSupportedServiceNames()
3506{
3507 return { "com.sun.star.document.LinkTargets" };
3508}
3509
3511 : mpModel(pModel)
3512 , mnType(nT)
3513{
3514 maName = SdResId(aTypeResIds[nT]);
3515}
3516
3517// beans::XPropertySet
3518
3519uno::Reference< beans::XPropertySetInfo > SAL_CALL SdDocLinkTargetType::getPropertySetInfo()
3520{
3521 static uno::Reference< beans::XPropertySetInfo > aRef;//(new SfxItemPropertySetInfo( lcl_GetLinkTargetMap() ));
3522 return aRef;
3523}
3524
3525void SAL_CALL SdDocLinkTargetType::setPropertyValue(const OUString& /* aPropertyName */,
3526 const uno::Any& /* aValue */)
3527{
3528 // everything is read-only
3529}
3530
3531uno::Any SAL_CALL SdDocLinkTargetType::getPropertyValue(const OUString& PropertyName)
3532{
3533 uno::Any aRet;
3534 if ( PropertyName == "LinkDisplayName" )
3535 aRet <<= maName;
3536
3537 return aRet;
3538}
3539
3541 const uno::Reference<beans::XPropertyChangeListener>&)
3542{ OSL_FAIL("not implemented"); }
3543
3545 const uno::Reference<beans::XPropertyChangeListener>&)
3546{ OSL_FAIL("not implemented"); }
3547
3549 const uno::Reference<beans::XVetoableChangeListener>&)
3550{ OSL_FAIL("not implemented"); }
3551
3553 const uno::Reference<beans::XVetoableChangeListener>&)
3554{ OSL_FAIL("not implemented"); }
3555
3556// document::XLinkTargetSupplier
3557
3558uno::Reference< container::XNameAccess > SAL_CALL SdDocLinkTargetType::getLinks()
3559{
3560 return new SdDocLinkTarget( mpModel, mnType );
3561}
3562
3563// XServiceInfo
3565{
3566 return "SdDocLinkTargetType";
3567}
3568
3569sal_Bool SAL_CALL SdDocLinkTargetType::supportsService( const OUString& ServiceName )
3570{
3571 return cppu::supportsService( this, ServiceName );
3572}
3573
3574uno::Sequence< OUString > SAL_CALL SdDocLinkTargetType::getSupportedServiceNames()
3575{
3576 return { "com.sun.star.document.LinkTargetSupplier" };
3577}
3578
3580 : mpModel(pModel)
3581 , mnType(nT)
3582{
3583}
3584
3585// container::XNameAccess
3586
3587uno::Any SAL_CALL SdDocLinkTarget::getByName(const OUString& aName)
3588{
3589 ::SolarMutexGuard aGuard;
3590
3591 if( nullptr == mpModel )
3592 throw lang::DisposedException();
3593
3594 SdPage* pPage = FindPage( aName );
3595
3596 if( pPage == nullptr )
3597 throw container::NoSuchElementException();
3598
3599 uno::Any aAny;
3600
3601 uno::Reference< beans::XPropertySet > xProps( pPage->getUnoPage(), uno::UNO_QUERY );
3602 if( xProps.is() )
3603 aAny <<= xProps;
3604
3605 return aAny;
3606}
3607
3608uno::Sequence<OUString> SAL_CALL SdDocLinkTarget::getElementNames()
3609{
3610 ::SolarMutexGuard aGuard;
3611
3612 if( nullptr == mpModel )
3613 throw lang::DisposedException();
3614
3615 SdDrawDocument* pDoc = mpModel->GetDoc();
3616 if( pDoc == nullptr )
3617 {
3618 return { };
3619 }
3620
3621 if( pDoc->GetDocumentType() == DocumentType::Draw )
3622 {
3623 const sal_uInt16 nMaxPages = pDoc->GetSdPageCount( PageKind::Standard );
3624 const sal_uInt16 nMaxMasterPages = pDoc->GetMasterSdPageCount( PageKind::Standard );
3625
3626 uno::Sequence< OUString > aSeq( mnType == SdLinkTargetType::Page ? nMaxPages : nMaxMasterPages );
3627 OUString* pStr = aSeq.getArray();
3628
3629 sal_uInt16 nPage;
3631 {
3632 // standard pages
3633 for( nPage = 0; nPage < nMaxPages; nPage++ )
3634 *pStr++ = pDoc->GetSdPage( nPage, PageKind::Standard )->GetName();
3635 }
3636 else
3637 {
3638 // master pages
3639 for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
3640 *pStr++ = pDoc->GetMasterSdPage( nPage, PageKind::Standard )->GetName();
3641 }
3642 return aSeq;
3643 }
3644 else
3645 {
3646 PageKind eKind;
3647 switch (mnType)
3648 {
3650 eKind = PageKind::Notes;
3651 break;
3653 eKind = PageKind::Handout;
3654 break;
3655 default:
3656 eKind = PageKind::Standard;
3657 break;
3658 }
3659 const sal_uInt16 nMaxPages = pDoc->GetSdPageCount( eKind );
3660 const sal_uInt16 nMaxMasterPages = pDoc->GetMasterPageCount();
3661
3662 uno::Sequence< OUString > aSeq( mnType == SdLinkTargetType::MasterPage ? nMaxMasterPages : nMaxPages );
3663 OUString* pStr = aSeq.getArray();
3664
3665 sal_uInt16 nPage;
3666 switch (mnType)
3667 {
3669 {
3670 for( nPage = 0; nPage < nMaxPages; nPage++ )
3671 *pStr++ = pDoc->GetSdPage( nPage, PageKind::Standard )->GetName();
3672 break;
3673 }
3675 {
3676 for( nPage = 0; nPage < nMaxPages; nPage++ )
3677 *pStr++ = pDoc->GetSdPage( nPage, PageKind::Notes )->GetName();
3678 break;
3679 }
3681 {
3682 for( nPage = 0; nPage < nMaxPages; nPage++ )
3683 *pStr++ = pDoc->GetSdPage( nPage, PageKind::Handout )->GetName();
3684 break;
3685 }
3687 {
3688 for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
3689 *pStr++ = static_cast<SdPage*>(pDoc->GetMasterPage( nPage ))->GetName();
3690 break;
3691 }
3692 }
3693 return aSeq;
3694 }
3695}
3696
3697sal_Bool SAL_CALL SdDocLinkTarget::hasByName(const OUString& aName)
3698{
3699 ::SolarMutexGuard aGuard;
3700
3701 if( nullptr == mpModel )
3702 throw lang::DisposedException();
3703
3704 return FindPage( aName ) != nullptr;
3705}
3706
3707// container::XElementAccess
3708
3710{
3712}
3713
3715{
3716 ::SolarMutexGuard aGuard;
3717
3718 if( nullptr == mpModel )
3719 throw lang::DisposedException();
3720
3721 return mpModel->GetDoc() != nullptr;
3722}
3723
3724// XServiceInfo
3726{
3727 return "SdDocLinkTarget";
3728}
3729
3730sal_Bool SAL_CALL SdDocLinkTarget::supportsService( const OUString& ServiceName )
3731{
3732 return cppu::supportsService( this, ServiceName );
3733}
3734
3735uno::Sequence< OUString > SAL_CALL SdDocLinkTarget::getSupportedServiceNames()
3736{
3737 return { "com.sun.star.document.LinkTargets" };
3738}
3739
3741{
3743 ::sd::DrawDocShell* pDocShell(rDocument.GetDocSh());
3744 if( pDocShell )
3745 {
3746 uno::Reference<frame::XModel> xModel(pDocShell->GetModel());
3747
3748 xRet.set( dynamic_cast< SdXImpressDocument* >( xModel.get() ) );
3749 }
3750
3751 return xRet;
3752}
3753
3754void NotifyDocumentEvent( SdDrawDocument const & rDocument, const OUString& rEventName )
3755{
3757
3758 if( xModel.is() )
3759 {
3760 uno::Reference< uno::XInterface > xSource( static_cast<uno::XWeak*>( xModel.get() ) );
3761 css::document::EventObject aEvent( xSource, rEventName );
3762 xModel->notifyEvent(aEvent );
3763 }
3764}
3765
3766void NotifyDocumentEvent( SdDrawDocument const & rDocument, const OUString& rEventName, const uno::Reference< uno::XInterface >& xSource )
3767{
3769
3770 if( xModel.is() )
3771 {
3772 css::document::EventObject aEvent( xSource, rEventName );
3773 xModel->notifyEvent(aEvent );
3774 }
3775}
3776
3777/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
Fraction conversionFract(o3tl::Length from, o3tl::Length to)
constexpr auto convertTwipToMm100(N n)
AnyEventRef aEvent
AUTOLAYOUT_NONE
AUTOLAYOUT_NOTES
static const AllSettings & GetSettings()
virtual void DrawMarkedObj(OutputDevice &rOut) const override
static bool HasValidData(const css::uno::Reference< css::datatransfer::XTransferable > &rTransferable)
bool GetAutoControlFocus() const
void SetOpenInDesignMode(bool _bOpenDesignMode)
void SetAutoControlFocus(bool _bAutoControlFocus)
bool GetOpenInDesignMode() const
virtual SdrPageView * ShowSdrPage(SdrPage *pPage) override
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, 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)
static void PaintAllInPlaceOnTile(VirtualDevice &rDevice, int nOutputWidth, int nOutputHeight, int nTilePosX, int nTilePosY, tools::Long nTileWidth, tools::Long nTileHeight)
void SetOrigin(const Point &rOrigin)
void SetScaleY(const Fraction &rScaleY)
void SetMapUnit(MapUnit eUnit)
void SetScaleX(const Fraction &rScaleX)
void SetMapMode()
const MapMode & GetMapMode() const
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unomodel.cxx:3552
SdDocLinkTargetType(SdXImpressDocument *pModel, sal_uInt16 nT)
Definition: unomodel.cxx:3510
virtual OUString SAL_CALL getImplementationName() override
Definition: unomodel.cxx:3564
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unomodel.cxx:3544
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unomodel.cxx:3548
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unomodel.cxx:3531
sal_uInt16 mnType
Definition: unomodel.hxx:428
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unomodel.cxx:3540
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unomodel.cxx:3574
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unomodel.cxx:3525
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override
Definition: unomodel.cxx:3558
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unomodel.cxx:3569
SdXImpressDocument * mpModel
Definition: unomodel.hxx:427
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unomodel.cxx:3519
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unomodel.cxx:3735
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unomodel.cxx:3709
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unomodel.cxx:3730
sal_uInt16 mnType
Definition: unomodel.hxx:462
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: unomodel.cxx:3587
SdDocLinkTarget(SdXImpressDocument *pModel, sal_uInt16 nT)
Definition: unomodel.cxx:3579
virtual OUString SAL_CALL getImplementationName() override
Definition: unomodel.cxx:3725
SdPage * FindPage(std::u16string_view rName) const
Definition: unomodel.cxx:3461
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: unomodel.cxx:3697
virtual sal_Bool SAL_CALL hasElements() override
Definition: unomodel.cxx:3714
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unomodel.cxx:3608
SdXImpressDocument * mpModel
Definition: unomodel.hxx:461
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unomodel.cxx:3415
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unomodel.cxx:3505
OUString aNames[SdLinkTargetType::Count]
Definition: unomodel.hxx:397
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unomodel.cxx:3451
virtual void SAL_CALL dispose() override
Definition: unomodel.cxx:3405
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unomodel.cxx:3410
virtual OUString SAL_CALL getImplementationName() override
Definition: unomodel.cxx:3495
SdDocLinkTargets(SdXImpressDocument &rMyModel)
Definition: unomodel.cxx:3393
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: unomodel.cxx:3442
virtual ~SdDocLinkTargets() noexcept override
Definition: unomodel.cxx:3400
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unomodel.cxx:3500
virtual sal_Bool SAL_CALL hasElements() override
Definition: unomodel.cxx:3456
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unomodel.cxx:3433
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: unomodel.cxx:3421
SdXImpressDocument * mpModel
Definition: unomodel.hxx:396
void CreateFirstPages(SdDrawDocument const *pRefDocument=nullptr)
if the document does not contain at least one handout, one slide and one notes page with at least one...
Definition: drawdoc2.cxx:493
SAL_DLLPRIVATE const css::uno::Reference< css::presentation::XPresentation2 > & getPresentation() const
sal_uInt16 GetMasterSdPageCount(PageKind ePgKind) const
Definition: drawdoc2.cxx:222
SAL_DLLPRIVATE sal_uInt16 GetMasterPageUserCount(SdrPage const *pMaster) const
Definition: drawdoc4.cxx:694
SAL_DLLPRIVATE std::vector< std::unique_ptr< sd::FrameView > > & GetFrameViewList()
Definition: drawdoc.hxx:442
virtual SAL_DLLPRIVATE void InsertMasterPage(SdrPage *pPage, sal_uInt16 nPos=0xFFFF) override
Definition: drawdoc2.cxx:434
SAL_DLLPRIVATE void SetOnlineSpell(bool bIn)
Definition: drawdoc.cxx:962
SAL_DLLPRIVATE SfxItemPool & GetPool()
Definition: drawdoc.hxx:237
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
Definition: drawdoc2.cxx:207
SAL_DLLPRIVATE void InsertPage(SdrPage *pPage, sal_uInt16 nPos=0xFFFF) override
Definition: drawdoc2.cxx:380
void StopWorkStartupDelay()
Definition: drawdoc2.cxx:932
SAL_DLLPRIVATE void SetLanguage(const LanguageType eLang, const sal_uInt16 nId)
Definition: drawdoc2.cxx:845
SAL_DLLPRIVATE sal_uInt16 GetPageByName(std::u16string_view rPgName, bool &rbIsMasterPage) const
Return the first page that has the given name.
Definition: drawdoc2.cxx:126
SAL_DLLPRIVATE bool MovePages(sal_uInt16 nTargetPage)
Definition: drawdoc2.cxx:726
virtual SAL_DLLPRIVATE rtl::Reference< SdrPage > RemoveMasterPage(sal_uInt16 nPgNum) override
Definition: drawdoc2.cxx:446
SAL_DLLPRIVATE LanguageType GetLanguage(const sal_uInt16 nId) const
Definition: drawdoc2.cxx:875
SdPage * GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind)
Definition: drawdoc2.cxx:217
SAL_DLLPRIVATE SdrObject * GetObj(std::u16string_view rObjName) const
Definition: drawdoc2.cxx:66
virtual SAL_DLLPRIVATE void SetChanged(bool bFlag=true) override
Definition: drawdoc.cxx:658
SAL_DLLPRIVATE::sd::DrawDocShell * GetDocSh() const
Definition: drawdoc.hxx:242
SAL_DLLPRIVATE rtl::Reference< SdrPage > RemovePage(sal_uInt16 nPgNum) override
Definition: drawdoc2.cxx:409
SAL_DLLPRIVATE DocumentType GetDocumentType() const
Definition: drawdoc.hxx:251
SAL_DLLPRIVATE rtl::Reference< SdPage > AllocSdPage(bool bMasterPage)
Definition: drawdoc.cxx:644
sal_uInt16 GetSdPageCount(PageKind ePgKind) const
Definition: drawdoc2.cxx:212
static OUString getPageApiName(SdPage const *pPage)
Definition: unopage.cxx:2151
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: unomodel.cxx:3017
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unomodel.cxx:2996
virtual void SAL_CALL dispose() override
Definition: unomodel.cxx:3147
virtual sal_Bool SAL_CALL hasElements() override
Definition: unomodel.cxx:3045
virtual ~SdDrawPagesAccess() noexcept override
Definition: unomodel.cxx:2928
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unomodel.cxx:3157
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unomodel.cxx:3141
virtual OUString SAL_CALL getImplementationName() override
Definition: unomodel.cxx:3131
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unomodel.cxx:3152
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unomodel.cxx:3040
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unomodel.cxx:3136
virtual sal_Int32 SAL_CALL getCount() override
Definition: unomodel.cxx:2933
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: unomodel.cxx:2966
SdDrawPagesAccess(SdXImpressDocument &rMyModel) noexcept
Definition: unomodel.cxx:2923
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: unomodel.cxx:2943
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL insertNewByIndex(sal_Int32 nIndex) override
Creates a new page with model at the specified position.
Definition: unomodel.cxx:3056
virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XDrawPage > &xPage) override
Removes the specified SdDrawPage from the model and the internal list.
Definition: unomodel.cxx:3082
SdXImpressDocument * mpModel
Definition: unomodel.hxx:309
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Provides a drawing::XDrawPage interface for accessing the Masterpage at the specified position in the...
Definition: unomodel.cxx:3203
virtual sal_Int32 SAL_CALL getCount() override
Definition: unomodel.cxx:3189
virtual sal_Bool SAL_CALL hasElements() override
Definition: unomodel.cxx:3232
virtual OUString SAL_CALL getImplementationName() override
Definition: unomodel.cxx:3378
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unomodel.cxx:3183
virtual ~SdMasterPagesAccess() noexcept override
Definition: unomodel.cxx:3168
virtual void SAL_CALL dispose() override
Definition: unomodel.cxx:3173
SdMasterPagesAccess(SdXImpressDocument &rMyModel) noexcept
Definition: unomodel.cxx:3163
virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XDrawPage > &xPage) override
Removes the specified SdMasterPage from the model and the internal list.
Definition: unomodel.cxx:3328
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unomodel.cxx:3383
SdXImpressDocument * mpModel
Definition: unomodel.hxx:350
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unomodel.cxx:3227
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unomodel.cxx:3178
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL insertNewByIndex(sal_Int32 nIndex) override
Definition: unomodel.cxx:3238
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unomodel.cxx:3388
void SetShowComments(bool bShow)
Definition: optsitem.hxx:319
virtual Orientation GetOrientation() const override
Definition: sdpage.cxx:2562
PageKind GetPageKind() const
Definition: sdpage.hxx:205
const sd::AnnotationVector & getAnnotations() const
Definition: sdpage.hxx:373
bool IsExcluded() const
Definition: sdpage.hxx:223
virtual OUString GetLayoutName() const override
Definition: sdpage.hxx:255
const OUString & GetName() const
Definition: sdpage.cxx:2505
sal_Int64 GetHashCode() const
Definition: sdpage.cxx:2698
virtual rtl::Reference< SdrPage > CloneSdrPage(SdrModel &rTargetModel) const override
Definition: sdpage2.cxx:420
static SD_DLLPUBLIC TranslateId GetClickActionSdResId(css::presentation::ClickAction eCA)
Definition: unomodel.cxx:150
virtual bool isMimeTypeSupported() override
Definition: unomodel.cxx:2778
const bool mbImpressDoc
Definition: unomodel.hxx:96
virtual void getPostIts(tools::JsonWriter &) override
Definition: unomodel.cxx:2533
virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) override
Definition: unomodel.cxx:2623
css::uno::Reference< css::uno::XInterface > mxBitmapTable
Definition: unomodel.hxx:109
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getViewData() override
Definition: unomodel.cxx:633
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unomodel.cxx:1196
virtual css::uno::Reference< css::ucb::XAnyCompare > SAL_CALL createAnyCompareByName(const OUString &PropertyName) override
Definition: unomodel.cxx:1473
virtual void SAL_CALL acquire() noexcept override
Definition: unomodel.cxx:352
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: unomodel.cxx:438
virtual css::uno::Reference< css::drawing::XDrawPages > SAL_CALL getDrawPages() override
Definition: unomodel.cxx:726
virtual void selectPart(int nPart, int nSelect) override
Definition: unomodel.cxx:2344
virtual void SAL_CALL dispose() override
This dispose implementation releases the resources held by the called object and forwards the call to...
Definition: unomodel.cxx:2841
SdXImpressDocument(::sd::DrawDocShell *pShell, bool bClipBoard)
Definition: unomodel.cxx:266
SdDrawDocument * mpDoc
Definition: unomodel.hxx:87
virtual void setPart(int nPart, bool bAllowChangeFocus=true) override
Definition: unomodel.cxx:2383
virtual void setGraphicSelection(int nType, int nX, int nY) override
Definition: unomodel.cxx:2704
css::uno::Reference< css::uno::XInterface > mxTransGradientTable
Definition: unomodel.hxx:110
css::uno::Reference< css::uno::XInterface > create(OUString const &aServiceSpecifier, OUString const &referer)
Definition: unomodel.cxx:826
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: unomodel.cxx:430
virtual void initializeForTiledRendering(const css::uno::Sequence< css::beans::PropertyValue > &rArguments) override
Definition: unomodel.cxx:2565
friend class SdMasterPagesAccess
Definition: unomodel.hxx:82
virtual void SAL_CALL release() noexcept override
Definition: unomodel.cxx:357
virtual OUString getPartName(int nPart) override
Definition: unomodel.cxx:2412
virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getCustomPresentations() override
Definition: unomodel.cxx:781
virtual void SAL_CALL unlockControllers() override
Definition: unomodel.cxx:610
css::uno::Reference< css::container::XNameAccess > mxLinks
Definition: unomodel.hxx:104
css::uno::Reference< css::uno::XInterface > mxGradientTable
Definition: unomodel.hxx:107
virtual void moveSelectedParts(int nPosition, bool bDuplicate) override
Definition: unomodel.cxx:2353
virtual OUString getPartHash(int nPart) override
Definition: unomodel.cxx:2429
virtual void SAL_CALL render(sal_Int32 nRenderer, const css::uno::Any &aSelection, const css::uno::Sequence< css::beans::PropertyValue > &xOptions) override
Definition: unomodel.cxx:1863
static rtl::Reference< SdXImpressDocument > GetModel(SdDrawDocument const &rDoc)
Definition: unomodel.cxx:3740
virtual ~SdXImpressDocument() noexcept override
Definition: unomodel.cxx:309
css::uno::WeakReference< css::drawing::XDrawPages > mxMasterPagesAccess
Definition: unomodel.hxx:100
virtual void setClipboard(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &xClipboard) override
Definition: unomodel.cxx:2767
sd::DrawViewShell * GetViewShell()
Definition: unomodel.cxx:2221
css::uno::Reference< css::uno::XInterface > mxDrawingPool
Definition: unomodel.hxx:112
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLayerManager() override
Definition: unomodel.cxx:765
css::uno::WeakReference< css::container::XNameAccess > mxLayerManager
Definition: unomodel.hxx:101
virtual Size getDocumentSize() override
Definition: unomodel.cxx:2513
virtual int getParts() override
Definition: unomodel.cxx:2392
virtual sal_Int32 SAL_CALL getRendererCount(const css::uno::Any &aSelection, const css::uno::Sequence< css::beans::PropertyValue > &xOptions) override
Definition: unomodel.cxx:1479
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getStyleFamilies() override
Definition: unomodel.cxx:1461
css::uno::Sequence< css::uno::Type > maTypeSequence
Definition: unomodel.hxx:116
friend class SdDrawPagesAccess
Definition: unomodel.hxx:81
OString getViewRenderState() override
Definition: unomodel.cxx:2329
virtual int getPart() override
Definition: unomodel.cxx:2403
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getHandoutMasterPage() override
Definition: unomodel.cxx:808
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(OUString const &ServiceSpecifier, css::uno::Sequence< css::uno::Any > const &Arguments) override
Definition: unomodel.cxx:1112
virtual void setClientVisibleArea(const tools::Rectangle &rRectangle) override
Definition: unomodel.cxx:2756
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unomodel.cxx:1212
virtual int getEditMode() override
Definition: unomodel.cxx:2493
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: unomodel.cxx:1509
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unomodel.cxx:1442
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unomodel.cxx:1218
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unomodel.cxx:1444
virtual css::uno::Reference< css::datatransfer::XTransferable > getSelection() override
Definition: unomodel.cxx:2693
virtual void SAL_CALL setViewData(const css::uno::Reference< css::container::XIndexAccess > &aData) override
Definition: unomodel.cxx:669
css::uno::Reference< css::uno::XInterface > mxHatchTable
Definition: unomodel.hxx:108
virtual PointerStyle getPointer() override
Definition: unomodel.cxx:2789
virtual void paintTile(VirtualDevice &rDevice, int nOutputWidth, int nOutputHeight, int nTilePosX, int nTilePosY, tools::Long nTileWidth, tools::Long nTileHeight) override
Definition: unomodel.cxx:2232
virtual void SAL_CALL lockControllers() override
Definition: unomodel.cxx:600
const SvxItemPropertySet * mpPropSet
Definition: unomodel.hxx:114
virtual VclPtr< vcl::Window > getDocWindow() override
Definition: unomodel.cxx:2462
friend class SdLayerManager
Definition: unomodel.hxx:83
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override
Definition: unomodel.cxx:1128
css::uno::WeakReference< css::drawing::XDrawPages > mxDrawPagesAccess
Definition: unomodel.hxx:99
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: unomodel.cxx:396
css::uno::WeakReference< css::i18n::XForbiddenCharacters > mxForbiddenCharacters
Definition: unomodel.hxx:103
virtual OUString SAL_CALL getImplementationName() override
Definition: unomodel.cxx:1186
virtual void setEditMode(int) override
Definition: unomodel.cxx:2502
SdDrawDocument * GetDoc() const
Definition: unomodel.hxx:141
virtual OUString getPartInfo(int nPart) override
Definition: unomodel.cxx:2360
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unomodel.cxx:1306
virtual void resetSelection() override
Definition: unomodel.cxx:2733
virtual css::uno::Reference< css::drawing::XDrawPages > SAL_CALL getMasterPages() override
Definition: unomodel.cxx:745
css::uno::WeakReference< css::container::XNameContainer > mxCustomPresentationAccess
Definition: unomodel.hxx:102
SdPage * InsertSdPage(sal_uInt16 nPage, bool bDuplicate)
Definition: unomodel.cxx:487
virtual css::uno::Reference< css::presentation::XPresentation > SAL_CALL getPresentation() override
Definition: unomodel.cxx:797
::sd::DrawDocShell * mpDocShell
Definition: unomodel.hxx:86
virtual void setTextSelection(int nType, int nX, int nY) override
Definition: unomodel.cxx:2663
void SetModified() noexcept
Definition: unomodel.cxx:593
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unomodel.cxx:1201
virtual void setPartMode(int nPartMode) override
Definition: unomodel.cxx:2475
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override
Definition: unomodel.cxx:1447
virtual sal_Bool SAL_CALL hasControllersLocked() override
Definition: unomodel.cxx:623
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unomodel.cxx:1441
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unomodel.cxx:1443
virtual SdrModel & getSdrModelFromUnoModel() const override
abstract SdrModel provider
Definition: unomodel.cxx:2835
css::uno::Reference< css::i18n::XForbiddenCharacters > getForbiddenCharsTable()
Definition: unomodel.cxx:2803
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL duplicate(const css::uno::Reference< css::drawing::XDrawPage > &xPage) override
Definition: unomodel.cxx:699
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: unomodel.cxx:314
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const OUString &aServiceSpecifier) override
Definition: unomodel.cxx:1106
void initializeDocument()
Definition: unomodel.cxx:2813
virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) override
Definition: unomodel.cxx:2629
OUString maBuildId
Definition: unomodel.hxx:118
css::uno::Reference< css::uno::XInterface > mxMarkerTable
Definition: unomodel.hxx:111
css::uno::Reference< css::uno::XInterface > mxDashTable
Definition: unomodel.hxx:106
SdrHintKind GetKind() const
SdrLayerID GetLayerID(const OUString &rName) const
void Set(SdrLayerID a)
bool IsSet(SdrLayerID a) const
const OUString & GetName() const
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
bool isLocked() const
::comphelper::IEmbeddedHelper * GetPersist() const
void BegUndo()
sal_uInt16 GetDefaultTabulator() const
const SdrPage * GetMasterPage(sal_uInt16 nPgNum) const
void SetDefaultTabulator(sal_uInt16 nVal)
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
SdrOutliner & GetDrawOutliner(const SdrTextObj *pObj=nullptr) const
void setLock(bool bLock)
sal_uInt16 GetMasterPageCount() const
const SfxItemPool & GetItemPool() const
std::shared_ptr< model::Theme > const & getTheme() const
SfxStyleSheetBasePool * GetStyleSheetPool() const
SdrUndoFactory & GetSdrUndoFactory() const
bool IsUndoEnabled() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
const SdrLayerAdmin & GetLayerAdmin() const
sal_uInt16 GetPageCount() const
void setTheme(std::shared_ptr< model::Theme > const &pTheme)
void EndUndo()
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
virtual bool IsTextEdit() const final override
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
static SdrItemPool & GetGlobalDrawObjectItemPool()
SdrPage * getSdrPageFromSdrObject() const
virtual SdrLayerID GetLayer() const
const SdrLayerIDSet & GetVisibleLayers() const
tools::Rectangle GetPageRect() const
void SetVisibleLayers(const SdrLayerIDSet &rSet)
void SetPrintableLayers(const SdrLayerIDSet &rSet)
SdrPage * GetPage() const
const SdrLayerIDSet & GetPrintableLayers() const
void unpatchPaintWindow(SdrPaintWindow *pPreviousPaintWindow)
SdrPaintWindow * patchPaintWindow(SdrPaintWindow &rPaintWindow)
css::uno::Reference< css::uno::XInterface > const & getUnoPage()
SdrPage & TRG_GetMasterPage() const
sal_uInt16 GetPageNum() const
bool IsMasterPage() const
Size GetSize() const
sal_Int32 GetUpperBorder() const
sal_Int32 GetRightBorder() const
sal_Int32 GetLeftBorder() const
Color GetPageBackgroundColor() const
const SdrLayerIDSet & TRG_GetMasterPageVisibleLayers() const
sal_Int32 GetLowerBorder() const
void SetPageVisible(bool bOn=true)
void SetHlplVisible(bool bOn=true)
void SetBordVisible(bool bOn=true)
void SetGlueVisible(bool bOn=true)
SdrPageView * GetSdrPageView() const
void SetGridVisible(bool bOn)
void SetPaintTextEdit(bool bPaint)
virtual std::unique_ptr< SdrUndoAction > CreateUndoDeletePage(SdrPage &rPage)
void UnmarkAll()
void Notify(SfxBroadcaster &aBC, const SfxHint &aHint) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
void notifyEvent(const css::document::EventObject &aEvent) const
void getGrabBagItem(css::uno::Any &rVal) const
bool hasValidSignatures() const
virtual void SAL_CALL acquire() noexcept override
void SAL_CALL setViewData(const css::uno::Reference< css::container::XIndexAccess > &aData) override
virtual void SAL_CALL release() noexcept override
OUString const & getRuntimeUID() const
virtual void SAL_CALL dispose() override
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
void setGrabBagItem(const css::uno::Any &rVal)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
bool hasEventListeners() const
css::uno::Reference< css::container::XIndexAccess > SAL_CALL getViewData() override
SfxHintId GetId() const
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
sal_uInt32 GetItemCount2(sal_uInt16 nWhich) const
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
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)
css::uno::Reference< css::script::XLibraryContainer > GetBasicContainer()
MapUnit GetMapUnit() const
virtual void SetVisArea(const tools::Rectangle &rVisArea)
css::uno::Reference< css::script::XLibraryContainer > GetDialogContainer()
css::uno::Reference< css::frame::XModel3 > GetModel() const
virtual tools::Rectangle GetVisArea(sal_uInt16 nAspect) const
SfxObjectCreateMode GetCreateMode() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void SetVisibleImpressView(bool bVisible)
SdrPage * GetSdrPage() const
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
FontFamily GetFamily() const
FontPitch GetPitch() const
const OUString & GetStyleName() const
rtl_TextEncoding GetCharSet() const
const OUString & GetFamilyName() const
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
const SfxItemPropertyMapEntry * getPropertyMapEntry(std::u16string_view rName) const
static bool createEvent(const SdrModel *pDoc, const SdrHint *pSdrHint, css::document::EventObject &aEvent)
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const OUString &ServiceSpecifier, const css::uno::Sequence< css::uno::Any > &Arguments) override
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
const VclPtr< OutputDevice > & GetOutputDevice() const
bool SetOutputSizePixel(const Size &rNewSize, bool bErase=true, bool bAlphaMaskTransparent=false)
static std::shared_ptr< ConfigurationChanges > create()
const css::uno::Sequence< sal_Int8 > & getSeq() const
css::uno::Type const & get()
static std::unique_ptr< Theme > FromAny(const css::uno::Any &rVal)
The SdClientView is used for DrawDocShell::Draw()
Definition: ClientView.hxx:30
virtual ::tools::Rectangle GetVisArea(sal_uInt16 nAspect) const override
Definition: docshel2.cxx:120
sd::ViewShell * GetViewShell()
SdDrawDocument * GetDoc()
View for MDIFrame.
Definition: FrameView.hxx:36
void WriteUserDataSequence(css::uno::Sequence< css::beans::PropertyValue > &)
Definition: frmview.cxx:378
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
::sd::View * GetView() const
Definition: ViewShell.hxx:144
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false) override
ends current text editing
Definition: sdview.cxx:772
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
virtual SdrObject * TryToGetSdrObject() const
virtual void createRedirectedPrimitive2DSequence(const sdr::contact::ViewObjectContact &rOriginal, const sdr::contact::DisplayInfo &rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor)
ViewContact & GetViewContact() const
void put(std::u16string_view pPropName, const OUString &rPropValue)
ScopedJsonWriterNode startNode(std::string_view)
constexpr Size GetSize() const
rtl::OString toString() const
void CreateNote(const tools::Rectangle &rRect, const PDFNote &rNote, sal_Int32 nPageNr=-1)
sal_Int32 CreateScreen(const tools::Rectangle &rRect, OUString const &rAltText, OUString const &rMimeType, sal_Int32 nPageNr, SdrObject const *pObj)
sal_Int32 CreateDest(const tools::Rectangle &rRect, sal_Int32 nPageNr=-1, PDFWriter::DestAreaType eType=PDFWriter::DestAreaType::XYZ)
std::vector< PDFExtOutDevBookmarkEntry > & GetBookmarks()
void SetDocumentLocale(const css::lang::Locale &rLoc)
bool GetIsExportNotes() const
void SetScreenStream(sal_Int32 nScreenId, const OUString &rURL)
bool GetIsExportHiddenSlides() const
void SetPageTransition(PDFWriter::PageTransition eType, sal_uInt32 nMilliSec)
void SetScreenURL(sal_Int32 nScreenId, const OUString &rURL)
void DescribeRegisteredDest(sal_Int32 nDestId, const tools::Rectangle &rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType=PDFWriter::DestAreaType::XYZ)
void SetLinkURL(sal_Int32 nLinkId, const OUString &rURL)
bool GetIsExportBookmarks() const
sal_Int32 CreateOutlineItem(sal_Int32 nParent, const OUString &rText, sal_Int32 nDestID)
bool GetIsExportNotesPages() const
bool GetIsExportNamedDestinations() const
bool GetIsExportTransitionEffects() const
sal_Int32 CreateNamedDest(const OUString &sDestName, const tools::Rectangle &rRect, sal_Int32 nPageNr=-1)
sal_Int32 CreateLink(const tools::Rectangle &rRect, OUString const &rAltText, sal_Int32 nPageNr=-1)
sal_Int32 GetCurrentPageNumber() const
void SetLinkDest(sal_Int32 nLinkId, sal_Int32 nDestId)
int nCount
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
ULONG m_refCount
float u
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
constexpr TypedWhichId< SvXMLAttrContainerItem > EE_PARA_XMLATTRIBS(EE_PARA_START+1)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
constexpr TypedWhichId< SvXMLAttrContainerItem > EE_CHAR_XMLATTRIBS(EE_CHAR_START+28)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
EmbeddedObjectRef * pObject
DocumentType eType
sal_Int16 nValue
constexpr OUStringLiteral SD_LT_SEPARATOR
Definition: glob.hxx:49
sal_Int32 nIndex
OUString aName
sal_Int64 n
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
#define SAL_WARN(area, stream)
void setTiledPainting(bool bTiledPainting)
const LanguageTag & getLocale()
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
sal_Int64 getSomething_cast(void *p)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
int i
std::enable_if< std::is_signed< T >::value, bool >::type checked_add(T a, T b, T &result)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
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)
std::vector< css::uno::Reference< css::office::XAnnotation > > AnnotationVector
Definition: sdpage.hxx:82
sal_uInt32 getAnnotationId(const uno::Reference< office::XAnnotation > &xAnnotation)
Definition: Annotation.cxx:326
Reference< XInterface > DocumentSettings_createInstance(SdXImpressDocument *pModel) noexcept
Reference< XInterface > NamespaceMap_createInstance(sal_uInt16 *pWhichIds, SfxItemPool *pPool)
DocumentType
long Long
OUString toISO8601(const css::util::DateTime &rDateTime)
OUTDEV_PDF
OUTDEV_PRINTER
sal_Int32 scale
PageKind
Definition: pres.hxx:45
PointerStyle
QPRO_FUNC_TYPE nType
sal_Int32 mnType
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
#define SD_MOD()
Definition: sdmod.hxx:184
constexpr OUStringLiteral STR_LAYOUT_OUTLINE
Definition: strings.hxx:16
View options for the current view.
Definition: viewopt.hxx:25
OUString msColorSchemeName
Definition: viewopt.hxx:31
Color annotColor
std::vector< basegfx::B2DPolygon > maPolygons
OUString Contents
OUString Title
Color interiorColor
css::util::DateTime maModificationDate
Reference< XModel > xModel
constexpr TypedWhichId< SvXMLAttrContainerItem > SDRATTR_XMLATTRIBUTES(SDRATTR_MISC_FIRST+22)
SdrObjKind
#define SDRPAGE_NOTFOUND
bool bVisible
unsigned char sal_Bool
SVXCORE_DLLPUBLIC bool SvxMapUnitToMeasureUnit(const MapUnit nVcl, short &eApi) noexcept
SVXCORE_DLLPUBLIC rtl::Reference< SvxShape > CreateSvxShapeByTypeAndInventor(SdrObjKind nType, SdrInventor nInventor, OUString const &referer)
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)
SVT_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvUnoImageMapCircleObject_createInstance(const SvEventDescription *pSupportedMacroItems)
SVT_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvUnoImageMapPolygonObject_createInstance(const SvEventDescription *pSupportedMacroItems)
SVT_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvUnoImageMapRectangleObject_createInstance(const SvEventDescription *pSupportedMacroItems)
constexpr OUStringLiteral sUNO_Prop_AutomContFocus
Definition: unokywds.hxx:53
constexpr OUStringLiteral sUNO_Prop_VisibleArea
Definition: unokywds.hxx:50
constexpr OUStringLiteral sUNO_LayerName_background_objects
Definition: unokywds.hxx:30
constexpr OUStringLiteral sUNO_Prop_MapUnit
Definition: unokywds.hxx:49
constexpr OUStringLiteral sUNO_Prop_ApplyFrmDsgnMode
Definition: unokywds.hxx:54
constexpr OUStringLiteral sUNO_Prop_ForbiddenCharacters
Definition: unokywds.hxx:48
constexpr OUStringLiteral sUNO_Service_ImageMapCircleObject
Definition: unokywds.hxx:43
constexpr OUStringLiteral sUNO_Prop_InteropGrabBag
Definition: unokywds.hxx:62
constexpr OUStringLiteral sUNO_Prop_RuntimeUID
Definition: unokywds.hxx:60
constexpr OUStringLiteral sUNO_Prop_CharLocale
Definition: unokywds.hxx:52
constexpr OUStringLiteral sUNO_Prop_Theme
Definition: unokywds.hxx:63
constexpr OUStringLiteral sUNO_Service_ImageMapRectangleObject
Definition: unokywds.hxx:41
constexpr OUStringLiteral sUNO_Service_ImageMapPolygonObject
Definition: unokywds.hxx:45
constexpr OUStringLiteral sUNO_Prop_HasValidSignatures
Definition: unokywds.hxx:61
constexpr OUStringLiteral sUNO_LayerName_background
Definition: unokywds.hxx:29
constexpr OUStringLiteral sUNO_Prop_TabStop
Definition: unokywds.hxx:51
SVXCORE_DLLPUBLIC css::uno::Reference< css::container::XIndexReplace > SvxCreateNumRule(SdrModel *pModel)
static sal_Int32 ImplPDFGetBookmarkPage(const OUString &rBookmark, SdDrawDocument const &rDoc)
Definition: unomodel.cxx:1571
const sal_uInt16 WID_MODEL_INTEROPGRABBAG
Definition: unomodel.cxx:237
const sal_uInt16 WID_MODEL_TABSTOP
Definition: unomodel.cxx:225
const sal_uInt16 WID_MODEL_DSGNMODE
Definition: unomodel.cxx:230
void NotifyDocumentEvent(SdDrawDocument const &rDocument, const OUString &rEventName)
Definition: unomodel.cxx:3754
const sal_uInt16 WID_MODEL_FORBCHARS
Definition: unomodel.cxx:228
const sal_uInt16 WID_MODEL_LANGUAGE
Definition: unomodel.cxx:224
static const SvxItemPropertySet * ImplGetDrawModelPropertySet()
Definition: unomodel.cxx:240
static void ImplPDFExportComments(const uno::Reference< drawing::XDrawPage > &xPage, vcl::PDFExtOutDevData &rPDFExtOutDevData)
Definition: unomodel.cxx:1596
const sal_uInt16 WID_MODEL_MAPUNIT
Definition: unomodel.cxx:227
static void ImplPDFExportShapeInteraction(const uno::Reference< drawing::XShape > &xShape, SdDrawDocument &rDoc, vcl::PDFExtOutDevData &rPDFExtOutDevData)
Definition: unomodel.cxx:1637
const TranslateId aTypeResIds[SdLinkTargetType::Count]
Definition: unomodel.cxx:142
const sal_uInt16 WID_MODEL_DIALOGLIBS
Definition: unomodel.cxx:235
const sal_uInt16 WID_MODEL_HASVALIDSIGNATURES
Definition: unomodel.cxx:234
const sal_uInt16 WID_MODEL_VISAREA
Definition: unomodel.cxx:226
const sal_uInt16 WID_MODEL_FONTS
Definition: unomodel.cxx:236
const sal_uInt16 WID_MODEL_BUILDID
Definition: unomodel.cxx:233
const sal_uInt16 WID_MODEL_RUNTIMEUID
Definition: unomodel.cxx:232
const sal_uInt16 WID_MODEL_BASICLIBS
Definition: unomodel.cxx:231
const sal_uInt16 WID_MODEL_CONTFOCUS
Definition: unomodel.cxx:229
const sal_uInt16 WID_MODEL_THEME
Definition: unomodel.cxx:238
@ MasterPage
Definition: unomodel.hxx:388
@ Count
Definition: unomodel.hxx:389
@ Page
Definition: unomodel.hxx:385
@ Handout
Definition: unomodel.hxx:387
Reference< XAnyCompare > SvxCreateNumRuleCompare() noexcept
const SvEventDescription * ImplGetSupportedMacroItems()
Definition: unoobj.cxx:235
uno::Reference< uno::XInterface > SdUnoCreatePool(SdDrawDocument *pDrawModel)
Definition: unopool.cxx:84
oslFileHandle & pOut
const SvXMLTokenMapEntry aTypes[]