LibreOffice Module sd (master) 1
sdview4.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <config_features.h>
21
22#include <View.hxx>
23
25#include <osl/file.hxx>
26#include <sfx2/bindings.hxx>
27#include <sfx2/request.hxx>
28#include <sfx2/docfilt.hxx>
29#include <sfx2/fcontnr.hxx>
30#include <sfx2/docfile.hxx>
31#include <sfx2/sfxsids.hrc>
32#include <vcl/outdev.hxx>
33#include <vcl/pdfread.hxx>
34#include <vcl/svapp.hxx>
35#include <vcl/weld.hxx>
36#include <svx/svdpagv.hxx>
37#include <svx/xbtmpit.hxx>
38#include <svx/svdundo.hxx>
39#include <svx/xfillit0.hxx>
40#include <svx/svdograf.hxx>
41#include <svx/svdomedia.hxx>
42#include <svx/svdoole2.hxx>
43#include <svx/ImageMapInfo.hxx>
44#include <sfx2/app.hxx>
46#include <svtools/ehdl.hxx>
47#include <svtools/sfxecode.hxx>
48#include <svtools/embedhlp.hxx>
49#include <vcl/graphicfilter.hxx>
50#include <app.hrc>
51#include <Window.hxx>
52#include <DrawDocShell.hxx>
53#include <DrawViewShell.hxx>
54#include <fuinsfil.hxx>
55#include <drawdoc.hxx>
56#include <sdresid.hxx>
57#include <strings.hrc>
58#include <sdpage.hxx>
60#include <com/sun/star/embed/XEmbedPersist.hpp>
61#include <com/sun/star/embed/Aspects.hpp>
62#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
63#include <com/sun/star/embed/XEmbeddedObject.hpp>
64#include <com/sun/star/media/XPlayer.hpp>
65#include <svtools/soerr.hxx>
66#include <sfx2/ipclient.hxx>
67#include <tools/debug.hxx>
68
69using namespace com::sun::star;
70
71namespace sd {
72
78SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
79 const Point& rPos, SdrObject* pObj, ImageMap const * pImageMap )
80{
82 mnAction = rAction;
83
84 // Is there an object at the position rPos?
87 SdrObject* pPickObj = pObj;
88 const bool bOnMaster = pPV && pPV->GetPage() && pPV->GetPage()->IsMasterPage();
89
90 if(pPV && dynamic_cast< const ::sd::slidesorter::view::SlideSorterView* >(this) != nullptr)
91 {
92 if(!pPV->GetPageRect().Contains(rPos))
93 pPV = nullptr;
94 }
95
96 if( !pPickObj && pPV )
97 {
98 SdrPageView* pPageView = pPV;
99 pPickObj = PickObj(rPos, getHitTolLog(), pPageView);
100 }
101
102 const bool bIsGraphic(dynamic_cast< const SdrGrafObj* >(pPickObj) != nullptr);
103
105 && pPickObj
106 && pPV
107 && (bIsGraphic || (pPickObj->IsEmptyPresObj() && !bOnMaster))) // #121603# Do not use pObj, it may be NULL
108 {
109 // hit on SdrGrafObj with wanted new linked graphic (or PresObj placeholder hit)
110 if( IsUndoEnabled() )
111 BegUndo(SdResId(STR_INSERTGRAPHIC));
112
113 SdPage* pPage = static_cast<SdPage*>( pPickObj->getSdrPageFromSdrObject() );
114
115 if( bIsGraphic )
116 {
117 // We fill the object with the Bitmap
118 pNewGrafObj = SdrObject::Clone(static_cast<SdrGrafObj&>(*pPickObj), pPickObj->getSdrModelFromSdrObject());
119 pNewGrafObj->SetGraphic(rGraphic);
120 }
121 else
122 {
123 pNewGrafObj = new SdrGrafObj(
125 rGraphic,
126 pPickObj->GetLogicRect());
127 pNewGrafObj->SetEmptyPresObj(true);
128 }
129
130 if ( pNewGrafObj->IsEmptyPresObj() )
131 {
132 ::tools::Rectangle aRect( pNewGrafObj->GetLogicRect() );
133 pNewGrafObj->AdjustToMaxRect( aRect );
134 pNewGrafObj->SetOutlinerParaObject(std::nullopt);
135 pNewGrafObj->SetEmptyPresObj(false);
136 }
137
138 if (pPage && pPage->IsPresObj(pPickObj))
139 {
140 // Insert new PresObj into the list
141 pPage->InsertPresObj( pNewGrafObj.get(), PresObjKind::Graphic );
142 pNewGrafObj->SetUserCall(pPickObj->GetUserCall());
143 }
144
145 if (pImageMap)
146 pNewGrafObj->AppendUserData(std::unique_ptr<SdrObjUserData>(new SvxIMapInfo(*pImageMap)));
147
148 ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj.get()); // maybe ReplaceObjectAtView
149
150 if( IsUndoEnabled() )
151 EndUndo();
152 }
153 else if (DND_ACTION_LINK == mnAction
154 && pPickObj
155 && !bIsGraphic
156 && pPickObj->IsClosedObj()
157 && !dynamic_cast< const SdrOle2Obj* >(pPickObj))
158 {
159 // fill style change (fill object with graphic), independent of mnAction
160 // and thus of DND_ACTION_LINK or DND_ACTION_MOVE
161 if( IsUndoEnabled() )
162 {
163 BegUndo(SdResId(STR_UNDO_DRAGDROP));
164 AddUndo(GetModel().GetSdrUndoFactory().CreateUndoAttrObject(*pPickObj));
165 EndUndo();
166 }
167
169
170 aSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
171 aSet.Put(XFillBitmapItem(rGraphic));
172 pPickObj->SetMergedItemSetAndBroadcast(aSet);
173 }
174
175 else if ( pPV )
176 {
177 Size aSizePixel = rGraphic.GetSizePixel();
178
179 // create new object
180 Size aSize;
181
182 if ( rGraphic.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
183 {
184 ::OutputDevice* pOutDev = nullptr;
185 if( mpViewSh )
186 pOutDev = mpViewSh->GetActiveWindow()->GetOutDev();
187
188 if( !pOutDev )
190
191 if( pOutDev )
192 aSize = pOutDev->PixelToLogic(rGraphic.GetPrefSize(), MapMode(MapUnit::Map100thMM));
193 }
194 else
195 {
196 aSize = OutputDevice::LogicToLogic( rGraphic.GetPrefSize(),
197 rGraphic.GetPrefMapMode(),
198 MapMode( MapUnit::Map100thMM ) );
199 }
200
201 sal_Int32 nPreferredDPI = mrDoc.getImagePreferredDPI();
202
203 if (rGraphic.GetGfxLink().GetType() == GfxLinkType::NativePdf && nPreferredDPI == 0 && vcl::PDF_INSERT_MAGIC_SCALE_FACTOR > 1)
205
206 if (nPreferredDPI > 0)
207 {
208 auto nWidth = o3tl::convert(aSizePixel.Width() / double(nPreferredDPI), o3tl::Length::in, o3tl::Length::mm100);
209 auto nHeight = o3tl::convert(aSizePixel.Height() / double(nPreferredDPI), o3tl::Length::in, o3tl::Length::mm100);
210 if (nWidth > 0 && nHeight > 0)
211 aSize = Size(nWidth, nHeight);
212 }
213
214 pNewGrafObj = new SdrGrafObj(getSdrModelFromSdrView(), rGraphic, ::tools::Rectangle(rPos, aSize));
215
216 if (nPreferredDPI > 0)
217 {
218 // move to the center of insertion point
219 pNewGrafObj->NbcMove(Size(-aSize.Width() / 2, -aSize.Height() / 2));
220 }
221 else
222 {
223 SdrPage* pPage = pPV->GetPage();
224 Size aPageSize( pPage->GetSize() );
225 aPageSize.AdjustWidth( -(pPage->GetLeftBorder() + pPage->GetRightBorder()) );
226 aPageSize.AdjustHeight( -(pPage->GetUpperBorder() + pPage->GetLowerBorder()) );
227 pNewGrafObj->AdjustToMaxRect( ::tools::Rectangle( Point(), aPageSize ), true );
228 }
229
230 SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER;
231 bool bIsPresTarget = false;
232
233 if ((mpViewSh
234 && mpViewSh->GetViewShell()!=nullptr
237 || dynamic_cast<const ::sd::slidesorter::view::SlideSorterView* >(this))
238 nOptions |= SdrInsertFlags::DONTMARK;
239
240 if( ( mnAction & DND_ACTION_MOVE ) && pPickObj && (pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall()) )
241 {
242 SdPage* pP = static_cast< SdPage* >( pPickObj->getSdrPageFromSdrObject() );
243
244 if ( pP && pP->IsMasterPage() )
245 bIsPresTarget = pP->IsPresObj(pPickObj);
246 }
247
248 if( ( mnAction & DND_ACTION_MOVE ) && pPickObj && !bIsPresTarget )
249 {
250 // replace object
251 if (pImageMap)
252 pNewGrafObj->AppendUserData(std::unique_ptr<SdrObjUserData>(new SvxIMapInfo(*pImageMap)));
253
254 ::tools::Rectangle aPickObjRect(pPickObj->GetCurrentBoundRect());
255 Size aPickObjSize(aPickObjRect.GetSize());
256 ::tools::Rectangle aObjRect(pNewGrafObj->GetCurrentBoundRect());
257 Size aObjSize(aObjRect.GetSize());
258
259 Fraction aScaleWidth(aPickObjSize.Width(), aObjSize.Width());
260 Fraction aScaleHeight(aPickObjSize.Height(), aObjSize.Height());
261 pNewGrafObj->NbcResize(aObjRect.TopLeft(), aScaleWidth, aScaleHeight);
262
263 Point aVec = aPickObjRect.TopLeft() - aObjRect.TopLeft();
264 pNewGrafObj->NbcMove(Size(aVec.X(), aVec.Y()));
265
266 const bool bUndo = IsUndoEnabled();
267
268 if( bUndo )
269 BegUndo(SdResId(STR_UNDO_DRAGDROP));
270 pNewGrafObj->NbcSetLayer(pPickObj->GetLayer());
271 SdrPage* pP = pPV->GetPage();
272 pP->InsertObject(pNewGrafObj.get());
273 if( bUndo )
274 {
277 }
278 pP->RemoveObject(pPickObj->GetOrdNum());
279
280 if( bUndo )
281 {
282 EndUndo();
283 }
285 }
286 else
287 {
288 bool bSuccess = InsertObjectAtView(pNewGrafObj.get(), *pPV, nOptions);
289 if (!bSuccess)
290 pNewGrafObj = nullptr;
291 else if (pImageMap)
292 pNewGrafObj->AppendUserData(std::unique_ptr<SdrObjUserData>(new SvxIMapInfo(*pImageMap)));
293 }
294 }
295
296 rAction = mnAction;
297
298 return pNewGrafObj.get();
299}
300
301void View::InsertMediaURL( const OUString& rMediaURL, sal_Int8& rAction,
302 const Point& rPos, const Size& rSize,
303 bool const bLink )
304{
305 OUString realURL;
306 if (bLink)
307 {
308 realURL = rMediaURL;
309 }
310 else
311 {
312 uno::Reference<frame::XModel> const xModel(
313 GetDoc().GetObjectShell()->GetModel());
314#if HAVE_FEATURE_AVMEDIA
315 bool const bRet = ::avmedia::EmbedMedia(xModel, rMediaURL, realURL);
316 if (!bRet) { return; }
317#else
318 return;
319#endif
320 }
321
322 InsertMediaObj(realURL, rAction, rPos, rSize);
323}
324
325SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, sal_Int8& rAction,
326 const Point& rPos, const Size& rSize )
327{
329 mnAction = rAction;
330
331 rtl::Reference<SdrMediaObj> pNewMediaObj;
334
335 if(pPV && dynamic_cast<const ::sd::slidesorter::view::SlideSorterView* >(this) )
336 {
337 if(!pPV->GetPageRect().Contains(rPos))
338 pPV = nullptr;
339 }
340
341 if( mnAction == DND_ACTION_LINK && pPV && dynamic_cast< SdrMediaObj *>( pPickObj ) )
342 {
343 pNewMediaObj = SdrObject::Clone(static_cast<SdrMediaObj&>(*pPickObj), pPickObj->getSdrModelFromSdrObject());
344 pNewMediaObj->setURL(rMediaURL, ""/*TODO?*/);
345
346 BegUndo(SdResId(STR_UNDO_DRAGDROP));
347 ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj.get());
348 EndUndo();
349 }
350 else if( pPV )
351 {
352 ::tools::Rectangle aRect( rPos, rSize );
353 SdrObjUserCall* pUserCall = nullptr;
354 if( pPickObj )
355 {
356 aRect = pPickObj->GetLogicRect();
357 pUserCall = pPickObj->GetUserCall(); // ReplaceObjectAtView can free pPickObj
358 }
359
360 pNewMediaObj = new SdrMediaObj(
362 aRect);
363
364 bool bIsPres = false;
365 if( pPickObj )
366 {
367 SdPage* pPage = static_cast< SdPage* >(pPickObj->getSdrPageFromSdrObject());
368 bIsPres = pPage && pPage->IsPresObj(pPickObj);
369 if( bIsPres )
370 {
371 pPage->InsertPresObj( pNewMediaObj.get(), PresObjKind::Media );
372 }
373 }
374
375 if( pPickObj )
376 ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj.get());
377 else
378 {
379 if (!InsertObjectAtView(pNewMediaObj.get(), *pPV, SdrInsertFlags::SETDEFLAYER))
380 pNewMediaObj = nullptr;
381 }
382
383 OUString referer;
384 DrawDocShell * sh = GetDocSh();
385 if (sh != nullptr && sh->HasName()) {
386 referer = sh->GetMedium()->GetName();
387 }
388
389 if (pNewMediaObj)
390 {
391 pNewMediaObj->setURL(rMediaURL, referer);
392
393 if( pPickObj )
394 {
395 pNewMediaObj->AdjustToMaxRect( aRect );
396 if( bIsPres )
397 pNewMediaObj->SetUserCall( pUserCall );
398 }
399 }
400 }
401
402 rAction = mnAction;
403
404 return pNewMediaObj.get();
405}
406
410IMPL_LINK_NOARG(View, DropInsertFileHdl, Timer *, void)
411{
412 DBG_ASSERT( mpViewSh, "sd::View::DropInsertFileHdl(), I need a view shell to work!" );
413 if( !mpViewSh )
414 return;
415
416 SfxErrorContext aEc( ERRCTX_ERROR, mpViewSh->GetFrameWeld(), RID_SO_ERRCTX );
417 ErrCode nError = ERRCODE_NONE;
418
419 ::std::vector< OUString >::const_iterator aIter( maDropFileVector.begin() );
420
421 while( (aIter != maDropFileVector.end()) && !nError )
422 {
423 OUString aCurrentDropFile( *aIter );
424 INetURLObject aURL( aCurrentDropFile );
425 bool bHandled = false;
426
427 if( aURL.GetProtocol() == INetProtocol::NotValid )
428 {
429 OUString aURLStr;
430 osl::FileBase::getFileURLFromSystemPath( aCurrentDropFile, aURLStr );
431 aURL = INetURLObject( aURLStr );
432 }
433
435 Graphic aGraphic;
436
437 aCurrentDropFile = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
438
439#if HAVE_FEATURE_AVMEDIA
440 if( !::avmedia::MediaWindow::isMediaURL( aCurrentDropFile, ""/*TODO?*/ ) )
441#else
442#endif
443 {
444 if( !rGraphicFilter.ImportGraphic( aGraphic, aURL ) )
445 {
446 sal_Int8 nTempAction = ( aIter == maDropFileVector.begin() ) ? mnAction : 0;
447 const bool bLink = ( ( nTempAction & DND_ACTION_LINK ) != 0 );
448 SdrGrafObj* pGrafObj = InsertGraphic( aGraphic, nTempAction, maDropPos, nullptr, nullptr );
449 if(pGrafObj && bLink)
450 {
451 pGrafObj->SetGraphicLink( aCurrentDropFile );
452 }
453
454 // return action from first inserted graphic
455 if( aIter == maDropFileVector.begin() )
456 mnAction = nTempAction;
457
458 bHandled = true;
459 }
460 if (!bHandled)
461 {
462 std::shared_ptr<const SfxFilter> pFoundFilter;
463 SfxMedium aSfxMedium( aCurrentDropFile, StreamMode::READ | StreamMode::SHARE_DENYNONE );
464 ErrCode nErr = SfxGetpApp()->GetFilterMatcher().GuessFilter( aSfxMedium, pFoundFilter );
465
466 if( pFoundFilter && !nErr )
467 {
468 ::std::vector< OUString > aFilterVector;
469 OUString aFilterName = pFoundFilter->GetFilterName();
470 OUString aLowerAsciiFileName = aCurrentDropFile.toAsciiLowerCase();
471
473
474 if( ( ::std::find( aFilterVector.begin(), aFilterVector.end(), pFoundFilter->GetMimeType() ) != aFilterVector.end() ) ||
475 aFilterName.indexOf( "Text" ) != -1 ||
476 aFilterName.indexOf( "Rich" ) != -1 ||
477 aFilterName.indexOf( "RTF" ) != -1 ||
478 aFilterName.indexOf( "HTML" ) != -1 ||
479 aLowerAsciiFileName.indexOf(".sdd") != -1 ||
480 aLowerAsciiFileName.indexOf(".sda") != -1 ||
481 aLowerAsciiFileName.indexOf(".sxd") != -1 ||
482 aLowerAsciiFileName.indexOf(".sxi") != -1 ||
483 aLowerAsciiFileName.indexOf(".std") != -1 ||
484 aLowerAsciiFileName.indexOf(".sti") != -1 )
485 {
486 ::sd::Window* pWin = mpViewSh->GetActiveWindow();
487 SfxRequest aReq(SID_INSERTFILE, ::SfxCallMode::SLOT, mrDoc.GetItemPool());
488 SfxStringItem aItem1( ID_VAL_DUMMY0, aCurrentDropFile ), aItem2( ID_VAL_DUMMY1, pFoundFilter->GetFilterName() );
489
490 aReq.AppendItem( aItem1 );
491 aReq.AppendItem( aItem2 );
492 FuInsertFile::Create( mpViewSh, pWin, this, &mrDoc, aReq );
493 bHandled = true;
494 }
495 }
496 }
497 }
498
499#if HAVE_FEATURE_AVMEDIA
500 if (!bHandled)
501 {
502 bool bShallowDetect = ::avmedia::MediaWindow::isMediaURL(aCurrentDropFile, ""/*TODO?*/);
503 if (bShallowDetect)
504 {
505 mxDropMediaSizeListener.set(new avmedia::PlayerListener(
506 [this, aCurrentDropFile](const css::uno::Reference<css::media::XPlayer>& rPlayer){
508
509 css::awt::Size aSize = rPlayer->getPreferredPlayerWindowSize();
510 Size aPrefSize(aSize.Width, aSize.Height);
511
512 if (aPrefSize.Width() && aPrefSize.Height())
513 {
514 ::sd::Window* pWin = mpViewSh->GetActiveWindow();
515
516 if( pWin )
517 aPrefSize = pWin->PixelToLogic(aPrefSize, MapMode(MapUnit::Map100thMM));
518 else
519 aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MapMode(MapUnit::Map100thMM));
520 }
521 else
522 aPrefSize = Size( 5000, 5000 );
523
524 InsertMediaURL(aCurrentDropFile, mnAction, maDropPos, aPrefSize, true);
525
526 mxDropMediaSizeListener.clear();
527 }));
528 }
529 bHandled = bShallowDetect && ::avmedia::MediaWindow::isMediaURL(aCurrentDropFile, ""/*TODO?*/, true, mxDropMediaSizeListener);
530 }
531#endif
532
533 if (!bHandled)
534 {
535 if( mnAction & DND_ACTION_LINK )
536 static_cast< DrawViewShell* >( mpViewSh )->InsertURLButton( aCurrentDropFile, aCurrentDropFile, OUString(), &maDropPos );
537 else
538 {
539 if( mpViewSh )
540 {
541 try
542 {
543 //TODO/MBA: testing
544 OUString aName;
545 uno::Sequence < beans::PropertyValue > aMedium{ comphelper::makePropertyValue(
546 "URL", aCurrentDropFile) };
547
548 uno::Reference < embed::XEmbeddedObject > xObj = mpDocSh->GetEmbeddedObjectContainer().
549 InsertEmbeddedObject( aMedium, aName );
550
551 uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
552 if ( xPersist.is())
553 {
554 // TODO/LEAN: VisualArea access can switch the object to running state
555 sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
556
557 xPersist->storeOwn();
558
559 awt::Size aSz;
560 try
561 {
562 aSz = xObj->getVisualAreaSize( nAspect );
563 }
564 catch( embed::NoVisualAreaSizeException& )
565 {
566 // the default size will be set later
567 }
568
569 Size aSize( aSz.Width, aSz.Height );
570 ::tools::Rectangle aRect;
571
572 if (!aSize.Width() || !aSize.Height())
573 {
574 aSize.setWidth( 1410 );
575 aSize.setHeight( 1000 );
576 }
577
578 aRect = ::tools::Rectangle( maDropPos, aSize );
579
581 getSdrModelFromSdrView(),
582 svt::EmbeddedObjectRef(xObj, nAspect),
583 aName,
584 aRect);
585 SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER;
586
587 if (mpViewSh != nullptr)
588 {
589 OSL_ASSERT (mpViewSh->GetViewShell()!=nullptr);
590 SfxInPlaceClient* pIpClient =
591 mpViewSh->GetViewShell()->GetIPClient();
592 if (pIpClient!=nullptr && pIpClient->IsObjectInPlaceActive())
593 nOptions |= SdrInsertFlags::DONTMARK;
594 }
595
596 if (InsertObjectAtView( pOleObj.get(), *GetSdrPageView(), nOptions ))
597 pOleObj->SetLogicRect( aRect );
598 aSz.Width = aRect.GetWidth();
599 aSz.Height = aRect.GetHeight();
600 xObj->setVisualAreaSize( nAspect,aSz );
601 }
602 }
603 catch( uno::Exception& )
604 {
605 nError = ERRCODE_IO_GENERAL;
606 // TODO/LATER: better error handling
607 }
608 }
609 }
610 }
611
612 ++aIter;
613 }
614
615 if( nError )
617}
618
622IMPL_LINK_NOARG(View, DropErrorHdl, Timer *, void)
623{
624 vcl::Window* pWin = mpViewSh ? mpViewSh->GetActiveWindow() : nullptr;
625 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
626 VclMessageType::Info, VclButtonsType::Ok,
627 SdResId(STR_ACTION_NOTPOSSIBLE)));
628 xInfoBox->run();
629}
630
635{
636 return SdrView::GetStyleSheet();
637}
638
639} // end of namespace sd
640
641/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxApplication * SfxGetpApp()
static OutputDevice * GetDefaultDevice()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
static GraphicFilter & GetGraphicFilter()
ErrCode ImportGraphic(Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat=GRFILTER_FORMAT_DONTKNOW, sal_uInt16 *pDeterminedFormat=nullptr, GraphicFilterImportFlags nImportFlags=GraphicFilterImportFlags::NONE)
Size GetPrefSize() const
GfxLink GetGfxLink() const
MapMode GetPrefMapMode() const
Size GetSizePixel(const OutputDevice *pRefDevice=nullptr) const
MapUnit GetMapUnit() const
SAL_DLLPRIVATE sal_Int32 GetDPIX() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long Y() const
constexpr tools::Long X() const
sal_Int32 getImagePreferredDPI() const override
Definition: drawdoc.hxx:621
bool IsPresObj(const SdrObject *pObj)
Definition: sdpage.cxx:2322
void InsertPresObj(SdrObject *pObj, PresObjKind eKind)
inserts the given SdrObject into the presentation object list
Definition: sdpage.cxx:2338
SfxStyleSheet * GetStyleSheet() const
void ReplaceObjectAtView(SdrObject *pOldObj, SdrPageView &rPV, SdrObject *pNewObj, bool bMark=true)
bool IsUndoEnabled() const
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
void BegUndo()
bool InsertObjectAtView(SdrObject *pObj, SdrPageView &rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE)
void EndUndo()
void SetGraphicLink(const OUString &rFileName)
SdrObject * PickObj(const Point &rPnt, short nTol, SdrPageView *&rpPV, SdrSearchOptions nOptions, SdrObject **ppRootObj, bool *pbHitPassDirect=nullptr) const
SdrUndoFactory & GetSdrUndoFactory() const
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
virtual rtl::Reference< SdrObject > RemoveObject(size_t nObjNum)
SdrObjUserCall * GetUserCall() const
bool IsClosedObj() const
sal_uInt32 GetOrdNum() const
bool IsEmptyPresObj() const
static rtl::Reference< T > Clone(T const &rObj, SdrModel &rTargetModel)
virtual const tools::Rectangle & GetCurrentBoundRect() const
SdrModel & getSdrModelFromSdrObject() const
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
SdrPage * getSdrPageFromSdrObject() const
virtual SdrLayerID GetLayer() const
virtual const tools::Rectangle & GetLogicRect() const
tools::Rectangle GetPageRect() const
SdrPage * GetPage() const
bool IsMasterPage() const
Size GetSize() const
sal_Int32 GetUpperBorder() const
sal_Int32 GetRightBorder() const
sal_Int32 GetLeftBorder() const
sal_Int32 GetLowerBorder() const
SdrModel & getSdrModelFromSdrView() const
friend friend class SdrGrafObj
SdrPageView * GetSdrPageView() const
SdrModel & GetModel() const
sal_uInt16 getHitTolLog() const
virtual std::unique_ptr< SdrUndoAction > CreateUndoNewObject(SdrObject &rObject, bool bOrdNumDirect=false)
virtual std::unique_ptr< SdrUndoAction > CreateUndoDeleteObject(SdrObject &rObject, bool bOrdNumDirect=false)
SfxFilterMatcher & GetFilterMatcher()
ErrCode GuessFilter(SfxMedium &rMedium, std::shared_ptr< const SfxFilter > &, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
bool IsObjectInPlaceActive() const
SfxViewShell * GetViewShell() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const OUString & GetName() const
bool HasName() const
SfxMedium * GetMedium() const
void AppendItem(const SfxPoolItem &)
SfxItemPool & GetPool() const
SfxViewShell * GetViewShell() const
SfxInPlaceClient * GetIPClient() const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static bool isMediaURL(std::u16string_view rURL, const OUString &rReferer, bool bDeep=false, rtl::Reference< PlayerListener > xPreferredPixelSizeListener=nullptr)
Base class of the stacked shells that provide graphical views to Draw and Impress documents and editi...
static rtl::Reference< FuPoor > Create(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: fuinsfil.cxx:115
static void GetSupportedFilterVector(::std::vector< OUString > &rFilterVector)
Definition: fuinsfil.cxx:704
::sd::Window * GetActiveWindow() const
The active window is usually the mpContentWindow.
Definition: ViewShell.hxx:155
DrawDocShell * GetDocSh() const
Definition: View.hxx:142
SdrMediaObj * InsertMediaObj(const OUString &rURL, sal_Int8 &rAction, const Point &rPos, const Size &rSize)
Definition: sdview4.cxx:325
SdrGrafObj * InsertGraphic(const Graphic &rGraphic, sal_Int8 &rAction, const Point &rPos, SdrObject *pSelectedObj, ImageMap const *pImageMap)
If an empty graphic object is provided, we fill it.
Definition: sdview4.cxx:78
DrawDocShell * mpDocSh
Definition: View.hxx:262
sal_Int8 mnAction
Definition: View.hxx:270
ViewShell * mpViewSh
Definition: View.hxx:263
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false) override
ends current text editing
Definition: sdview.cxx:772
SdrObject * GetEmptyPresentationObject(PresObjKind eKind)
Definition: sdview5.cxx:79
virtual SfxStyleSheet * GetStyleSheet() const
Definition: sdview4.cxx:634
SdDrawDocument & mrDoc
Definition: View.hxx:261
void InsertMediaURL(const OUString &rMediaURL, sal_Int8 &rAction, const Point &rPos, const Size &rSize, bool const bLink)
Definition: sdview4.cxx:301
SdDrawDocument & GetDoc() const
Definition: View.hxx:293
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
constexpr tools::Long GetWidth() const
bool Contains(const Point &rPOINT) const
constexpr Point TopLeft() const
constexpr Size GetSize() const
constexpr tools::Long GetHeight() const
::OutputDevice const * GetOutDev() const
Point PixelToLogic(const Point &rDevicePt) const
weld::Window * GetFrameWeld() const
#define DBG_ASSERT(sCon, aError)
URL aURL
#define ERRCODE_IO_GENERAL
#define ERRCODE_NONE
OUString aName
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
IMPL_LINK_NOARG(MainSequence, onTimerHdl, Timer *, void)
constexpr int PDF_INSERT_MAGIC_SCALE_FACTOR
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
#define ERRCTX_ERROR
SVT_DLLPUBLIC const ErrMsgCode RID_SO_ERRCTX[]
Reference< XModel > xModel
SdrInsertFlags
#define DND_ACTION_MOVE
#define DND_ACTION_COPY
#define DND_ACTION_LINK
signed char sal_Int8