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_sdext.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "PresenterBitmapContainer.hxx" 32*cdf0e10cSrcweir #include "PresenterComponent.hxx" 33*cdf0e10cSrcweir #include "PresenterConfigurationAccess.hxx" 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <com/sun/star/deployment/XPackageInformationProvider.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/drawing/XPresenterHelper.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiComponentFactory.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/rendering/CompositeOperation.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/rendering/XIntegerBitmap.hpp> 40*cdf0e10cSrcweir #include <boost/bind.hpp> 41*cdf0e10cSrcweir #include <map> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir using namespace ::com::sun::star; 44*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 45*cdf0e10cSrcweir using namespace ::std; 46*cdf0e10cSrcweir using ::rtl::OUString; 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir namespace sdext { namespace presenter { 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir namespace { 54*cdf0e10cSrcweir static OUString gsNameProperty (A2S("Name")); 55*cdf0e10cSrcweir static OUString gsNormalFileNameProperty (A2S("NormalFileName")); 56*cdf0e10cSrcweir static OUString gsMouseOverFileNameProperty (A2S("MouseOverFileName")); 57*cdf0e10cSrcweir static OUString gsButtonDownFileNameProperty (A2S("ButtonDownFileName")); 58*cdf0e10cSrcweir static OUString gsDisabledFileNameProperty (A2S("DisabledFileName")); 59*cdf0e10cSrcweir static OUString gsMaskFileNameProperty (A2S("MaskFileName")); 60*cdf0e10cSrcweir static OUString gsXOffsetProperty (A2S("XOffset")); 61*cdf0e10cSrcweir static OUString gsYOffsetProperty (A2S("YOffset")); 62*cdf0e10cSrcweir static OUString gsXHotSpotProperty (A2S("XHotSpot")); 63*cdf0e10cSrcweir static OUString gsYHotSpotProperty (A2S("YHotSpot")); 64*cdf0e10cSrcweir static OUString gsReplacementColorProperty (A2S("ReplacementColor")); 65*cdf0e10cSrcweir static OUString gsHorizontalTexturingModeProperty (A2S("HorizontalTexturingMode")); 66*cdf0e10cSrcweir static OUString gsVerticalTexturingModeProperty (A2S("VerticalTexturingMode")); 67*cdf0e10cSrcweir } 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir //===== PresenterBitmapContainer ============================================== 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir PresenterBitmapContainer::PresenterBitmapContainer ( 72*cdf0e10cSrcweir const ::rtl::OUString& rsConfigurationBase, 73*cdf0e10cSrcweir const ::boost::shared_ptr<PresenterBitmapContainer>& rpParentContainer, 74*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext, 75*cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 76*cdf0e10cSrcweir const OUString& rsBasePath, 77*cdf0e10cSrcweir const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper) 78*cdf0e10cSrcweir : mpParentContainer(rpParentContainer), 79*cdf0e10cSrcweir maIconContainer(), 80*cdf0e10cSrcweir msBasePath(rsBasePath), 81*cdf0e10cSrcweir mxCanvas(rxCanvas), 82*cdf0e10cSrcweir mxPresenterHelper(rxPresenterHelper) 83*cdf0e10cSrcweir { 84*cdf0e10cSrcweir Initialize(rxComponentContext); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir // Get access to the configuration. 87*cdf0e10cSrcweir PresenterConfigurationAccess aConfiguration ( 88*cdf0e10cSrcweir rxComponentContext, 89*cdf0e10cSrcweir A2S("org.openoffice.Office.extension.PresenterScreen"), 90*cdf0e10cSrcweir PresenterConfigurationAccess::READ_ONLY); 91*cdf0e10cSrcweir Reference<container::XNameAccess> xBitmapList ( 92*cdf0e10cSrcweir aConfiguration.GetConfigurationNode(rsConfigurationBase), 93*cdf0e10cSrcweir UNO_QUERY_THROW); 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir LoadBitmaps(xBitmapList); 96*cdf0e10cSrcweir } 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir PresenterBitmapContainer::PresenterBitmapContainer ( 103*cdf0e10cSrcweir const css::uno::Reference<css::container::XNameAccess>& rxRootNode, 104*cdf0e10cSrcweir const ::boost::shared_ptr<PresenterBitmapContainer>& rpParentContainer, 105*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext, 106*cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 107*cdf0e10cSrcweir const OUString& rsBasePath, 108*cdf0e10cSrcweir const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper) 109*cdf0e10cSrcweir : mpParentContainer(rpParentContainer), 110*cdf0e10cSrcweir maIconContainer(), 111*cdf0e10cSrcweir msBasePath(rsBasePath), 112*cdf0e10cSrcweir mxCanvas(rxCanvas), 113*cdf0e10cSrcweir mxPresenterHelper(rxPresenterHelper) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir Initialize(rxComponentContext); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir LoadBitmaps(rxRootNode); 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir void PresenterBitmapContainer::Initialize ( 124*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir if ( ! mxPresenterHelper.is()) 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir // Create an object that is able to load the bitmaps in a format that is 129*cdf0e10cSrcweir // supported by the canvas. 130*cdf0e10cSrcweir Reference<lang::XMultiComponentFactory> xFactory ( 131*cdf0e10cSrcweir rxComponentContext->getServiceManager(), UNO_QUERY); 132*cdf0e10cSrcweir if ( ! xFactory.is()) 133*cdf0e10cSrcweir return; 134*cdf0e10cSrcweir mxPresenterHelper = Reference<drawing::XPresenterHelper>( 135*cdf0e10cSrcweir xFactory->createInstanceWithContext( 136*cdf0e10cSrcweir A2S("com.sun.star.drawing.PresenterHelper"), 137*cdf0e10cSrcweir rxComponentContext), 138*cdf0e10cSrcweir UNO_QUERY_THROW); 139*cdf0e10cSrcweir } 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir PresenterBitmapContainer::~PresenterBitmapContainer (void) 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir maIconContainer.clear(); 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir SharedBitmapDescriptor PresenterBitmapContainer::GetBitmap ( 154*cdf0e10cSrcweir const OUString& rsName) const 155*cdf0e10cSrcweir { 156*cdf0e10cSrcweir BitmapContainer::const_iterator iSet (maIconContainer.find(rsName)); 157*cdf0e10cSrcweir if (iSet != maIconContainer.end()) 158*cdf0e10cSrcweir return iSet->second; 159*cdf0e10cSrcweir else if (mpParentContainer.get() != NULL) 160*cdf0e10cSrcweir return mpParentContainer->GetBitmap(rsName); 161*cdf0e10cSrcweir else 162*cdf0e10cSrcweir return SharedBitmapDescriptor(); 163*cdf0e10cSrcweir } 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir void PresenterBitmapContainer::LoadBitmaps ( 169*cdf0e10cSrcweir const css::uno::Reference<css::container::XNameAccess>& rxBitmapList) 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir if ( ! mxCanvas.is()) 172*cdf0e10cSrcweir return; 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir if ( ! rxBitmapList.is()) 175*cdf0e10cSrcweir return; 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir try 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir // Load all button bitmaps. 180*cdf0e10cSrcweir if (rxBitmapList.is()) 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir PresenterConfigurationAccess::ForAll( 183*cdf0e10cSrcweir rxBitmapList, 184*cdf0e10cSrcweir ::boost::bind(&PresenterBitmapContainer::ProcessBitmap, this, _1, _2)); 185*cdf0e10cSrcweir } 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir catch (Exception&) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir OSL_ASSERT(false); 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir } 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir SharedBitmapDescriptor PresenterBitmapContainer::LoadBitmap ( 197*cdf0e10cSrcweir const css::uno::Reference<css::container::XHierarchicalNameAccess>& rxNode, 198*cdf0e10cSrcweir const ::rtl::OUString& rsPath, 199*cdf0e10cSrcweir const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper, 200*cdf0e10cSrcweir const OUString& rsBasePath, 201*cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 202*cdf0e10cSrcweir const SharedBitmapDescriptor& rpDefault) 203*cdf0e10cSrcweir { 204*cdf0e10cSrcweir SharedBitmapDescriptor pBitmap; 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir if (rxNode.is()) 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir try 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir Reference<beans::XPropertySet> xBitmapProperties ( 211*cdf0e10cSrcweir PresenterConfigurationAccess::GetConfigurationNode(rxNode, rsPath), 212*cdf0e10cSrcweir UNO_QUERY); 213*cdf0e10cSrcweir if (xBitmapProperties.is()) 214*cdf0e10cSrcweir pBitmap = LoadBitmap( 215*cdf0e10cSrcweir xBitmapProperties, 216*cdf0e10cSrcweir rxPresenterHelper, 217*cdf0e10cSrcweir rsBasePath, 218*cdf0e10cSrcweir rxCanvas, 219*cdf0e10cSrcweir rpDefault); 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir catch (Exception&) 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir OSL_ASSERT(false); 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir return pBitmap; 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir void PresenterBitmapContainer::ProcessBitmap ( 234*cdf0e10cSrcweir const OUString& rsKey, 235*cdf0e10cSrcweir const Reference<beans::XPropertySet>& rxProperties) 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir OUString sName; 238*cdf0e10cSrcweir if ( ! (PresenterConfigurationAccess::GetProperty(rxProperties, gsNameProperty) >>= sName)) 239*cdf0e10cSrcweir sName = rsKey; 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir maIconContainer[sName] = LoadBitmap( 242*cdf0e10cSrcweir rxProperties, 243*cdf0e10cSrcweir mxPresenterHelper, 244*cdf0e10cSrcweir msBasePath, 245*cdf0e10cSrcweir mxCanvas, 246*cdf0e10cSrcweir SharedBitmapDescriptor()); 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir SharedBitmapDescriptor PresenterBitmapContainer::LoadBitmap ( 253*cdf0e10cSrcweir const Reference<beans::XPropertySet>& rxProperties, 254*cdf0e10cSrcweir const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper, 255*cdf0e10cSrcweir const OUString& rsBasePath, 256*cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 257*cdf0e10cSrcweir const SharedBitmapDescriptor& rpDefault) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir OSL_ASSERT(rxCanvas.is()); 260*cdf0e10cSrcweir OSL_ASSERT(rxPresenterHelper.is()); 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir SharedBitmapDescriptor pBitmap (new BitmapDescriptor(rpDefault)); 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir if ( ! rxProperties.is()) 265*cdf0e10cSrcweir return pBitmap; 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir OUString sFileName; 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir // Load bitmaps. 270*cdf0e10cSrcweir if (PresenterConfigurationAccess::GetProperty(rxProperties, gsNormalFileNameProperty) >>= sFileName) 271*cdf0e10cSrcweir try 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir pBitmap->SetBitmap( 274*cdf0e10cSrcweir BitmapDescriptor::Normal, 275*cdf0e10cSrcweir rxPresenterHelper->loadBitmap(rsBasePath + sFileName, rxCanvas)); 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir catch (Exception&) 278*cdf0e10cSrcweir {} 279*cdf0e10cSrcweir if (PresenterConfigurationAccess::GetProperty(rxProperties, gsMouseOverFileNameProperty) >>= sFileName) 280*cdf0e10cSrcweir try 281*cdf0e10cSrcweir { 282*cdf0e10cSrcweir pBitmap->SetBitmap( 283*cdf0e10cSrcweir BitmapDescriptor::MouseOver, 284*cdf0e10cSrcweir rxPresenterHelper->loadBitmap(rsBasePath + sFileName, rxCanvas)); 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir catch (Exception&) 287*cdf0e10cSrcweir {} 288*cdf0e10cSrcweir if (PresenterConfigurationAccess::GetProperty(rxProperties, gsButtonDownFileNameProperty) >>= sFileName) 289*cdf0e10cSrcweir try 290*cdf0e10cSrcweir { 291*cdf0e10cSrcweir pBitmap->SetBitmap( 292*cdf0e10cSrcweir BitmapDescriptor::ButtonDown, 293*cdf0e10cSrcweir rxPresenterHelper->loadBitmap(rsBasePath + sFileName, rxCanvas)); 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir catch (Exception&) 296*cdf0e10cSrcweir {} 297*cdf0e10cSrcweir if (PresenterConfigurationAccess::GetProperty(rxProperties, gsDisabledFileNameProperty) >>= sFileName) 298*cdf0e10cSrcweir try 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir pBitmap->SetBitmap( 301*cdf0e10cSrcweir BitmapDescriptor::Disabled, 302*cdf0e10cSrcweir rxPresenterHelper->loadBitmap(rsBasePath + sFileName, rxCanvas)); 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir catch (Exception&) 305*cdf0e10cSrcweir {} 306*cdf0e10cSrcweir if (PresenterConfigurationAccess::GetProperty(rxProperties, gsMaskFileNameProperty) >>= sFileName) 307*cdf0e10cSrcweir try 308*cdf0e10cSrcweir { 309*cdf0e10cSrcweir pBitmap->SetBitmap( 310*cdf0e10cSrcweir BitmapDescriptor::Mask, 311*cdf0e10cSrcweir rxPresenterHelper->loadBitmap(rsBasePath + sFileName, rxCanvas)); 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir catch (Exception&) 314*cdf0e10cSrcweir {} 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir PresenterConfigurationAccess::GetProperty(rxProperties, gsXOffsetProperty) >>= pBitmap->mnXOffset; 318*cdf0e10cSrcweir PresenterConfigurationAccess::GetProperty(rxProperties, gsYOffsetProperty) >>= pBitmap->mnYOffset; 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir PresenterConfigurationAccess::GetProperty(rxProperties, gsXHotSpotProperty) >>= pBitmap->mnXHotSpot; 321*cdf0e10cSrcweir PresenterConfigurationAccess::GetProperty(rxProperties, gsYHotSpotProperty) >>= pBitmap->mnYHotSpot; 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir PresenterConfigurationAccess::GetProperty(rxProperties, gsReplacementColorProperty) >>= pBitmap->maReplacementColor; 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir OUString sTexturingMode; 326*cdf0e10cSrcweir if (PresenterConfigurationAccess::GetProperty(rxProperties, gsHorizontalTexturingModeProperty) >>= sTexturingMode) 327*cdf0e10cSrcweir pBitmap->meHorizontalTexturingMode = StringToTexturingMode(sTexturingMode); 328*cdf0e10cSrcweir if (PresenterConfigurationAccess::GetProperty(rxProperties, gsVerticalTexturingModeProperty) >>= sTexturingMode) 329*cdf0e10cSrcweir pBitmap->meVerticalTexturingMode = StringToTexturingMode(sTexturingMode); 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir return pBitmap; 332*cdf0e10cSrcweir } 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir PresenterBitmapContainer::BitmapDescriptor::TexturingMode 338*cdf0e10cSrcweir PresenterBitmapContainer::StringToTexturingMode (const OUString& rsTexturingMode) 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir if (rsTexturingMode == A2S("Once")) 341*cdf0e10cSrcweir return PresenterBitmapContainer::BitmapDescriptor::Once; 342*cdf0e10cSrcweir else if (rsTexturingMode == A2S("Repeat")) 343*cdf0e10cSrcweir return PresenterBitmapContainer::BitmapDescriptor::Repeat; 344*cdf0e10cSrcweir else if (rsTexturingMode == A2S("Stretch")) 345*cdf0e10cSrcweir return PresenterBitmapContainer::BitmapDescriptor::Stretch; 346*cdf0e10cSrcweir else 347*cdf0e10cSrcweir return PresenterBitmapContainer::BitmapDescriptor::Once; 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir //===== PresenterBitmapContainer::BitmapSet =================================== 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir PresenterBitmapContainer::BitmapDescriptor::BitmapDescriptor (void) 356*cdf0e10cSrcweir : mnWidth(0), 357*cdf0e10cSrcweir mnHeight(0), 358*cdf0e10cSrcweir mnXOffset(0), 359*cdf0e10cSrcweir mnYOffset(0), 360*cdf0e10cSrcweir mnXHotSpot(0), 361*cdf0e10cSrcweir mnYHotSpot(0), 362*cdf0e10cSrcweir maReplacementColor(0x00000000), 363*cdf0e10cSrcweir meHorizontalTexturingMode(Once), 364*cdf0e10cSrcweir meVerticalTexturingMode(Once), 365*cdf0e10cSrcweir mxNormalBitmap(), 366*cdf0e10cSrcweir mxMouseOverBitmap(), 367*cdf0e10cSrcweir mxButtonDownBitmap(), 368*cdf0e10cSrcweir mxDisabledBitmap(), 369*cdf0e10cSrcweir mxMaskBitmap() 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir } 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir PresenterBitmapContainer::BitmapDescriptor::BitmapDescriptor ( 377*cdf0e10cSrcweir const ::boost::shared_ptr<PresenterBitmapContainer::BitmapDescriptor>& rpDefault) 378*cdf0e10cSrcweir : mnWidth(0), 379*cdf0e10cSrcweir mnHeight(0), 380*cdf0e10cSrcweir mnXOffset(0), 381*cdf0e10cSrcweir mnYOffset(0), 382*cdf0e10cSrcweir mnXHotSpot(0), 383*cdf0e10cSrcweir mnYHotSpot(0), 384*cdf0e10cSrcweir maReplacementColor(0x00000000), 385*cdf0e10cSrcweir meHorizontalTexturingMode(Once), 386*cdf0e10cSrcweir meVerticalTexturingMode(Once), 387*cdf0e10cSrcweir mxNormalBitmap(), 388*cdf0e10cSrcweir mxMouseOverBitmap(), 389*cdf0e10cSrcweir mxButtonDownBitmap(), 390*cdf0e10cSrcweir mxDisabledBitmap(), 391*cdf0e10cSrcweir mxMaskBitmap() 392*cdf0e10cSrcweir { 393*cdf0e10cSrcweir if (rpDefault.get() != NULL) 394*cdf0e10cSrcweir { 395*cdf0e10cSrcweir mnWidth = rpDefault->mnWidth; 396*cdf0e10cSrcweir mnHeight = rpDefault->mnHeight; 397*cdf0e10cSrcweir mnXOffset = rpDefault->mnXOffset; 398*cdf0e10cSrcweir mnYOffset = rpDefault->mnYOffset; 399*cdf0e10cSrcweir mnXHotSpot = rpDefault->mnXHotSpot; 400*cdf0e10cSrcweir mnYHotSpot = rpDefault->mnYHotSpot; 401*cdf0e10cSrcweir maReplacementColor = rpDefault->maReplacementColor; 402*cdf0e10cSrcweir meHorizontalTexturingMode = rpDefault->meHorizontalTexturingMode; 403*cdf0e10cSrcweir meVerticalTexturingMode = rpDefault->meVerticalTexturingMode; 404*cdf0e10cSrcweir mxNormalBitmap = rpDefault->mxNormalBitmap; 405*cdf0e10cSrcweir mxMouseOverBitmap = rpDefault->mxMouseOverBitmap; 406*cdf0e10cSrcweir mxButtonDownBitmap = rpDefault->mxButtonDownBitmap; 407*cdf0e10cSrcweir mxDisabledBitmap = rpDefault->mxDisabledBitmap; 408*cdf0e10cSrcweir mxMaskBitmap = rpDefault->mxMaskBitmap; 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir css::uno::Reference<css::rendering::XBitmap> 414*cdf0e10cSrcweir PresenterBitmapContainer::BitmapDescriptor::GetNormalBitmap (void) const 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir return mxNormalBitmap; 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir css::uno::Reference<css::rendering::XBitmap> 423*cdf0e10cSrcweir PresenterBitmapContainer::BitmapDescriptor::GetBitmap ( 424*cdf0e10cSrcweir const Mode eMode, 425*cdf0e10cSrcweir const bool bMissingDefaultsToNormal) const 426*cdf0e10cSrcweir { 427*cdf0e10cSrcweir switch (eMode) 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir case Normal: 430*cdf0e10cSrcweir default: 431*cdf0e10cSrcweir return mxNormalBitmap; 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir case MouseOver: 434*cdf0e10cSrcweir if (mxMouseOverBitmap.is()) 435*cdf0e10cSrcweir return mxMouseOverBitmap; 436*cdf0e10cSrcweir else if (bMissingDefaultsToNormal) 437*cdf0e10cSrcweir return mxNormalBitmap; 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir case ButtonDown: 440*cdf0e10cSrcweir if (mxButtonDownBitmap.is()) 441*cdf0e10cSrcweir return mxButtonDownBitmap; 442*cdf0e10cSrcweir else if (bMissingDefaultsToNormal) 443*cdf0e10cSrcweir return mxNormalBitmap; 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir case Disabled: 446*cdf0e10cSrcweir if (mxDisabledBitmap.is()) 447*cdf0e10cSrcweir return mxDisabledBitmap; 448*cdf0e10cSrcweir else if (bMissingDefaultsToNormal) 449*cdf0e10cSrcweir return mxNormalBitmap; 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir case Mask: 452*cdf0e10cSrcweir return mxMaskBitmap; 453*cdf0e10cSrcweir } 454*cdf0e10cSrcweir return NULL; 455*cdf0e10cSrcweir } 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir void PresenterBitmapContainer::BitmapDescriptor::SetBitmap ( 461*cdf0e10cSrcweir const Mode eMode, 462*cdf0e10cSrcweir const css::uno::Reference<css::rendering::XBitmap>& rxBitmap) 463*cdf0e10cSrcweir { 464*cdf0e10cSrcweir switch (eMode) 465*cdf0e10cSrcweir { 466*cdf0e10cSrcweir case Normal: 467*cdf0e10cSrcweir default: 468*cdf0e10cSrcweir mxNormalBitmap = rxBitmap; 469*cdf0e10cSrcweir if (mxNormalBitmap.is()) 470*cdf0e10cSrcweir { 471*cdf0e10cSrcweir const geometry::IntegerSize2D aSize (mxNormalBitmap->getSize()); 472*cdf0e10cSrcweir mnWidth = aSize.Width; 473*cdf0e10cSrcweir mnHeight = aSize.Height; 474*cdf0e10cSrcweir } 475*cdf0e10cSrcweir break; 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir case MouseOver: 478*cdf0e10cSrcweir mxMouseOverBitmap = rxBitmap; 479*cdf0e10cSrcweir break; 480*cdf0e10cSrcweir 481*cdf0e10cSrcweir case ButtonDown: 482*cdf0e10cSrcweir mxButtonDownBitmap = rxBitmap; 483*cdf0e10cSrcweir break; 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir case Disabled: 486*cdf0e10cSrcweir mxDisabledBitmap = rxBitmap; 487*cdf0e10cSrcweir break; 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir case Mask: 490*cdf0e10cSrcweir mxMaskBitmap = rxBitmap; 491*cdf0e10cSrcweir break; 492*cdf0e10cSrcweir } 493*cdf0e10cSrcweir } 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir 496*cdf0e10cSrcweir 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir } } // end of namespace ::sdext::presenter 499