Author: af Date: Tue Mar 26 13:00:41 2013 New Revision: 1461104 URL: http://svn.apache.org/r1461104 Log: i121961: Added navigator panel for Draw/Impress to sidebar.
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/NavigatorWrapper.cxx openoffice/branches/sidebar/main/sd/source/ui/sidebar/NavigatorWrapper.hxx openoffice/branches/sidebar/main/sd/source/ui/sidebar/PanelFactory.cxx openoffice/branches/sidebar/main/sd/source/ui/sidebar/PanelFactory.hxx Modified: openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/Impress.xcu openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu openoffice/branches/sidebar/main/sd/source/ui/dlg/NavigatorChildWindow.cxx openoffice/branches/sidebar/main/sd/source/ui/dlg/navigatr.cxx openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicPaneFactory.cxx openoffice/branches/sidebar/main/sd/source/ui/inc/navigatr.hxx openoffice/branches/sidebar/main/sd/source/ui/sidebar/makefile.mk openoffice/branches/sidebar/main/sd/source/ui/unoidl/facreg.cxx Modified: openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/Impress.xcu URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/Impress.xcu?rev=1461104&r1=1461103&r2=1461104&view=diff ============================================================================== --- openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/Impress.xcu (original) +++ openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/Impress.xcu Tue Mar 26 13:00:41 2013 @@ -85,11 +85,6 @@ </node> <node oor:name="R6" oor:op="replace"> <prop oor:name="URL"> - <value>private:resource/view/SidebarView</value> - </prop> - </node> - <node oor:name="R7" oor:op="replace"> - <prop oor:name="URL"> <value>private:resource/view/PresentationView</value> </prop> </node> @@ -149,18 +144,6 @@ </node> </node> </node> - <node oor:name="F4" oor:op="replace"> - <prop oor:name="ServiceName"> - <value>org.openoffice.comp.Draw.framework.SidebarFactory</value> - </prop> - <node oor:name="ResourceList"> - <node oor:name="P0" oor:op="replace"> - <prop oor:name="URL"> - <value>private:resource/pane/SidebarPane</value> - </prop> - </node> - </node> - </node> </node> <node oor:name="StartupServices"> <node oor:name="S0" oor:op="replace"> Modified: openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu?rev=1461104&r1=1461103&r2=1461104&view=diff ============================================================================== --- openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu (original) +++ openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu Tue Mar 26 13:00:41 2013 @@ -106,7 +106,7 @@ <value></value> </prop> <prop oor:name="FactoryImplementation"> - <value>org.openoffice.comp.Draw.framework.SidebarFactory</value> + <value>org.openoffice.comp.Draw.framework.PanelFactory</value> </prop> </node> <node oor:name="SwPanelFactory" oor:op="replace"> Modified: openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu?rev=1461104&r1=1461103&r2=1461104&view=diff ============================================================================== --- openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu (original) +++ openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu Tue Mar 26 13:00:41 2013 @@ -45,23 +45,23 @@ </node> <node oor:name="GalleryDeck" oor:op="replace"> - <prop oor:name="Title" oor:type="xs:string"> + <prop oor:name="Title" oor:type="xs:string"> <value xml:lang="en-US">Gallery</value> - </prop> - <prop oor:name="Id" oor:type="xs:string"> + </prop> + <prop oor:name="Id" oor:type="xs:string"> <value>GalleryDeck</value> - </prop> - <prop oor:name="IconURL" oor:type="xs:string"> + </prop> + <prop oor:name="IconURL" oor:type="xs:string"> <value>private:graphicrepository/sfx2/res/symphony/sidebar-gallery-large.png</value> - </prop> + </prop> <prop oor:name="ContextList"> <value oor:separator=";"> any, any, visible ; </value> </prop> - <prop oor:name="OrderIndex" oor:type="xs:int"> + <prop oor:name="OrderIndex" oor:type="xs:int"> <value>150</value> - </prop> + </prop> </node> <node oor:name="ImpressMasterPagesDeck" oor:op="replace"> @@ -124,6 +124,26 @@ </prop> </node> + <node oor:name="NavigatorDeck" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Navigator</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>NavigatorDeck</value> + </prop> + <prop oor:name="IconURL" oor:type="xs:string"> + <value>private:graphicrepository/sfx2/res/symphony/sidebar-navigator-large.png</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + any, any, visible ; + </value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>150</value> + </prop> + </node> + </node> <node oor:name="PanelList"> @@ -307,26 +327,29 @@ </node> <node oor:name="GalleryPanel" oor:op="replace"> - <prop oor:name="Title" oor:type="xs:string"> + <prop oor:name="Title" oor:type="xs:string"> <value xml:lang="en-US">Gallery</value> - </prop> - <prop oor:name="Id" oor:type="xs:string"> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> <value>GalleryPanel</value> - </prop> - <prop oor:name="DeckId" oor:type="xs:string"> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> <value>GalleryDeck</value> - </prop> + </prop> <prop oor:name="ContextList"> <value oor:separator=";"> any, any, visible ; </value> </prop> - <prop oor:name="ImplementationURL" oor:type="xs:string"> + <prop oor:name="ImplementationURL" oor:type="xs:string"> <value>private:resource/toolpanel/SvxPanelFactory/GalleryPanel</value> - </prop> - <prop oor:name="OrderIndex" oor:type="xs:int"> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> - </prop> + </prop> </node> <node oor:name="PosSizePropertyPanel" oor:op="replace"> @@ -763,6 +786,32 @@ </prop> </node> + <node oor:name="SdNavigatorPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Navigator</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>SdNavigatorPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>NavigatorDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + DrawImpress, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SdPanelFactory/Navigator</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + </node> </node> </oor:component-data> Modified: openoffice/branches/sidebar/main/sd/source/ui/dlg/NavigatorChildWindow.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/dlg/NavigatorChildWindow.cxx?rev=1461104&r1=1461103&r2=1461104&view=diff ============================================================================== --- openoffice/branches/sidebar/main/sd/source/ui/dlg/NavigatorChildWindow.cxx (original) +++ openoffice/branches/sidebar/main/sd/source/ui/dlg/NavigatorChildWindow.cxx Tue Mar 26 13:00:41 2013 @@ -29,11 +29,31 @@ #include "app.hrc" #include "navigatr.hrc" #include <sfx2/app.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <svl/eitem.hxx> +#include <boost/bind.hpp> + namespace sd { SFX_IMPL_CHILDWINDOWCONTEXT(NavigatorChildWindow, SID_NAVIGATOR) +void RequestNavigatorUpdate (SfxBindings* pBindings) +{ + if (pBindings != NULL + && pBindings->GetDispatcher() != NULL) + { + SfxBoolItem aItem (SID_NAVIGATOR_INIT, sal_True); + pBindings->GetDispatcher()->Execute( + SID_NAVIGATOR_INIT, + SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, + &aItem, + 0L); + } +} + + NavigatorChildWindow::NavigatorChildWindow ( ::Window* pParent, sal_uInt16 nId, @@ -41,8 +61,12 @@ NavigatorChildWindow::NavigatorChildWind SfxChildWinInfo* ) : SfxChildWindowContext( nId ) { - SdNavigatorWin* pNavWin = new SdNavigatorWin( pParent, this, - SdResId( FLT_NAVIGATOR ), pBindings ); + SdNavigatorWin* pNavWin = new SdNavigatorWin( + pParent, + this, + SdResId( FLT_NAVIGATOR ), + pBindings, + ::boost::bind(RequestNavigatorUpdate, pBindings)); SetWindow( pNavWin ); } Modified: openoffice/branches/sidebar/main/sd/source/ui/dlg/navigatr.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/dlg/navigatr.cxx?rev=1461104&r1=1461103&r2=1461104&view=diff ============================================================================== --- openoffice/branches/sidebar/main/sd/source/ui/dlg/navigatr.cxx (original) +++ openoffice/branches/sidebar/main/sd/source/ui/dlg/navigatr.cxx Tue Mar 26 13:00:41 2013 @@ -72,18 +72,19 @@ SdNavigatorWin::SdNavigatorWin( ::Window* pParent, ::sd::NavigatorChildWindow* pChWinCtxt, const SdResId& rSdResId, - SfxBindings* pInBindings ) -: ::Window( pParent, rSdResId ) -, maToolbox ( this, SdResId( 1 ) ) -, maTlbObjects( this, SdResId( TLB_OBJECTS ) ) -, maLbDocs ( this, SdResId( LB_DOCS ) ) -, mpChildWinContext( pChWinCtxt ) -, mbDocImported ( sal_False ) - // Bei Aenderung des DragTypes: SelectionMode der TLB anpassen! -, meDragType ( NAVIGATOR_DRAGTYPE_EMBEDDED ) -, mpBindings ( pInBindings ) -, maImageList ( SdResId( IL_NAVIGATR ) ) -, maImageListH ( SdResId( ILH_NAVIGATR ) ) + SfxBindings* pInBindings, + const UpdateRequestFunctor& rUpdateRequest) + : ::Window( pParent, rSdResId ), + maToolbox ( this, SdResId( 1 ) ), + maTlbObjects( this, SdResId( TLB_OBJECTS ) ), + maLbDocs ( this, SdResId( LB_DOCS ) ), + mpChildWinContext( pChWinCtxt ), + mbDocImported ( sal_False ), + // Bei Aenderung des DragTypes: SelectionMode der TLB anpassen! + meDragType ( NAVIGATOR_DRAGTYPE_EMBEDDED ), + mpBindings ( pInBindings ), + maImageList ( SdResId( IL_NAVIGATR ) ), + maImageListH ( SdResId( ILH_NAVIGATR ) ) { maTlbObjects.SetViewFrame( mpBindings->GetDispatcher()->GetFrame() ); @@ -91,8 +92,8 @@ SdNavigatorWin::SdNavigatorWin( maTlbObjects.SetAccessibleName(String(SdResId(STR_OBJECTS_TREE))); - mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings ); - mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings ); + mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings, rUpdateRequest); + mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings, rUpdateRequest); mpDocList = new List(); ApplyImageList(); // load images *before* calculating sizes to get something useful !!! @@ -137,13 +138,13 @@ SdNavigatorWin::SdNavigatorWin( if( nMinWidth > maMinSize.Width() ) maMinSize.Width() = nMinWidth; maMinSize.Height() -= 40; - ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel( maMinSize ); + SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(GetParent()); + if (pDockingParent != NULL) + pDockingParent->SetMinOutputSizePixel( maMinSize ); // InitTlb; Wird ueber Slot initiiert - SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True ); - mpBindings->GetDispatcher()->Execute( - SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); - + if (rUpdateRequest) + rUpdateRequest(); } // ----------------------------------------------------------------------- @@ -882,11 +883,14 @@ void SdNavigatorWin::ApplyImageList() |* \************************************************************************/ -SdNavigatorControllerItem::SdNavigatorControllerItem( sal_uInt16 _nId, - SdNavigatorWin* pNavWin, - SfxBindings* _pBindings) : - SfxControllerItem( _nId, *_pBindings ), - pNavigatorWin( pNavWin ) +SdNavigatorControllerItem::SdNavigatorControllerItem( + sal_uInt16 _nId, + SdNavigatorWin* pNavWin, + SfxBindings* _pBindings, + const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest) + : SfxControllerItem( _nId, *_pBindings ), + pNavigatorWin( pNavWin ), + maUpdateRequest(rUpdateRequest) { } @@ -954,9 +958,8 @@ void SdNavigatorControllerItem::StateCha if( nState & NAVTLB_UPDATE ) { // InitTlb; Wird ueber Slot initiiert - SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True ); - GetBindings().GetDispatcher()->Execute( - SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); + if (maUpdateRequest) + maUpdateRequest(); } } } @@ -968,11 +971,14 @@ void SdNavigatorControllerItem::StateCha |* \************************************************************************/ -SdPageNameControllerItem::SdPageNameControllerItem( sal_uInt16 _nId, - SdNavigatorWin* pNavWin, - SfxBindings* _pBindings) : - SfxControllerItem( _nId, *_pBindings ), - pNavigatorWin( pNavWin ) +SdPageNameControllerItem::SdPageNameControllerItem( + sal_uInt16 _nId, + SdNavigatorWin* pNavWin, + SfxBindings* _pBindings, + const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest) + : SfxControllerItem( _nId, *_pBindings ), + pNavigatorWin( pNavWin ), + maUpdateRequest(rUpdateRequest) { } Modified: openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicPaneFactory.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicPaneFactory.cxx?rev=1461104&r1=1461103&r2=1461104&view=diff ============================================================================== --- openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicPaneFactory.cxx (original) +++ openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicPaneFactory.cxx Tue Mar 26 13:00:41 2013 @@ -51,8 +51,7 @@ namespace { CenterPaneId, FullScreenPaneId, LeftImpressPaneId, - LeftDrawPaneId, - SidebarPaneId + LeftDrawPaneId }; static const sal_Int32 gnConfigurationUpdateStartEvent(0); Modified: openoffice/branches/sidebar/main/sd/source/ui/inc/navigatr.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/inc/navigatr.hxx?rev=1461104&r1=1461103&r2=1461104&view=diff ============================================================================== --- openoffice/branches/sidebar/main/sd/source/ui/inc/navigatr.hxx (original) +++ openoffice/branches/sidebar/main/sd/source/ui/inc/navigatr.hxx Tue Mar 26 13:00:41 2013 @@ -88,11 +88,21 @@ class SdNavigatorWin : public Window { public: + typedef ::boost::function<void(void)> UpdateRequestFunctor; + + /** Create a new instance of the navigator. + @param bUseActiveUpdate + When <TRUE/>, the default, then the SdNavigatorWin object + will make a SID_NAVIGATOR_INIT call whenever it thinks an + update is necessary. When <FALSE/> the navigator will + rely on others to trigger updates. + */ SdNavigatorWin( ::Window* pParent, ::sd::NavigatorChildWindow* pChildWinContext, const SdResId& rSdResId, - SfxBindings* pBindings ); + SfxBindings* pBindings, + const UpdateRequestFunctor& rUpdateRequest); virtual ~SdNavigatorWin(); virtual void KeyInput( const KeyEvent& rKEvt ); @@ -137,7 +147,7 @@ private: /** This flag controls whether all shapes or only the named shapes are shown. */ - bool mbShowAllShapes; + // bool mbShowAllShapes; sal_uInt16 GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage = sal_False ); NavDocInfo* GetDocInfo(); @@ -169,7 +179,8 @@ private: class SdNavigatorControllerItem : public SfxControllerItem { public: - SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* ); + SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*, + const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest); protected: virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, @@ -177,6 +188,7 @@ protected: private: SdNavigatorWin* pNavigatorWin; + const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest; }; @@ -190,7 +202,8 @@ private: class SdPageNameControllerItem : public SfxControllerItem { public: - SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* ); + SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*, + const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest); protected: virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, @@ -198,6 +211,7 @@ protected: private: SdNavigatorWin* pNavigatorWin; + const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest; }; #endif Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/NavigatorWrapper.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/NavigatorWrapper.cxx?rev=1461104&view=auto ============================================================================== --- openoffice/branches/sidebar/main/sd/source/ui/sidebar/NavigatorWrapper.cxx (added) +++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/NavigatorWrapper.cxx Tue Mar 26 13:00:41 2013 @@ -0,0 +1,86 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sd.hxx" + +#include "NavigatorWrapper.hxx" +#include "navigatr.hrc" +#include "ViewShellBase.hxx" + +#include <boost/bind.hpp> + + +namespace sd { namespace sidebar { + +NavigatorWrapper::NavigatorWrapper ( + ::Window* pParent, + sd::ViewShellBase& rViewShellBase, + SfxBindings* pBindings) + : Control(pParent, 0), + mrViewShellBase(rViewShellBase), + maNavigator( + this, + NULL, + SdResId(FLT_NAVIGATOR), + pBindings, + ::boost::bind(&NavigatorWrapper::UpdateNavigator, this)) +{ + maNavigator.SetPosSizePixel( + Point(0,0), + GetSizePixel()); + maNavigator.Show(); +} + + + + +NavigatorWrapper::~NavigatorWrapper (void) +{ +} + + + + +void NavigatorWrapper::Resize (void) +{ + maNavigator.SetSizePixel(GetSizePixel()); +} + + + + +css::ui::LayoutSize NavigatorWrapper::GetHeightForWidth (const sal_Int32 nWidth) +{ + (void)nWidth; + + return css::ui::LayoutSize(-1,-1,-1); +} + + + + +void NavigatorWrapper::UpdateNavigator (void) +{ + maNavigator.InitTreeLB(mrViewShellBase.GetDocument()); +} + + +} } // end of namespace sd::sidebar Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/NavigatorWrapper.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/NavigatorWrapper.hxx?rev=1461104&view=auto ============================================================================== --- openoffice/branches/sidebar/main/sd/source/ui/sidebar/NavigatorWrapper.hxx (added) +++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/NavigatorWrapper.hxx Tue Mar 26 13:00:41 2013 @@ -0,0 +1,72 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SD_SIDEBAR_NAVIGATOR_WRAPPER_HXX +#define SD_SIDEBAR_NAVIGATOR_WRAPPER_HXX + +#include <sfx2/sidebar/ILayoutableWindow.hxx> +#include <vcl/ctrl.hxx> +#include "navigatr.hxx" + + +class SfxBindings; +namespace sd { class ViewShellBase; } + +namespace css = ::com::sun::star; + +namespace sd { namespace sidebar { + +/** Present the navigator as control that can be displayed inside the + sidebar. + This wrapper has two main responsibilities: + - Watch for document changes and update the navigator when one + happens. + - Forward size changes from sidebar to navigator. +*/ +class NavigatorWrapper + : public Control, + public sfx2::sidebar::ILayoutableWindow +{ +public: + NavigatorWrapper ( + ::Window* pParent, + sd::ViewShellBase& rViewShellBase, + SfxBindings* pBindings); + + virtual ~NavigatorWrapper (void); + + // Control + virtual void Resize (void); + + // From ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + +private: + ViewShellBase& mrViewShellBase; + SdNavigatorWin maNavigator; + + void UpdateNavigator (void); +}; + + +} } // end of namespace sd::sidebar + +#endif Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/PanelFactory.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/PanelFactory.cxx?rev=1461104&view=auto ============================================================================== --- openoffice/branches/sidebar/main/sd/source/ui/sidebar/PanelFactory.cxx (added) +++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/PanelFactory.cxx Tue Mar 26 13:00:41 2013 @@ -0,0 +1,208 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sd.hxx" + +#include "PanelFactory.hxx" +#include "framework/Pane.hxx" +#include "ViewShellBase.hxx" +#include "DrawController.hxx" +#include "LayoutMenu.hxx" +#include "CurrentMasterPagesSelector.hxx" +#include "RecentMasterPagesSelector.hxx" +#include "AllMasterPagesSelector.hxx" +#include "CustomAnimationPanel.hxx" +#include "TableDesignPanel.hxx" +#include "SlideTransitionPanel.hxx" +#include "NavigatorWrapper.hxx" + +#include <sfx2/viewfrm.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <vcl/window.hxx> +#include <toolkit/helper/vclunohelper.hxx> + +using namespace css; +using namespace cssu; +using namespace ::sd::framework; +using ::rtl::OUString; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +namespace sd { namespace sidebar { + +namespace { + /** Note that these names have to be identical to (the tail of) + the entries in officecfg/registry/data/org/openoffice/Office/Impress.xcu + for the TaskPanelFactory. + */ + const static char* gsResourceNameCustomAnimations = "/CustomAnimations"; + const static char* gsResourceNameLayouts = "/Layouts"; + const static char* gsResourceNameAllMasterPages = "/AllMasterPages"; + const static char* gsResourceNameRecentMasterPages = "/RecentMasterPages"; + const static char* gsResourceNameUsedMasterPages = "/UsedMasterPages"; + const static char* gsResourceNameSlideTransitions = "/SlideTransitions"; + const static char* gsResourceNameTableDesign = "/TableDesign"; + const static char* gsResourceNameNavigator = "/Navigator"; +} + +Reference<lang::XEventListener> mxControllerDisposeListener; + + + +// ----- Service functions ---------------------------------------------------- + +Reference<XInterface> SAL_CALL PanelFactory_createInstance ( + const Reference<XComponentContext>& rxContext) +{ + return Reference<XInterface>(static_cast<XWeak*>(new PanelFactory(rxContext))); +} + + + + +::rtl::OUString PanelFactory_getImplementationName (void) throw(RuntimeException) +{ + return ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.Draw.framework.PanelFactory")); +} + + + + +Sequence<rtl::OUString> SAL_CALL PanelFactory_getSupportedServiceNames (void) + throw (RuntimeException) +{ + static const ::rtl::OUString sServiceName( + ::rtl::OUString::createFromAscii("com.sun.star.drawing.framework.PanelFactory")); + return Sequence<rtl::OUString>(&sServiceName, 1); +} + + + + +//----- PanelFactory -------------------------------------------------------- + +PanelFactory::PanelFactory( + const css::uno::Reference<css::uno::XComponentContext>& rxContext) + : PanelFactoryInterfaceBase(m_aMutex) +{ +} + + + + +PanelFactory::~PanelFactory (void) +{ +} + + + + +void SAL_CALL PanelFactory::disposing (void) +{ +} + + + + +// XUIElementFactory + +Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( + const ::rtl::OUString& rsUIElementResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + css::container::NoSuchElementException, + css::lang::IllegalArgumentException, + cssu::RuntimeException) +{ + // Process arguments. + const ::comphelper::NamedValueCollection aArguments (rArguments); + Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>())); + Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>())); + Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>())); + + // Throw exceptions when the arguments are not as expected. + ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); + if ( ! xParentWindow.is() || pParentWindow==NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without ParentWindow"), + NULL); + if ( ! xFrame.is()) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without XFrame"), + NULL); + + // Tunnel through the controller to obtain a ViewShellBase. + ViewShellBase* pBase = NULL; + Reference<lang::XUnoTunnel> xTunnel (xFrame->getController(), UNO_QUERY); + if (xTunnel.is()) + { + ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>( + xTunnel->getSomething(sd::DrawController::getUnoTunnelId())); + if (pController != NULL) + pBase = pController->GetViewShellBase(); + } + if (pBase == NULL) + throw RuntimeException(A2S("can not get ViewShellBase for frame"), NULL); + + // Get bindings from given arguments. + const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); + SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); + + // Create a framework view. + ::Window* pControl = NULL; + +#define EndsWith(s,t) s.endsWithAsciiL(t,strlen(t)) + if (EndsWith(rsUIElementResourceURL, gsResourceNameCustomAnimations)) + pControl = new CustomAnimationPanel(pParentWindow, *pBase); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameLayouts)) + pControl = new LayoutMenu(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameAllMasterPages)) + pControl = AllMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameRecentMasterPages)) + pControl = RecentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameUsedMasterPages)) + pControl = CurrentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameSlideTransitions)) + pControl = new SlideTransitionPanel(pParentWindow, *pBase); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameTableDesign)) + pControl = new TableDesignPanel(pParentWindow, *pBase); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameNavigator)) + pControl = new NavigatorWrapper(pParentWindow, *pBase, pBindings); +#undef EndsWith + + if (pControl == NULL) + throw lang::IllegalArgumentException(); + + // Create a wrapper around the control that implements the + // necessary UNO interfaces. + return sfx2::sidebar::SidebarPanelBase::Create( + rsUIElementResourceURL, + xFrame, + pControl, + ui::LayoutSize(-1,-1,-1)); +} + + + + +} } // end of namespace sd::sidebar Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/PanelFactory.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/PanelFactory.hxx?rev=1461104&view=auto ============================================================================== --- openoffice/branches/sidebar/main/sd/source/ui/sidebar/PanelFactory.hxx (added) +++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/PanelFactory.hxx Tue Mar 26 13:00:41 2013 @@ -0,0 +1,88 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SD_SIDEBAR_PANEL_FACTORY_HXX +#define SD_SIDEBAR_PANEL_FACTORY_HXX + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> +#include <rtl/ref.hxx> +#include "framework/Pane.hxx" + +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XInitialization.hpp> + +#include <map> +#include <boost/noncopyable.hpp> +#include <boost/shared_ptr.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +namespace sd { + class ViewShellBase; +} + +namespace sd { namespace sidebar { + +namespace +{ + typedef ::cppu::WeakComponentImplHelper1 < + css::ui::XUIElementFactory + > PanelFactoryInterfaceBase; +} + + +class PanelFactory + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public PanelFactoryInterfaceBase +{ +public: + static ::rtl::OUString SAL_CALL getImplementationName (void); + static cssu::Reference<cssu::XInterface> SAL_CALL createInstance ( + const cssu::Reference<css::lang::XMultiServiceFactory>& rxFactory); + static cssu::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames (void); + + PanelFactory (const cssu::Reference<cssu::XComponentContext>& rxContext); + virtual ~PanelFactory (void); + + virtual void SAL_CALL disposing (void); + + + // XUIElementFactory + + cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement ( + const ::rtl::OUString& rsResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + css::container::NoSuchElementException, + css::lang::IllegalArgumentException, + cssu::RuntimeException); +}; + + +} } // end of namespace sd::sidebar + +#endif Modified: openoffice/branches/sidebar/main/sd/source/ui/sidebar/makefile.mk URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/makefile.mk?rev=1461104&r1=1461103&r2=1461104&view=diff ============================================================================== --- openoffice/branches/sidebar/main/sd/source/ui/sidebar/makefile.mk (original) +++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/makefile.mk Tue Mar 26 13:00:41 2013 @@ -51,11 +51,12 @@ SLOFILES = \ $(SLO)$/MasterPageDescriptor.obj \ $(SLO)$/MasterPageObserver.obj \ $(SLO)$/MasterPagesSelector.obj \ + $(SLO)$/NavigatorWrapper.obj \ $(SLO)$/PanelBase.obj \ + $(SLO)$/PanelFactory.obj \ $(SLO)$/PreviewValueSet.obj \ $(SLO)$/RecentlyUsedMasterPages.obj \ $(SLO)$/RecentMasterPagesSelector.obj \ - $(SLO)$/SidebarFactory.obj \ $(SLO)$/SlideTransitionPanel.obj \ $(SLO)$/TableDesignPanel.obj Modified: openoffice/branches/sidebar/main/sd/source/ui/unoidl/facreg.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/unoidl/facreg.cxx?rev=1461104&r1=1461103&r2=1461104&view=diff ============================================================================== --- openoffice/branches/sidebar/main/sd/source/ui/unoidl/facreg.cxx (original) +++ openoffice/branches/sidebar/main/sd/source/ui/unoidl/facreg.cxx Tue Mar 26 13:00:41 2013 @@ -140,11 +140,11 @@ extern uno::Sequence<OUString> SAL_CALL namespace sd { namespace sidebar { -extern uno::Reference<uno::XInterface> SAL_CALL SidebarFactory_createInstance( +extern uno::Reference<uno::XInterface> SAL_CALL PanelFactory_createInstance( const uno::Reference<uno::XComponentContext>& rxContext) throw(uno::Exception); -extern OUString SidebarFactory_getImplementationName(void) throw (uno::RuntimeException); -extern uno::Sequence<OUString> SAL_CALL SidebarFactory_getSupportedServiceNames (void) +extern OUString PanelFactory_getImplementationName(void) throw (uno::RuntimeException); +extern uno::Sequence<OUString> SAL_CALL PanelFactory_getSupportedServiceNames (void) throw (uno::RuntimeException); } } @@ -229,7 +229,7 @@ enum FactoryId BasicPaneFactoryFactoryId, BasicToolBarFactoryFactoryId, BasicViewFactoryFactoryId, - SidebarFactoryFactoryId, + PanelFactoryFactoryId, ResourceIdFactoryId, PresentationFactoryProviderFactoryId, SlideRendererFactoryId, @@ -262,7 +262,7 @@ static ::boost::shared_ptr<FactoryMap> s (*spFactoryMap)[BasicPaneFactory_getImplementationName()] = BasicPaneFactoryFactoryId; (*spFactoryMap)[BasicToolBarFactory_getImplementationName()] = BasicToolBarFactoryFactoryId; (*spFactoryMap)[BasicViewFactory_getImplementationName()] = BasicViewFactoryFactoryId; - (*spFactoryMap)[sidebar::SidebarFactory_getImplementationName()] = SidebarFactoryFactoryId; + (*spFactoryMap)[sidebar::PanelFactory_getImplementationName()] = PanelFactoryFactoryId; (*spFactoryMap)[ResourceId_getImplementationName()] = ResourceIdFactoryId; (*spFactoryMap)[PresentationFactoryProvider_getImplementationName()] = PresentationFactoryProviderFactoryId; (*spFactoryMap)[SlideRenderer_getImplementationName()] = SlideRendererFactoryId; @@ -392,11 +392,11 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL com sd::framework::BasicViewFactory_getSupportedServiceNames()); break; - case SidebarFactoryFactoryId: + case PanelFactoryFactoryId: xComponentFactory = ::cppu::createSingleComponentFactory( - sd::sidebar::SidebarFactory_createInstance, - sd::sidebar::SidebarFactory_getImplementationName(), - sd::sidebar::SidebarFactory_getSupportedServiceNames()); + sd::sidebar::PanelFactory_createInstance, + sd::sidebar::PanelFactory_getImplementationName(), + sd::sidebar::PanelFactory_getSupportedServiceNames()); break; case ResourceIdFactoryId: