LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewcontactofsdrpage.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 212 253 83.8 %
Date: 2014-11-03 Functions: 49 63 77.8 %
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             : #include <sdr/contact/viewcontactofsdrpage.hxx>
      21             : #include <svx/sdr/contact/viewobjectcontact.hxx>
      22             : #include <svx/svdpage.hxx>
      23             : #include <svx/sdr/contact/displayinfo.hxx>
      24             : #include <sdr/contact/viewobjectcontactofsdrpage.hxx>
      25             : #include <basegfx/polygon/b2dpolygontools.hxx>
      26             : #include <basegfx/matrix/b2dhommatrix.hxx>
      27             : #include <svx/svdpagv.hxx>
      28             : #include <svx/svdview.hxx>
      29             : #include <vcl/svapp.hxx>
      30             : #include <svx/sdr/contact/objectcontact.hxx>
      31             : #include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx>
      32             : #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
      33             : #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
      34             : #include <basegfx/polygon/b2dpolygon.hxx>
      35             : #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
      36             : #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
      37             : #include <vcl/lazydelete.hxx>
      38             : #include <vcl/settings.hxx>
      39             : #include <svx/svdstr.hrc>
      40             : #include <svdglob.hxx>
      41             : #include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx>
      42             : #include <drawinglayer/attribute/sdrfillattribute.hxx>
      43             : 
      44             : namespace sdr { namespace contact {
      45             : 
      46      107118 : ViewContactOfPageSubObject::ViewContactOfPageSubObject(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
      47      107118 : :   mrParentViewContactOfSdrPage(rParentViewContactOfSdrPage)
      48             : {
      49      107118 : }
      50             : 
      51      106689 : ViewContactOfPageSubObject::~ViewContactOfPageSubObject()
      52             : {
      53      106689 : }
      54             : 
      55           0 : ViewContact* ViewContactOfPageSubObject::GetParentContact() const
      56             : {
      57           0 :     return &mrParentViewContactOfSdrPage;
      58             : }
      59             : 
      60      122661 : const SdrPage& ViewContactOfPageSubObject::getPage() const
      61             : {
      62      122661 :     return mrParentViewContactOfSdrPage.GetSdrPage();
      63             : }
      64             : 
      65        3513 : ViewObjectContact& ViewContactOfPageBackground::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
      66             : {
      67        3513 :     ViewObjectContact* pRetval = new ViewObjectContactOfPageBackground(rObjectContact, *this);
      68             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
      69             : 
      70        3513 :     return *pRetval;
      71             : }
      72             : 
      73         623 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageBackground::createViewIndependentPrimitive2DSequence() const
      74             : {
      75             :     // We have only the page information, not the view information. Use the
      76             :     // svtools::DOCCOLOR color for initialisation
      77         623 :     const svtools::ColorConfig aColorConfig;
      78         623 :     const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
      79        1246 :     const basegfx::BColor aRGBColor(aInitColor.getBColor());
      80             :     const drawinglayer::primitive2d::Primitive2DReference xReference(
      81        1246 :         new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
      82             : 
      83        1246 :     return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
      84             : }
      85             : 
      86        9738 : ViewContactOfPageBackground::ViewContactOfPageBackground(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
      87        9738 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
      88             : {
      89        9738 : }
      90             : 
      91        9699 : ViewContactOfPageBackground::~ViewContactOfPageBackground()
      92             : {
      93        9699 : }
      94             : 
      95        3513 : ViewObjectContact& ViewContactOfPageShadow::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
      96             : {
      97        3513 :     ViewObjectContact* pRetval = new ViewObjectContactOfPageShadow(rObjectContact, *this);
      98             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
      99             : 
     100        3513 :     return *pRetval;
     101             : }
     102             : 
     103        1702 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence() const
     104             : {
     105             :     static bool bUseOldPageShadow(false);
     106        1702 :     const SdrPage& rPage = getPage();
     107        1702 :     basegfx::B2DHomMatrix aPageMatrix;
     108        1702 :     aPageMatrix.set(0, 0, (double)rPage.GetWdt());
     109        1702 :     aPageMatrix.set(1, 1, (double)rPage.GetHgt());
     110             : 
     111        1702 :     if(bUseOldPageShadow)
     112             :     {
     113             :         // create page shadow polygon
     114           0 :         const double fPageBorderFactor(1.0 / 256.0);
     115           0 :         basegfx::B2DPolygon aPageShadowPolygon;
     116           0 :         aPageShadowPolygon.append(basegfx::B2DPoint(1.0, fPageBorderFactor));
     117           0 :         aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, fPageBorderFactor));
     118           0 :         aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, 1.0 + fPageBorderFactor));
     119           0 :         aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0 + fPageBorderFactor));
     120           0 :         aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0));
     121           0 :         aPageShadowPolygon.append(basegfx::B2DPoint(1.0, 1.0));
     122           0 :         aPageShadowPolygon.setClosed(true);
     123           0 :         aPageShadowPolygon.transform(aPageMatrix);
     124             : 
     125             :         // We have only the page information, not the view information. Use the
     126             :         // svtools::FONTCOLOR color for initialisation
     127           0 :         const svtools::ColorConfig aColorConfig;
     128           0 :         const Color aShadowColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
     129           0 :         const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
     130             :         const drawinglayer::primitive2d::Primitive2DReference xReference(
     131             :             new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
     132             :                 basegfx::B2DPolyPolygon(aPageShadowPolygon),
     133           0 :                 aRGBShadowColor));
     134             : 
     135           0 :         return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
     136             :     }
     137             :     else
     138             :     {
     139             :         static vcl::DeleteOnDeinit< drawinglayer::primitive2d::DiscreteShadow > aDiscreteShadow(
     140             :             new drawinglayer::primitive2d::DiscreteShadow(
     141             :                 BitmapEx(
     142             :                     ResId(
     143             :                         SIP_SA_PAGESHADOW35X35,
     144        1702 :                         *ImpGetResMgr()))));
     145             : 
     146        1702 :         if(aDiscreteShadow.get())
     147             :         {
     148             :             const drawinglayer::primitive2d::Primitive2DReference xReference(
     149             :                 new drawinglayer::primitive2d::DiscreteShadowPrimitive2D(
     150             :                     aPageMatrix,
     151        1702 :                     *aDiscreteShadow.get()));
     152             : 
     153        1702 :             return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
     154             :         }
     155             : 
     156           0 :         return drawinglayer::primitive2d::Primitive2DSequence();
     157        1702 :     }
     158             : }
     159             : 
     160        9738 : ViewContactOfPageShadow::ViewContactOfPageShadow(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
     161        9738 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
     162             : {
     163        9738 : }
     164             : 
     165        9699 : ViewContactOfPageShadow::~ViewContactOfPageShadow()
     166             : {
     167        9699 : }
     168             : 
     169        3101 : ViewObjectContact& ViewContactOfMasterPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     170             : {
     171        3101 :     ViewObjectContact* pRetval = new ViewObjectContactOfMasterPage(rObjectContact, *this);
     172             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     173             : 
     174        3101 :     return *pRetval;
     175             : }
     176             : 
     177         559 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPage::createViewIndependentPrimitive2DSequence() const
     178             : {
     179         559 :     drawinglayer::primitive2d::Primitive2DSequence xRetval;
     180             : 
     181             :     // this class is used when the page is a MasterPage and is responsible to
     182             :     // create a visualisation for the MPBGO, if exists. This needs to be suppressed
     183             :     // when a SdrPage which uses a MasterPage creates it's output. Suppression
     184             :     // is done in the corresponding VOC since DisplayInfo data is needed
     185         559 :     const SdrPage& rPage = getPage();
     186             : 
     187         559 :     if(rPage.IsMasterPage())
     188             :     {
     189         320 :         if(0 == rPage.GetPageNum())
     190             :         {
     191             :             // #i98063#
     192             :             // filter MasterPage 0 since it's the HandoutPage. Thus, it's a
     193             :             // MasterPage, but has no MPBGO, so there is nothing to do here.
     194             :         }
     195             :         else
     196             :         {
     197         320 :             drawinglayer::attribute::SdrFillAttribute aFill;
     198             : 
     199             :             // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets,
     200             :             // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all
     201             :             // MasterPages should have a StyleSheet excactly for this reason, but historically
     202             :             // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others).
     203         320 :             if(rPage.getSdrPageProperties().GetStyleSheet())
     204             :             {
     205             :                 // create page fill attributes with correct properties
     206         640 :                 aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(
     207         640 :                     rPage.getSdrPageProperties().GetItemSet());
     208             :             }
     209             : 
     210         320 :             if(!aFill.isDefault())
     211             :             {
     212             :                 // direct model data is the page size, get and use it
     213             :                 const basegfx::B2DRange aInnerRange(
     214           0 :                     rPage.GetLftBorder(), rPage.GetUppBorder(),
     215           0 :                     rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder());
     216           0 :                 const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
     217             :                 const drawinglayer::primitive2d::Primitive2DReference xReference(
     218             :                     drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
     219             :                         basegfx::B2DPolyPolygon(aInnerPolgon),
     220             :                         aFill,
     221           0 :                         drawinglayer::attribute::FillGradientAttribute()));
     222             : 
     223           0 :                 xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
     224         320 :             }
     225             :         }
     226             :     }
     227             : 
     228         559 :     return xRetval;
     229             : }
     230             : 
     231        9738 : ViewContactOfMasterPage::ViewContactOfMasterPage(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
     232        9738 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
     233             : {
     234        9738 : }
     235             : 
     236        9699 : ViewContactOfMasterPage::~ViewContactOfMasterPage()
     237             : {
     238        9699 : }
     239             : 
     240        3513 : ViewObjectContact& ViewContactOfPageFill::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     241             : {
     242        3513 :     ViewObjectContact* pRetval = new ViewObjectContactOfPageFill(rObjectContact, *this);
     243             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     244             : 
     245        3513 :     return *pRetval;
     246             : }
     247             : 
     248         623 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageFill::createViewIndependentPrimitive2DSequence() const
     249             : {
     250         623 :     const SdrPage& rPage = getPage();
     251         623 :     const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
     252         623 :     const basegfx::B2DPolygon aPageFillPolygon(basegfx::tools::createPolygonFromRect(aPageFillRange));
     253             : 
     254             :     // We have only the page information, not the view information. Use the
     255             :     // svtools::DOCCOLOR color for initialisation
     256        1246 :     const svtools::ColorConfig aColorConfig;
     257         623 :     const Color aPageFillColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
     258             : 
     259             :     // create and add primitive
     260        1246 :     const basegfx::BColor aRGBColor(aPageFillColor.getBColor());
     261        1246 :     const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor));
     262             : 
     263        1246 :     return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
     264             : }
     265             : 
     266        9738 : ViewContactOfPageFill::ViewContactOfPageFill(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
     267        9738 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
     268             : {
     269        9738 : }
     270             : 
     271        9699 : ViewContactOfPageFill::~ViewContactOfPageFill()
     272             : {
     273        9699 : }
     274             : 
     275        3513 : ViewObjectContact& ViewContactOfOuterPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     276             : {
     277        3513 :     ViewObjectContact* pRetval = new ViewObjectContactOfOuterPageBorder(rObjectContact, *this);
     278             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     279             : 
     280        3513 :     return *pRetval;
     281             : }
     282             : 
     283        1941 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfOuterPageBorder::createViewIndependentPrimitive2DSequence() const
     284             : {
     285        1941 :     drawinglayer::primitive2d::Primitive2DSequence xRetval;
     286        1941 :     const SdrPage& rPage = getPage();
     287        1941 :     const basegfx::B2DRange aPageBorderRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
     288             : 
     289             :     // Changed to 0x949599 for renaissance, before svtools::FONTCOLOR was used.
     290             :     // Added old case as fallback for HighContrast.
     291        3882 :     basegfx::BColor aRGBBorderColor(0x94 / (double)0xff, 0x95 / (double)0xff, 0x99 / (double)0xff);
     292             : 
     293        1941 :     if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
     294             :     {
     295           0 :         const svtools::ColorConfig aColorConfig;
     296           0 :         const Color aBorderColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
     297             : 
     298           0 :         aRGBBorderColor = aBorderColor.getBColor();
     299             :     }
     300             : 
     301        1941 :     if(rPage.getPageBorderOnlyLeftRight())
     302             :     {
     303             :         // #i93597# for Report Designer, the page border shall be only displayed right and left,
     304             :         // but not top and bottom. Create simplified geometry.
     305           0 :         basegfx::B2DPolygon aLeft, aRight;
     306             : 
     307           0 :         aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMinY()));
     308           0 :         aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMaxY()));
     309             : 
     310           0 :         aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMinY()));
     311           0 :         aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMaxY()));
     312             : 
     313           0 :         xRetval.realloc(2);
     314           0 :         xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aLeft, aRGBBorderColor));
     315           0 :         xRetval[1] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aRight, aRGBBorderColor));
     316             :     }
     317             :     else
     318             :     {
     319        1941 :         xRetval.realloc(1);
     320        1941 :         const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
     321        1941 :         xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
     322             :     }
     323             : 
     324        3882 :     return xRetval;
     325             : }
     326             : 
     327        9738 : ViewContactOfOuterPageBorder::ViewContactOfOuterPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
     328        9738 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
     329             : {
     330        9738 : }
     331             : 
     332        9699 : ViewContactOfOuterPageBorder::~ViewContactOfOuterPageBorder()
     333             : {
     334        9699 : }
     335             : 
     336        3513 : ViewObjectContact& ViewContactOfInnerPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     337             : {
     338        3513 :     ViewObjectContact* pRetval = new ViewObjectContactOfInnerPageBorder(rObjectContact, *this);
     339             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     340             : 
     341        3513 :     return *pRetval;
     342             : }
     343             : 
     344        1657 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfInnerPageBorder::createViewIndependentPrimitive2DSequence() const
     345             : {
     346        1657 :     const SdrPage& rPage = getPage();
     347             :     const basegfx::B2DRange aPageBorderRange(
     348        3314 :         (double)rPage.GetLftBorder(), (double)rPage.GetUppBorder(),
     349        4971 :         (double)(rPage.GetWdt() - rPage.GetRgtBorder()), (double)(rPage.GetHgt() - rPage.GetLwrBorder()));
     350        1657 :     const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
     351             : 
     352             :     // We have only the page information, not the view information. Use the
     353             :     // svtools::FONTCOLOR or svtools::DOCBOUNDARIES color for initialisation
     354        3314 :     const svtools::ColorConfig aColorConfig;
     355        1657 :     Color aBorderColor;
     356             : 
     357        1657 :     if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
     358             :     {
     359           0 :         aBorderColor = aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor;
     360             :     }
     361             :     else
     362             :     {
     363        1657 :         aBorderColor = aColorConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor;
     364             :     }
     365             : 
     366             :     // create page outer border primitive
     367        3314 :     const basegfx::BColor aRGBBorderColor(aBorderColor.getBColor());
     368        3314 :     const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
     369             : 
     370        3314 :     return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
     371             : }
     372             : 
     373        9738 : ViewContactOfInnerPageBorder::ViewContactOfInnerPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
     374        9738 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
     375             : {
     376        9738 : }
     377             : 
     378        9699 : ViewContactOfInnerPageBorder::~ViewContactOfInnerPageBorder()
     379             : {
     380        9699 : }
     381             : 
     382        3513 : ViewObjectContact& ViewContactOfPageHierarchy::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     383             : {
     384        3513 :     ViewObjectContact* pRetval = new ViewObjectContactOfPageHierarchy(rObjectContact, *this);
     385             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     386             : 
     387        3513 :     return *pRetval;
     388             : }
     389             : 
     390         623 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageHierarchy::createViewIndependentPrimitive2DSequence() const
     391             : {
     392             :     // collect sub-hierarchy
     393         623 :     drawinglayer::primitive2d::Primitive2DSequence xRetval;
     394         623 :     const sal_uInt32 nObjectCount(GetObjectCount());
     395             : 
     396             :     // collect all sub-primitives
     397        4653 :     for(sal_uInt32 a(0); a < nObjectCount; a++)
     398             :     {
     399        4030 :         const ViewContact& rCandidate(GetViewContact(a));
     400        4030 :         const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence());
     401             : 
     402        4030 :         drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
     403        4030 :     }
     404             : 
     405         623 :     return xRetval;
     406             : }
     407             : 
     408        9738 : ViewContactOfPageHierarchy::ViewContactOfPageHierarchy(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
     409        9738 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
     410             : {
     411        9738 : }
     412             : 
     413        9699 : ViewContactOfPageHierarchy::~ViewContactOfPageHierarchy()
     414             : {
     415        9699 : }
     416             : 
     417       61875 : sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const
     418             : {
     419       61875 :     return getPage().GetObjCount();
     420             : }
     421             : 
     422       51498 : ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const
     423             : {
     424       51498 :     SdrObject* pObj = getPage().GetObj(nIndex);
     425             :     assert(pObj && "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
     426       51498 :     return pObj->GetViewContact();
     427             : }
     428             : 
     429        7026 : ViewObjectContact& ViewContactOfGrid::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     430             : {
     431        7026 :     ViewObjectContact* pRetval = new ViewObjectContactOfPageGrid(rObjectContact, *this);
     432             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     433             : 
     434        7026 :     return *pRetval;
     435             : }
     436             : 
     437           0 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGrid::createViewIndependentPrimitive2DSequence() const
     438             : {
     439             :     // We have only the page information, not the view information and thus no grid settings. Create empty
     440             :     // default. For the view-dependent implementation, see ViewObjectContactOfPageGrid::createPrimitive2DSequence
     441           0 :     return drawinglayer::primitive2d::Primitive2DSequence();
     442             : }
     443             : 
     444       19476 : ViewContactOfGrid::ViewContactOfGrid(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
     445             : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
     446       19476 :     mbFront(bFront)
     447             : {
     448       19476 : }
     449             : 
     450       19398 : ViewContactOfGrid::~ViewContactOfGrid()
     451             : {
     452       19398 : }
     453             : 
     454        7026 : ViewObjectContact& ViewContactOfHelplines::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     455             : {
     456        7026 :     ViewObjectContact* pRetval = new ViewObjectContactOfPageHelplines(rObjectContact, *this);
     457             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     458             : 
     459        7026 :     return *pRetval;
     460             : }
     461             : 
     462           0 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfHelplines::createViewIndependentPrimitive2DSequence() const
     463             : {
     464             :     // We have only the page information, not the view information and thus no helplines. Create empty
     465             :     // default. For the view-dependent implementation, see ViewObjectContactOfPageHelplines::createPrimitive2DSequence
     466           0 :     return drawinglayer::primitive2d::Primitive2DSequence();
     467             : }
     468             : 
     469       19476 : ViewContactOfHelplines::ViewContactOfHelplines(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
     470             : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
     471       19476 :     mbFront(bFront)
     472             : {
     473       19476 : }
     474             : 
     475       19398 : ViewContactOfHelplines::~ViewContactOfHelplines()
     476             : {
     477       19398 : }
     478             : 
     479             : // Create a Object-Specific ViewObjectContact, set ViewContact and
     480             : // ObjectContact. Always needs to return something.
     481        3513 : ViewObjectContact& ViewContactOfSdrPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     482             : {
     483        3513 :     ViewObjectContact* pRetval = new ViewObjectContactOfSdrPage(rObjectContact, *this);
     484             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     485             : 
     486        3513 :     return *pRetval;
     487             : }
     488             : 
     489        9738 : ViewContactOfSdrPage::ViewContactOfSdrPage(SdrPage& rPage)
     490             : :   ViewContact(),
     491             :     mrPage(rPage),
     492             :     maViewContactOfPageBackground(*this),
     493             :     maViewContactOfPageShadow(*this),
     494             :     maViewContactOfPageFill(*this),
     495             :     maViewContactOfMasterPage(*this),
     496             :     maViewContactOfOuterPageBorder(*this),
     497             :     maViewContactOfInnerPageBorder(*this),
     498             :     maViewContactOfGridBack(*this, false),
     499             :     maViewContactOfHelplinesBack(*this, false),
     500             :     maViewContactOfPageHierarchy(*this),
     501             :     maViewContactOfGridFront(*this, true),
     502        9738 :     maViewContactOfHelplinesFront(*this, true)
     503             : {
     504        9738 : }
     505             : 
     506       19398 : ViewContactOfSdrPage::~ViewContactOfSdrPage()
     507             : {
     508       19398 : }
     509             : 
     510             : // Access to possible sub-hierarchy
     511      139359 : sal_uInt32 ViewContactOfSdrPage::GetObjectCount() const
     512             : {
     513             :     // Fixed count of content. It contains PageBackground (Wiese), PageShadow, PageFill,
     514             :     // then - depending on if the page has a MasterPage - either MasterPage Hierarchy
     515             :     // or MPBGO. Also OuterPageBorder, InnerPageBorder and two pairs of Grid and Helplines
     516             :     // (for front and back) which internally are visible or not depending on the current
     517             :     // front/back setting for those.
     518      139359 :     return 11;
     519             : }
     520             : 
     521      531465 : ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const
     522             : {
     523      531465 :     switch(nIndex)
     524             :     {
     525       48315 :         case 0: return (ViewContact&)maViewContactOfPageBackground;
     526       48315 :         case 1: return (ViewContact&)maViewContactOfPageShadow;
     527       48315 :         case 2: return (ViewContact&)maViewContactOfPageFill;
     528             :         case 3:
     529             :         {
     530       48315 :             const SdrPage& rPage = GetSdrPage();
     531             : 
     532       48315 :             if(rPage.TRG_HasMasterPage())
     533             :             {
     534        1552 :                 return rPage.TRG_GetMasterPageDescriptorViewContact();
     535             :             }
     536             :             else
     537             :             {
     538       46763 :                 return (ViewContact&)maViewContactOfMasterPage;
     539             :             }
     540             :         }
     541       48315 :         case 4: return (ViewContact&)maViewContactOfOuterPageBorder;
     542       48315 :         case 5: return (ViewContact&)maViewContactOfInnerPageBorder;
     543       48315 :         case 6: return (ViewContact&)maViewContactOfGridBack;
     544       48315 :         case 7: return (ViewContact&)maViewContactOfHelplinesBack;
     545       48315 :         case 8: return (ViewContact&)maViewContactOfPageHierarchy;
     546       48315 :         case 9: return (ViewContact&)maViewContactOfGridFront;
     547       48315 :         default: return (ViewContact&)maViewContactOfHelplinesFront;
     548             :     }
     549             : }
     550             : 
     551             : // React on changes of the object of this ViewContact
     552       36260 : void ViewContactOfSdrPage::ActionChanged()
     553             : {
     554             :     // call parent
     555       36260 :     ViewContact::ActionChanged();
     556             : 
     557             :     // apply to local viewContacts, they all rely on page information. Exception
     558             :     // is the sub hierarchy; this will not be influenced by the change
     559       36260 :     maViewContactOfPageBackground.ActionChanged();
     560       36260 :     maViewContactOfPageShadow.ActionChanged();
     561       36260 :     maViewContactOfPageFill.ActionChanged();
     562             : 
     563       36260 :     const SdrPage& rPage = GetSdrPage();
     564             : 
     565       36260 :     if(rPage.TRG_HasMasterPage())
     566             :     {
     567        7626 :         rPage.TRG_GetMasterPageDescriptorViewContact().ActionChanged();
     568             :     }
     569       28634 :     else if(rPage.IsMasterPage())
     570             :     {
     571        6438 :         maViewContactOfMasterPage.ActionChanged();
     572             :     }
     573             : 
     574       36260 :     maViewContactOfOuterPageBorder.ActionChanged();
     575       36260 :     maViewContactOfInnerPageBorder.ActionChanged();
     576       36260 :     maViewContactOfGridBack.ActionChanged();
     577       36260 :     maViewContactOfHelplinesBack.ActionChanged();
     578       36260 :     maViewContactOfGridFront.ActionChanged();
     579       36260 :     maViewContactOfHelplinesFront.ActionChanged();
     580       36260 : }
     581             : 
     582             : // overload for acessing the SdrPage
     583           0 : SdrPage* ViewContactOfSdrPage::TryToGetSdrPage() const
     584             : {
     585           0 :     return &GetSdrPage();
     586             : }
     587             : 
     588         623 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPage::createViewIndependentPrimitive2DSequence() const
     589             : {
     590         623 :     drawinglayer::primitive2d::Primitive2DSequence xRetval;
     591             : 
     592             :     // collect all sub-sequences including sub hierarchy.
     593         623 :     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageBackground.getViewIndependentPrimitive2DSequence());
     594         623 :     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageShadow.getViewIndependentPrimitive2DSequence());
     595         623 :     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageFill.getViewIndependentPrimitive2DSequence());
     596             : 
     597         623 :     const SdrPage& rPage = GetSdrPage();
     598             : 
     599         623 :     if(rPage.TRG_HasMasterPage())
     600             :     {
     601             :         drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
     602         106 :             rPage.TRG_GetMasterPageDescriptorViewContact().getViewIndependentPrimitive2DSequence());
     603             :     }
     604         517 :     else if(rPage.IsMasterPage())
     605             :     {
     606             :         drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
     607         124 :             maViewContactOfMasterPage.getViewIndependentPrimitive2DSequence());
     608             :     }
     609             : 
     610         623 :     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfOuterPageBorder.getViewIndependentPrimitive2DSequence());
     611         623 :     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfInnerPageBorder.getViewIndependentPrimitive2DSequence());
     612         623 :     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageHierarchy.getViewIndependentPrimitive2DSequence());
     613             : 
     614             :     // Only add front versions of grid and helplines since no visibility test is done,
     615             :     // so adding the back incarnations is not necessary. This makes the Front
     616             :     // visualisation the default when no visibility tests are done.
     617             : 
     618             :     // Since we have no view here, no grid and helpline definitions are available currently. The used
     619             :     // methods at ViewContactOfHelplines and ViewContactOfGrid return only empty sequences and
     620             :     // do not need to be called ATM. This may change later if grid or helpline info gets
     621             :     // model data (it should not). Keeping the lines commented to hold this hint.
     622             : 
     623             :     // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfGridFront.getViewIndependentPrimitive2DSequence());
     624             :     // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfHelplinesFront.getViewIndependentPrimitive2DSequence());
     625             : 
     626         623 :     return xRetval;
     627             : }
     628             : 
     629         651 : }}
     630             : 
     631             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10