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

Generated by: LCOV version 1.10