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