LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/tools - PreviewRenderer.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 223 0.0 %
Date: 2012-12-17 Functions: 0 19 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      21             : #include "PreviewRenderer.hxx"
      22             : 
      23             : #include "DrawDocShell.hxx"
      24             : #include "drawdoc.hxx"
      25             : #include "drawview.hxx"
      26             : #include "sdpage.hxx"
      27             : #include "ViewShell.hxx"
      28             : #include <vcl/virdev.hxx>
      29             : #include <svx/svdpagv.hxx>
      30             : #include <svx/svdoutl.hxx>
      31             : #include <editeng/eeitem.hxx>
      32             : #include <editeng/editstat.hxx>
      33             : #include <vcl/svapp.hxx>
      34             : #include <tools/diagnose_ex.h>
      35             : #include <svx/sdr/contact/viewobjectcontact.hxx>
      36             : #include <svx/sdr/contact/viewcontact.hxx>
      37             : 
      38             : using namespace ::com::sun::star;
      39             : using namespace ::com::sun::star::uno;
      40             : 
      41             : 
      42             : namespace sd {
      43             : 
      44             : const int PreviewRenderer::snSubstitutionTextSize = 11;
      45             : const int PreviewRenderer::snFrameWidth = 1;
      46             : 
      47             : namespace {
      48             :     /** This incarnation of the ViewObjectContactRedirector filters away all
      49             :         PageObj objects, unconditionally.
      50             :     */
      51             :     class ViewRedirector : public ::sdr::contact::ViewObjectContactRedirector
      52             :     {
      53             :     public:
      54             :         ViewRedirector (void);
      55             :         virtual ~ViewRedirector (void);
      56             :         virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
      57             :             const sdr::contact::ViewObjectContact& rOriginal,
      58             :                 const sdr::contact::DisplayInfo& rDisplayInfo);
      59             :     };
      60             : }
      61             : 
      62             : 
      63             : 
      64             : 
      65             : //===== PreviewRenderer =======================================================
      66             : 
      67           0 : PreviewRenderer::PreviewRenderer (
      68             :     OutputDevice* pTemplate,
      69             :     const bool bHasFrame)
      70           0 :     : mpPreviewDevice (new VirtualDevice()),
      71             :       mpView(NULL),
      72             :       mpDocShellOfView(NULL),
      73           0 :       maFrameColor (svtools::ColorConfig().GetColorValue(svtools::DOCBOUNDARIES).nColor),
      74           0 :       mbHasFrame(bHasFrame)
      75             : {
      76           0 :     if (pTemplate != NULL)
      77             :     {
      78           0 :         mpPreviewDevice->SetDigitLanguage (pTemplate->GetDigitLanguage());
      79           0 :         mpPreviewDevice->SetBackground(pTemplate->GetBackground());
      80             :     }
      81             :     else
      82             :     {
      83           0 :         mpPreviewDevice->SetBackground(Wallpaper(
      84           0 :             Application::GetSettings().GetStyleSettings().GetWindowColor()));
      85             :     }
      86           0 : }
      87             : 
      88             : 
      89             : 
      90             : 
      91           0 : PreviewRenderer::~PreviewRenderer (void)
      92             : {
      93           0 :     if (mpDocShellOfView != NULL)
      94           0 :         EndListening (*mpDocShellOfView);
      95           0 : }
      96             : 
      97             : 
      98             : 
      99             : 
     100           0 : Image PreviewRenderer::RenderPage (
     101             :     const SdPage* pPage,
     102             :     const sal_Int32 nWidth,
     103             :     const String& rSubstitutionText,
     104             :     const bool bObeyHighContrastMode,
     105             :     const bool bDisplayPresentationObjects)
     106             : {
     107           0 :     if (pPage != NULL)
     108             :     {
     109           0 :         const Size aPageModelSize (pPage->GetSize());
     110             :         const double nAspectRatio (
     111           0 :             double(aPageModelSize.Width()) / double(aPageModelSize.Height()));
     112           0 :         const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0);
     113             :         const sal_Int32 nHeight (sal::static_int_cast<sal_Int32>(
     114           0 :             (nWidth - 2*nFrameWidth) / nAspectRatio + 2*nFrameWidth + 0.5));
     115             :         return RenderPage (
     116             :             pPage,
     117             :             Size(nWidth,nHeight),
     118             :             rSubstitutionText,
     119             :             bObeyHighContrastMode,
     120           0 :             bDisplayPresentationObjects);
     121             :     }
     122             :     else
     123           0 :         return Image();
     124             : }
     125             : 
     126             : 
     127             : 
     128             : 
     129           0 : Image PreviewRenderer::RenderPage (
     130             :     const SdPage* pPage,
     131             :     Size aPixelSize,
     132             :     const String& rSubstitutionText,
     133             :     const bool bObeyHighContrastMode,
     134             :     const bool bDisplayPresentationObjects)
     135             : {
     136           0 :     Image aPreview;
     137             : 
     138           0 :     if (pPage != NULL)
     139             :     {
     140             :         try
     141             :         {
     142           0 :             if (Initialize(pPage, aPixelSize, bObeyHighContrastMode))
     143             :             {
     144           0 :                 PaintPage(pPage, bDisplayPresentationObjects);
     145           0 :                 PaintSubstitutionText(rSubstitutionText);
     146           0 :                 PaintFrame();
     147             : 
     148           0 :                 Size aSize (mpPreviewDevice->GetOutputSizePixel());
     149           0 :                 aPreview = mpPreviewDevice->GetBitmap (
     150           0 :                     mpPreviewDevice->PixelToLogic(Point(0,0)),
     151           0 :                     mpPreviewDevice->PixelToLogic(aSize));
     152             : 
     153           0 :                 Cleanup();
     154             :             }
     155             :         }
     156           0 :         catch (const com::sun::star::uno::Exception&)
     157             :         {
     158             :             DBG_UNHANDLED_EXCEPTION();
     159             :         }
     160             :     }
     161             : 
     162           0 :     return aPreview;
     163             : }
     164             : 
     165             : 
     166             : 
     167             : 
     168           0 : Image PreviewRenderer::RenderSubstitution (
     169             :     const Size& rPreviewPixelSize,
     170             :     const String& rSubstitutionText)
     171             : {
     172           0 :     Image aPreview;
     173             : 
     174             :     try
     175             :     {
     176             :         // Set size.
     177           0 :         mpPreviewDevice->SetOutputSizePixel(rPreviewPixelSize);
     178             : 
     179             :         // Adjust contrast mode.
     180             :         const bool bUseContrast (
     181           0 :             Application::GetSettings().GetStyleSettings().GetHighContrastMode());
     182           0 :         mpPreviewDevice->SetDrawMode (bUseContrast
     183             :             ? ViewShell::OUTPUT_DRAWMODE_CONTRAST
     184           0 :             : ViewShell::OUTPUT_DRAWMODE_COLOR);
     185             : 
     186             :         // Set a map mode that makes a typical substitution text completely
     187             :         // visible.
     188           0 :         MapMode aMapMode (mpPreviewDevice->GetMapMode());
     189           0 :         aMapMode.SetMapUnit(MAP_100TH_MM);
     190           0 :         const double nFinalScale (25.0 * rPreviewPixelSize.Width() / 28000.0);
     191           0 :         aMapMode.SetScaleX(nFinalScale);
     192           0 :         aMapMode.SetScaleY(nFinalScale);
     193           0 :         const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0);
     194           0 :         aMapMode.SetOrigin(mpPreviewDevice->PixelToLogic(
     195           0 :             Point(nFrameWidth,nFrameWidth),aMapMode));
     196           0 :         mpPreviewDevice->SetMapMode (aMapMode);
     197             : 
     198             :         // Clear the background.
     199             :         const Rectangle aPaintRectangle (
     200             :             Point(0,0),
     201           0 :             mpPreviewDevice->GetOutputSizePixel());
     202           0 :         mpPreviewDevice->EnableMapMode(sal_False);
     203           0 :         mpPreviewDevice->SetLineColor();
     204           0 :         svtools::ColorConfig aColorConfig;
     205           0 :         mpPreviewDevice->SetFillColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
     206           0 :         mpPreviewDevice->DrawRect (aPaintRectangle);
     207           0 :         mpPreviewDevice->EnableMapMode(sal_True);
     208             : 
     209             :         // Paint substitution text and a frame around it.
     210           0 :         PaintSubstitutionText (rSubstitutionText);
     211           0 :         PaintFrame();
     212             : 
     213           0 :         const Size aSize (mpPreviewDevice->GetOutputSizePixel());
     214           0 :         aPreview = mpPreviewDevice->GetBitmap (
     215           0 :             mpPreviewDevice->PixelToLogic(Point(0,0)),
     216           0 :             mpPreviewDevice->PixelToLogic(aSize));
     217             :     }
     218           0 :     catch (const com::sun::star::uno::Exception&)
     219             :     {
     220             :         DBG_UNHANDLED_EXCEPTION();
     221             :     }
     222             : 
     223           0 :     return aPreview;
     224             : }
     225             : 
     226             : 
     227             : 
     228             : 
     229           0 : bool PreviewRenderer::Initialize (
     230             :     const SdPage* pPage,
     231             :     const Size& rPixelSize,
     232             :     const bool bObeyHighContrastMode)
     233             : {
     234           0 :     if (pPage == NULL)
     235           0 :         return false;
     236             : 
     237           0 :     SdrModel* pModel = pPage->GetModel();
     238           0 :     if (pModel == NULL)
     239           0 :         return false;
     240             : 
     241           0 :     SetupOutputSize(*pPage, rPixelSize);
     242             : 
     243             :     SdDrawDocument* pDocument
     244           0 :         = static_cast<SdDrawDocument*>(pPage->GetModel());
     245           0 :     DrawDocShell* pDocShell = pDocument->GetDocSh();
     246             : 
     247             :     // Create view
     248           0 :     ProvideView (pDocShell);
     249           0 :     if (mpView.get() == NULL)
     250           0 :         return false;
     251             : 
     252             :     // Adjust contrast mode.
     253             :     bool bUseContrast (bObeyHighContrastMode
     254           0 :         && Application::GetSettings().GetStyleSettings().GetHighContrastMode());
     255           0 :     mpPreviewDevice->SetDrawMode (bUseContrast
     256             :         ? ViewShell::OUTPUT_DRAWMODE_CONTRAST
     257           0 :         : ViewShell::OUTPUT_DRAWMODE_COLOR);
     258           0 :     mpPreviewDevice->SetSettings(Application::GetSettings());
     259             : 
     260             :     // Tell the view to show the given page.
     261           0 :     SdPage* pNonConstPage = const_cast<SdPage*>(pPage);
     262           0 :     if (pPage->IsMasterPage())
     263             :     {
     264           0 :         mpView->ShowSdrPage(mpView->GetModel()->GetMasterPage(pPage->GetPageNum()));
     265             :     }
     266             :     else
     267             :     {
     268           0 :         mpView->ShowSdrPage(pNonConstPage);
     269             :     }
     270             : 
     271             :     // Make sure that a page view exists.
     272           0 :     SdrPageView* pPageView = mpView->GetSdrPageView();
     273             : 
     274           0 :     if (pPageView == NULL)
     275           0 :         return false;
     276             : 
     277             :     // Set background color of page view and outliner.
     278           0 :     svtools::ColorConfig aColorConfig;
     279           0 :     const Color aPageBackgroundColor(pPage->GetPageBackgroundColor(pPageView));
     280           0 :     pPageView->SetApplicationBackgroundColor(aPageBackgroundColor);
     281           0 :     SdrOutliner& rOutliner (pDocument->GetDrawOutliner(NULL));
     282           0 :     rOutliner.SetBackgroundColor(aPageBackgroundColor);
     283           0 :     rOutliner.SetDefaultLanguage(pDocument->GetLanguage(EE_CHAR_LANGUAGE));
     284           0 :     mpView->SetApplicationBackgroundColor(
     285           0 :         Color(aColorConfig.GetColorValue(svtools::APPBACKGROUND).nColor));
     286           0 :     mpPreviewDevice->SetBackground(Wallpaper(aPageBackgroundColor));
     287           0 :     mpPreviewDevice->Erase();
     288             : 
     289           0 :     return true;
     290             : }
     291             : 
     292             : 
     293             : 
     294             : 
     295           0 : void PreviewRenderer::Cleanup (void)
     296             : {
     297           0 :     mpView->HideSdrPage();
     298           0 : }
     299             : 
     300             : 
     301             : 
     302             : 
     303           0 : void PreviewRenderer::PaintPage (
     304             :     const SdPage* pPage,
     305             :     const bool bDisplayPresentationObjects)
     306             : {
     307             :     // Paint the page.
     308           0 :     Rectangle aPaintRectangle (Point(0,0), pPage->GetSize());
     309           0 :     Region aRegion (aPaintRectangle);
     310             : 
     311             :     // Turn off online spelling and redlining.
     312           0 :     SdrOutliner* pOutliner = NULL;
     313           0 :     sal_uLong nSavedControlWord (0);
     314           0 :     if (mpDocShellOfView!=NULL && mpDocShellOfView->GetDoc()!=NULL)
     315             :     {
     316           0 :         pOutliner = &mpDocShellOfView->GetDoc()->GetDrawOutliner();
     317           0 :         nSavedControlWord = pOutliner->GetControlWord();
     318           0 :         pOutliner->SetControlWord((nSavedControlWord & ~EE_CNTRL_ONLINESPELLING));
     319             :     }
     320             : 
     321             :     // Use a special redirector to prevent PresObj shapes from being painted.
     322           0 :     boost::scoped_ptr<ViewRedirector> pRedirector;
     323           0 :     if ( ! bDisplayPresentationObjects)
     324           0 :         pRedirector.reset(new ViewRedirector());
     325             : 
     326             :     try
     327             :     {
     328           0 :         mpView->CompleteRedraw(mpPreviewDevice.get(), aRegion, pRedirector.get());
     329             :     }
     330           0 :     catch (const ::com::sun::star::uno::Exception&)
     331             :     {
     332             :         DBG_UNHANDLED_EXCEPTION();
     333             :     }
     334             : 
     335             :     // Restore the previous online spelling and redlining states.
     336           0 :     if (pOutliner != NULL)
     337           0 :         pOutliner->SetControlWord(nSavedControlWord);
     338           0 : }
     339             : 
     340             : 
     341             : 
     342             : 
     343           0 : void PreviewRenderer::PaintSubstitutionText (const String& rSubstitutionText)
     344             : {
     345           0 :     if (rSubstitutionText.Len() > 0)
     346             :     {
     347             :         // Set the font size.
     348           0 :         const Font& rOriginalFont (mpPreviewDevice->GetFont());
     349           0 :         Font aFont (mpPreviewDevice->GetSettings().GetStyleSettings().GetAppFont());
     350           0 :         sal_Int32 nHeight (mpPreviewDevice->PixelToLogic(Size(0,snSubstitutionTextSize)).Height());
     351           0 :         aFont.SetHeight(nHeight);
     352           0 :         mpPreviewDevice->SetFont (aFont);
     353             : 
     354             :         // Paint the substitution text.
     355             :         Rectangle aTextBox (
     356             :             Point(0,0),
     357           0 :             mpPreviewDevice->PixelToLogic(
     358           0 :                 mpPreviewDevice->GetOutputSizePixel()));
     359             :         sal_uInt16 nTextStyle =
     360             :             TEXT_DRAW_CENTER
     361             :             | TEXT_DRAW_VCENTER
     362             :             | TEXT_DRAW_MULTILINE
     363           0 :             | TEXT_DRAW_WORDBREAK;
     364           0 :         mpPreviewDevice->DrawText (aTextBox, rSubstitutionText, nTextStyle);
     365             : 
     366             :         // Restore the font.
     367           0 :         mpPreviewDevice->SetFont (rOriginalFont);
     368             :     }
     369           0 : }
     370             : 
     371             : 
     372             : 
     373             : 
     374           0 : void PreviewRenderer::PaintFrame (void)
     375             : {
     376           0 :     if (mbHasFrame)
     377             :     {
     378             :         // Paint a frame arround the preview.
     379             :         Rectangle aPaintRectangle (
     380             :             Point(0,0),
     381           0 :             mpPreviewDevice->GetOutputSizePixel());
     382           0 :         mpPreviewDevice->EnableMapMode(sal_False);
     383           0 :         mpPreviewDevice->SetLineColor(maFrameColor);
     384           0 :         mpPreviewDevice->SetFillColor();
     385           0 :         mpPreviewDevice->DrawRect(aPaintRectangle);
     386           0 :         mpPreviewDevice->EnableMapMode(sal_True);
     387             :      }
     388           0 : }
     389             : 
     390             : 
     391             : 
     392             : 
     393           0 : void PreviewRenderer::SetupOutputSize (
     394             :     const SdPage& rPage,
     395             :     const Size& rFramePixelSize)
     396             : {
     397             :     // First set the map mode to some arbitrary scale that is numerically
     398             :     // stable.
     399           0 :     MapMode aMapMode (mpPreviewDevice->GetMapMode());
     400           0 :     aMapMode.SetMapUnit(MAP_PIXEL);
     401             : 
     402             :     // Adapt it to the desired width.
     403           0 :     const Size aPageModelSize (rPage.GetSize());
     404           0 :     if (aPageModelSize.Width()>0 || aPageModelSize.Height()>0)
     405             :     {
     406           0 :         const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0);
     407             :         aMapMode.SetScaleX(
     408           0 :             Fraction(rFramePixelSize.Width()-2*nFrameWidth-1, aPageModelSize.Width()));
     409             :         aMapMode.SetScaleY(
     410           0 :             Fraction(rFramePixelSize.Height()-2*nFrameWidth-1, aPageModelSize.Height()));
     411           0 :         aMapMode.SetOrigin(mpPreviewDevice->PixelToLogic(Point(nFrameWidth,nFrameWidth),aMapMode));
     412             :     }
     413             :     else
     414             :     {
     415             :         // We should never get here.
     416             :         OSL_ASSERT(false);
     417           0 :         aMapMode.SetScaleX(1.0);
     418           0 :         aMapMode.SetScaleY(1.0);
     419             :     }
     420           0 :     mpPreviewDevice->SetMapMode (aMapMode);
     421           0 :     mpPreviewDevice->SetOutputSizePixel(rFramePixelSize);
     422           0 : }
     423             : 
     424             : 
     425             : 
     426             : 
     427           0 : void PreviewRenderer::ProvideView (DrawDocShell* pDocShell)
     428             : {
     429           0 :     if (pDocShell != mpDocShellOfView)
     430             :     {
     431             :         // Destroy the view that is connected to the current doc shell.
     432           0 :         mpView.reset (NULL);
     433             : 
     434             :         // Switch our attention, i.e. listening for DYING events, to
     435             :         // the new doc shell.
     436           0 :         if (mpDocShellOfView != NULL)
     437           0 :             EndListening (*mpDocShellOfView);
     438           0 :         mpDocShellOfView = pDocShell;
     439           0 :         if (mpDocShellOfView != NULL)
     440           0 :             StartListening (*mpDocShellOfView);
     441             :     }
     442           0 :     if (mpView.get() == NULL)
     443             :     {
     444           0 :         mpView.reset (new DrawView (pDocShell, mpPreviewDevice.get(), NULL));
     445             :     }
     446           0 :     mpView->SetPreviewRenderer(true);
     447             : #if 1
     448           0 :     mpView->SetPageVisible(false);
     449           0 :     mpView->SetPageBorderVisible(true);
     450           0 :     mpView->SetBordVisible(false);
     451           0 :     mpView->SetGridVisible(false);
     452           0 :     mpView->SetHlplVisible(false);
     453           0 :     mpView->SetGlueVisible(false);
     454             : 
     455             : #else
     456             :     // This works in the slide sorter but prevents the master page
     457             :     // background being painted in the list of current master pages in the
     458             :     // task manager.
     459             :     mpView->SetPagePaintingAllowed(false);
     460             : #endif
     461           0 : }
     462             : 
     463             : 
     464             : 
     465             : 
     466           0 : Image PreviewRenderer::ScaleBitmap (
     467             :     const BitmapEx& rBitmapEx,
     468             :     int nWidth)
     469             : {
     470           0 :     Image aPreview;
     471             : 
     472             :     do
     473             :     {
     474             :         // Adjust contrast mode.
     475           0 :         bool bUseContrast = Application::GetSettings().GetStyleSettings().
     476           0 :             GetHighContrastMode();
     477           0 :         mpPreviewDevice->SetDrawMode (bUseContrast
     478             :             ? ViewShell::OUTPUT_DRAWMODE_CONTRAST
     479           0 :             : ViewShell::OUTPUT_DRAWMODE_COLOR);
     480             : 
     481             :         // Set output size.
     482           0 :         Size aSize (rBitmapEx.GetSizePixel());
     483           0 :         if (aSize.Width() <= 0)
     484             :             break;
     485             :         Size aFrameSize (
     486             :             nWidth,
     487           0 :             (long)((nWidth*1.0 * aSize.Height()) / aSize.Width() + 0.5));
     488           0 :         Size aPreviewSize (aFrameSize.Width()-2,aFrameSize.Height()-2);
     489           0 :         MapMode aMapMode (mpPreviewDevice->GetMapMode());
     490           0 :         aMapMode.SetMapUnit(MAP_PIXEL);
     491           0 :         aMapMode.SetOrigin (Point());
     492           0 :         aMapMode.SetScaleX (1.0);
     493           0 :         aMapMode.SetScaleY (1.0);
     494           0 :         mpPreviewDevice->SetMapMode (aMapMode);
     495           0 :         mpPreviewDevice->SetOutputSize (aFrameSize);
     496             : 
     497             :         // Paint a frame arround the preview.
     498           0 :         mpPreviewDevice->SetLineColor (maFrameColor);
     499           0 :         mpPreviewDevice->SetFillColor ();
     500           0 :         mpPreviewDevice->DrawRect (Rectangle(Point(0,0), aFrameSize));
     501             : 
     502             :         // Paint the bitmap scaled to the desired width.
     503           0 :         BitmapEx aScaledBitmap (rBitmapEx.GetBitmap());
     504           0 :         aScaledBitmap.Scale (aPreviewSize, BMP_SCALE_BEST);
     505           0 :         mpPreviewDevice->DrawBitmap (
     506             :             Point(1,1),
     507             :             aPreviewSize,
     508           0 :             aScaledBitmap.GetBitmap());
     509             : 
     510             :         // Get the resulting bitmap.
     511           0 :         aPreview = mpPreviewDevice->GetBitmap (Point(0,0), aFrameSize);
     512             :     }
     513             :     while (false);
     514             : 
     515           0 :     return aPreview;
     516             : }
     517             : 
     518             : 
     519             : 
     520             : 
     521           0 : void PreviewRenderer::Notify(SfxBroadcaster&, const SfxHint& rHint)
     522             : {
     523           0 :     if (rHint.IsA(TYPE(SfxSimpleHint))
     524             :         && mpDocShellOfView != NULL)
     525             :     {
     526           0 :         const SfxSimpleHint* pSimpleHint = PTR_CAST(SfxSimpleHint, &rHint);
     527           0 :         if (pSimpleHint != NULL
     528           0 :             && pSimpleHint->GetId() == SFX_HINT_DYING)
     529             :         {
     530             :             // The doc shell is dying.  Our view uses its item pool and
     531             :             // has to be destroyed as well.  The next call to
     532             :             // ProvideView will create a new one (for another
     533             :             // doc shell, of course.)
     534           0 :             mpView.reset (NULL);
     535           0 :             mpDocShellOfView = NULL;
     536             :         }
     537             :     }
     538           0 : }
     539             : 
     540             : 
     541             : 
     542             : 
     543             : //===== ViewRedirector ========================================================
     544             : 
     545             : namespace {
     546             : 
     547           0 : ViewRedirector::ViewRedirector (void)
     548             : {
     549           0 : }
     550             : 
     551             : 
     552             : 
     553             : 
     554           0 : ViewRedirector::~ViewRedirector (void)
     555             : {
     556           0 : }
     557             : 
     558             : 
     559             : 
     560             : 
     561           0 : drawinglayer::primitive2d::Primitive2DSequence ViewRedirector::createRedirectedPrimitive2DSequence(
     562             :     const sdr::contact::ViewObjectContact& rOriginal,
     563             :     const sdr::contact::DisplayInfo& rDisplayInfo)
     564             : {
     565           0 :     SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
     566             : 
     567           0 :     if (pObject==NULL || pObject->GetPage() == NULL)
     568             :     {
     569             :         // not a SdrObject visualisation (maybe e.g. page) or no page
     570             :         return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
     571             :             rOriginal,
     572           0 :             rDisplayInfo);
     573             :     }
     574             : 
     575           0 :     const bool bDoCreateGeometry (pObject->GetPage()->checkVisibility( rOriginal, rDisplayInfo, true));
     576             : 
     577           0 :     if ( ! bDoCreateGeometry
     578           0 :         && (pObject->GetObjInventor() != SdrInventor || pObject->GetObjIdentifier() != OBJ_PAGE))
     579             :     {
     580           0 :         return drawinglayer::primitive2d::Primitive2DSequence();
     581             :     }
     582             : 
     583           0 :     if (pObject->IsEmptyPresObj())
     584           0 :         return drawinglayer::primitive2d::Primitive2DSequence();
     585             : 
     586             :     return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
     587             :         rOriginal,
     588           0 :         rDisplayInfo);
     589             : }
     590             : 
     591             : } // end of anonymous namespace
     592             : 
     593             : 
     594             : } // end of namespace ::sd
     595             : 
     596             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10