/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// the SdrPageView this window belongs to
SdrPageView& mrPageView;
// the PaintWindow to paint on. Here is access to OutDev etc. // #i72752# change to pointer to allow patcing it in DrawLayer() if necessary
SdrPaintWindow* mpPaintWindow;
SdrPaintWindow* mpOriginalPaintWindow;
// UNO stuff for xControls
uno::Reference<awt::XControlContainer> mxControlContainer;
// #100394# xC->setVisible triggers window->Show() and this has // problems when the view is not completely constructed which may // happen when loading. This leads to accessibility broadcasts which // throw asserts due to the not finished view. All this chain can be avoided // since xC->setVisible is here called only for the side effect in // UnoControlContainer::setVisible(...) which calls createPeer(...). // This will now be called directly from here.
SdrPaintWindow* SdrPageWindow::patchPaintWindow(SdrPaintWindow& rPaintWindow)
{ if (!mpImpl) return nullptr;
if (!mpImpl->mpOriginalPaintWindow)
{ // first patch
mpImpl->mpOriginalPaintWindow = mpImpl->mpPaintWindow;
mpImpl->mpPaintWindow = &rPaintWindow;
mpImpl->mpOriginalPaintWindow->setPatched(&rPaintWindow); return mpImpl->mpOriginalPaintWindow;
} else
{ // second or more patch auto pPreviousPaintWindow = mpImpl->mpPaintWindow;
mpImpl->mpPaintWindow = &rPaintWindow;
mpImpl->mpOriginalPaintWindow->setPatched(&rPaintWindow); return pPreviousPaintWindow;
}
}
void SdrPageWindow::unpatchPaintWindow(SdrPaintWindow* pPreviousPaintWindow)
{ if (pPreviousPaintWindow == mpImpl->mpOriginalPaintWindow)
{ // first patch
mpImpl->mpPaintWindow = mpImpl->mpOriginalPaintWindow;
mpImpl->mpOriginalPaintWindow->setPatched(nullptr);
mpImpl->mpOriginalPaintWindow = nullptr;
} else
{ // second or more patch
mpImpl->mpPaintWindow = pPreviousPaintWindow;
mpImpl->mpOriginalPaintWindow->setPatched(pPreviousPaintWindow);
}
}
void SdrPageWindow::PrePaint()
{ // give OC the chance to do ProcessDisplay preparations if(HasObjectContact())
{
GetObjectContact().PrepareProcessDisplay();
}
}
void SdrPageWindow::PrepareRedraw(const vcl::Region& rReg)
{ // give OC the chance to do ProcessDisplay preparations if(HasObjectContact())
{
GetObjectContact().PrepareProcessDisplay();
}
// if necessary, remember changed RedrawArea at PaintWindow for usage with // overlay and PreRenderDevice stuff
GetPaintWindow().SetRedrawRegion(rReg);
}
if(aPolyA.count() && aPolyA.isClosed() && aPolyB.count())
{ // poly A is the clipregion, clip poly b against it. Algo depends on // poly b being closed.
basegfx::B2DPolyPolygon aResult(basegfx::utils::clipPolyPolygonOnPolyPolygon(aPolyB, aPolyA));
for(autoconst& rPolygon : aResult)
{ int nR = comphelper::rng::uniform_int_distribution(0, 254); int nG = comphelper::rng::uniform_int_distribution(0, 254); int nB = comphelper::rng::uniform_int_distribution(0, 254);
Color aColor(nR, nG, nB);
impPaintStrokePolygon(rPolygon, rOutDev, aColor);
}
}
}
}
}
} // end of anonymous namespace #endif// CLIPPER_TEST
void SdrPageWindow::RedrawAll( sdr::contact::ViewObjectContactRedirector* pRedirector )
{ // set Redirector
GetObjectContact().SetViewObjectContactRedirector(pRedirector);
// get to be processed layers constbool bPrinter(GetPaintWindow().OutputToPrinter());
SdrLayerIDSet aProcessLayers = bPrinter ? mpImpl->mrPageView.GetPrintableLayers() : mpImpl->mrPageView.GetVisibleLayers();
// create PaintInfoRec; use Rectangle only temporarily const vcl::Region& rRegion = GetPaintWindow().GetRedrawRegion();
// create processing data
sdr::contact::DisplayInfo aDisplayInfo;
// Draw all layers. do NOT draw form layer from CompleteRedraw, this is done separately // as a single layer paint const SdrLayerAdmin& rLayerAdmin = rModel.GetLayerAdmin(); const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID(rLayerAdmin.GetControlLayerName());
aProcessLayers.Clear(nControlLayerId);
// still something to paint? if(!aProcessLayers.IsEmpty())
{
aDisplayInfo.SetProcessLayers(aProcessLayers);
// Set region as redraw area
aDisplayInfo.SetRedrawArea(rRegion);
// get the layers to process constbool bPrinter(GetPaintWindow().OutputToPrinter());
SdrLayerIDSet aProcessLayers = bPrinter ? mpImpl->mrPageView.GetPrintableLayers() : mpImpl->mrPageView.GetVisibleLayers();
// is the given layer visible at all? if(aProcessLayers.IsSet(*pId))
{ // find out if we are painting the ControlLayer const SdrLayerAdmin& rLayerAdmin = rModel.GetLayerAdmin(); const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID(rLayerAdmin.GetControlLayerName()); constbool bControlLayerProcessingActive(nControlLayerId == *pId);
// create PaintInfoRec, use Rectangle only temporarily const vcl::Region& rRegion = GetPaintWindow().GetRedrawRegion();
// create processing data
sdr::contact::DisplayInfo aDisplayInfo;
// is it the control layer? If Yes, set flag
aDisplayInfo.SetControlLayerProcessingActive(bControlLayerProcessingActive);
// Draw just the one given layer
aProcessLayers.ClearAll();
aProcessLayers.Set(*pId);
aDisplayInfo.SetProcessLayers(aProcessLayers);
// Set region as redraw area
aDisplayInfo.SetRedrawArea(rRegion);
// Writer or calc, coming from original RedrawOneLayer. // #i72889# no page painting or MasterPage painting for layer painting constbool bOldPageDecorationAllowed(GetPageView().GetView().IsPageDecorationAllowed()); constbool bOldMasterPageVisualizationAllowed(GetPageView().GetView().IsMasterPageVisualizationAllowed());
GetPageView().GetView().SetPageDecorationAllowed(false);
GetPageView().GetView().SetMasterPageVisualizationAllowed(false);
if (pPageFrame) // Writer page frame for anchor based clipping
{
aDisplayInfo.SetWriterPageFrame(*pPageFrame);
}
// Invalidate call, used from ObjectContact(OfPageView) in InvalidatePartOfView(...) void SdrPageWindow::InvalidatePageWindow(const basegfx::B2DRange& rRange)
{ if (GetPageView().IsVisible() && GetPaintWindow().OutputToWindow())
{
OutputDevice& rWindow(GetPaintWindow().GetOutputDevice());
basegfx::B2DRange aDiscreteRange(rRange);
aDiscreteRange.transform(rWindow.GetViewTransformation());
if (SvtOptionsDrawinglayer::IsAntiAliasing())
{ // invalidate one discrete unit more under the assumption that AA // needs one pixel more
aDiscreteRange.grow(1.0);
}
// If the shapes use negative X coordinates, make them positive before sending // the invalidation rectangle. bool bNegativeX = mpImpl->mrPageView.GetView().IsNegativeX();
constbool bWasMapModeEnabled(rWindow.IsMapModeEnabled());
rWindow.EnableMapMode(false);
GetPageView().GetView().InvalidateOneWin(rWindow, aVCLDiscreteRectangle);
rWindow.EnableMapMode(bWasMapModeEnabled);
} elseif (comphelper::LibreOfficeKit::isActive())
{ // we don't really have to have a paint window with LOK; OTOH we know // that the drawinglayer units are 100ths of mm, so they are easy to // convert to twips
// If the shapes use negative X coordinates, make them positive before sending // the invalidation rectangle. bool bNegativeX = mpImpl->mrPageView.GetView().IsNegativeX(); const tools::Rectangle aRect100thMM( static_cast<tools::Long>(bNegativeX ? std::max(0.0, ceil(-rRange.getMaxX())) : floor(rRange.getMinX())), static_cast<tools::Long>(floor(rRange.getMinY())), static_cast<tools::Long>(bNegativeX ? std::max(0.0, floor(-rRange.getMinX())) : ceil(rRange.getMaxX())), static_cast<tools::Long>(ceil(rRange.getMaxY())));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.