49#include <osl/diagnose.h>
60 if(&(candidate->GetOutputDevice()) == &rOut)
62 return candidate.get();
66 if(
nullptr != candidate->getPatched() && &(candidate->getPatched()->GetOutputDevice()) == &rOut)
83 [&](
const std::unique_ptr<SdrPaintWindow>&
p) { return p.get() == &rOld; });
110 const sal_uInt32 nMaximumQuadraticPixels)
125 nMaximumQuadraticPixels);
133 , mpActualOutDev(nullptr)
135 , mpDefaultStyleSheet(nullptr)
136 , maDefaultAttr(rSdrModel.GetItemPool())
137 , maComeBackIdle(
"svx::SdrPaintView aComeBackIdle" )
143 , mbPageVisible(true)
144 , mbPageShadowVisible(true)
145 , mbPageBorderVisible(true)
146 , mbBordVisible(true)
147 , mbGridVisible(true)
149 , mbHlplVisible(true)
151 , mbGlueVisible(false)
152 , mbGlueVisible2(false)
153 , mbGlueVisible3(false)
154 , mbGlueVisible4(false)
155 , mbSomeObjChgdFlag(false)
156 , mbSwapAsynchron(false)
157 , mbPrintPreview(false)
158 , mbAnimationPause(false)
159 , mbBufferedOutputAllowed(false)
160 , mbBufferedOverlayAllowed(false)
161 , mbPageDecorationAllowed(true)
162 , mbMasterPageVisualizationAllowed(true)
163 , mbPreviewRenderer(false)
167 , mbHideFormControl(false)
168 , mbPaintTextEdit(true)
201 if (rHint.
GetId() == SfxHintId::Dying)
206 if (rHint.
GetId() != SfxHintId::ThisIsAnSdrHint)
241 if (mbSomeObjChgdFlag) {
242 mbSomeObjChgdFlag=
false;
306 if (nMinMov>=0)
return sal_uInt16(nMinMov);
320 if (nHitTol>=0)
return sal_uInt16(nHitTol);
394 mpPageView->AddPaintWindowToPageView(*pNewPaintWindow);
406 mpPageView->RemovePaintWindowFromPageView(*pCandidate);
482#ifdef SVX_REPAINT_TIMER_TEST
483#define REMEMBERED_TIMES_COUNT (10)
484 static bool bDoTimerTest(
false);
485 static bool bTimesInited(
false);
486 static sal_uInt32 nRepeatCount(10);
487 static double fLastTimes[REMEMBERED_TIMES_COUNT];
494 count = nRepeatCount;
521 OSL_ENSURE(pPaintWindow,
"SdrPaintView::CompleteRedraw: No OutDev (!)");
526#ifdef SVX_REPAINT_TIMER_TEST
532 const sal_uInt64 nNeededTime(nStopTime - nStartTime);
533 const double fTimePerPaint((
double)nNeededTime / (
double)nRepeatCount);
537 for(
a = 0;
a < REMEMBERED_TIMES_COUNT;
a++)
539 fLastTimes[
a] = fTimePerPaint;
546 for(
a = 1;
a < REMEMBERED_TIMES_COUNT;
a++)
548 fLastTimes[
a - 1] = fLastTimes[
a];
551 fLastTimes[REMEMBERED_TIMES_COUNT - 1] = fTimePerPaint;
554 double fAddedTimes(0.0);
556 for(
a = 0;
a < REMEMBERED_TIMES_COUNT;
a++)
558 fAddedTimes += fLastTimes[
a];
561 const double fAverageTimePerPaint(fAddedTimes / (
double)REMEMBERED_TIMES_COUNT);
563 fprintf(stderr,
"-----------(start result)----------\n");
564 fprintf(stderr,
"StartTime : %" SAL_PRIuUINT64
", StopTime: %" SAL_PRIuUINT64
", NeededTime: %" SAL_PRIuUINT64
", TimePerPaint: %f\n", nStartTime, nStopTime, nNeededTime, fTimePerPaint);
565 fprintf(stderr,
"Remembered times: ");
567 for(
a = 0;
a < REMEMBERED_TIMES_COUNT;
a++)
569 fprintf(stderr,
"%d: %f ",
a, fLastTimes[
a]);
572 fprintf(stderr,
"\n");
573 fprintf(stderr,
"AverageTimePerPaint: %f\n", fAverageTimePerPaint);
574 fprintf(stderr,
"-----------(stop result)----------\n");
584 OSL_ENSURE(
pOut,
"SdrPaintView::BeginCompleteRedraw: No OutDev (!)");
610 mpPageView->CompleteRedraw(rPaintWindow, rReg, pRedirector);
616 std::unique_ptr<SdrPaintWindow> pPaintWindow;
620 pPaintWindow.reset(&rPaintWindow);
621 pPaintWindow->setTemporaryTarget(
false);
627 delete &rPaintWindow;
646 static_cast< SdrView*
>(
this)->TextEditDrawing(rPaintWindow);
655 [
this, &bRequireMasterPage, &rPaintWindow] (
SdrView* pView)
657 SdrPageView* pCurrentPageView = pView->GetSdrPageView();
658 bool bIsCurrentMasterPage = (pCurrentPageView && pCurrentPageView->GetPage()) ?
659 pCurrentPageView->GetPage()->IsMasterPage() : false;
661 if (pView == this || bRequireMasterPage != bIsCurrentMasterPage)
664 if (pView->IsTextEdit() && pView->GetSdrPageView())
666 pView->TextEditDrawing(rPaintWindow);
685 OSL_ENSURE(pPaintWindow,
"SdrPaintView::BeginDrawLayers: No SdrPaintWindow (!)");
699 mpPageView->setPreparedPageWindow(pKnownTarget);
721 OSL_ENSURE(pPaintWindow,
"SdrPaintView::UpdateDrawLayersRegion: No SdrPaintWindow (!)");
731 mpPageView->setPreparedPageWindow(pKnownTarget);
760 return aOptimizedRepaintRegion;
779 mpPageView->setPreparedPageWindow(pKnownTarget);
800 for(sal_uInt32 nWinNum(0); nWinNum < nWindowCount; nWinNum++)
812 for (
size_t nObjNum=0; nObjNum<nObjCount; ++nObjNum) {
815 if (pGPL!=
nullptr && pGPL->
GetCount()!=0) {
828 for(sal_uInt32
a(0);
a < nWindowCount;
a++)
843 for(sal_uInt32
a(0);
a < nWindowCount;
a++)
912 if (pLayer!=
nullptr) {
940 bool bHasEEFeatureItems=
false;
946 sal_uInt16 nW=pItem->Which();
951 if(bHasEEFeatureItems)
954 VclMessageType::Info, VclButtonsType::Ok,
955 "SdrPaintView::SetDefaultAttr(): Setting EE_FEATURE items at the SdrView does not make sense! It only leads to overhead and unreadable documents."));
973 if (pStyleSheet!=
nullptr && !bDontRemoveHardAttr) {
1031 bool bNewScale=
false;
1032 bool bNeedMoreX=aNewSize.
Width()>aActualSize.
Width();
1033 bool bNeedMoreY=aNewSize.
Height()>aActualSize.
Height();
1034 if (bNeedMoreX || bNeedMoreY)
1040 if (aYFact>aXFact) aXFact=aYFact;
1041 aXFact*=
aMap.GetScaleX();
1043 aMap.SetScaleX(aXFact);
1044 aMap.SetScaleY(aYFact);
1054 if (l>rRect.
Left()) dx=rRect.
Left()-l;
1055 else if (r<rRect.
Right()) dx=rRect.
Right()-r;
1056 if (o>rRect.
Top()) dy=rRect.
Top()-o;
1060 if (dx!=0 || dy!=0) {
1090 for(sal_uInt32 b(0); b <
mpPageView->PageWindowCount(); b++)
1146 mpPageView->SetApplicationBackgroundColor(aBackgroundColor);
1155 mpPageView->SetApplicationDocumentColor(aDocumentColor);
1208 for(sal_uInt32
a(0);
a <
mpPageView->PageWindowCount();
a++)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
void ReduceInaccurate(unsigned nSignificantBits)
virtual void Start(bool bStartTimer=true) override
const Point & GetOrigin() const
Size GetOutputSize() const
const MapMode & GetMapMode() const
virtual vcl::Window * GetOwnerWindow() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
bool IsMeasureTool() const
void Invalidate(vcl::Window &rWin, const SdrObject *pObj) const
sal_uInt16 GetCount() const
const SdrPage * GetPage() const
SdrHintKind GetKind() const
const OUString & GetControlLayerName() const
SdrLayer * GetLayerPerID(SdrLayerID nID)
SdrLayerID GetLayerID(const OUString &rName) const
const OUString & GetName() const
const SdrLayerAdmin & GetLayerAdmin() const
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual const SdrGluePointList * GetGluePointList() const
SdrPage * GetPage() const
void PrepareRedraw(const vcl::Region &rReg)
SdrPaintWindow & GetPaintWindow() const
const sdr::contact::ObjectContact & GetObjectContact() const
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
bool IsMasterPage() const
bool IsGroupEntered() const
Determine, whether Leave is useful or not.
virtual void MovAction(const Point &rPnt)
virtual void DeleteDeviceFromPaintView(OutputDevice &rOldDev)
virtual void AddDeviceToPaintView(OutputDevice &rNewDev, vcl::Window *pWindow)
void SetLayerLocked(const OUString &rName, bool bLock=true)
void LeaveOneGroup()
Leave an object group of all visible Pages (like chdir .. in MS-DOS)
void LeaveAllGroup()
Leave all entered object groups of all visible Pages (like chdir \ in MS-DOS)
bool IsBufferedOverlayAllowed() const
SdrPaintWindow * FindPaintWindow(const OutputDevice &rOut) const
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
bool IsBufferedOutputAllowed() const
static vcl::Region OptimizeDrawLayersRegion(const OutputDevice *pOut, const vcl::Region &rReg, bool bDisableIntersect)
virtual void DoConnect(SdrOle2Obj *pOleObj)
For Plugins Is called by the Paint of the OLE object.
void SetApplicationDocumentColor(Color aDocumentColor)
void SetAttributes(const SfxItemSet &rSet, bool bReplaceAll)
virtual void CompleteRedraw(OutputDevice *pOut, const vcl::Region &rReg, sdr::contact::ViewObjectContactRedirector *pRedirector=nullptr)
virtual SdrPaintWindow * BeginCompleteRedraw(OutputDevice *pOut)
SfxStyleSheet * GetStyleSheet() const
sal_uInt16 ImpGetMinMovLogic(short nMinMov, const OutputDevice *pOut) const
void UpdateDrawLayersRegion(const OutputDevice *pOut, const vcl::Region &rReg)
SdrAnimationMode meAnimationMode
OutputDevice * GetFirstOutputDevice() const
svtools::ColorConfig maColorConfig
bool IsLayerVisible(const OUString &rName) const
void SetAnimationTimer(sal_uInt32 nTime)
void SetApplicationBackgroundColor(Color aBackgroundColor)
virtual void ClearPageView()
bool IsLayerPrintable(const OUString &rName) const
std::unique_ptr< SdrPageView > mpPageView
void SetBufferedOverlayAllowed(bool bNew)
void DoCompleteRedraw(SdrPaintWindow &rPaintWindow, const vcl::Region &rReg, sdr::contact::ViewObjectContactRedirector *pRedirector=nullptr)
bool mbBufferedOverlayAllowed
void SetAnimationEnabled(bool bEnable=true)
void MergeNotPersistDefaultAttr(SfxItemSet &rAttr) const
virtual SdrPageView * ShowSdrPage(SdrPage *pPage)
virtual void TakeActionRect(tools::Rectangle &rRect) const
void SetLayerPrintable(const OUString &rName, bool bPrn)
void EndDrawLayers(SdrPaintWindow &rPaintWindow, bool bPaintFormLayer)
virtual bool IsAction() const
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin)
void ImpFormLayerDrawing(SdrPaintWindow &rPaintWindow)
virtual bool IsTextEdit() const
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr) const
virtual ~SdrPaintView() override
void ConfigurationChanged(::utl::ConfigurationBroadcaster *, ConfigurationHints) override
sal_uInt16 ImpGetHitTolLogic(short nHitTol, const OutputDevice *pOut) const
void SetDefaultStyleSheet(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr)
VclPtr< OutputDevice > mpActualOutDev
virtual void InvalidateOneWin(OutputDevice &rWin)
If the View should not call Invalidate() on the windows, override the following 2 methods and do some...
virtual bool KeyInput(const KeyEvent &rKEvt, vcl::Window *pWin)
sal_uInt32 PaintWindowCount() const
void SetNotPersistDefaultAttr(const SfxItemSet &rAttr)
bool IsLayerLocked(const OUString &rName) const
void SetMasterPageVisualizationAllowed(bool bNew)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
SfxStyleSheet * mpDefaultStyleSheet
bool mbBufferedOutputAllowed
bool mbPageDecorationAllowed
void SetActualWin(const OutputDevice *pWin)
virtual void HideSdrPage()
void DeletePaintWindow(const SdrPaintWindow &rOld)
bool mbMasterPageVisualizationAllowed
void SetDefaultAttr(const SfxItemSet &rAttr, bool bReplaceAll)
Default attributes at the View Newly created objects are assigned these attributes by default when th...
SdrPaintView(SdrModel &rSdrModel, OutputDevice *pOut)
void onChangeColorConfig()
SdrPageView * GetSdrPageView() const
virtual void EndCompleteRedraw(SdrPaintWindow &rPaintWindow, bool bPaintFormLayer)
void SetAnimationPause(bool bSet)
Set/unset pause state for animations.
SdrModel & GetModel() const
void SetStyleSheet(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr)
void SetAnimationMode(const SdrAnimationMode eMode)
Mode when starting an animation in the Paint Handler:
void FlushComeBackTimer() const
virtual void ModelHasChanged()
void SetBufferedOutputAllowed(bool bNew)
void GlueInvalidate() const
void SetLayerVisible(const OUString &rName, bool bShow)
void SetPageDecorationAllowed(bool bNew)
SdrPaintWindow * BeginDrawLayers(OutputDevice *pOut, const vcl::Region &rReg, bool bDisableIntersect=false)
std::vector< std::unique_ptr< SdrPaintWindow > > maPaintWindows
const vcl::Region & GetRedrawRegion() const
void DrawOverlay(const vcl::Region &rRegion)
void setTemporaryTarget(bool bNew)
OutputDevice & GetTargetOutputDevice()
OutputDevice & GetOutputDevice() const
bool OutputToWindow() const
void SetRedrawRegion(const vcl::Region &rNew)
SdrPaintWindow * getPatched() const
void OutputPreRenderDevice(const vcl::Region &rExpandedRegion)
bool getTemporaryTarget() const
void PreparePreRenderDevice()
void Broadcast(const SfxHint &rHint)
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool Set(const SfxItemSet &, bool bDeep=true)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
virtual SfxItemSet & GetItemSet()
SfxItemState GetItemState(bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void SetPriority(TaskPriority ePriority)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
B2DVector getRange() const
B2DPoint getMinimum() const
SAL_DLLPRIVATE bool IsPaused() const
SAL_DLLPRIVATE void SetTime(sal_uInt32 nTime)
SAL_DLLPRIVATE void SetPaused(bool bNew)
void Intersect(const tools::Rectangle &rRegion)
virtual bool IsChart() const
const MapMode & GetMapMode() const
::OutputDevice const * GetOutDev() const
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
vcl::Region GetPaintRegion() const
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr sal_uInt16 EE_FEATURE_END(EE_FEATURE_FIELD+0)
constexpr sal_uInt16 EE_FEATURE_START(EE_CHAR_END+1)
#define LINK(Instance, Class, Member)
void ForAllViews(const SdrPage *pPage, std::function< void(SdrView *)> f)
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
BitmapEx convertPrimitive2DContainerToBitmapEx(primitive2d::Primitive2DContainer &&rSequence, const basegfx::B2DRange &rTargetRange, sal_uInt32 nMaximumQuadraticPixels, const o3tl::Length eTargetUnit, const std::optional< Size > &rTargetDPI)
HashMap_OWString_Interface aMap
bool IsInvalidItem(const SfxPoolItem *pItem)
constexpr TypedWhichId< SdrLayerNameItem > SDRATTR_LAYERNAME(SDRATTR_NOTPERSIST_FIRST+4)
constexpr TypedWhichId< SdrLayerIdItem > SDRATTR_LAYERID(SDRATTR_NOTPERSIST_FIRST+3)
IMPL_LINK_NOARG(SdrPaintView, ImpComeBackHdl, Timer *, void)
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...
constexpr SdrLayerID SDRLAYER_NOTFOUND(-1)