You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2013/02/19 10:09:05 UTC
svn commit: r1447641 [3/9] - in /openoffice/branches/sidebar/main:
default_images/sfx2/res/symphony/ framework/inc/services/
framework/source/services/ offapi/com/sun/star/ui/
officecfg/registry/data/org/openoffice/Office/
officecfg/registry/data/org/o...
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarFocusManager.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarFocusManager.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarFocusManager.hxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarFocusManager.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,130 @@
+/**************************************************************
+ *
+ * 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_TOOLPANEL_FOCUS_MANAGER_HXX
+#define SD_TOOLPANEL_FOCUS_MANAGER_HXX
+
+#include <tools/link.hxx>
+
+#include <memory>
+
+class KeyCode;
+class VclSimpleEvent;
+class Window;
+
+namespace sd { namespace toolpanel {
+
+/** On certain key presses the focus is moved from one window to another.
+ For this to work every window that wants its focus managed has to
+ register or be registered and tell where to put the focus on what key
+ press.
+*/
+class FocusManager
+{
+public:
+ /** Return an instance of the focus manager.
+ */
+ static FocusManager& Instance (void);
+
+ /** Register a link from one window to another so that any time the
+ specified key is pressed while the source window is focused, the
+ focus is transferred to the target window.
+ @param pSource
+ The window from which the focus will be transferred.
+ @param pTarget
+ The window to which the focus will be transferred.
+ @param rKey
+ The key for which the focus is transferred from the source
+ window to the target window.
+ */
+ void RegisterLink (
+ ::Window* pSource,
+ ::Window* pTarget,
+ const KeyCode& rKey);
+
+ /** Register a link that will move the focus from the source window to
+ the target window when the source window is focused and KEY_ESCAPE
+ is pressed.
+ @param pSource
+ The window from which the focus will be transferred.
+ @param pTarget
+ The window to which the focus will be transferred.
+ */
+ void RegisterUpLink (::Window* pSource, ::Window* pTarget);
+
+ /** Register a link that will move the focus from the source window to
+ the target window when the source window is focused and KEY_RETURN
+ is pressed.
+ @param pSource
+ The window from which the focus will be transferred.
+ @param pTarget
+ The window to which the focus will be transferred.
+ */
+ void RegisterDownLink (::Window* pSource, ::Window* pTarget);
+
+ /** Remove all links from the source window to the target window. When
+ there are links from the target window to the source window then
+ these are not touced.
+ */
+ void RemoveLinks (
+ ::Window* pSource,
+ ::Window* pTarget);
+
+ /** Let the focus manager transfer the focus from the specified source
+ window to a target window that is determined according the the
+ registered links and the given key code.
+ When there is no rule for this combination of source window and key
+ code then the focus stays where it is.
+ */
+ bool TransferFocus (::Window* pSource, const KeyCode& rCode);
+
+private:
+ class LinkMap;
+ ::std::auto_ptr<LinkMap> mpLinks;
+
+ FocusManager (void);
+ ~FocusManager (void);
+
+ /** Clear the list of focus transfer links. This removes all window
+ listeners.
+ */
+ void Clear (void);
+
+ /** Remove all links from or to the given window.
+ */
+ void RemoveLinks (::Window* pWindow);
+
+ /** Unregister as event listener from the given window when there are no
+ links from this window anymore.
+ */
+ void RemoveUnusedEventListener (::Window* pWindow);
+
+ /** Listen for key events and on KEY_RETURN go down and on
+ KEY_ESCAPE go up.
+ */
+ DECL_LINK(WindowEventListener, VclSimpleEvent*);
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarShellManager.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarShellManager.cxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarShellManager.cxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarShellManager.cxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,176 @@
+/**************************************************************
+ *
+ * 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 "SidebarShellManager.hxx"
+
+#include "ViewShellManager.hxx"
+#include <tools/diagnose_ex.h>
+#include <vcl/window.hxx>
+
+#include <algorithm>
+
+namespace sd { namespace sidebar {
+
+SidebarShellManager::SidebarShellManager (
+ const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
+ const ViewShell& rViewShell)
+ : mpViewShellManager(rpViewShellManager),
+ mrViewShell(rViewShell),
+ maSubShells()
+{
+}
+
+
+
+
+SidebarShellManager::~SidebarShellManager (void)
+{
+ while ( ! maSubShells.empty())
+ RemoveSubShell(maSubShells.begin()->second.mpShell);
+}
+
+
+
+
+SfxShell* SidebarShellManager::CreateShell( ShellId nId, ::Window* , FrameView* )
+{
+ SubShells::const_iterator iShell (maSubShells.find(nId));
+ if (iShell != maSubShells.end())
+ return iShell->second.mpShell;
+ else
+ return NULL;
+}
+
+
+
+
+void SidebarShellManager::ReleaseShell (SfxShell* )
+{
+ // Nothing to do.
+}
+
+void SidebarShellManager::AddSubShell (
+ ShellId nId,
+ SfxShell* pShell,
+ ::Window* pWindow)
+{
+ if (pShell != NULL)
+ {
+ maSubShells[nId] = ShellDescriptor(pShell,pWindow);
+ if (pWindow != NULL)
+ {
+ pWindow->AddEventListener(LINK(this,SidebarShellManager,WindowCallback));
+ if (pWindow->IsReallyVisible())
+ mpViewShellManager->ActivateSubShell(mrViewShell, nId);
+ }
+ else
+ mpViewShellManager->ActivateSubShell(mrViewShell, nId);
+ }
+}
+
+
+
+
+void SidebarShellManager::RemoveSubShell (const ShellId i_nShellId)
+{
+ SubShells::iterator pos = maSubShells.find( i_nShellId );
+ ENSURE_OR_RETURN_VOID( pos != maSubShells.end(), "no shell for this ID" );
+ if ( pos->second.mpWindow != NULL )
+ {
+ pos->second.mpWindow->RemoveEventListener( LINK( this, SidebarShellManager, WindowCallback ) );
+ }
+ mpViewShellManager->DeactivateSubShell( mrViewShell, pos->first );
+ maSubShells.erase( pos );
+}
+
+
+
+
+void SidebarShellManager::RemoveSubShell (const SfxShell* pShell)
+{
+ if (pShell != NULL)
+ {
+ SubShells::iterator iShell;
+ for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
+ if (iShell->second.mpShell == pShell)
+ {
+ if (iShell->second.mpWindow != NULL)
+ iShell->second.mpWindow->RemoveEventListener(
+ LINK(this,SidebarShellManager,WindowCallback));
+ mpViewShellManager->DeactivateSubShell(mrViewShell,iShell->first);
+ maSubShells.erase(iShell);
+ break;
+ }
+ }
+}
+
+
+
+
+void SidebarShellManager::MoveToTop (SfxShell* pShell)
+{
+ SubShells::const_iterator iShell;
+ for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
+ if (iShell->second.mpShell == pShell)
+ {
+ ViewShellManager::UpdateLock aLocker (mpViewShellManager);
+ mpViewShellManager->MoveSubShellToTop(mrViewShell,iShell->first);
+ mpViewShellManager->MoveToTop(mrViewShell);
+ break;
+ }
+}
+
+
+
+
+IMPL_LINK(SidebarShellManager, WindowCallback, VclWindowEvent*, pEvent)
+{
+ if (pEvent != NULL)
+ {
+ SubShells::const_iterator iShell;
+ ::Window* pWindow = pEvent->GetWindow();
+ for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
+ if (iShell->second.mpWindow == pWindow)
+ break;
+ if (iShell != maSubShells.end())
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_SHOW:
+ mpViewShellManager->ActivateSubShell(mrViewShell,iShell->first);
+ break;
+
+ case VCLEVENT_WINDOW_HIDE:
+ // Do not activate the sub shell. This leads to
+ // problems with shapes currently being in text edit
+ // mode: Deactivating the shell leads to leaving the
+ // text editing mode.
+ // mpViewShellManager->DeactivateSubShell(mrViewShell,iShell->first);
+ break;
+ }
+ }
+
+ return 0;
+}
+
+
+} } // end of namespace ::sd::sidebar
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarShellManager.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarShellManager.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarShellManager.hxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarShellManager.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,117 @@
+/**************************************************************
+ *
+ * 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_SHELL_MANAGER_HXX
+#define SD_SIDEBAR_SHELL_MANAGER_HXX
+
+#include "ShellFactory.hxx"
+#include "ViewShellManager.hxx"
+#include <map>
+
+class FrameView;
+class SfxShell;
+class VclWindowEvent;
+class Window;
+
+namespace sd {
+class ViewShell;
+}
+
+namespace sd { namespace sidebar {
+
+/** The TaskPaneShellManager implements the ViewShellManager::ShellFactory
+ interface. However, it does not create or delete shells. It only
+ gives the ViewShellManager access to the sub shells of the
+ ToolPanelViewShell. Life time control of the sub shells is managed by
+ the sub shells themselves.
+*/
+class SidebarShellManager
+ : public ShellFactory<SfxShell>
+{
+public:
+ /** Create a shell manager that manages the stacked shells for the given
+ view shell. It works together with the given view shell manager.
+ */
+ SidebarShellManager (
+ const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
+ const ViewShell& rViewShell);
+ ~SidebarShellManager (void);
+
+ /** Return the requested sub shell.
+ @param nId
+ The id of the requested sub shell.
+ @return
+ When there is no sub shell currently registered under the given
+ id then NULL is returned.
+ */
+ virtual SfxShell* CreateShell (
+ ShellId nId,
+ ::Window* pParentWindow,
+ FrameView* pFrameView = NULL);
+
+ virtual void ReleaseShell (SfxShell* pShell);
+
+ /** Add a sub shell to the set of sub shells managed by the
+ TaskPaneShellManager. Only shells added by this method are returned
+ by CreateShell().
+ */
+ void AddSubShell (ShellId nId, SfxShell* pShell, ::Window* pWindow);
+
+ /** Remove the given shell from the set of sub shells managed by the
+ TaskPaneShellManager. Following calls to CreateShell() will return
+ NULL when this shell is requested.
+ */
+ void RemoveSubShell (const SfxShell* pShell);
+ /** removes the shell given by its ID from the set of sub shells managed by the
+ TaskPaneShellManager. Subsequent calls to CreateShell() will return
+ NULL when this shell is requested.
+ */
+ void RemoveSubShell (const ShellId i_nShellId);
+
+ /** Move the given sub-shell to the top of the local shell stack.
+ Furthermore move the view shell whose sub-shells this class manages
+ to the top of the global shell stack.
+ */
+ void MoveToTop (SfxShell* pShell);
+
+ DECL_LINK(WindowCallback,VclWindowEvent*);
+
+private:
+ ::boost::shared_ptr<ViewShellManager> mpViewShellManager;
+
+ /// The view shell whose sub-shells this class manages.
+ const ViewShell& mrViewShell;
+
+ class ShellDescriptor { public:
+ SfxShell* mpShell;
+ ::Window* mpWindow;
+ ShellDescriptor(void) : mpShell(NULL),mpWindow(NULL){}
+ ShellDescriptor(SfxShell*pShell,::Window*pWindow) : mpShell(pShell),mpWindow(pWindow){}
+ };
+ typedef ::std::map<ShellId,ShellDescriptor> SubShells;
+ SubShells maSubShells;
+};
+
+} } // end of namespace ::sd::sidebar
+
+#endif
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarViewShell.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarViewShell.cxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarViewShell.cxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarViewShell.cxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,357 @@
+/**************************************************************
+ *
+ * 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 "SidebarViewShell.hxx"
+
+#include "SidebarShellManager.hxx"
+#include "SidebarFocusManager.hxx"
+#include "taskpane/SlideSorterCacheDisplay.hxx"
+#include "panels/LayoutMenu.hxx"
+#include "panels/CurrentMasterPagesSelector.hxx"
+#include "panels/RecentMasterPagesSelector.hxx"
+#include "panels/AllMasterPagesSelector.hxx"
+#include "panels/CustomAnimationPanel.hxx"
+#include "panels/TableDesignPanel.hxx"
+#include "panels/SlideTransitionPanel.hxx"
+
+#include "glob.hrc"
+#include "Window.hxx"
+#include "FrameView.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
+#include <com/sun/star/drawing/XDrawSubController.hpp>
+
+#include <svx/dlgctrl.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/msg.hxx>
+#include <sfx2/objface.hxx>
+#include <svx/colrctrl.hxx>
+#include <svx/xtable.hxx>
+#include <vcl/dockwin.hxx>
+#include "sdtreelb.hxx"
+#include "DrawViewShell.hxx"
+#include "drawdoc.hxx"
+#include "ViewShellBase.hxx"
+#include <svx/ruler.hxx>
+#include <vcl/svapp.hxx>
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+
+#define SidebarViewShell
+using namespace sd::sidebar;
+#include "sdslots.hxx"
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::sd::framework::FrameworkHelper;
+
+
+namespace sd { namespace sidebar {
+
+SFX_IMPL_INTERFACE(SidebarViewShell, SfxShell, SdResId(STR_SIDEBARVIEWSHELL))
+{
+}
+
+TYPEINIT1(SidebarViewShell, ViewShell);
+
+
+
+
+SidebarViewShell::SidebarViewShell (
+ SfxViewFrame* pFrame,
+ ViewShellBase& rViewShellBase,
+ ::Window* pParentWindow,
+ FrameView* pFrameViewArgument)
+ : ViewShell (pFrame, pParentWindow, rViewShellBase),
+ mpSubShellManager(),
+ maContentWindowParent(NULL, WB_STDWORK)
+{
+ meShellType = ST_SIDEBAR;
+
+ // Move the content window to a parent whose lifetime we have
+ // under control.
+ mpContentWindow->SetParent(&maContentWindowParent);
+ mpContentWindow->SetViewShell(NULL);
+
+#ifdef DEBUG
+ mpContentWindow->SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SidebarViewShell:ContentWindow")));
+#endif
+
+ mpContentWindow->SetCenterAllowed (false);
+
+ SetPool (&GetDoc()->GetPool());
+
+ if (pFrameViewArgument != NULL)
+ mpFrameView = pFrameViewArgument;
+ else
+ mpFrameView = new FrameView(GetDoc());
+ GetFrameView()->Connect();
+
+ // Hide or delete unused controls that we have inherited from the
+ // ViewShell base class.
+ mpHorizontalScrollBar.reset();
+ mpVerticalScrollBar.reset();
+ mpScrollBarBox.reset();
+ mpHorizontalRuler.reset();
+ mpVerticalRuler.reset();
+ mpContentWindow->Hide();
+ SetActiveWindow(mpContentWindow.get());
+
+ SetName (String (RTL_CONSTASCII_USTRINGPARAM("SidebarViewShell")));
+
+ // Register the shell manager as factory at the ViewShellManager.
+ mpSubShellManager.reset (new SidebarShellManager(
+ GetViewShellBase().GetViewShellManager(),
+ *this));
+ GetViewShellBase().GetViewShellManager()->AddSubShellFactory(this, mpSubShellManager);
+}
+
+
+
+
+SidebarViewShell::~SidebarViewShell (void)
+{
+ GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager);
+ GetFrameView()->Disconnect(); //, memory leak,
+
+ // Delete the content window before its parent is destroyed.
+ mpContentWindow.reset();
+}
+
+
+
+// static
+void SidebarViewShell::RegisterControls (void)
+{
+ SfxModule* pModule = SD_MOD();
+ MasterPagesSelector::RegisterInterface(pModule);
+ LayoutMenu::RegisterInterface(pModule);
+}
+
+
+
+
+::Window* SidebarViewShell::CreatePanel (
+ ::Window* pParentWindow,
+ const PanelId ePanelId)
+{
+ if (pParentWindow == NULL)
+ return NULL;
+ switch(ePanelId)
+ {
+ case PID_CUSTOM_ANIMATION:
+ return new CustomAnimationPanel(pParentWindow, this->GetViewShellBase());
+
+ case PID_LAYOUT:
+ return new LayoutMenu(
+ pParentWindow,
+ GetViewShellBase(),
+ GetSubShellManager());
+
+ case PID_MASTER_PAGES_ALL:
+ return AllMasterPagesSelector::Create(
+ pParentWindow,
+ GetViewShellBase(),
+ GetSubShellManager());
+ case PID_MASTER_PAGES_RECENT:
+ return RecentMasterPagesSelector::Create(
+ pParentWindow,
+ GetViewShellBase(),
+ GetSubShellManager());
+ case PID_MASTER_PAGES_USED:
+ return CurrentMasterPagesSelector::Create(
+ pParentWindow,
+ GetViewShellBase(),
+ GetSubShellManager());
+
+ case PID_SLIDE_TRANSITION:
+ return new SlideTransitionPanel(pParentWindow, this->GetViewShellBase());
+
+ case PID_TABLE_DESIGN:
+ return new TableDesignPanel(pParentWindow, this->GetViewShellBase());
+
+ default:
+ return NULL;
+ }
+}
+
+
+
+
+void SidebarViewShell::ArrangeGUIElements (void)
+{
+ ViewShell::ArrangeGUIElements();
+}
+
+
+
+
+void SidebarViewShell::GetFocus (void)
+{
+ Invalidate ();
+}
+
+
+
+
+void SidebarViewShell::LoseFocus (void)
+{
+ Invalidate ();
+}
+
+
+
+
+void SidebarViewShell::KeyInput (const KeyEvent& rEvent)
+{
+ KeyCode nCode = rEvent.GetKeyCode();
+ if (nCode == KEY_RETURN)
+ {
+// mpTaskPane->GrabFocus();
+ }
+ else
+ ViewShell::KeyInput (rEvent, NULL);
+}
+
+
+
+
+
+
+
+SdPage* SidebarViewShell::GetActualPage (void)
+{
+ return NULL;
+}
+
+SdPage* SidebarViewShell::getCurrentPage(void) const
+{
+ return NULL;
+}
+
+
+
+void SidebarViewShell::Execute (SfxRequest& )
+{
+}
+
+
+
+
+void SidebarViewShell::GetState (SfxItemSet& rItemSet)
+{
+ (void)rItemSet;
+}
+
+
+
+
+SidebarShellManager& SidebarViewShell::GetSubShellManager (void) const
+{
+ return *mpSubShellManager.get();
+}
+
+
+
+
+DockingWindow* SidebarViewShell::GetDockingWindow (void)
+{
+ ::Window* pParentWindow = GetParentWindow();
+ DockingWindow* pDockingWindow = NULL;
+ while (pParentWindow!=NULL && pDockingWindow==NULL)
+ {
+ pDockingWindow = dynamic_cast<DockingWindow*>(pParentWindow);
+ pParentWindow = pParentWindow->GetParent();
+ }
+ return pDockingWindow;
+}
+
+
+
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ SidebarViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> xAccessible;
+
+ //if (mpTaskPane.get()!=NULL && pWindow!=NULL)
+ //{
+ // // We have to call CreateAccessible directly so that we can specify
+ // // the correct accessible parent.
+ // ::Window* pParentWindow = pWindow->GetAccessibleParentWindow();
+ // if (pParentWindow != NULL)
+ // xAccessible = mpTaskPane->CreateAccessibleObject(
+ // pParentWindow->GetAccessible());
+ //}
+
+ return xAccessible;
+}
+
+
+
+
+Reference<drawing::XDrawSubController> SidebarViewShell::CreateSubController (void)
+{
+ // This view shell is not designed to be the main view shell and thus
+ // does not support a UNO sub controller.
+ return Reference<drawing::XDrawSubController>();
+}
+
+
+
+
+bool SidebarViewShell::RelocateToParentWindow (::Window* pParentWindow)
+{
+ /* ::Window* pOldParentWindow = GetParentWindow();
+ FocusManager::Instance().RemoveLinks(pOldParentWindow, mpTaskPane.get());
+ FocusManager::Instance().RemoveLinks(mpTaskPane.get(), pOldParentWindow);
+
+ ViewShell::RelocateToParentWindow(pParentWindow);
+
+ PaneDockingWindow* pDockingWindow = dynamic_cast<PaneDockingWindow*>(GetDockingWindow());
+ if (pDockingWindow != NULL)
+ {
+ pDockingWindow->InitializeTitleToolBox();
+ mnMenuId = pDockingWindow->AddMenu (
+ String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_TITLE)),
+ HID_SD_TASK_PANE_VIEW_MENU,
+ LINK(this, SidebarViewShell, ToolboxClickHandler));
+ }
+ FocusManager::Instance().RegisterDownLink(pParentWindow, mpTaskPane.get());
+
+ Resize();*/
+
+ return true;
+}
+
+
+} } // end of namespace ::sd::sidebar
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/UIElementWrapper.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/UIElementWrapper.cxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/UIElementWrapper.cxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/UIElementWrapper.cxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,238 @@
+/**************************************************************
+ *
+ * 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 "UIElementWrapper.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+#include "framework/TaskPanelResource.hxx"
+#include "ILayoutableWindow.hxx"
+#include "panels/LayoutMenu.hxx"
+#include "DrawController.hxx"
+#include <comphelper/make_shared_from_uno.hxx>
+#include <vcl/wrkwin.hxx>
+
+#include <boost/bind.hpp>
+
+using namespace css;
+using namespace cssu;
+using namespace cssdf;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+namespace sd { namespace sidebar {
+
+UIElementWrapper::UIElementWrapper (
+ const ::rtl::OUString& rsUIElementResourceURL,
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ const ::rtl::OUString& rsTaskPanelURL,
+ const cssu::Reference<css::ui::XSidebar>& rxSidebar,
+ ::Window* pParentWindow)
+ : SidebarPanelBase(rsUIElementResourceURL, rxFrame, NULL, ::boost::function<void(void)>()),
+ mxPanelResourceId(),
+ mxSidebar(rxSidebar),
+ mpParentWindow(pParentWindow),
+ mpTemporaryParent(NULL),
+ mbResourceHasBeenDeactivated(false)
+{
+ OSL_TRACE("created UIElementWrapper at %x", this);
+ if ( ! rxFrame.is())
+ throw RuntimeException(A2S("UIElementWrapper has no XFrame"), NULL);
+ ::boost::shared_ptr<framework::FrameworkHelper> pFrameworkHelper (
+ framework::FrameworkHelper::Instance(mxFrame->getController()));
+ if ( ! pFrameworkHelper)
+ throw RuntimeException(A2S("UIElementWrapper has no FrameworkHelper"), NULL);
+
+ // Request the drawing framework to make pane and view visible.
+ mxPanelResourceId = pFrameworkHelper->RequestSidebarPanel(rsTaskPanelURL);
+
+ // Set up a function to run when the requested panel has been created.
+ ::boost::shared_ptr<UIElementWrapper> pThis (
+ ::comphelper::make_shared_from_UNO<UIElementWrapper>(this));
+ pFrameworkHelper->RunOnResourceActivation(
+ mxPanelResourceId,
+ ::boost::bind(
+ &UIElementWrapper::HandleResourceActivation,
+ pThis,
+ _1));
+}
+
+
+
+
+UIElementWrapper::~UIElementWrapper (void)
+{
+ OSL_TRACE("~UIElementWrapper at %x", this);
+ if (mpTemporaryParent != NULL)
+ {
+ // This should not happen. But it does happen when the office
+ // is closed.
+
+ DestroyWindows(mpTemporaryParent);
+ }
+}
+
+
+
+
+void SAL_CALL UIElementWrapper::disposing (void)
+ throw (cssu::RuntimeException)
+{
+ OSL_TRACE("UIElementWrapper::disposing at %x", this);
+
+ // Deactivate panel, view and pane.
+ ::boost::shared_ptr<framework::FrameworkHelper> pFrameworkHelper (
+ framework::FrameworkHelper::Instance(mxFrame->getController()));
+ if ( ! pFrameworkHelper)
+ return;
+
+ if (mxPanelResourceId.is() && pFrameworkHelper)
+ {
+ pFrameworkHelper->RequestResourceDeactivation(mxPanelResourceId);
+
+ Reference<XResourceId> xViewId (mxPanelResourceId->getAnchor());
+ if (xViewId.is())
+ {
+ pFrameworkHelper->RequestResourceDeactivation(xViewId);
+
+ Reference<XResourceId> xPaneId (xViewId->getAnchor());
+ if (xPaneId.is())
+ {
+ pFrameworkHelper->RequestResourceDeactivation(xPaneId);
+ }
+ }
+ }
+
+ Reference<lang::XComponent> xPanelComponent (pFrameworkHelper->GetResource(mxPanelResourceId), UNO_QUERY);
+ if (xPanelComponent.is())
+ xPanelComponent->dispose();
+
+ /*
+ ::boost::scoped_ptr< ::Window> pTemporaryParent (new WorkWindow(NULL,WB_STDWORK));
+
+ // Reparent all children of mpParentWindow to our local window.
+ // This is necessary because mpParentWindow will be destroyed
+ // before the children, which are owned by drawing framework
+ // resoures. These resources have been requested to be
+ // deactivated above but deactivation happens asynchronously.
+ if (GetControl() != NULL)
+ GetControl()->SetParent(pTemporaryParent.get());
+
+ if (mbResourceHasBeenDeactivated)
+ {
+ // View has been deactivated in the meantime. We can delete
+ // the windows now.
+ DestroyWindows(pTemporaryParent);
+ }
+ else
+ {
+ // View will be deactivated later. Remember the temporary window.
+ mpTemporaryParent.swap(pTemporaryParent);
+ }
+ */
+ SidebarPanelBase::disposing();
+}
+
+
+
+
+ui::LayoutSize SAL_CALL UIElementWrapper::getHeightForWidth (const sal_Int32 nWidth)
+ throw(cssu::RuntimeException)
+{
+ ILayoutableWindow* pLayoutableWindow = dynamic_cast<ILayoutableWindow*>(GetControl());
+ if (pLayoutableWindow != NULL)
+ return pLayoutableWindow->GetHeightForWidth(nWidth);
+ else
+ return ui::LayoutSize(0,0,0);
+}
+
+
+
+
+void SAL_CALL UIElementWrapper::disposing (
+ const css::lang::EventObject& rEvent)
+ throw (cssu::RuntimeException)
+{
+ Reference<XResource> xPanel (rEvent.Source, UNO_QUERY);
+ if (xPanel.is()
+ && xPanel->getResourceId()->compareTo(mxPanelResourceId) == 0)
+ {
+ OSL_TRACE("UIElementWrapper at %x got disposing call for panel %x", this, GetControl());
+ mbResourceHasBeenDeactivated = true;
+ SetControl(NULL);
+ }
+ else
+ {
+ SidebarPanelBase::disposing(rEvent);
+ }
+}
+
+
+
+
+void UIElementWrapper::HandleResourceActivation (const bool bIsResourceActive)
+{
+ if ( ! mxFrame.is())
+ return;
+ ::boost::shared_ptr<framework::FrameworkHelper> pFrameworkHelper (
+ framework::FrameworkHelper::Instance(mxFrame->getController()));
+ if ( ! pFrameworkHelper)
+ return;
+ cssu::Reference<cssdf::XResource> xPanel (pFrameworkHelper->GetResource(mxPanelResourceId));
+ if ( ! xPanel.is())
+ return;
+ Reference<lang::XComponent> xComponent (xPanel, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->addEventListener(this);
+ framework::TaskPanelResource* pResource = dynamic_cast<framework::TaskPanelResource*>(xPanel.get());
+ if (pResource == NULL)
+ return;
+ ::Window* pControl = pResource->GetControl();
+ SetControl(pControl);
+ if (pControl == NULL)
+ return;
+ pControl->SetParent(mpParentWindow);
+ pControl->SetSizePixel(mpParentWindow->GetSizePixel());
+ ISidebarReceiver* pSidebarReceiver = dynamic_cast<ISidebarReceiver*>(pControl);
+ if (pSidebarReceiver != NULL)
+ pSidebarReceiver->SetSidebar(mxSidebar);
+ OSL_TRACE("UIELementWrapper has panel at %x", pControl);
+}
+
+
+
+
+void UIElementWrapper::DestroyWindows (::boost::scoped_ptr< ::Window>& rpRoot)
+{
+ if ( ! rpRoot)
+ return;
+ else if (rpRoot->GetChildCount() == 0)
+ rpRoot.reset();
+ else
+ ; // The window still has living windows. Better to leak
+ // rpRoot than to destroy the parent of the living children.
+}
+
+
+
+} } // end of namespace sd::sidebar
+
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/UIElementWrapper.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/UIElementWrapper.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/UIElementWrapper.hxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/UIElementWrapper.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,101 @@
+/**************************************************************
+ *
+ * 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_UIELEMENT_WRAPPER_HXX
+#define SD_SIDEBAR_UIELEMENT_WRAPPER_HXX
+
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
+#include <com/sun/star/ui/XSidebar.hpp>
+
+#include <boost/scoped_ptr.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+namespace cssdf = ::com::sun::star::drawing::framework;
+
+
+namespace sd { namespace sidebar {
+
+/** Make the legacy tool pane panels appear like XUIElement objects.
+
+ In the constructor the drawing framework is requested to activate
+ the associated resource.
+
+ In the disposing() method the resource is requested to be
+ deactivated. Also in disposing() the windows (typically the
+ content window of a view shell) below mpParentWindow
+ are relocated into a temporary parent window and deleted in the
+ destructor.
+
+*/
+class UIElementWrapper
+ : public ::sfx2::sidebar::SidebarPanelBase
+{
+public:
+ UIElementWrapper (
+ const ::rtl::OUString& rsUIElementResourceURL,
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ const ::rtl::OUString& rsTaskPanelPanelURL,
+ const cssu::Reference<css::ui::XSidebar>& rxSidebar,
+ ::Window* pParentWindow);
+ virtual ~UIElementWrapper (void);
+
+ // XSidebarPanel
+
+ /** This is forwarded to the actual panel resource.
+ */
+ virtual css::ui::LayoutSize SAL_CALL getHeightForWidth (sal_Int32 nWidth)
+ throw(cssu::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing (
+ const css::lang::EventObject& rEvent)
+ throw (cssu::RuntimeException);
+
+protected:
+ virtual void SAL_CALL disposing (void)
+ throw (cssu::RuntimeException);
+
+private:
+ cssu::Reference<cssdf::XResourceId> mxPanelResourceId;
+ cssu::Reference<css::ui::XSidebar> mxSidebar;
+ ::Window* mpParentWindow;
+ // A temporary parent for children of mpParentWindow. Typically
+ // lives from calls to disposing(void) to ~UIElementWrapper().
+ ::boost::scoped_ptr< ::Window> mpTemporaryParent;
+ bool mbResourceHasBeenDeactivated;
+
+ /** Called at the start of the lifetime of a new UIElementWrapper
+ object.
+ Transfers the XSidebar object to the panel control.
+ */
+ void HandleResourceActivation (const bool bIsResourceActive);
+ void DestroyWindows (::boost::scoped_ptr< ::Window>& rpRoot);
+};
+
+
+} } // end of namespace sd::sidebar
+
+#endif
Added: 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=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/makefile.mk (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/makefile.mk Tue Feb 19 09:09:02 2013
@@ -0,0 +1,54 @@
+#**************************************************************
+#
+# 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.
+#
+#**************************************************************
+
+
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=sidebar
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/SidebarFactory.obj \
+ $(SLO)$/UIElementWrapper.obj \
+ $(SLO)$/SidebarShellManager.obj \
+ $(SLO)$/SidebarViewShell.obj \
+
+EXCEPTIONSFILES=
+#SRS2NAME = sidebar
+#SRC2FILES = SlsChildWindow.src
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/AllMasterPagesSelector.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/AllMasterPagesSelector.cxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/AllMasterPagesSelector.cxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/AllMasterPagesSelector.cxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,236 @@
+/**************************************************************
+ *
+ * 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 "AllMasterPagesSelector.hxx"
+#include "PreviewValueSet.hxx"
+#include "ViewShellBase.hxx"
+#include "../SidebarShellManager.hxx"
+#include "MasterPageContainer.hxx"
+#include "MasterPageDescriptor.hxx"
+#include "app.hrc"
+#include "helpids.h"
+
+#include <tools/link.hxx>
+#include <set>
+
+namespace {
+
+using namespace sd::sidebar;
+
+int GetURLPriority (const SharedMasterPageDescriptor& rpDescriptor)
+{
+ int nPriority (0);
+ switch (rpDescriptor->GetURLClassification())
+ {
+ case MasterPageDescriptor::URLCLASS_USER: nPriority = 0; break;
+ case MasterPageDescriptor::URLCLASS_LAYOUT: nPriority = 1; break;
+ case MasterPageDescriptor::URLCLASS_PRESENTATION: nPriority = 2; break;
+ case MasterPageDescriptor::URLCLASS_OTHER: nPriority = 3; break;
+ case MasterPageDescriptor::URLCLASS_UNKNOWN: nPriority = 4; break;
+ default:
+ case MasterPageDescriptor::URLCLASS_UNDETERMINED: nPriority = 5; break;
+ }
+ return nPriority;
+}
+
+
+class MasterPageDescriptorOrder
+{
+public:
+ bool operator() (
+ const SharedMasterPageDescriptor& rp1,
+ const SharedMasterPageDescriptor& rp2)
+ {
+ if (rp1->meOrigin == MasterPageContainer::DEFAULT)
+ return true;
+ else if (rp2->meOrigin == MasterPageContainer::DEFAULT)
+ return false;
+ else if (rp1->GetURLClassification() == rp2->GetURLClassification())
+ return rp1->mnTemplateIndex < rp2->mnTemplateIndex;
+ else
+ return GetURLPriority(rp1) < GetURLPriority(rp2);
+ }
+};
+
+} // end of anonymous namespace
+
+
+
+namespace sd { namespace sidebar {
+
+class AllMasterPagesSelector::SortedMasterPageDescriptorList
+ : public ::std::set<SharedMasterPageDescriptor,MasterPageDescriptorOrder>
+{
+public:
+ SortedMasterPageDescriptorList (void) {}
+};
+
+
+
+
+MasterPagesSelector* AllMasterPagesSelector::Create (
+ ::Window* pParent,
+ ViewShellBase& rViewShellBase,
+ SidebarShellManager& rSubShellManager)
+{
+ SdDrawDocument* pDocument = rViewShellBase.GetDocument();
+ if (pDocument == NULL)
+ return NULL;
+
+ ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
+
+ MasterPagesSelector* pSelector(
+ new AllMasterPagesSelector (
+ pParent,
+ *pDocument,
+ rViewShellBase,
+ rSubShellManager,
+ pContainer));
+ pSelector->LateInit();
+ pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_ALL);
+ rSubShellManager.AddSubShell(
+ SHELLID_SD_TASK_PANE_PREVIEW_ALL,
+ pSelector,
+ pSelector->GetWindow());
+
+ return pSelector;
+}
+
+
+
+
+AllMasterPagesSelector::AllMasterPagesSelector (
+ ::Window* pParent,
+ SdDrawDocument& rDocument,
+ ViewShellBase& rBase,
+ SidebarShellManager& rShellManager,
+ const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
+ : MasterPagesSelector(pParent, rDocument, rBase, rShellManager, rpContainer),
+ mpSortedMasterPages(new SortedMasterPageDescriptorList())
+{
+ SetName (String(RTL_CONSTASCII_USTRINGPARAM("AllMasterPagesSelector")));
+ MasterPagesSelector::Fill();
+}
+
+
+
+
+AllMasterPagesSelector::~AllMasterPagesSelector (void)
+{
+}
+
+
+
+
+void AllMasterPagesSelector::Fill (ItemList& rItemList)
+{
+ if (mpSortedMasterPages->empty())
+ UpdateMasterPageList();
+ UpdatePageSet(rItemList);
+}
+
+
+
+
+void AllMasterPagesSelector::NotifyContainerChangeEvent (
+ const MasterPageContainerChangeEvent& rEvent)
+{
+ switch (rEvent.meEventType)
+ {
+ case MasterPageContainerChangeEvent::CHILD_ADDED:
+ AddItem(rEvent.maChildToken);
+ MasterPagesSelector::Fill();
+ break;
+
+ case MasterPageContainerChangeEvent::INDEX_CHANGED:
+ case MasterPageContainerChangeEvent::INDEXES_CHANGED:
+ mpSortedMasterPages->clear();
+ MasterPagesSelector::Fill();
+ break;
+
+ default:
+ MasterPagesSelector::NotifyContainerChangeEvent(rEvent);
+ break;
+ }
+}
+
+
+
+
+void AllMasterPagesSelector::UpdateMasterPageList (void)
+{
+ mpSortedMasterPages->clear();
+ int nTokenCount = mpContainer->GetTokenCount();
+ for (int i=0; i<nTokenCount; i++)
+ AddItem(mpContainer->GetTokenForIndex(i));
+}
+
+
+
+
+void AllMasterPagesSelector::AddItem (MasterPageContainer::Token aToken)
+{
+ switch (mpContainer->GetOriginForToken(aToken))
+ {
+ case MasterPageContainer::DEFAULT:
+ case MasterPageContainer::TEMPLATE:
+ // Templates are added only when coming from the
+ // MasterPageContainerFiller so that they have an id which
+ // defines their place in the list. Templates (pre) loaded from
+ // RecentlyUsedMasterPages are ignored (they will be loaded
+ // later by the MasterPageContainerFiller.)
+ if (mpContainer->GetTemplateIndexForToken(aToken) >= 0)
+ mpSortedMasterPages->insert(mpContainer->GetDescriptorForToken(aToken));
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+
+
+void AllMasterPagesSelector::UpdatePageSet (ItemList& rItemList)
+{
+ SortedMasterPageDescriptorList::const_iterator iDescriptor;
+ SortedMasterPageDescriptorList::const_iterator iEnd (mpSortedMasterPages->end());
+ for (iDescriptor=mpSortedMasterPages->begin(); iDescriptor!=iEnd; ++iDescriptor)
+ rItemList.push_back((*iDescriptor)->maToken);
+}
+
+
+
+
+void AllMasterPagesSelector::GetState (SfxItemSet& rItemSet)
+{
+ MasterPagesSelector::GetState(rItemSet);
+
+ if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE)
+ rItemSet.DisableItem(SID_TP_EDIT_MASTER);
+}
+
+
+
+
+} } // end of namespace sd::sidebar
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/AllMasterPagesSelector.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/AllMasterPagesSelector.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/AllMasterPagesSelector.hxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/AllMasterPagesSelector.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,90 @@
+/**************************************************************
+ *
+ * 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_PANELS_ALL_MASTER_PAGES_SELECTOR_HXX
+#define SD_SIDEBAR_PANELS_ALL_MASTER_PAGES_SELECTOR_HXX
+
+#include "MasterPagesSelector.hxx"
+
+#include <memory>
+
+namespace sd { namespace sidebar {
+
+
+/** Show a list of all available master pages so that the user can assign
+ them to the document.
+*/
+class AllMasterPagesSelector
+ : public MasterPagesSelector
+{
+public:
+ static MasterPagesSelector* Create (
+ ::Window* pParent,
+ ViewShellBase& rViewShellBase,
+ SidebarShellManager& rSubShellManager);
+ /** Scan the set of templates for the ones whose first master pages are
+ shown by this control and store them in the MasterPageContainer.
+ */
+ virtual void Fill (ItemList& rItemList);
+
+ virtual void GetState (SfxItemSet& rItemSet);
+
+protected:
+ virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent);
+
+private:
+ /** The list of master pages displayed by this class.
+ */
+ class SortedMasterPageDescriptorList;
+ ::std::auto_ptr<SortedMasterPageDescriptorList> mpSortedMasterPages;
+
+ AllMasterPagesSelector (
+ ::Window* pParent,
+ SdDrawDocument& rDocument,
+ ViewShellBase& rBase,
+ SidebarShellManager& rShellManager,
+ const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
+ virtual ~AllMasterPagesSelector (void);
+
+ void AddTemplate (const TemplateEntry& rEntry);
+
+ /** This filter returns <TRUE/> when the master page specified by the
+ given file name belongs to the set of Impress master pages.
+ */
+ bool FileFilter (const String& sFileName);
+
+ void AddItem (MasterPageContainer::Token aToken);
+
+ /** Add all items in the internal master page list into the given list.
+ */
+ void UpdatePageSet (ItemList& rItemList);
+
+ /** Update the internal list of master pages that are to show in the
+ control.
+ */
+ void UpdateMasterPageList (void);
+
+ using MasterPagesSelector::Fill;
+};
+
+} } // end of namespace sd::sidebar
+
+#endif
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CurrentMasterPagesSelector.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CurrentMasterPagesSelector.cxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CurrentMasterPagesSelector.cxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CurrentMasterPagesSelector.cxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,367 @@
+/**************************************************************
+ *
+ * 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 "CurrentMasterPagesSelector.hxx"
+#include "PreviewValueSet.hxx"
+#include "ViewShellBase.hxx"
+#include "../SidebarShellManager.hxx"
+#include "DrawViewShell.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "MasterPageContainer.hxx"
+#include "MasterPageDescriptor.hxx"
+#include "EventMultiplexer.hxx"
+#include "app.hrc"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "res_bmp.hrc"
+#include "sdresid.hxx"
+#include "helpids.h"
+
+#include <vcl/image.hxx>
+#include <svx/svdmodel.hxx>
+#include <sfx2/request.hxx>
+
+#include <set>
+
+
+using namespace ::com::sun::star;
+
+namespace sd { namespace sidebar {
+
+MasterPagesSelector* CurrentMasterPagesSelector::Create (
+ ::Window* pParent,
+ ViewShellBase& rViewShellBase,
+ SidebarShellManager& rSubShellManager)
+{
+ SdDrawDocument* pDocument = rViewShellBase.GetDocument();
+ if (pDocument == NULL)
+ return NULL;
+
+ ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
+
+ MasterPagesSelector* pSelector(
+ new CurrentMasterPagesSelector (
+ pParent,
+ *pDocument,
+ rViewShellBase,
+ rSubShellManager,
+ pContainer));
+ pSelector->LateInit();
+ pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT );
+ rSubShellManager.AddSubShell(
+ SHELLID_SD_TASK_PANE_PREVIEW_CURRENT,
+ pSelector,
+ pSelector->GetWindow());
+
+ return pSelector;
+}
+
+
+
+
+CurrentMasterPagesSelector::CurrentMasterPagesSelector (
+ ::Window* pParent,
+ SdDrawDocument& rDocument,
+ ViewShellBase& rBase,
+ SidebarShellManager& rShellManager,
+ const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
+ : MasterPagesSelector (pParent, rDocument, rBase, rShellManager, rpContainer)
+{
+ SetName(String(RTL_CONSTASCII_USTRINGPARAM("CurrentMasterPagesSelector")));
+
+ // For this master page selector only we change the default action for
+ // left clicks.
+ mnDefaultClickAction = SID_TP_APPLY_TO_SELECTED_SLIDES;
+
+ Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener));
+ rBase.GetEventMultiplexer()->AddEventListener(aLink,
+ sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE
+ | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL
+ | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER
+ | sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER
+ | sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED
+ | sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED
+ | sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED);
+}
+
+
+
+
+CurrentMasterPagesSelector::~CurrentMasterPagesSelector (void)
+{
+ if (mrDocument.GetDocSh() != NULL)
+ {
+ EndListening(*mrDocument.GetDocSh());
+ }
+ else
+ {
+ OSL_ASSERT(mrDocument.GetDocSh() != NULL);
+ }
+
+ Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener));
+ mrBase.GetEventMultiplexer()->RemoveEventListener(aLink);
+}
+
+
+
+
+void CurrentMasterPagesSelector::LateInit (void)
+{
+ MasterPagesSelector::LateInit();
+ MasterPagesSelector::Fill();
+ if (mrDocument.GetDocSh() != NULL)
+ {
+ StartListening(*mrDocument.GetDocSh());
+ }
+ else
+ {
+ OSL_ASSERT(mrDocument.GetDocSh() != NULL);
+ }
+}
+
+
+
+
+void CurrentMasterPagesSelector::Fill (ItemList& rItemList)
+{
+ sal_uInt16 nPageCount = mrDocument.GetMasterSdPageCount(PK_STANDARD);
+ SdPage* pMasterPage;
+ // Remember the names of the master pages that have been inserted to
+ // avoid double insertion.
+ ::std::set<String> aMasterPageNames;
+ for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++)
+ {
+ pMasterPage = mrDocument.GetMasterSdPage (nIndex, PK_STANDARD);
+ if (pMasterPage == NULL)
+ continue;
+
+ // Use the name of the master page to avoid duplicate entries.
+ String sName (pMasterPage->GetName());
+ if (aMasterPageNames.find(sName)!=aMasterPageNames.end())
+ continue;
+ aMasterPageNames.insert (sName);
+
+ // Look up the master page in the container and, when it is not yet
+ // in it, insert it.
+ MasterPageContainer::Token aToken = mpContainer->GetTokenForPageObject(pMasterPage);
+ if (aToken == MasterPageContainer::NIL_TOKEN)
+ {
+ SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
+ MasterPageContainer::MASTERPAGE,
+ nIndex,
+ String(),
+ pMasterPage->GetName(),
+ String(),
+ pMasterPage->IsPrecious(),
+ ::boost::shared_ptr<PageObjectProvider>(new ExistingPageProvider(pMasterPage)),
+ ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider())));
+ aToken = mpContainer->PutMasterPage(pDescriptor);
+ }
+
+ rItemList.push_back(aToken);
+ }
+}
+
+
+
+
+ResId CurrentMasterPagesSelector::GetContextMenuResId (void) const
+{
+ return SdResId(RID_TASKPANE_CURRENT_MASTERPAGESSELECTOR_POPUP);
+}
+
+
+
+
+void CurrentMasterPagesSelector::UpdateSelection (void)
+{
+ // Iterate over all pages and for the selected ones put the name of
+ // their master page into a set.
+ sal_uInt16 nPageCount = mrDocument.GetSdPageCount(PK_STANDARD);
+ SdPage* pPage;
+ ::std::set<String> aNames;
+ sal_uInt16 nIndex;
+ bool bLoop (true);
+ for (nIndex=0; nIndex<nPageCount && bLoop; nIndex++)
+ {
+ pPage = mrDocument.GetSdPage (nIndex, PK_STANDARD);
+ if (pPage != NULL && pPage->IsSelected())
+ {
+ if ( ! pPage->TRG_HasMasterPage())
+ {
+ // One of the pages has no master page. This is an
+ // indicator for that this method is called in the middle of
+ // a document change and that the model is not in a valid
+ // state. Therefore we stop update the selection and wait
+ // for another call to UpdateSelection when the model is
+ // valid again.
+ bLoop = false;
+ }
+ else
+ {
+ SdrPage& rMasterPage (pPage->TRG_GetMasterPage());
+ SdPage* pMasterPage = static_cast<SdPage*>(&rMasterPage);
+ if (pMasterPage != NULL)
+ aNames.insert (pMasterPage->GetName());
+ }
+ }
+ }
+
+ // Find the items for the master pages in the set.
+ sal_uInt16 nItemCount (PreviewValueSet::GetItemCount());
+ for (nIndex=1; nIndex<=nItemCount && bLoop; nIndex++)
+ {
+ String sName (PreviewValueSet::GetItemText (nIndex));
+ if (aNames.find(sName) != aNames.end())
+ {
+ PreviewValueSet::SelectItem (nIndex);
+ }
+ }
+}
+
+
+
+
+void CurrentMasterPagesSelector::Execute (SfxRequest& rRequest)
+{
+ switch (rRequest.GetSlot())
+ {
+ case SID_DELETE_MASTER_PAGE:
+ {
+ // Check once again that the master page can safely be deleted,
+ // i.e. is not used.
+ SdPage* pMasterPage = GetSelectedMasterPage();
+ if (pMasterPage != NULL
+ && mrDocument.GetMasterPageUserCount(pMasterPage) == 0)
+ {
+ // Removing the precious flag so that the following call to
+ // RemoveUnnessesaryMasterPages() will remove this master page.
+ pMasterPage->SetPrecious(false);
+ mrDocument.RemoveUnnecessaryMasterPages(pMasterPage, sal_False, sal_True);
+ }
+ }
+ break;
+
+ default:
+ MasterPagesSelector::Execute(rRequest);
+ break;
+ }
+}
+
+
+
+
+void CurrentMasterPagesSelector::GetState (SfxItemSet& rItemSet)
+{
+ // Disable the SID_DELTE_MASTER slot when there is only one master page.
+ if (rItemSet.GetItemState(SID_DELETE_MASTER_PAGE) == SFX_ITEM_AVAILABLE
+ && mrDocument.GetMasterPageUserCount(GetSelectedMasterPage()) > 0)
+ {
+ rItemSet.DisableItem(SID_DELETE_MASTER_PAGE);
+ }
+
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
+ if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE
+ && pDrawViewShell
+ && pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
+ {
+ rItemSet.DisableItem (SID_TP_EDIT_MASTER);
+ }
+
+ MasterPagesSelector::GetState(rItemSet);
+}
+
+
+
+
+
+
+IMPL_LINK(CurrentMasterPagesSelector,EventMultiplexerListener,
+ sd::tools::EventMultiplexerEvent*,pEvent)
+{
+ if (pEvent != NULL)
+ {
+ switch (pEvent->meEventId)
+ {
+ case sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
+ case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL:
+ case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER:
+ case sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION:
+ UpdateSelection();
+ break;
+
+ case sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER:
+ // This is tricky. If a master page is removed, moved, or
+ // added we have to wait until both the notes master page
+ // and the standard master page have been removed, moved,
+ // or added. We do this by looking at the number of master
+ // pages which has to be odd in the consistent state (the
+ // handout master page is always present). If the number is
+ // even we ignore the hint.
+ if (mrBase.GetDocument()->GetMasterPageCount()%2 == 1)
+ MasterPagesSelector::Fill();
+ break;
+
+ case sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED:
+ case sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED:
+ case sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED:
+ InvalidatePreview((const SdPage*)pEvent->mpUserData);
+ break;
+ }
+ }
+
+ return 0;
+}
+
+
+
+
+void CurrentMasterPagesSelector::Notify (SfxBroadcaster&, const SfxHint& rHint)
+{
+ const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
+ if (pSimpleHint != NULL)
+ {
+ if (pSimpleHint->GetId() == SFX_HINT_DOCCHANGED)
+ {
+ // Is the edit view visible in the center pane?
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
+ if (pDrawViewShell.get() != NULL)
+ {
+ // Is the edit view in master page mode?
+ if (pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
+ {
+ // Mark the currently edited master page as precious.
+ SdPage* pCurrentMasterPage = pDrawViewShell->getCurrentPage();
+ if (pCurrentMasterPage != NULL)
+ pCurrentMasterPage->SetPrecious(true);
+ }
+ }
+ }
+ }
+}
+
+
+} } // end of namespace sd::sidebar
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CurrentMasterPagesSelector.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CurrentMasterPagesSelector.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CurrentMasterPagesSelector.hxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CurrentMasterPagesSelector.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,87 @@
+/**************************************************************
+ *
+ * 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_PANELS_CURRENT_MASTER_PAGES_SELECTOR_HXX
+#define SD_SIDEBAR_PANELS_CURRENT_MASTER_PAGES_SELECTOR_HXX
+
+#include "MasterPagesSelector.hxx"
+#include <com/sun/star/lang/XComponent.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
+namespace sd { namespace tools { class EventMultiplexerEvent; } }
+
+
+namespace sd { namespace sidebar {
+
+
+/** Show the master pages currently used by a SdDrawDocument.
+*/
+class CurrentMasterPagesSelector
+ : public MasterPagesSelector,
+ public SfxListener
+{
+public:
+ static MasterPagesSelector* Create (
+ ::Window* pParent,
+ ViewShellBase& rViewShellBase,
+ SidebarShellManager& rSubShellManager);
+
+ /** Set the selection so that the master page is selected that is
+ used by the currently selected page of the document in the
+ center pane.
+ */
+ virtual void UpdateSelection (void);
+
+ /** Copy all master pages that are to be shown into the given list.
+ */
+ virtual void Fill (ItemList& rItemList);
+
+ using MasterPagesSelector::Fill;
+
+protected:
+ virtual ResId GetContextMenuResId (void) const;
+ virtual void Execute (SfxRequest& rRequest);
+ virtual void GetState (SfxItemSet& rItemSet);
+
+private:
+ cssu::Reference<css::lang::XComponent> mxListener;
+
+ CurrentMasterPagesSelector (
+ ::Window* pParent,
+ SdDrawDocument& rDocument,
+ ViewShellBase& rBase,
+ SidebarShellManager& rShellManager,
+ const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
+ virtual ~CurrentMasterPagesSelector (void);
+
+ virtual void LateInit (void);
+
+ DECL_LINK(EventMultiplexerListener,sd::tools::EventMultiplexerEvent*);
+ void Notify (SfxBroadcaster&, const SfxHint& rHint);
+};
+
+} } // end of namespace sd::sidebar
+
+#endif
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CustomAnimationPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CustomAnimationPanel.cxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CustomAnimationPanel.cxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CustomAnimationPanel.cxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,80 @@
+/**************************************************************
+ *
+ * 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 "CustomAnimationPanel.hxx"
+
+#include "SidebarViewShell.hxx"
+#include "ViewShellBase.hxx"
+
+
+namespace sd {
+ extern ::Window * createCustomAnimationPanel (::Window* pParent, ViewShellBase& rBase);
+ extern sal_Int32 getCustomAnimationPanelMinimumHeight (::Window* pParent);
+}
+
+
+
+
+namespace sd { namespace sidebar {
+
+
+CustomAnimationPanel::CustomAnimationPanel (
+ ::Window* pParentWindow,
+ ViewShellBase& rViewShellBase)
+ : PanelBase(
+ pParentWindow,
+ rViewShellBase)
+{
+#ifdef DEBUG
+ SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:CustomAnimationPanel")));
+#endif
+}
+
+
+
+
+CustomAnimationPanel::~CustomAnimationPanel (void)
+{
+}
+
+
+
+
+::Window* CustomAnimationPanel::CreateWrappedControl (
+ ::Window* pParentWindow,
+ ViewShellBase& rViewShellBase)
+{
+ return createCustomAnimationPanel(pParentWindow, rViewShellBase);
+}
+
+
+
+
+css::ui::LayoutSize CustomAnimationPanel::GetHeightForWidth (const sal_Int32 nWidth)
+{
+ const sal_Int32 nMinimumHeight(getCustomAnimationPanelMinimumHeight(mpWrappedControl.get()));
+ return css::ui::LayoutSize(nMinimumHeight,-1, nMinimumHeight);
+}
+
+
+} } // end of namespace sd::sidebar
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CustomAnimationPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CustomAnimationPanel.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CustomAnimationPanel.hxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/panels/CustomAnimationPanel.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,50 @@
+/**************************************************************
+ *
+ * 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_CUSTOM_ANIMATION_PANEL_HXX
+#define SD_SIDEBAR_CUSTOM_ANIMATION_PANEL_HXX
+
+#include "PanelBase.hxx"
+
+
+namespace sd { namespace sidebar {
+
+class CustomAnimationPanel
+ : public PanelBase
+{
+public:
+ CustomAnimationPanel (
+ ::Window* pParentWindow,
+ ViewShellBase& rViewShellBase);
+ virtual ~CustomAnimationPanel (void);
+
+ // ILayoutableWindow
+ virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth);
+
+protected:
+ virtual ::Window* CreateWrappedControl (
+ ::Window* pParentWindow,
+ ViewShellBase& rViewShellBase);
+};
+
+} } // end of namespace sd::sidebar
+
+#endif