SidebarController.cxx (65908a7e) SidebarController.cxx (22f77e9e)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 27 unchanged lines hidden (view full) ---

36#include "sfxresid.hxx"
37#include "sfx2/sfxsids.hrc"
38#include "sfx2/titledockwin.hxx"
39#include "sfxlocal.hrc"
40#include <vcl/floatwin.hxx>
41#include "splitwin.hxx"
42#include <svl/smplhint.hxx>
43#include <tools/link.hxx>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 27 unchanged lines hidden (view full) ---

36#include "sfxresid.hxx"
37#include "sfx2/sfxsids.hrc"
38#include "sfx2/titledockwin.hxx"
39#include "sfxlocal.hrc"
40#include <vcl/floatwin.hxx>
41#include "splitwin.hxx"
42#include <svl/smplhint.hxx>
43#include <tools/link.hxx>
44#include <toolkit/helper/vclunohelper.hxx>
45
44#include <comphelper/componentfactory.hxx>
45#include <comphelper/processfactory.hxx>
46#include <comphelper/componentcontext.hxx>
47#include <comphelper/namedvaluecollection.hxx>
48
49#include <com/sun/star/frame/XDispatchProvider.hpp>
50#include <com/sun/star/lang/XInitialization.hpp>
51#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
52#include <com/sun/star/ui/ContextChangeEventObject.hpp>
53#include <com/sun/star/ui/XUIElementFactory.hpp>
54#include <com/sun/star/util/XURLTransformer.hpp>
55#include <com/sun/star/util/URL.hpp>
46#include <comphelper/componentfactory.hxx>
47#include <comphelper/processfactory.hxx>
48#include <comphelper/componentcontext.hxx>
49#include <comphelper/namedvaluecollection.hxx>
50
51#include <com/sun/star/frame/XDispatchProvider.hpp>
52#include <com/sun/star/lang/XInitialization.hpp>
53#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
54#include <com/sun/star/ui/ContextChangeEventObject.hpp>
55#include <com/sun/star/ui/XUIElementFactory.hpp>
56#include <com/sun/star/util/XURLTransformer.hpp>
57#include <com/sun/star/util/URL.hpp>
58#include <com/sun/star/rendering/XSpriteCanvas.hpp>
56
57#include <boost/bind.hpp>
58#include <boost/function.hpp>
59#include <boost/scoped_array.hpp>
60
61
62using namespace css;
63using namespace cssu;

--- 429 unchanged lines hidden (view full) ---

493
494
495
496
497bool SidebarController::ArePanelSetsEqual (
498 const SharedPanelContainer& rCurrentPanels,
499 const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels)
500{
59
60#include <boost/bind.hpp>
61#include <boost/function.hpp>
62#include <boost/scoped_array.hpp>
63
64
65using namespace css;
66using namespace cssu;

--- 429 unchanged lines hidden (view full) ---

496
497
498
499
500bool SidebarController::ArePanelSetsEqual (
501 const SharedPanelContainer& rCurrentPanels,
502 const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels)
503{
504#ifdef DEBUG
501 OSL_TRACE("current panel list:");
502 for (SharedPanelContainer::const_iterator
503 iPanel(rCurrentPanels.begin()),
504 iEnd(rCurrentPanels.end());
505 iPanel!=iEnd;
506 ++iPanel)
507 {
508 OSL_TRACE(" panel %s", S2A((*iPanel)->GetId()));
509 }
510
511 OSL_TRACE("requested panels: ");
512 for (ResourceManager::PanelContextDescriptorContainer::const_iterator
513 iId(rRequestedPanels.begin()),
514 iEnd(rRequestedPanels.end());
515 iId!=iEnd;
516 ++iId)
517 {
518 OSL_TRACE(" panel %s", S2A(iId->msId));
519 }
505 OSL_TRACE("current panel list:");
506 for (SharedPanelContainer::const_iterator
507 iPanel(rCurrentPanels.begin()),
508 iEnd(rCurrentPanels.end());
509 iPanel!=iEnd;
510 ++iPanel)
511 {
512 OSL_TRACE(" panel %s", S2A((*iPanel)->GetId()));
513 }
514
515 OSL_TRACE("requested panels: ");
516 for (ResourceManager::PanelContextDescriptorContainer::const_iterator
517 iId(rRequestedPanels.begin()),
518 iEnd(rRequestedPanels.end());
519 iId!=iEnd;
520 ++iId)
521 {
522 OSL_TRACE(" panel %s", S2A(iId->msId));
523 }
524#endif
520
521 if (rCurrentPanels.size() != rRequestedPanels.size())
522 return false;
523 for (sal_Int32 nIndex=0,nCount=rCurrentPanels.size(); nIndex<nCount; ++nIndex)
524 {
525 if (rCurrentPanels[nIndex] == NULL)
526 return false;
527 if ( ! rCurrentPanels[nIndex]->GetId().equals(rRequestedPanels[nIndex].msId))

--- 27 unchanged lines hidden (view full) ---

555 ::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()),
556 rsMenuCommand.getLength()>0
557 ? ::boost::bind(&SidebarController::ShowDetailMenu,this,rsMenuCommand)
558 : ::boost::function<void(void)>()));
559
560 // Create the XUIElement.
561 Reference<ui::XUIElement> xUIElement (CreateUIElement(
562 pPanel->GetComponentInterface(),
525
526 if (rCurrentPanels.size() != rRequestedPanels.size())
527 return false;
528 for (sal_Int32 nIndex=0,nCount=rCurrentPanels.size(); nIndex<nCount; ++nIndex)
529 {
530 if (rCurrentPanels[nIndex] == NULL)
531 return false;
532 if ( ! rCurrentPanels[nIndex]->GetId().equals(rRequestedPanels[nIndex].msId))

--- 27 unchanged lines hidden (view full) ---

560 ::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()),
561 rsMenuCommand.getLength()>0
562 ? ::boost::bind(&SidebarController::ShowDetailMenu,this,rsMenuCommand)
563 : ::boost::function<void(void)>()));
564
565 // Create the XUIElement.
566 Reference<ui::XUIElement> xUIElement (CreateUIElement(
567 pPanel->GetComponentInterface(),
563 pPanelDescriptor->msImplementationURL));
568 pPanelDescriptor->msImplementationURL,
569 pPanelDescriptor->mbWantsCanvas));
564 if (xUIElement.is())
565 {
566 // Initialize the panel and add it to the active deck.
567 pPanel->SetUIElement(xUIElement);
568 }
569 else
570 {
571 pPanel.reset();
572 }
573
574 return pPanel;
575}
576
577
578
579
580Reference<ui::XUIElement> SidebarController::CreateUIElement (
581 const Reference<awt::XWindowPeer>& rxWindow,
570 if (xUIElement.is())
571 {
572 // Initialize the panel and add it to the active deck.
573 pPanel->SetUIElement(xUIElement);
574 }
575 else
576 {
577 pPanel.reset();
578 }
579
580 return pPanel;
581}
582
583
584
585
586Reference<ui::XUIElement> SidebarController::CreateUIElement (
587 const Reference<awt::XWindowPeer>& rxWindow,
582 const ::rtl::OUString& rsImplementationURL)
588 const ::rtl::OUString& rsImplementationURL,
589 const bool bWantsCanvas)
583{
584 try
585 {
586 const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory());
587 const Reference<ui::XUIElementFactory> xUIElementFactory (
588 aComponentContext.createComponent("com.sun.star.ui.UIElementFactoryManager"),
589 UNO_QUERY_THROW);
590
591 // Create the XUIElement.
592 ::comphelper::NamedValueCollection aCreationArguments;
593 aCreationArguments.put("Frame", makeAny(mxFrame));
594 aCreationArguments.put("ParentWindow", makeAny(rxWindow));
595 SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(mpParentWindow);
596 if (pSfxDockingWindow != NULL)
597 aCreationArguments.put("SfxBindings", makeAny(sal_uInt64(&pSfxDockingWindow->GetBindings())));
598 aCreationArguments.put("Theme", Theme::GetPropertySet());
599 aCreationArguments.put("Sidebar", makeAny(Reference<ui::XSidebar>(static_cast<ui::XSidebar*>(this))));
590{
591 try
592 {
593 const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory());
594 const Reference<ui::XUIElementFactory> xUIElementFactory (
595 aComponentContext.createComponent("com.sun.star.ui.UIElementFactoryManager"),
596 UNO_QUERY_THROW);
597
598 // Create the XUIElement.
599 ::comphelper::NamedValueCollection aCreationArguments;
600 aCreationArguments.put("Frame", makeAny(mxFrame));
601 aCreationArguments.put("ParentWindow", makeAny(rxWindow));
602 SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(mpParentWindow);
603 if (pSfxDockingWindow != NULL)
604 aCreationArguments.put("SfxBindings", makeAny(sal_uInt64(&pSfxDockingWindow->GetBindings())));
605 aCreationArguments.put("Theme", Theme::GetPropertySet());
606 aCreationArguments.put("Sidebar", makeAny(Reference<ui::XSidebar>(static_cast<ui::XSidebar*>(this))));
607 if (bWantsCanvas)
608 {
609 Reference<rendering::XSpriteCanvas> xCanvas (VCLUnoHelper::GetWindow(rxWindow)->GetSpriteCanvas());
610 aCreationArguments.put("Canvas", makeAny(xCanvas));
611 }
600
601 Reference<ui::XUIElement> xUIElement(
602 xUIElementFactory->createUIElement(
603 rsImplementationURL,
604 Sequence<beans::PropertyValue>(aCreationArguments.getPropertyValues())),
605 UNO_QUERY_THROW);
606
607 return xUIElement;

--- 327 unchanged lines hidden ---
612
613 Reference<ui::XUIElement> xUIElement(
614 xUIElementFactory->createUIElement(
615 rsImplementationURL,
616 Sequence<beans::PropertyValue>(aCreationArguments.getPropertyValues())),
617 UNO_QUERY_THROW);
618
619 return xUIElement;

--- 327 unchanged lines hidden ---