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