SidebarController.cxx (11fa8afe) SidebarController.cxx (ae13266d)
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

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

575 aNewPanels[nWriteIndex]->SetExpanded(rPanelContexDescriptor.mbIsInitiallyVisible);
576 }
577 else
578 {
579 // Panel does not yet exist. Create it.
580 aNewPanels[nWriteIndex] = CreatePanel(
581 rPanelContexDescriptor.msId,
582 mpCurrentDeck->GetPanelParentWindow(),
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

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

575 aNewPanels[nWriteIndex]->SetExpanded(rPanelContexDescriptor.mbIsInitiallyVisible);
576 }
577 else
578 {
579 // Panel does not yet exist. Create it.
580 aNewPanels[nWriteIndex] = CreatePanel(
581 rPanelContexDescriptor.msId,
582 mpCurrentDeck->GetPanelParentWindow(),
583 rPanelContexDescriptor.mbIsInitiallyVisible);
583 rPanelContexDescriptor.mbIsInitiallyVisible,
584 rContext);
584 bHasPanelSetChanged = true;
585 }
586 if (aNewPanels[nWriteIndex] != NULL)
587 {
588 // Depending on the context we have to apply the show menu functor.
589 aNewPanels[nWriteIndex]->SetShowMenuFunctor(
590 rPanelContexDescriptor.msMenuCommand.getLength()>0
591 ? ::boost::bind(&SidebarController::ShowDetailMenu,this,rPanelContexDescriptor.msMenuCommand)

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

644}
645
646
647
648
649SharedPanel SidebarController::CreatePanel (
650 const OUString& rsPanelId,
651 ::Window* pParentWindow,
585 bHasPanelSetChanged = true;
586 }
587 if (aNewPanels[nWriteIndex] != NULL)
588 {
589 // Depending on the context we have to apply the show menu functor.
590 aNewPanels[nWriteIndex]->SetShowMenuFunctor(
591 rPanelContexDescriptor.msMenuCommand.getLength()>0
592 ? ::boost::bind(&SidebarController::ShowDetailMenu,this,rPanelContexDescriptor.msMenuCommand)

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

645}
646
647
648
649
650SharedPanel SidebarController::CreatePanel (
651 const OUString& rsPanelId,
652 ::Window* pParentWindow,
652 const bool bIsInitiallyExpanded)
653 const bool bIsInitiallyExpanded,
654 const Context& rContext)
653{
654 const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
655 if (pPanelDescriptor == NULL)
656 return SharedPanel();
657
658 // Create the panel which is the parent window of the UIElement.
659 SharedPanel pPanel (new Panel(
660 *pPanelDescriptor,
661 pParentWindow,
662 bIsInitiallyExpanded,
663 ::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()),
664 ::boost::bind(&SidebarController::GetCurrentContext, this)));
665
666 // Create the XUIElement.
667 Reference<ui::XUIElement> xUIElement (CreateUIElement(
668 pPanel->GetComponentInterface(),
669 pPanelDescriptor->msImplementationURL,
655{
656 const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
657 if (pPanelDescriptor == NULL)
658 return SharedPanel();
659
660 // Create the panel which is the parent window of the UIElement.
661 SharedPanel pPanel (new Panel(
662 *pPanelDescriptor,
663 pParentWindow,
664 bIsInitiallyExpanded,
665 ::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()),
666 ::boost::bind(&SidebarController::GetCurrentContext, this)));
667
668 // Create the XUIElement.
669 Reference<ui::XUIElement> xUIElement (CreateUIElement(
670 pPanel->GetComponentInterface(),
671 pPanelDescriptor->msImplementationURL,
670 pPanelDescriptor->mbWantsCanvas));
672 pPanelDescriptor->mbWantsCanvas,
673 rContext));
671 if (xUIElement.is())
672 {
673 // Initialize the panel and add it to the active deck.
674 pPanel->SetUIElement(xUIElement);
675 }
676 else
677 {
678 pPanel.reset();
679 }
680
681 return pPanel;
682}
683
684
685
686
687Reference<ui::XUIElement> SidebarController::CreateUIElement (
688 const Reference<awt::XWindowPeer>& rxWindow,
689 const ::rtl::OUString& rsImplementationURL,
674 if (xUIElement.is())
675 {
676 // Initialize the panel and add it to the active deck.
677 pPanel->SetUIElement(xUIElement);
678 }
679 else
680 {
681 pPanel.reset();
682 }
683
684 return pPanel;
685}
686
687
688
689
690Reference<ui::XUIElement> SidebarController::CreateUIElement (
691 const Reference<awt::XWindowPeer>& rxWindow,
692 const ::rtl::OUString& rsImplementationURL,
690 const bool bWantsCanvas)
693 const bool bWantsCanvas,
694 const Context& rContext)
691{
692 try
693 {
694 const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory());
695 const Reference<ui::XUIElementFactory> xUIElementFactory (
696 aComponentContext.createComponent("com.sun.star.ui.UIElementFactoryManager"),
697 UNO_QUERY_THROW);
698

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

705 aCreationArguments.put("SfxBindings", makeAny(sal_uInt64(&pSfxDockingWindow->GetBindings())));
706 aCreationArguments.put("Theme", Theme::GetPropertySet());
707 aCreationArguments.put("Sidebar", makeAny(Reference<ui::XSidebar>(static_cast<ui::XSidebar*>(this))));
708 if (bWantsCanvas)
709 {
710 Reference<rendering::XSpriteCanvas> xCanvas (VCLUnoHelper::GetWindow(rxWindow)->GetSpriteCanvas());
711 aCreationArguments.put("Canvas", makeAny(xCanvas));
712 }
695{
696 try
697 {
698 const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory());
699 const Reference<ui::XUIElementFactory> xUIElementFactory (
700 aComponentContext.createComponent("com.sun.star.ui.UIElementFactoryManager"),
701 UNO_QUERY_THROW);
702

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

709 aCreationArguments.put("SfxBindings", makeAny(sal_uInt64(&pSfxDockingWindow->GetBindings())));
710 aCreationArguments.put("Theme", Theme::GetPropertySet());
711 aCreationArguments.put("Sidebar", makeAny(Reference<ui::XSidebar>(static_cast<ui::XSidebar*>(this))));
712 if (bWantsCanvas)
713 {
714 Reference<rendering::XSpriteCanvas> xCanvas (VCLUnoHelper::GetWindow(rxWindow)->GetSpriteCanvas());
715 aCreationArguments.put("Canvas", makeAny(xCanvas));
716 }
717 aCreationArguments.put("ApplicationName", makeAny(rContext.msApplication));
718 aCreationArguments.put("ContextName", makeAny(rContext.msContext));
713
714 Reference<ui::XUIElement> xUIElement(
715 xUIElementFactory->createUIElement(
716 rsImplementationURL,
717 Sequence<beans::PropertyValue>(aCreationArguments.getPropertyValues())),
718 UNO_QUERY_THROW);
719
720 return xUIElement;

--- 468 unchanged lines hidden ---
719
720 Reference<ui::XUIElement> xUIElement(
721 xUIElementFactory->createUIElement(
722 rsImplementationURL,
723 Sequence<beans::PropertyValue>(aCreationArguments.getPropertyValues())),
724 UNO_QUERY_THROW);
725
726 return xUIElement;

--- 468 unchanged lines hidden ---