LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewobjectcontactofsdrpage.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 226 269 84.0 %
Date: 2014-04-11 Functions: 49 50 98.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 <svx/sdr/contact/viewobjectcontactofsdrpage.hxx>
      22             : #include <svx/sdr/contact/displayinfo.hxx>
      23             : #include <svx/sdr/contact/viewcontactofsdrpage.hxx>
      24             : #include <svx/svdview.hxx>
      25             : #include <svx/svdpage.hxx>
      26             : #include <svx/sdr/contact/objectcontact.hxx>
      27             : #include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx>
      28             : #include <basegfx/polygon/b2dpolygontools.hxx>
      29             : #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
      30             : #include <drawinglayer/primitive2d/gridprimitive2d.hxx>
      31             : #include <drawinglayer/primitive2d/helplineprimitive2d.hxx>
      32             : #include <basegfx/polygon/b2dpolygon.hxx>
      33             : #include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
      34             : 
      35             : 
      36             : 
      37             : using namespace com::sun::star;
      38             : 
      39             : 
      40             : 
      41             : namespace sdr
      42             : {
      43             :     namespace contact
      44             :     {
      45        1308 :         const SdrPage& ViewObjectContactOfPageSubObject::getPage() const
      46             :         {
      47        1308 :             return static_cast< ViewContactOfPageSubObject& >(GetViewContact()).getPage();
      48             :         }
      49             : 
      50        9380 :         ViewObjectContactOfPageSubObject::ViewObjectContactOfPageSubObject(ObjectContact& rObjectContact, ViewContact& rViewContact)
      51        9380 :         :   ViewObjectContact(rObjectContact, rViewContact)
      52             :         {
      53        9380 :         }
      54             : 
      55        9358 :         ViewObjectContactOfPageSubObject::~ViewObjectContactOfPageSubObject()
      56             :         {
      57        9358 :         }
      58             : 
      59      104056 :         bool ViewObjectContactOfPageSubObject::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
      60             :         {
      61      104056 :             if(rDisplayInfo.GetSubContentActive())
      62             :             {
      63        4920 :                 return false;
      64             :             }
      65             : 
      66       99136 :             if(rDisplayInfo.GetControlLayerProcessingActive())
      67             :             {
      68       34728 :                 return false;
      69             :             }
      70             : 
      71       64408 :             if(!rDisplayInfo.GetPageProcessingActive())
      72             :             {
      73       56150 :                 return false;
      74             :             }
      75             : 
      76        8258 :             if(GetObjectContact().isOutputToPrinter())
      77             :             {
      78           0 :                 return false;
      79             :             }
      80             : 
      81        8258 :             if(!GetObjectContact().TryToGetSdrPageView())
      82             :             {
      83           0 :                 return false;
      84             :             }
      85             : 
      86        8258 :             return true;
      87             :         }
      88             : 
      89        2042 :         bool ViewObjectContactOfPageSubObject::isPrimitiveGhosted(const DisplayInfo& /*rDisplayInfo*/) const
      90             :         {
      91             :             // suppress ghosted for page parts
      92        2042 :             return false;
      93             :         }
      94             :     } // end of namespace contact
      95             : } // end of namespace sdr
      96             : 
      97             : 
      98             : 
      99             : namespace sdr
     100             : {
     101             :     namespace contact
     102             :     {
     103         864 :         ViewObjectContactOfPageBackground::ViewObjectContactOfPageBackground(ObjectContact& rObjectContact, ViewContact& rViewContact)
     104         864 :         :   ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
     105             :         {
     106         864 :         }
     107             : 
     108        1724 :         ViewObjectContactOfPageBackground::~ViewObjectContactOfPageBackground()
     109             :         {
     110        1724 :         }
     111             : 
     112       10504 :         bool ViewObjectContactOfPageBackground::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
     113             :         {
     114       10504 :             if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
     115             :             {
     116        9629 :                 return false;
     117             :             }
     118             : 
     119             :             // no page background for preview renderers
     120         875 :             if(GetObjectContact().IsPreviewRenderer())
     121             :             {
     122          72 :                 return false;
     123             :             }
     124             : 
     125         803 :             return true;
     126             :         }
     127             : 
     128         963 :         drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageBackground::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
     129             :         {
     130             :             // Initialize background. Dependent of IsPageVisible, use ApplicationBackgroundColor or ApplicationDocumentColor. Most
     131             :             // old renderers for export (html, pdf, gallery, ...) set the page to not visible (SetPageVisible(false)). They expect the
     132             :             // given OutputDevice to be initialized with the ApplicationDocumentColor then.
     133         963 :             const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
     134         963 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
     135             : 
     136         963 :             if(pPageView)
     137             :             {
     138         963 :                 const SdrView& rView = pPageView->GetView();
     139         963 :                 Color aInitColor;
     140             : 
     141         963 :                 if(rView.IsPageVisible())
     142             :                 {
     143         530 :                     aInitColor = pPageView->GetApplicationBackgroundColor();
     144             :                 }
     145             :                 else
     146             :                 {
     147         433 :                     aInitColor = pPageView->GetApplicationDocumentColor();
     148             : 
     149         433 :                     if(Color(COL_AUTO) == aInitColor)
     150             :                     {
     151         433 :                         const svtools::ColorConfig aColorConfig;
     152         433 :                         aInitColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
     153             :                     }
     154             :                 }
     155             : 
     156             :                 // init background with InitColor
     157         963 :                 xRetval.realloc(1);
     158         963 :                 const basegfx::BColor aRGBColor(aInitColor.getBColor());
     159         963 :                 xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
     160             :             }
     161             : 
     162         963 :             return xRetval;
     163             :         }
     164             :     } // end of namespace contact
     165             : } // end of namespace sdr
     166             : 
     167             : 
     168             : 
     169             : namespace sdr
     170             : {
     171             :     namespace contact
     172             :     {
     173         740 :         ViewObjectContactOfMasterPage::ViewObjectContactOfMasterPage(ObjectContact& rObjectContact, ViewContact& rViewContact)
     174         740 :         :   ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
     175             :         {
     176         740 :         }
     177             : 
     178        1476 :         ViewObjectContactOfMasterPage::~ViewObjectContactOfMasterPage()
     179             :         {
     180        1476 :         }
     181             : 
     182        9520 :         bool ViewObjectContactOfMasterPage::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
     183             :         {
     184        9520 :             if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
     185             :             {
     186        9137 :                 return false;
     187             :             }
     188             : 
     189             :             // this object is only used for MasterPages. When not the MasterPage is
     190             :             // displayed as a page, but another page is using it as sub-object, the
     191             :             // geometry needs to be hidden
     192         383 :             if(rDisplayInfo.GetSubContentActive())
     193             :             {
     194           0 :                 return false;
     195             :             }
     196             : 
     197         383 :             return true;
     198             :         }
     199             :     } // end of namespace contact
     200             : } // end of namespace sdr
     201             : 
     202             : 
     203             : 
     204             : namespace sdr
     205             : {
     206             :     namespace contact
     207             :     {
     208         864 :         ViewObjectContactOfPageFill::ViewObjectContactOfPageFill(ObjectContact& rObjectContact, ViewContact& rViewContact)
     209         864 :         :   ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
     210             :         {
     211         864 :         }
     212             : 
     213        1724 :         ViewObjectContactOfPageFill::~ViewObjectContactOfPageFill()
     214             :         {
     215        1724 :         }
     216             : 
     217       10504 :         bool ViewObjectContactOfPageFill::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
     218             :         {
     219       10504 :             if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
     220             :             {
     221        9629 :                 return false;
     222             :             }
     223             : 
     224         875 :             SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
     225             : 
     226         875 :             if(!pSdrPageView)
     227             :             {
     228           0 :                 return false;
     229             :             }
     230             : 
     231         875 :             if(!pSdrPageView->GetView().IsPageVisible())
     232             :             {
     233         465 :                 return false;
     234             :             }
     235             : 
     236         410 :             return true;
     237             :         }
     238             : 
     239         570 :         drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageFill::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
     240             :         {
     241         570 :             const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
     242         570 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
     243             : 
     244         570 :             if(pPageView)
     245             :             {
     246         570 :                 const SdrPage& rPage = getPage();
     247             : 
     248         570 :                 const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
     249         570 :                 const basegfx::B2DPolygon aPageFillPolygon(basegfx::tools::createPolygonFromRect(aPageFillRange));
     250         570 :                 Color aPageFillColor;
     251             : 
     252         570 :                 if(pPageView->GetApplicationDocumentColor() != COL_AUTO)
     253             :                 {
     254           0 :                     aPageFillColor = pPageView->GetApplicationDocumentColor();
     255             :                 }
     256             :                 else
     257             :                 {
     258         570 :                     const svtools::ColorConfig aColorConfig;
     259         570 :                     aPageFillColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
     260             :                 }
     261             : 
     262             :                 // create and add primitive
     263         570 :                 xRetval.realloc(1);
     264        1140 :                 const basegfx::BColor aRGBColor(aPageFillColor.getBColor());
     265        1140 :                 xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor));
     266             :             }
     267             : 
     268         570 :             return xRetval;
     269             :         }
     270             :     } // end of namespace contact
     271             : } // end of namespace sdr
     272             : 
     273             : 
     274             : 
     275             : namespace sdr
     276             : {
     277             :     namespace contact
     278             :     {
     279         864 :         ViewObjectContactOfPageShadow::ViewObjectContactOfPageShadow(ObjectContact& rObjectContact, ViewContact& rViewContact)
     280         864 :         :   ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
     281             :         {
     282         864 :         }
     283             : 
     284        1724 :         ViewObjectContactOfPageShadow::~ViewObjectContactOfPageShadow()
     285             :         {
     286        1724 :         }
     287             : 
     288       10504 :         bool ViewObjectContactOfPageShadow::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
     289             :         {
     290       10504 :             if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
     291             :             {
     292        9629 :                 return false;
     293             :             }
     294             : 
     295         875 :             SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
     296             : 
     297         875 :             if(!pSdrPageView)
     298             :             {
     299           0 :                 return false;
     300             :             }
     301             : 
     302         875 :             if(!pSdrPageView->GetView().IsPageVisible())
     303             :             {
     304         465 :                 return false;
     305             :             }
     306             : 
     307             :             // no page shadow for preview renderers
     308         410 :             if(GetObjectContact().IsPreviewRenderer())
     309             :             {
     310           0 :                 return false;
     311             :             }
     312             : 
     313             :             // no page shadow for high contrast mode
     314         410 :             if(GetObjectContact().isDrawModeHighContrast())
     315             :             {
     316           0 :                 return false;
     317             :             }
     318             : 
     319         410 :             return true;
     320             :         }
     321             :     } // end of namespace contact
     322             : } // end of namespace sdr
     323             : 
     324             : 
     325             : 
     326             : namespace sdr
     327             : {
     328             :     namespace contact
     329             :     {
     330         864 :         ViewObjectContactOfOuterPageBorder::ViewObjectContactOfOuterPageBorder(ObjectContact& rObjectContact, ViewContact& rViewContact)
     331         864 :         :   ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
     332             :         {
     333         864 :         }
     334             : 
     335        1724 :         ViewObjectContactOfOuterPageBorder::~ViewObjectContactOfOuterPageBorder()
     336             :         {
     337        1724 :         }
     338             : 
     339       10504 :         bool ViewObjectContactOfOuterPageBorder::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
     340             :         {
     341       10504 :             if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
     342             :             {
     343        9629 :                 return false;
     344             :             }
     345             : 
     346         875 :             SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
     347             : 
     348         875 :             if(!pSdrPageView)
     349             :             {
     350           0 :                 return false;
     351             :             }
     352             : 
     353         875 :             const SdrView& rView = pSdrPageView->GetView();
     354             : 
     355         875 :             if(!rView.IsPageVisible() && rView.IsPageBorderVisible())
     356             :             {
     357          87 :                 return false;
     358             :             }
     359             : 
     360         788 :             return true;
     361             :         }
     362             :     } // end of namespace contact
     363             : } // end of namespace sdr
     364             : 
     365             : 
     366             : 
     367             : namespace sdr
     368             : {
     369             :     namespace contact
     370             :     {
     371         864 :         ViewObjectContactOfInnerPageBorder::ViewObjectContactOfInnerPageBorder(ObjectContact& rObjectContact, ViewContact& rViewContact)
     372         864 :         :   ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
     373             :         {
     374         864 :         }
     375             : 
     376        1724 :         ViewObjectContactOfInnerPageBorder::~ViewObjectContactOfInnerPageBorder()
     377             :         {
     378        1724 :         }
     379             : 
     380       10504 :         bool ViewObjectContactOfInnerPageBorder::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
     381             :         {
     382       10504 :             if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
     383             :             {
     384        9629 :                 return false;
     385             :             }
     386             : 
     387         875 :             SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
     388             : 
     389         875 :             if(!pSdrPageView)
     390             :             {
     391           0 :                 return false;
     392             :             }
     393             : 
     394         875 :             if(!pSdrPageView->GetView().IsBordVisible())
     395             :             {
     396         465 :                 return false;
     397             :             }
     398             : 
     399         410 :             const SdrPage& rPage = getPage();
     400             : 
     401         410 :             if(!rPage.GetLftBorder() && !rPage.GetUppBorder() && !rPage.GetRgtBorder() && !rPage.GetLwrBorder())
     402             :             {
     403          46 :                 return false;
     404             :             }
     405             : 
     406             :             // no inner page border for preview renderers
     407         364 :             if(GetObjectContact().IsPreviewRenderer())
     408             :             {
     409           0 :                 return false;
     410             :             }
     411             : 
     412         364 :             return true;
     413             :         }
     414             :     } // end of namespace contact
     415             : } // end of namespace sdr
     416             : 
     417             : 
     418             : 
     419             : namespace sdr
     420             : {
     421             :     namespace contact
     422             :     {
     423         864 :         ViewObjectContactOfPageHierarchy::ViewObjectContactOfPageHierarchy(ObjectContact& rObjectContact, ViewContact& rViewContact)
     424         864 :         :   ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
     425             :         {
     426         864 :         }
     427             : 
     428        1724 :         ViewObjectContactOfPageHierarchy::~ViewObjectContactOfPageHierarchy()
     429             :         {
     430        1724 :         }
     431             : 
     432       10504 :         drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageHierarchy::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
     433             :         {
     434       10504 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
     435             : 
     436             :             // process local sub-hierarchy
     437       10504 :             const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
     438             : 
     439       10504 :             if(nSubHierarchyCount)
     440             :             {
     441       10077 :                 xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo);
     442             : 
     443       10077 :                 if(xRetval.hasElements())
     444             :                 {
     445             :                     // get ranges
     446        3576 :                     const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
     447        3576 :                     const basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
     448        3576 :                     const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
     449             : 
     450             :                     // check geometrical visibility
     451        3576 :                     if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
     452             :                     {
     453             :                         // not visible, release
     454           0 :                         xRetval.realloc(0);
     455             :                     }
     456             :                 }
     457             :             }
     458             : 
     459       10504 :             return xRetval;
     460             :         }
     461             :     } // end of namespace contact
     462             : } // end of namespace sdr
     463             : 
     464             : 
     465             : 
     466             : namespace sdr
     467             : {
     468             :     namespace contact
     469             :     {
     470        1728 :         ViewObjectContactOfPageGrid::ViewObjectContactOfPageGrid(ObjectContact& rObjectContact, ViewContact& rViewContact)
     471        1728 :         :   ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
     472             :         {
     473        1728 :         }
     474             : 
     475        3448 :         ViewObjectContactOfPageGrid::~ViewObjectContactOfPageGrid()
     476             :         {
     477        3448 :         }
     478             : 
     479       21008 :         bool ViewObjectContactOfPageGrid::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
     480             :         {
     481       21008 :             if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
     482             :             {
     483       19258 :                 return false;
     484             :             }
     485             : 
     486        1750 :             SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
     487             : 
     488        1750 :             if(!pSdrPageView)
     489             :             {
     490           0 :                 return false;
     491             :             }
     492             : 
     493        1750 :             const SdrView& rView = pSdrPageView->GetView();
     494             : 
     495        1750 :             if(!rView.IsGridVisible())
     496             :             {
     497        1750 :                 return false;
     498             :             }
     499             : 
     500             :             // no page grid for preview renderers
     501           0 :             if(GetObjectContact().IsPreviewRenderer())
     502             :             {
     503           0 :                 return false;
     504             :             }
     505             : 
     506           0 :             if(static_cast< ViewContactOfGrid& >(GetViewContact()).getFront() != (bool)rView.IsGridFront())
     507             :             {
     508           0 :                 return false;
     509             :             }
     510             : 
     511           0 :             return true;
     512             :         }
     513             : 
     514         328 :         drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageGrid::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
     515             :         {
     516         328 :             const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
     517         328 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
     518             : 
     519         328 :             if(pPageView)
     520             :             {
     521         328 :                 const SdrView& rView = pPageView->GetView();
     522         328 :                 const SdrPage& rPage = getPage();
     523         328 :                 const Color aGridColor(rView.GetGridColor());
     524         328 :                 const basegfx::BColor aRGBGridColor(aGridColor.getBColor());
     525             : 
     526         656 :                 basegfx::B2DHomMatrix aGridMatrix;
     527         328 :                 aGridMatrix.set(0, 0, (double)(rPage.GetWdt() - (rPage.GetRgtBorder() + rPage.GetLftBorder())));
     528         328 :                 aGridMatrix.set(1, 1, (double)(rPage.GetHgt() - (rPage.GetLwrBorder() + rPage.GetUppBorder())));
     529         328 :                 aGridMatrix.set(0, 2, (double)rPage.GetLftBorder());
     530         328 :                 aGridMatrix.set(1, 2, (double)rPage.GetUppBorder());
     531             : 
     532         328 :                 const Size aRaw(rView.GetGridCoarse());
     533         328 :                 const Size aFine(rView.GetGridFine());
     534         328 :                 const double fWidthX(aRaw.getWidth());
     535         328 :                 const double fWidthY(aRaw.getHeight());
     536         328 :                 const sal_uInt32 nSubdivisionsX(aFine.getWidth() ? aRaw.getWidth() / aFine.getWidth() : 0L);
     537         328 :                 const sal_uInt32 nSubdivisionsY(aFine.getHeight() ? aRaw.getHeight() / aFine.getHeight() : 0L);
     538             : 
     539         328 :                 xRetval.realloc(1);
     540         656 :                 xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::GridPrimitive2D(
     541             :                     aGridMatrix, fWidthX, fWidthY, 10.0, 3.0, nSubdivisionsX, nSubdivisionsY, aRGBGridColor,
     542        1312 :                     drawinglayer::primitive2d::createDefaultCross_3x3(aRGBGridColor)));
     543             :             }
     544             : 
     545         328 :             return xRetval;
     546             :         }
     547             :     } // end of namespace contact
     548             : } // end of namespace sdr
     549             : 
     550             : 
     551             : 
     552             : namespace sdr
     553             : {
     554             :     namespace contact
     555             :     {
     556        1728 :         ViewObjectContactOfPageHelplines::ViewObjectContactOfPageHelplines(ObjectContact& rObjectContact, ViewContact& rViewContact)
     557        1728 :         :   ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
     558             :         {
     559        1728 :         }
     560             : 
     561        3448 :         ViewObjectContactOfPageHelplines::~ViewObjectContactOfPageHelplines()
     562             :         {
     563        3448 :         }
     564             : 
     565       21008 :         bool ViewObjectContactOfPageHelplines::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
     566             :         {
     567       21008 :             if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
     568             :             {
     569       19258 :                 return false;
     570             :             }
     571             : 
     572        1750 :             SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
     573             : 
     574        1750 :             if(!pSdrPageView)
     575             :             {
     576           0 :                 return false;
     577             :             }
     578             : 
     579        1750 :             const SdrView& rView = pSdrPageView->GetView();
     580             : 
     581        1750 :             if(!rView.IsHlplVisible())
     582             :             {
     583        1750 :                 return false;
     584             :             }
     585             : 
     586             :             // no helplines for preview renderers
     587           0 :             if(GetObjectContact().IsPreviewRenderer())
     588             :             {
     589           0 :                 return false;
     590             :             }
     591             : 
     592           0 :             if(static_cast< ViewContactOfHelplines& >(GetViewContact()).getFront() != (bool)rView.IsHlplFront())
     593             :             {
     594           0 :                 return false;
     595             :             }
     596             : 
     597           0 :             return true;
     598             :         }
     599             : 
     600         532 :         drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageHelplines::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
     601             :         {
     602         532 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
     603         532 :             const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
     604             : 
     605         532 :             if(pPageView)
     606             :             {
     607         532 :                 const SdrHelpLineList& rHelpLineList = pPageView->GetHelpLines();
     608         532 :                 const sal_uInt32 nCount(rHelpLineList.GetCount());
     609             : 
     610         532 :                 if(nCount)
     611             :                 {
     612           0 :                     const basegfx::BColor aRGBColorA(1.0, 1.0, 1.0);
     613           0 :                     const basegfx::BColor aRGBColorB(0.0, 0.0, 0.0);
     614           0 :                     xRetval.realloc(nCount);
     615             : 
     616           0 :                     for(sal_uInt32 a(0L); a < nCount; a++)
     617             :                     {
     618           0 :                         const SdrHelpLine& rHelpLine = rHelpLineList[(sal_uInt16)a];
     619           0 :                         const basegfx::B2DPoint aPosition((double)rHelpLine.GetPos().X(), (double)rHelpLine.GetPos().Y());
     620           0 :                         const double fDiscreteDashLength(4.0);
     621             : 
     622           0 :                         switch(rHelpLine.GetKind())
     623             :                         {
     624             :                             default : // SDRHELPLINE_POINT
     625             :                             {
     626           0 :                                 xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D(
     627             :                                     aPosition, basegfx::B2DVector(1.0, 0.0), drawinglayer::primitive2d::HELPLINESTYLE2D_POINT,
     628           0 :                                     aRGBColorA, aRGBColorB, fDiscreteDashLength));
     629           0 :                                 break;
     630             :                             }
     631             :                             case SDRHELPLINE_VERTICAL :
     632             :                             {
     633           0 :                                 xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D(
     634             :                                     aPosition, basegfx::B2DVector(0.0, 1.0), drawinglayer::primitive2d::HELPLINESTYLE2D_LINE,
     635           0 :                                     aRGBColorA, aRGBColorB, fDiscreteDashLength));
     636           0 :                                 break;
     637             :                             }
     638             :                             case SDRHELPLINE_HORIZONTAL :
     639             :                             {
     640           0 :                                 xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D(
     641             :                                     aPosition, basegfx::B2DVector(1.0, 0.0), drawinglayer::primitive2d::HELPLINESTYLE2D_LINE,
     642           0 :                                     aRGBColorA, aRGBColorB, fDiscreteDashLength));
     643           0 :                                 break;
     644             :                             }
     645             :                         }
     646           0 :                     }
     647             :                 }
     648             :             }
     649             : 
     650         532 :             return xRetval;
     651             :         }
     652             :     } // end of namespace contact
     653             : } // end of namespace sdr
     654             : 
     655             : 
     656             : 
     657             : namespace sdr
     658             : {
     659             :     namespace contact
     660             :     {
     661        1742 :         ViewObjectContactOfSdrPage::ViewObjectContactOfSdrPage(ObjectContact& rObjectContact, ViewContact& rViewContact)
     662        1742 :         :   ViewObjectContact(rObjectContact, rViewContact)
     663             :         {
     664        1742 :         }
     665             : 
     666        3480 :         ViewObjectContactOfSdrPage::~ViewObjectContactOfSdrPage()
     667             :         {
     668        3480 :         }
     669             : 
     670       10504 :         drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfSdrPage::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
     671             :         {
     672       10504 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
     673             : 
     674             :             // process local sub-hierarchy
     675       10504 :             const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
     676             : 
     677       10504 :             if(nSubHierarchyCount)
     678             :             {
     679             :                 const sal_Bool bDoGhostedDisplaying(
     680       10504 :                     GetObjectContact().DoVisualizeEnteredGroup()
     681       10504 :                     && !GetObjectContact().isOutputToPrinter()
     682       21008 :                     && GetObjectContact().getActiveViewContact() == &GetViewContact());
     683             : 
     684       10504 :                 if(bDoGhostedDisplaying)
     685             :                 {
     686       10012 :                     rDisplayInfo.ClearGhostedDrawMode();
     687             :                 }
     688             : 
     689             :                 // create object hierarchy
     690       10504 :                 xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo);
     691             : 
     692       10504 :                 if(xRetval.hasElements())
     693             :                 {
     694             :                     // get ranges
     695        3590 :                     const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
     696        3590 :                     const basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
     697        3590 :                     const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
     698             : 
     699             :                     // check geometrical visibility
     700        3590 :                     if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
     701             :                     {
     702             :                         // not visible, release
     703           0 :                         xRetval.realloc(0);
     704             :                     }
     705             :                 }
     706             : 
     707       10504 :                 if(bDoGhostedDisplaying)
     708             :                 {
     709       10012 :                     rDisplayInfo.SetGhostedDrawMode();
     710             :                 }
     711             :             }
     712             : 
     713       10504 :             return xRetval;
     714             :         }
     715             :     } // end of namespace contact
     716             : } // end of namespace sdr
     717             : 
     718             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10