LibreOffice Module svx (master) 1
UnoGraphicExporter.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 <vector>
21#include <com/sun/star/io/XOutputStream.hpp>
22#include <com/sun/star/beans/XPropertySet.hpp>
23#include <com/sun/star/container/XChild.hpp>
24#include <com/sun/star/lang/XServiceInfo.hpp>
25#include <com/sun/star/lang/XComponent.hpp>
26#include <com/sun/star/drawing/XShape.hpp>
27#include <com/sun/star/drawing/XDrawPage.hpp>
28#include <com/sun/star/drawing/XGraphicExportFilter.hpp>
29#include <com/sun/star/graphic/XGraphic.hpp>
30#include <com/sun/star/graphic/XGraphicRenderer.hpp>
31#include <com/sun/star/task/XStatusIndicator.hpp>
32#include <com/sun/star/task/XInteractionHandler.hpp>
33#include <com/sun/star/task/XInteractionContinuation.hpp>
34#include <com/sun/star/uno/XComponentContext.hpp>
35
36#include <tools/debug.hxx>
38#include <tools/urlobj.hxx>
41#include <com/sun/star/drawing/GraphicFilterRequest.hpp>
42#include <com/sun/star/util/URL.hpp>
45#include <vcl/metaact.hxx>
46#include <vcl/svapp.hxx>
47#include <vcl/virdev.hxx>
48#include <svl/outstrm.hxx>
53#include <editeng/numitem.hxx>
54#include <svx/svdograf.hxx>
55#include <svx/xoutbmp.hxx>
56#include <vcl/graphicfilter.hxx>
57#include <svx/svdpage.hxx>
58#include <svx/svdmodel.hxx>
59#include <svx/fmview.hxx>
60#include <svx/fmmodel.hxx>
61#include <svx/unopage.hxx>
62#include <svx/svdoutl.hxx>
63#include <svx/xlineit0.hxx>
64#include <editeng/flditem.hxx>
70#include <memory>
71
72#define MAX_EXT_PIX 2048
73
74using namespace ::comphelper;
75using namespace ::cppu;
76using namespace ::com::sun::star;
77using namespace ::com::sun::star::uno;
78using namespace ::com::sun::star::util;
79using namespace ::com::sun::star::container;
80using namespace ::com::sun::star::drawing;
81using namespace ::com::sun::star::lang;
82using namespace ::com::sun::star::document;
83using namespace ::com::sun::star::beans;
84using namespace ::com::sun::star::task;
85
86// #i102251#
87#include <editeng/editstat.hxx>
88
89namespace {
90
91 struct ExportSettings
92 {
93 OUString maFilterName;
94 OUString maMediaType;
95 URL maURL;
96 css::uno::Reference< css::io::XOutputStream > mxOutputStream;
97 css::uno::Reference< css::graphic::XGraphicRenderer > mxGraphicRenderer;
98 css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator;
99 css::uno::Reference< css::task::XInteractionHandler > mxInteractionHandler;
100
101 sal_Int32 mnWidth;
102 sal_Int32 mnHeight;
103 bool mbExportOnlyBackground;
104 bool mbScrollText;
105 bool mbUseHighContrast;
106 bool mbTranslucent;
107
108 Sequence< PropertyValue > maFilterData;
109
110 Fraction maScaleX;
111 Fraction maScaleY;
112
113 TriState meAntiAliasing = TRISTATE_INDET;
114
115 explicit ExportSettings();
116 };
117
118 ExportSettings::ExportSettings()
119 : mnWidth( 0 )
120 ,mnHeight( 0 )
121 ,mbExportOnlyBackground( false )
122 ,mbScrollText( false )
123 ,mbUseHighContrast( false )
124 ,mbTranslucent( false )
125 ,maScaleX(1, 1)
126 ,maScaleY(1, 1)
127 {
128 }
129
134 class GraphicExporter : public WeakImplHelper< XGraphicExportFilter, XServiceInfo >
135 {
136 public:
137 GraphicExporter();
138
139 // XFilter
140 virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& aDescriptor ) override;
141 virtual void SAL_CALL cancel( ) override;
142
143 // XExporter
144 virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) override;
145
146 // XServiceInfo
147 virtual OUString SAL_CALL getImplementationName( ) override;
148 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
149 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
150
151 // XMimeTypeInfo
152 virtual sal_Bool SAL_CALL supportsMimeType( const OUString& MimeTypeName ) override;
153 virtual Sequence< OUString > SAL_CALL getSupportedMimeTypeNames( ) override;
154
155 VclPtr<VirtualDevice> CreatePageVDev( SdrPage* pPage, tools::Long nWidthPixel, tools::Long nHeightPixel ) const;
156
157 DECL_LINK( CalcFieldValueHdl, EditFieldInfo*, void );
158
159 void ParseSettings( const Sequence< PropertyValue >& aDescriptor, ExportSettings& rSettings );
160 bool GetGraphic( ExportSettings const & rSettings, Graphic& aGraphic, bool bVectorType );
161
162 private:
163 Reference< XShape > mxShape;
164 Reference< XDrawPage > mxPage;
165 Reference< XShapes > mxShapes;
167
168 SvxDrawPage* mpUnoPage;
169
170 Link<EditFieldInfo*,void> maOldCalcFieldValueHdl;
171 sal_Int32 mnPageNumber;
172 SdrPage* mpCurrentPage;
173 SdrModel* mpDoc;
174 };
175
178 BitmapEx GetBitmapFromMetaFile( const GDIMetaFile& rMtf, const Size* pSize )
179 {
180 // use new primitive conversion tooling
181 basegfx::B2DRange aRange(basegfx::B2DPoint(0.0, 0.0));
182 sal_uInt32 nMaximumQuadraticPixels(500000);
183
184 if(pSize)
185 {
186 // use 100th mm for primitive bitmap converter tool, input is pixel
187 // use a real OutDev to get the correct DPI, the static LogicToLogic assumes 72dpi which is wrong (!)
188 const Size aSize100th(Application::GetDefaultDevice()->PixelToLogic(*pSize, MapMode(MapUnit::Map100thMM)));
189
190 aRange.expand(basegfx::B2DPoint(aSize100th.Width(), aSize100th.Height()));
191
192 // when explicitly pixels are requested from the GraphicExporter, use a *very* high limit
193 // of 16gb (4096x4096 pixels), else use the default for the converters
194 nMaximumQuadraticPixels = std::min(sal_uInt32(4096 * 4096), sal_uInt32(pSize->Width() * pSize->Height()));
195 }
196 else
197 {
198 // use 100th mm for primitive bitmap converter tool
199 const Size aSize100th(OutputDevice::LogicToLogic(rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MapMode(MapUnit::Map100thMM)));
200
201 aRange.expand(basegfx::B2DPoint(aSize100th.Width(), aSize100th.Height()));
202 }
203
204 return convertMetafileToBitmapEx(rMtf, aRange, nMaximumQuadraticPixels);
205 }
206
207 Size* CalcSize( sal_Int32 nWidth, sal_Int32 nHeight, const Size& aBoundSize, Size& aOutSize )
208 {
209 if( (nWidth == 0) && (nHeight == 0) )
210 return nullptr;
211
212 if( (nWidth == 0) && (nHeight != 0) && (aBoundSize.Height() != 0) )
213 {
214 nWidth = ( nHeight * aBoundSize.Width() ) / aBoundSize.Height();
215 }
216 else if( (nWidth != 0) && (nHeight == 0) && (aBoundSize.Width() != 0) )
217 {
218 nHeight = ( nWidth * aBoundSize.Height() ) / aBoundSize.Width();
219 }
220
221 aOutSize.setWidth( nWidth );
222 aOutSize.setHeight( nHeight );
223
224 return &aOutSize;
225 }
226
227class ImplExportCheckVisisbilityRedirector : public sdr::contact::ViewObjectContactRedirector
228{
229public:
230 explicit ImplExportCheckVisisbilityRedirector( SdrPage* pCurrentPage );
231
233 const sdr::contact::ViewObjectContact& rOriginal,
234 const sdr::contact::DisplayInfo& rDisplayInfo,
236
237private:
238 SdrPage* mpCurrentPage;
239};
240
241ImplExportCheckVisisbilityRedirector::ImplExportCheckVisisbilityRedirector( SdrPage* pCurrentPage )
242: mpCurrentPage( pCurrentPage )
243{
244}
245
246void ImplExportCheckVisisbilityRedirector::createRedirectedPrimitive2DSequence(
247 const sdr::contact::ViewObjectContact& rOriginal,
248 const sdr::contact::DisplayInfo& rDisplayInfo,
250{
252
253 if(pObject)
254 {
255 SdrPage* pPage = mpCurrentPage;
256
257 if(nullptr == pPage)
258 {
259 pPage = pObject->getSdrPageFromSdrObject();
260 }
261
262 if( (pPage == nullptr) || pPage->checkVisibility(rOriginal, rDisplayInfo, false) )
263 {
265 }
266
267 return;
268 }
269 else
270 {
271 // not an object, maybe a page
273 }
274}
275
276GraphicExporter::GraphicExporter()
277: mpUnoPage( nullptr ), mnPageNumber(-1), mpCurrentPage(nullptr), mpDoc( nullptr )
278{
279}
280
281IMPL_LINK(GraphicExporter, CalcFieldValueHdl, EditFieldInfo*, pInfo, void)
282{
283 if( pInfo )
284 {
285 if( mpCurrentPage )
286 {
287 pInfo->SetSdrPage( mpCurrentPage );
288 }
289 else if( mnPageNumber != -1 )
290 {
291 const SvxFieldData* pField = pInfo->GetField().GetField();
292 if( dynamic_cast<const SvxPageField*>( pField) )
293 {
294 OUString aPageNumValue;
295 bool bUpper = false;
296
297 switch(mpDoc->GetPageNumType())
298 {
299 case css::style::NumberingType::CHARS_UPPER_LETTER:
300 aPageNumValue += OUStringChar( sal_Unicode((mnPageNumber - 1) % 26 + 'A') );
301 break;
302 case css::style::NumberingType::CHARS_LOWER_LETTER:
303 aPageNumValue += OUStringChar( sal_Unicode((mnPageNumber - 1) % 26 + 'a') );
304 break;
305 case css::style::NumberingType::ROMAN_UPPER:
306 bUpper = true;
307 [[fallthrough]];
308 case css::style::NumberingType::ROMAN_LOWER:
309 aPageNumValue += SvxNumberFormat::CreateRomanString(mnPageNumber, bUpper);
310 break;
311 case css::style::NumberingType::NUMBER_NONE:
312 aPageNumValue = " ";
313 break;
314 default:
315 aPageNumValue += OUString::number( mnPageNumber );
316 }
317
318 pInfo->SetRepresentation( aPageNumValue );
319
320 return;
321 }
322 }
323 }
324
325 maOldCalcFieldValueHdl.Call( pInfo );
326
327 if( pInfo && mpCurrentPage )
328 pInfo->SetSdrPage( nullptr );
329}
330
335VclPtr<VirtualDevice> GraphicExporter::CreatePageVDev( SdrPage* pPage, tools::Long nWidthPixel, tools::Long nHeightPixel ) const
336{
338 MapMode aMM( MapUnit::Map100thMM );
339
340 Point aPoint( 0, 0 );
341 Size aPageSize(pPage->GetSize());
342
343 // use scaling?
344 if( nWidthPixel != 0 )
345 {
346 const Fraction aFrac( nWidthPixel, pVDev->LogicToPixel( aPageSize, aMM ).Width() );
347
348 aMM.SetScaleX( aFrac );
349
350 if( nHeightPixel == 0 )
351 aMM.SetScaleY( aFrac );
352 }
353
354 if( nHeightPixel != 0 )
355 {
356 const Fraction aFrac( nHeightPixel, pVDev->LogicToPixel( aPageSize, aMM ).Height() );
357
358 if( nWidthPixel == 0 )
359 aMM.SetScaleX( aFrac );
360
361 aMM.SetScaleY( aFrac );
362 }
363
364 pVDev->SetMapMode( aMM );
365 bool bSuccess(false);
366
367 // #i122820# If available, use pixel size directly
368 if(nWidthPixel && nHeightPixel)
369 {
370 bSuccess = pVDev->SetOutputSizePixel(Size(nWidthPixel, nHeightPixel));
371 }
372 else
373 {
374 bSuccess = pVDev->SetOutputSize(aPageSize);
375 }
376
377 if(bSuccess)
378 {
379 SdrView aView(*mpDoc, pVDev);
380
381 aView.SetPageVisible( false );
382 aView.SetBordVisible( false );
383 aView.SetGridVisible( false );
384 aView.SetHlplVisible( false );
385 aView.SetGlueVisible( false );
386 aView.ShowSdrPage(pPage);
387
388 vcl::Region aRegion (tools::Rectangle( aPoint, aPageSize ) );
389
390 ImplExportCheckVisisbilityRedirector aRedirector( mpCurrentPage );
391
392 aView.CompleteRedraw(pVDev, aRegion, &aRedirector);
393 }
394 else
395 {
396 OSL_ENSURE(false, "Could not get a VirtualDevice of requested size (!)");
397 }
398
399 return pVDev;
400}
401
402void GraphicExporter::ParseSettings(const Sequence<PropertyValue>& rDescriptor,
403 ExportSettings& rSettings)
404{
405 Sequence<PropertyValue> aDescriptor = rDescriptor;
406 if (aDescriptor.hasElements())
407 {
409 Sequence<PropertyValue> aFilterData;
410 OUString aFilterOptions;
411 auto it = aMap.find("FilterData");
412 if (it != aMap.end())
413 {
414 it->second >>= aFilterData;
415 }
416 it = aMap.find("FilterOptions");
417 if (it != aMap.end())
418 {
419 it->second >>= aFilterOptions;
420 }
421 if (!aFilterData.hasElements() && !aFilterOptions.isEmpty())
422 {
423 // Allow setting filter data keys from the cmdline.
424 std::vector<PropertyValue> aData
425 = comphelper::JsonToPropertyValues(aFilterOptions.toUtf8());
427 if (aFilterData.hasElements())
428 {
429 aMap["FilterData"] <<= aFilterData;
430 aDescriptor = aMap.getAsConstPropertyValueList();
431 }
432 }
433 }
434
435 for( const PropertyValue& rValue : aDescriptor )
436 {
437 if ( rValue.Name == "FilterName" )
438 {
439 rValue.Value >>= rSettings.maFilterName;
440 }
441 else if ( rValue.Name == "MediaType" )
442 {
443 rValue.Value >>= rSettings.maMediaType;
444 }
445 else if ( rValue.Name == "URL" )
446 {
447 if( !( rValue.Value >>= rSettings.maURL ) )
448 {
449 rValue.Value >>= rSettings.maURL.Complete;
450 }
451 }
452 else if ( rValue.Name == "OutputStream" )
453 {
454 rValue.Value >>= rSettings.mxOutputStream;
455 }
456 else if ( rValue.Name == "GraphicRenderer" )
457 {
458 rValue.Value >>= rSettings.mxGraphicRenderer;
459 }
460 else if ( rValue.Name == "StatusIndicator" )
461 {
462 rValue.Value >>= rSettings.mxStatusIndicator;
463 }
464 else if ( rValue.Name == "InteractionHandler" )
465 {
466 rValue.Value >>= rSettings.mxInteractionHandler;
467 }
468 else if( rValue.Name == "Width" ) // for compatibility reasons, deprecated
469 {
470 rValue.Value >>= rSettings.mnWidth;
471 }
472 else if( rValue.Name == "Height" ) // for compatibility reasons, deprecated
473 {
474 rValue.Value >>= rSettings.mnHeight;
475 }
476 else if( rValue.Name == "ExportOnlyBackground" ) // for compatibility reasons, deprecated
477 {
478 rValue.Value >>= rSettings.mbExportOnlyBackground;
479 }
480 else if ( rValue.Name == "FilterData" )
481 {
482 rValue.Value >>= rSettings.maFilterData;
483
484 for( PropertyValue& rDataValue : asNonConstRange(rSettings.maFilterData) )
485 {
486 if ( rDataValue.Name == "Translucent" )
487 {
488 if ( !( rDataValue.Value >>= rSettings.mbTranslucent ) ) // SJ: TODO: The GIF Transparency is stored as int32 in
489 { // configuration files, this has to be changed to boolean
490 sal_Int32 nTranslucent = 0;
491 if ( rDataValue.Value >>= nTranslucent )
492 rSettings.mbTranslucent = nTranslucent != 0;
493 }
494 }
495 else if ( rDataValue.Name == "PixelWidth" )
496 {
497 rDataValue.Value >>= rSettings.mnWidth;
498 }
499 else if ( rDataValue.Name == "PixelHeight" )
500 {
501 rDataValue.Value >>= rSettings.mnHeight;
502 }
503 else if( rDataValue.Name == "Width" ) // for compatibility reasons, deprecated
504 {
505 rDataValue.Value >>= rSettings.mnWidth;
506 rDataValue.Name = "PixelWidth";
507 }
508 else if( rDataValue.Name == "Height" ) // for compatibility reasons, deprecated
509 {
510 rDataValue.Value >>= rSettings.mnHeight;
511 rDataValue.Name = "PixelHeight";
512 }
513 else if ( rDataValue.Name == "ExportOnlyBackground" )
514 {
515 rDataValue.Value >>= rSettings.mbExportOnlyBackground;
516 }
517 else if ( rDataValue.Name == "HighContrast" )
518 {
519 rDataValue.Value >>= rSettings.mbUseHighContrast;
520 }
521 else if ( rDataValue.Name == "PageNumber" )
522 {
523 rDataValue.Value >>= mnPageNumber;
524 }
525 else if ( rDataValue.Name == "ScrollText" )
526 {
527 // #110496# Read flag solitary scroll text metafile
528 rDataValue.Value >>= rSettings.mbScrollText;
529 }
530 else if ( rDataValue.Name == "CurrentPage" )
531 {
532 Reference< XDrawPage > xPage;
533 rDataValue.Value >>= xPage;
534 if( xPage.is() )
535 {
536 SvxDrawPage* pUnoPage = comphelper::getFromUnoTunnel<SvxDrawPage>( xPage );
537 if( pUnoPage && pUnoPage->GetSdrPage() )
538 mpCurrentPage = pUnoPage->GetSdrPage();
539 }
540 }
541 else if ( rDataValue.Name == "ScaleXNumerator" )
542 {
543 sal_Int32 nVal = 1;
544 if( rDataValue.Value >>= nVal )
545 rSettings.maScaleX = Fraction( nVal, rSettings.maScaleX.GetDenominator() );
546 }
547 else if ( rDataValue.Name == "ScaleXDenominator" )
548 {
549 sal_Int32 nVal = 1;
550 if( rDataValue.Value >>= nVal )
551 rSettings.maScaleX = Fraction( rSettings.maScaleX.GetNumerator(), nVal );
552 }
553 else if ( rDataValue.Name == "ScaleYNumerator" )
554 {
555 sal_Int32 nVal = 1;
556 if( rDataValue.Value >>= nVal )
557 rSettings.maScaleY = Fraction( nVal, rSettings.maScaleY.GetDenominator() );
558 }
559 else if ( rDataValue.Name == "ScaleYDenominator" )
560 {
561 sal_Int32 nVal = 1;
562 if( rDataValue.Value >>= nVal )
563 rSettings.maScaleY = Fraction( rSettings.maScaleY.GetNumerator(), nVal );
564 }
565 else if (rDataValue.Name == "AntiAliasing")
566 {
567 bool bAntiAliasing;
568 if (rDataValue.Value >>= bAntiAliasing)
569 rSettings.meAntiAliasing = bAntiAliasing ? TRISTATE_TRUE : TRISTATE_FALSE;
570 }
571 }
572 }
573 }
574
575 // putting the StatusIndicator that we got from the MediaDescriptor into our local FilterData copy
576 if ( rSettings.mxStatusIndicator.is() )
577 {
578 int i = rSettings.maFilterData.getLength();
579 rSettings.maFilterData.realloc( i + 1 );
580 auto pFilterData = rSettings.maFilterData.getArray();
581 pFilterData[ i ].Name = "StatusIndicator";
582 pFilterData[ i ].Value <<= rSettings.mxStatusIndicator;
583 }
584}
585
586bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGraphic, bool bVectorType )
587{
588 if( !mpDoc || !mpUnoPage )
589 return false;
590
591 SdrPage* pPage = mpUnoPage->GetSdrPage();
592 if( !pPage )
593 return false;
594
596 const MapMode aMap( mpDoc->GetScaleUnit(), Point(), rSettings.maScaleX, rSettings.maScaleY );
597
598 SdrOutliner& rOutl=mpDoc->GetDrawOutliner();
599 maOldCalcFieldValueHdl = rOutl.GetCalcFieldValueHdl();
600 rOutl.SetCalcFieldValueHdl( LINK(this, GraphicExporter, CalcFieldValueHdl) );
602
603 // #i102251#
604 const EEControlBits nOldCntrl(rOutl.GetControlWord());
605 EEControlBits nCntrl = nOldCntrl & ~EEControlBits::ONLINESPELLING;
606 rOutl.SetControlWord(nCntrl);
607
608 rtl::Reference<SdrObject> pTempBackgroundShape;
609 std::vector< SdrObject* > aShapes;
610 bool bRet = true;
611
612 // export complete page?
613 if ( !mxShape.is() )
614 {
615 if( rSettings.mbExportOnlyBackground )
616 {
617 const SdrPageProperties* pCorrectProperties = pPage->getCorrectSdrPageProperties();
618
619 if(pCorrectProperties)
620 {
621 pTempBackgroundShape = new SdrRectObj(
622 *mpDoc,
623 tools::Rectangle(Point(0,0), pPage->GetSize()));
624 pTempBackgroundShape->SetMergedItemSet(pCorrectProperties->GetItemSet());
625 pTempBackgroundShape->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
626 pTempBackgroundShape->NbcSetStyleSheet(pCorrectProperties->GetStyleSheet(), true);
627 aShapes.push_back(pTempBackgroundShape.get());
628 }
629 }
630 else
631 {
632 const Size aSize( pPage->GetSize() );
633
634 // generate a bitmap to convert it to a pixel format.
635 // For gif pictures there can also be a vector format used (bTranslucent)
636 if ( !bVectorType && !rSettings.mbTranslucent )
637 {
638 tools::Long nWidthPix = 0;
639 tools::Long nHeightPix = 0;
640 if ( rSettings.mnWidth > 0 && rSettings.mnHeight > 0 )
641 {
642 nWidthPix = rSettings.mnWidth;
643 nHeightPix = rSettings.mnHeight;
644 }
645 else
646 {
647 const Size aSizePix( Application::GetDefaultDevice()->LogicToPixel( aSize, aMap ) );
648 if (aSizePix.Width() > MAX_EXT_PIX || aSizePix.Height() > MAX_EXT_PIX)
649 {
650 if (aSizePix.Width() > MAX_EXT_PIX)
651 nWidthPix = MAX_EXT_PIX;
652 else
653 nWidthPix = aSizePix.Width();
654 if (aSizePix.Height() > MAX_EXT_PIX)
655 nHeightPix = MAX_EXT_PIX;
656 else
657 nHeightPix = aSizePix.Height();
658
659 double fWidthDif = static_cast<double>(aSizePix.Width()) / nWidthPix;
660 double fHeightDif = static_cast<double>(aSizePix.Height()) / nHeightPix;
661
662 if (fWidthDif > fHeightDif)
663 nHeightPix = static_cast<tools::Long>(aSizePix.Height() / fWidthDif);
664 else
665 nWidthPix = static_cast<tools::Long>(aSizePix.Width() / fHeightDif);
666 }
667 else
668 {
669 nWidthPix = aSizePix.Width();
670 nHeightPix = aSizePix.Height();
671 }
672 }
673
674 std::unique_ptr<SdrView> xLocalView;
675
676 if (FmFormModel* pFormModel = dynamic_cast<FmFormModel*>(mpDoc))
677 {
678 xLocalView.reset(new FmFormView(*pFormModel, aVDev));
679 }
680 else
681 {
682 xLocalView.reset(new SdrView(*mpDoc, aVDev));
683 }
684
685 ScopedVclPtr<VirtualDevice> pVDev(CreatePageVDev( pPage, nWidthPix, nHeightPix ));
686
687 if( pVDev )
688 {
689 aGraphic = pVDev->GetBitmapEx( Point(), pVDev->GetOutputSize() );
690 aGraphic.SetPrefMapMode( aMap );
691 aGraphic.SetPrefSize( aSize );
692 }
693 }
694 // create a metafile to export a vector format
695 else
696 {
697 GDIMetaFile aMtf;
698
699 aVDev->SetMapMode( aMap );
700 if( rSettings.mbUseHighContrast )
701 aVDev->SetDrawMode( aVDev->GetDrawMode() | DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill | DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient );
702 aVDev->EnableOutput( false );
703 aMtf.Record( aVDev );
704 Size aNewSize;
705
706 // create a view
707 std::unique_ptr< SdrView > pView;
708
709 if (FmFormModel *pFormModel = dynamic_cast<FmFormModel*>(mpDoc))
710 {
711 pView.reset(new FmFormView(*pFormModel, aVDev));
712 }
713 else
714 {
715 pView.reset(new SdrView(*mpDoc, aVDev));
716 }
717
718 pView->SetBordVisible( false );
719 pView->SetPageVisible( false );
720 pView->ShowSdrPage( pPage );
721
722 // tdf#96922 deactivate EditView PageVisualization, including PageBackground
723 // (formerly 'wiese'). Do *not* switch off MasterPageVisualizationAllowed, we
724 // want MasterPage content if a whole SdrPage is exported
725 pView->SetPageDecorationAllowed(false);
726
727 const Point aNewOrg( pPage->GetLeftBorder(), pPage->GetUpperBorder() );
728 aNewSize = Size( aSize.Width() - pPage->GetLeftBorder() - pPage->GetRightBorder(),
729 aSize.Height() - pPage->GetUpperBorder() - pPage->GetLowerBorder() );
730 const tools::Rectangle aClipRect( aNewOrg, aNewSize );
731 MapMode aVMap( aMap );
732
733 aVDev->Push();
734 aVMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) );
735 aVDev->SetRelativeMapMode( aVMap );
736 aVDev->IntersectClipRegion( aClipRect );
737
738 // Use new StandardCheckVisisbilityRedirector
739 ImplExportCheckVisisbilityRedirector aRedirector( mpCurrentPage );
740
741 pView->CompleteRedraw(aVDev, vcl::Region(tools::Rectangle(aNewOrg, aNewSize)), &aRedirector);
742
743 aVDev->Pop();
744
745 aMtf.Stop();
746 aMtf.WindStart();
747 aMtf.SetPrefMapMode( aMap );
748 aMtf.SetPrefSize( aNewSize );
749
750 // AW: Here the current version was filtering out the MetaActionType::CLIPREGIONs
751 // from the metafile. I asked some other developers why this was done, but no
752 // one knew a direct reason. Since it's in for long time, it may be an old
753 // piece of code. MetaFiles save and load ClipRegions with polygons with preserving
754 // the polygons, so a resolution-independent roundtrip is supported. Removed this
755 // code since it destroys some MetaFiles where ClipRegions are used. Anyways,
756 // just filtering them out is a hack, at least the encapsulated content would need
757 // to be clipped geometrically.
758 aGraphic = Graphic(aMtf);
759
760 pView->HideSdrPage();
761
762 if( rSettings.mbTranslucent )
763 {
764 Size aOutSize;
765 aGraphic = GetBitmapFromMetaFile( aGraphic.GetGDIMetaFile(), CalcSize( rSettings.mnWidth, rSettings.mnHeight, aNewSize, aOutSize ) );
766 }
767 }
768 }
769 }
770
771 // export only single shape or shape collection
772 else
773 {
774 // build list of SdrObject
775 if( mxShapes.is() )
776 {
777 Reference< XShape > xShape;
778 const sal_Int32 nCount = mxShapes->getCount();
779
780 for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
781 {
782 mxShapes->getByIndex( nIndex ) >>= xShape;
784 if( pObj )
785 aShapes.push_back( pObj );
786 }
787 }
788 else
789 {
790 // only one shape
792 if( pObj )
793 aShapes.push_back( pObj );
794 }
795
796 if( aShapes.empty() )
797 bRet = false;
798 }
799
800 if( bRet && !aShapes.empty() )
801 {
802 // special treatment for only one SdrGrafObj that has text
803 bool bSingleGraphic = false;
804
805 if( 1 == aShapes.size() )
806 {
807 if( !bVectorType )
808 {
809 if( auto pGrafObj = dynamic_cast<const SdrGrafObj*>(aShapes.front()) )
810 if (pGrafObj->HasText() )
811 {
812 aGraphic = pGrafObj->GetTransformedGraphic();
813 if ( aGraphic.GetType() == GraphicType::Bitmap )
814 {
815 Size aSizePixel( aGraphic.GetSizePixel() );
816 if( rSettings.mnWidth && rSettings.mnHeight &&
817 ( ( rSettings.mnWidth != aSizePixel.Width() ) ||
818 ( rSettings.mnHeight != aSizePixel.Height() ) ) )
819 {
820 BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
821 // export: use highest quality
822 aBmpEx.Scale( Size( rSettings.mnWidth, rSettings.mnHeight ), BmpScaleFlag::Lanczos );
823 aGraphic = aBmpEx;
824 }
825
826 // #118804# only accept for bitmap graphics, else the
827 // conversion to bitmap will happen anywhere without size control
828 // as evtl. defined in rSettings.mnWidth/mnHeight
829 bSingleGraphic = true;
830 }
831 }
832 }
833 else if( rSettings.mbScrollText )
834 {
835 SdrObject* pObj = aShapes.front();
836 auto pTextObj = DynCastSdrTextObj( pObj);
837 if( pTextObj && pTextObj->HasText() )
838 {
839 tools::Rectangle aScrollRectangle;
840 tools::Rectangle aPaintRectangle;
841
842 const std::unique_ptr< GDIMetaFile > pMtf(
843 pTextObj->GetTextScrollMetaFileAndRectangle(
844 aScrollRectangle, aPaintRectangle ) );
845
846 // take the larger one of the two rectangles (that
847 // should be the bound rect of the retrieved
848 // metafile)
849 tools::Rectangle aTextRect;
850
851 if( aScrollRectangle.Contains( aPaintRectangle ) )
852 aTextRect = aScrollRectangle;
853 else
854 aTextRect = aPaintRectangle;
855
856 // setup pref size and mapmode
857 pMtf->SetPrefSize( aTextRect.GetSize() );
858
859 // set actual origin (mtf is at actual shape
860 // output position)
861 MapMode aLocalMapMode( aMap );
862 aLocalMapMode.SetOrigin(
863 Point( -aPaintRectangle.Left(),
864 -aPaintRectangle.Top() ) );
865 pMtf->SetPrefMapMode( aLocalMapMode );
866
867 pMtf->AddAction( new MetaCommentAction(
868 "XTEXT_SCROLLRECT", 0,
869 reinterpret_cast<sal_uInt8 const*>(&aScrollRectangle),
870 sizeof( tools::Rectangle ) ) );
871 pMtf->AddAction( new MetaCommentAction(
872 "XTEXT_PAINTRECT", 0,
873 reinterpret_cast<sal_uInt8 const*>(&aPaintRectangle),
874 sizeof( tools::Rectangle ) ) );
875
876 aGraphic = Graphic( *pMtf );
877
878 bSingleGraphic = true;
879 }
880 }
881 }
882
883 if( !bSingleGraphic )
884 {
885 // create a metafile for all shapes
887
888 // calculate bound rect for all shapes
889 // tdf#126319 I did not convert all rendering to primities,
890 // that would be to much for this fix. But I did so for the
891 // range calculation to get a valid high quality range.
892 // Based on that the conversion is reliable. With the BoundRect
893 // fetched from the Metafile it was just not possible to get the
894 // examples from the task handled in a way to fit all cases -
895 // due to bad-quality range data from it.
896 basegfx::B2DRange aBound;
897 const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
898
899 {
900 for( SdrObject* pObj : aShapes )
901 {
903 pObj->GetViewContact().getViewIndependentPrimitive2DContainer(aSequence);
904 aBound.expand(aSequence.getB2DRange(aViewInformation2D));
905 }
906 }
907
908 aOut->EnableOutput( false );
909 aOut->SetMapMode( aMap );
910 if( rSettings.mbUseHighContrast )
911 aOut->SetDrawMode( aOut->GetDrawMode() | DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill | DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient );
912
913 GDIMetaFile aMtf;
914 aMtf.Clear();
915 aMtf.Record( aOut );
916
917 MapMode aOutMap( aMap );
918 const Size aOnePixelInMtf(
919 Application::GetDefaultDevice()->PixelToLogic(
920 Size(1, 1),
921 aMap));
922 const Size aHalfPixelInMtf(
923 (aOnePixelInMtf.getWidth() + 1) / 2,
924 (aOnePixelInMtf.getHeight() + 1) / 2);
925
926 // tdf#126319 Immediately add needed offset to create metafile,
927 // that avoids to do it later by Metafile::Move what would be expensive
928 aOutMap.SetOrigin(
929 Point(
930 basegfx::fround(-aBound.getMinX() - aHalfPixelInMtf.getWidth()),
931 basegfx::fround(-aBound.getMinY() - aHalfPixelInMtf.getHeight()) ) );
932 aOut->SetRelativeMapMode( aOutMap );
933
934 sdr::contact::DisplayInfo aDisplayInfo;
935
936 if(mpCurrentPage)
937 {
938 if(mpCurrentPage->TRG_HasMasterPage() && pPage->IsMasterPage())
939 {
940 // MasterPage is processed as another page's SubContent
941 aDisplayInfo.SetProcessLayers(mpCurrentPage->TRG_GetMasterPageVisibleLayers());
942 aDisplayInfo.SetSubContentActive(true);
943 }
944 }
945
946 if(!aShapes.empty())
947 {
948 // more effective way to paint a vector of SdrObjects. Hand over the processed page
949 // to have it in the
950 ImplExportCheckVisisbilityRedirector aCheckVisibilityRedirector(mpCurrentPage);
951 sdr::contact::ObjectContactOfObjListPainter aMultiObjectPainter(*aOut, std::move(aShapes), mpCurrentPage);
952 aMultiObjectPainter.SetViewObjectContactRedirector(&aCheckVisibilityRedirector);
953
954 aMultiObjectPainter.ProcessDisplay(aDisplayInfo);
955 }
956
957 aMtf.Stop();
958 aMtf.WindStart();
959
960 // tdf#126319 Immediately add needed size to target's PrefSize
961 // tdf#150102 Checked that in aBound is indeed the size - 1 (probably
962 // due to old integer stuff using Size()/Rectangle() and getWidth()/GetWidth()
963 // with the old one-less paradigm somewhere), so just correct to the
964 // correct size. Be aware that checking of tdf#126319 is needed, but
965 // looks good in my tests. Still: Changing the central UNO API Metafile
966 // export is always a risky thing, so it will have to show if this will
967 // not influence something else.
968 const Size aBoundSize(
969 basegfx::fround(aBound.getWidth() + 1),
970 basegfx::fround(aBound.getHeight() + 1));
971 aMtf.SetPrefMapMode( aMap );
972 aMtf.SetPrefSize( aBoundSize );
973
974 if( !bVectorType )
975 {
976 Size aOutSize;
977 aGraphic = GetBitmapFromMetaFile( aMtf, CalcSize( rSettings.mnWidth, rSettings.mnHeight, aBoundSize, aOutSize ) );
978 }
979 else
980 {
981 aGraphic = aMtf;
982 }
983 }
984 }
985
986 pTempBackgroundShape.clear();
987
988 rOutl.SetCalcFieldValueHdl( maOldCalcFieldValueHdl );
989
990 // #i102251#
991 rOutl.SetControlWord(nOldCntrl);
992
993 return bRet;
994
995}
996
997// XFilter
998sal_Bool SAL_CALL GraphicExporter::filter( const Sequence< PropertyValue >& aDescriptor )
999{
1000 ::SolarMutexGuard aGuard;
1001
1002 if( maGraphic.IsNone() && nullptr == mpUnoPage )
1003 return false;
1004
1005 if( maGraphic.IsNone() && ( nullptr == mpUnoPage->GetSdrPage() || nullptr == mpDoc ) )
1006 return false;
1007
1009
1010 // get the arguments from the descriptor
1011 ExportSettings aSettings;
1012 ParseSettings(aDescriptor, aSettings);
1013
1014 const sal_uInt16 nFilter = !aSettings.maMediaType.isEmpty()
1015 ? rFilter.GetExportFormatNumberForMediaType( aSettings.maMediaType )
1016 : rFilter.GetExportFormatNumberForShortName( aSettings.maFilterName );
1017 bool bVectorType = !rFilter.IsExportPixelFormat( nFilter );
1018
1019 // create the output stuff
1020 Graphic aGraphic = maGraphic;
1021
1022 ErrCode nStatus = ERRCODE_NONE;
1023 if (maGraphic.IsNone())
1024 {
1025 bool bAntiAliasing = SvtOptionsDrawinglayer::IsAntiAliasing();
1026 AllSettings aAllSettings = Application::GetSettings();
1027 StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
1028 bool bUseFontAAFromSystem = aStyleSettings.GetUseFontAAFromSystem();
1029 if (aSettings.meAntiAliasing != TRISTATE_INDET)
1030 {
1031 // This is safe to do globally as we own the solar mutex.
1032 SvtOptionsDrawinglayer::SetAntiAliasing(aSettings.meAntiAliasing == TRISTATE_TRUE, /*bTemporary*/true);
1033 // Opt in to have AA affect font rendering as well.
1034 aStyleSettings.SetUseFontAAFromSystem(false);
1035 aAllSettings.SetStyleSettings(aStyleSettings);
1036 Application::SetSettings(aAllSettings);
1037 }
1038 nStatus = GetGraphic( aSettings, aGraphic, bVectorType ) ? ERRCODE_NONE : ERRCODE_GRFILTER_FILTERERROR;
1039 if (aSettings.meAntiAliasing != TRISTATE_INDET)
1040 {
1041 SvtOptionsDrawinglayer::SetAntiAliasing(bAntiAliasing, /*bTemporary*/true);
1042 aStyleSettings.SetUseFontAAFromSystem(bUseFontAAFromSystem);
1043 aAllSettings.SetStyleSettings(aStyleSettings);
1044 Application::SetSettings(aAllSettings);
1045 }
1046 }
1047
1048 if( nStatus == ERRCODE_NONE )
1049 {
1050 // export graphic only if it has a size
1051 const Size aGraphSize( aGraphic.GetPrefSize() );
1052 if ( aGraphSize.IsEmpty() )
1053 {
1055 }
1056 else
1057 {
1058 // now we have a graphic, so export it
1059 if( aSettings.mxGraphicRenderer.is() )
1060 {
1061 // render graphic directly into given renderer
1062 aSettings.mxGraphicRenderer->render( aGraphic.GetXGraphic() );
1063 }
1064 else if( aSettings.mxOutputStream.is() )
1065 {
1066 // TODO: Either utilize optional XSeekable functionality for the
1067 // SvOutputStream, or adapt the graphic filter to not seek anymore.
1068 SvMemoryStream aStream( 1024, 1024 );
1069
1070 nStatus = rFilter.ExportGraphic( aGraphic, u"", aStream, nFilter, &aSettings.maFilterData );
1071
1072 // copy temp stream to XOutputStream
1073 SvOutputStream aOutputStream( aSettings.mxOutputStream );
1074 aStream.Seek(0);
1075 aOutputStream.WriteStream( aStream );
1076 }
1077 else
1078 {
1079 INetURLObject aURLObject( aSettings.maURL.Complete );
1080 DBG_ASSERT( aURLObject.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
1081
1082 nStatus = XOutBitmap::ExportGraphic( aGraphic, aURLObject, rFilter, nFilter, &aSettings.maFilterData );
1083 }
1084 }
1085 }
1086
1087 if ( aSettings.mxInteractionHandler.is() && ( nStatus != ERRCODE_NONE ) )
1088 {
1089 Any aInteraction;
1090 Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations{
1091 new ::comphelper::OInteractionApprove()
1092 };
1093
1094 GraphicFilterRequest aErrorCode;
1095 aErrorCode.ErrCode = sal_uInt32(nStatus);
1096 aInteraction <<= aErrorCode;
1097 aSettings.mxInteractionHandler->handle( framework::InteractionRequest::CreateRequest( aInteraction, lContinuations ) );
1098 }
1099 return nStatus == ERRCODE_NONE;
1100}
1101
1102void SAL_CALL GraphicExporter::cancel()
1103{
1104}
1105
1106// XExporter
1107
1109void SAL_CALL GraphicExporter::setSourceDocument( const Reference< lang::XComponent >& xComponent )
1110{
1111 ::SolarMutexGuard aGuard;
1112
1113 mxShapes = nullptr;
1114 mpUnoPage = nullptr;
1115
1116 try
1117 {
1118 // any break inside this one loop while will throw an IllegalArgumentException
1119 do
1120 {
1121 mxPage.set( xComponent, UNO_QUERY );
1122 mxShapes.set( xComponent, UNO_QUERY );
1123 mxShape.set( xComponent, UNO_QUERY );
1124
1125 // Step 1: try a generic XShapes
1126 if( !mxPage.is() && !mxShape.is() && mxShapes.is() )
1127 {
1128 // we do not support empty shape collections
1129 if( 0 == mxShapes->getCount() )
1130 break;
1131
1132 // get first shape to detect corresponding page and model
1133 mxShapes->getByIndex(0) >>= mxShape;
1134 }
1135 else
1136 {
1137 mxShapes = nullptr;
1138 }
1139
1140 // Step 2: try a shape
1141 if( mxShape.is() )
1142 {
1144 {
1145 // This is not a Draw shape, let's see if it's a Writer one.
1146 uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY);
1147 if (!xPropertySet.is())
1148 break;
1149 uno::Reference<graphic::XGraphic> xGraphic(
1150 xPropertySet->getPropertyValue("Graphic"), uno::UNO_QUERY);
1151 if (!xGraphic.is())
1152 break;
1153
1154 maGraphic = Graphic(xGraphic);
1155 if (!maGraphic.IsNone())
1156 return;
1157 else
1158 break;
1159 }
1160
1161 // get page for this shape
1162 Reference< XChild > xChild( mxShape, UNO_QUERY );
1163 if( !xChild.is() )
1164 break;
1165
1166 Reference< XInterface > xInt;
1167 do
1168 {
1169 xInt = xChild->getParent();
1170 mxPage.set( xInt, UNO_QUERY );
1171 if( !mxPage.is() )
1172 xChild.set( xInt, UNO_QUERY );
1173 }
1174 while( !mxPage.is() && xChild.is() );
1175
1176 if( !mxPage.is() )
1177 break;
1178 }
1179
1180 // Step 3: check the page
1181 if( !mxPage.is() )
1182 break;
1183
1184 mpUnoPage = comphelper::getFromUnoTunnel<SvxDrawPage>( mxPage );
1185
1186 if( nullptr == mpUnoPage || nullptr == mpUnoPage->GetSdrPage() )
1187 break;
1188
1189 mpDoc = &mpUnoPage->GetSdrPage()->getSdrModelFromSdrPage();
1190
1191 // Step 4: If we got a generic XShapes test all contained shapes
1192 // if they belong to the same XDrawPage
1193
1194 if( mxShapes.is() )
1195 {
1196 SdrPage* pPage = mpUnoPage->GetSdrPage();
1197 SdrObject* pObj;
1198 Reference< XShape > xShape;
1199
1200 bool bOk = true;
1201
1202 const sal_Int32 nCount = mxShapes->getCount();
1203
1204 // test all but the first shape if they have the same page than
1205 // the first shape
1206 for( sal_Int32 nIndex = 1; bOk && ( nIndex < nCount ); nIndex++ )
1207 {
1208 mxShapes->getByIndex( nIndex ) >>= xShape;
1209 pObj = SdrObject::getSdrObjectFromXShape(xShape);
1210 bOk = pObj && pObj->getSdrPageFromSdrObject() == pPage;
1211 }
1212
1213 if( !bOk )
1214 break;
1215 }
1216
1217 // no errors so far
1218 return;
1219 }
1220 while( false );
1221 }
1222 catch( Exception& )
1223 {
1224 }
1225
1226 throw IllegalArgumentException();
1227}
1228
1229// XServiceInfo
1230OUString SAL_CALL GraphicExporter::getImplementationName( )
1231{
1232 return "com.sun.star.comp.Draw.GraphicExporter";
1233}
1234
1235sal_Bool SAL_CALL GraphicExporter::supportsService( const OUString& ServiceName )
1236{
1237 return cppu::supportsService(this, ServiceName);
1238}
1239
1240Sequence< OUString > SAL_CALL GraphicExporter::getSupportedServiceNames( )
1241{
1242 Sequence< OUString > aSupportedServiceNames { "com.sun.star.drawing.GraphicExportFilter" };
1243 return aSupportedServiceNames;
1244}
1245
1246// XMimeTypeInfo
1247sal_Bool SAL_CALL GraphicExporter::supportsMimeType( const OUString& rMimeTypeName )
1248{
1250 sal_uInt16 nCount = rFilter.GetExportFormatCount();
1251 sal_uInt16 nFilter;
1252 for( nFilter = 0; nFilter < nCount; nFilter++ )
1253 {
1254 if( rMimeTypeName == rFilter.GetExportFormatMediaType( nFilter ) )
1255 {
1256 return true;
1257 }
1258 }
1259
1260 return false;
1261}
1262
1263Sequence< OUString > SAL_CALL GraphicExporter::getSupportedMimeTypeNames( )
1264{
1266 sal_uInt16 nCount = rFilter.GetExportFormatCount();
1267 sal_uInt16 nFilter;
1268 sal_uInt16 nFound = 0;
1269
1270 Sequence< OUString > aSeq( nCount );
1271 OUString* pStr = aSeq.getArray();
1272
1273 for( nFilter = 0; nFilter < nCount; nFilter++ )
1274 {
1275 OUString aMimeType( rFilter.GetExportFormatMediaType( nFilter ) );
1276 if( !aMimeType.isEmpty() )
1277 {
1278 *pStr++ = aMimeType;
1279 nFound++;
1280 }
1281 }
1282
1283 if( nFound < nCount )
1284 aSeq.realloc( nFound );
1285
1286 return aSeq;
1287}
1288
1289}
1290
1292{
1293 Graphic aGraphic;
1294 try
1295 {
1296 rtl::Reference< GraphicExporter > xExporter( new GraphicExporter() );
1297 Reference< XComponent > xComp( rShape.getUnoShape(), UNO_QUERY_THROW );
1298 xExporter->setSourceDocument( xComp );
1299 ExportSettings aSettings;
1300 xExporter->GetGraphic( aSettings, aGraphic, true/*bVector*/ );
1301 }
1302 catch( Exception& )
1303 {
1304 TOOLS_WARN_EXCEPTION("svx", "");
1305 }
1306 return aGraphic;
1307}
1308
1309extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
1311 css::uno::XComponentContext *,
1312 css::uno::Sequence<css::uno::Any> const &)
1313{
1314 return cppu::acquire(new GraphicExporter);
1315}
1316
1317/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator
#define MAX_EXT_PIX
Graphic SvxGetGraphicForShape(SdrObject &rShape)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Draw_GraphicExporter_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
IMPL_LINK(MaskData, PipetteHdl, const OUString &, rId, void)
Definition: _bmpmask.cxx:192
const StyleSettings & GetStyleSettings() const
void SetStyleSettings(const StyleSettings &rSet)
static OutputDevice * GetDefaultDevice()
static const AllSettings & GetSettings()
static void SetSettings(const AllSettings &rSettings)
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
void WindStart()
const Size & GetPrefSize() const
void Clear()
void SetPrefMapMode(const MapMode &rMapMode)
void Record(OutputDevice *pOutDev)
const MapMode & GetPrefMapMode() const
void SetPrefSize(const Size &rSize)
sal_uInt16 GetExportFormatNumberForShortName(std::u16string_view rShortName)
static GraphicFilter & GetGraphicFilter()
bool IsExportPixelFormat(sal_uInt16 nFormat)
sal_uInt16 GetExportFormatNumberForMediaType(std::u16string_view rShortName)
ErrCode ExportGraphic(const Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData=nullptr)
sal_uInt16 GetExportFormatCount() const
OUString GetExportFormatMediaType(sal_uInt16 nFormat)
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
Size GetPrefSize() const
void SetPrefMapMode(const MapMode &rPrefMapMode)
const GDIMetaFile & GetGDIMetaFile() const
GraphicType GetType() const
bool IsNone() const
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
Size GetSizePixel(const OutputDevice *pRefDevice=nullptr) const
void SetPrefSize(const Size &rPrefSize)
INetProtocol GetProtocol() const
void SetOrigin(const Point &rOrigin)
void SetScaleY(const Fraction &rScaleY)
void SetScaleX(const Fraction &rScaleX)
EEControlBits GetControlWord() const
const Link< EditFieldInfo *, void > & GetCalcFieldValueHdl() const
void SetControlWord(EEControlBits nWord)
void SetCalcFieldValueHdl(const Link< EditFieldInfo *, void > &rLink)
void SetBackgroundColor(const Color &rColor)
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
This class represents an embedded or linked bitmap graphic object.
Definition: svdograf.hxx:68
SdrPageView * ShowSdrPage(SdrPage *pPage) override
Definition: svdedxv.cxx:131
Abstract DrawObject.
Definition: svdobj.hxx:260
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
Definition: unoshape.cxx:4020
virtual css::uno::Reference< css::drawing::XShape > getUnoShape()
Definition: svdobj.cxx:2866
SdrPage * getSdrPageFromSdrObject() const
Definition: svdobj.cxx:279
const SfxItemSet & GetItemSet() const
Definition: svdpage.hxx:342
SfxStyleSheet * GetStyleSheet() const
Definition: svdpage.hxx:349
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:379
bool IsMasterPage() const
Definition: svdpage.hxx:464
Size GetSize() const
Definition: svdpage.cxx:1450
sal_Int32 GetUpperBorder() const
Definition: svdpage.cxx:1561
virtual bool checkVisibility(const sdr::contact::ViewObjectContact &rOriginal, const sdr::contact::DisplayInfo &rDisplayInfo, bool bEdit)
this method returns true if the object from the ViewObjectContact should be visible on this page whil...
Definition: svdpage.cxx:1833
sal_Int32 GetRightBorder() const
Definition: svdpage.cxx:1566
sal_Int32 GetLeftBorder() const
Definition: svdpage.cxx:1556
Color GetPageBackgroundColor() const
deprecated returns an averaged background color of this page
Definition: svdpage.cxx:1822
const SdrPageProperties * getCorrectSdrPageProperties() const
Definition: svdpage.cxx:1887
sal_Int32 GetLowerBorder() const
Definition: svdpage.cxx:1571
void SetPageVisible(bool bOn=true)
Definition: svdpntv.hxx:402
virtual void CompleteRedraw(OutputDevice *pOut, const vcl::Region &rReg, sdr::contact::ViewObjectContactRedirector *pRedirector=nullptr)
Definition: svdpntv.cxx:480
void SetHlplVisible(bool bOn=true)
Definition: svdpntv.hxx:408
void SetBordVisible(bool bOn=true)
Definition: svdpntv.hxx:405
void SetGlueVisible(bool bOn=true)
Definition: svdpntv.hxx:410
void SetGridVisible(bool bOn)
Definition: svdpntv.hxx:406
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
bool IsEmpty() const
constexpr tools::Long getHeight() const
constexpr tools::Long Height() const
constexpr tools::Long getWidth() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
bool GetUseFontAAFromSystem() const
void SetUseFontAAFromSystem(bool bUseFontAAFromSystem)
sal_uInt64 Seek(sal_uInt64 nPos)
SdrPage * GetSdrPage() const
Definition: unopage.hxx:77
static OUString CreateRomanString(sal_Int32 nNo, bool bUpper)
static VclPtr< reference_type > Create(Arg &&... arg)
static ErrCode ExportGraphic(const Graphic &rGraphic, const INetURLObject &rURL, GraphicFilter &rFilter, const sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData)
Definition: _xoutbmp.cxx:402
TYPE getWidth() const
TYPE getMinX() const
TYPE getMinY() const
void expand(const Tuple2D< TYPE > &rTuple)
TYPE getHeight() const
basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &aViewInformation) const
static css::uno::Reference< css::task::XInteractionRequest > CreateRequest(const css::uno::Any &aRequest, const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > &lContinuations)
void SetProcessLayers(const SdrLayerIDSet &rSet)
Definition: displayinfo.cxx:34
void SetSubContentActive(bool bNew)
Definition: displayinfo.cxx:68
virtual void ProcessDisplay(DisplayInfo &rDisplayInfo) override
virtual SdrObject * TryToGetSdrObject() const
virtual void createRedirectedPrimitive2DSequence(const sdr::contact::ViewObjectContact &rOriginal, const sdr::contact::DisplayInfo &rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor)
ViewContact & GetViewContact() const
bool Contains(const Point &rPOINT) const
constexpr tools::Long Top() const
constexpr Size GetSize() const
constexpr tools::Long Left() const
int nCount
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
float u
EEControlBits
EmbeddedObjectRef * pObject
#define ERRCODE_NONE
TriState
TRISTATE_FALSE
TRISTATE_INDET
TRISTATE_TRUE
#define ERRCODE_GRFILTER_FILTERERROR
const Graphic maGraphic
sal_Int32 nIndex
Sequence< sal_Int8 > aSeq
constexpr OUStringLiteral aData
void SetAntiAliasing(bool bOn, bool bTemporary)
B2IRange fround(const B2DRange &rRange)
@ Exception
class SvxPropertySetInfoPool
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
std::vector< css::beans::PropertyValue > JsonToPropertyValues(const OString &rJson)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
int i
long Long
HashMap_OWString_Interface aMap
const URL maURL
uno::Reference< drawing::XShape > const mxShape
double mnWidth
double mnHeight
const sal_Unicode *const aMimeType[]
SdrTextObj * DynCastSdrTextObj(SdrObject *pObj)
Definition: svdobj.cxx:3212
BitmapEx convertMetafileToBitmapEx(const GDIMetaFile &rMtf, const basegfx::B2DRange &rTargetRange, const sal_uInt32 nMaximumQuadraticPixels)
Helper to convert any GDIMetaFile to a good quality BitmapEx, using default parameters and graphic::X...
Definition: svdpntv.cxx:107
unsigned char sal_uInt8
unsigned char sal_Bool
sal_uInt16 sal_Unicode