Author: af
Date: Tue Apr 2 09:22:29 2013
New Revision: 1463459
URL: http://svn.apache.org/r1463459
Log:
i121420: Improved keyboard navigation in sidebar. Fixed bug in sidebar gallery.
Added:
openoffice/branches/sidebar/main/sfx2/source/sidebar/FocusManager.cxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/FocusManager.hxx
Modified:
openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
openoffice/branches/sidebar/main/sfx2/Library_sfx.mk
openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.cxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.cxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckTitleBar.cxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/MenuButton.cxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.hxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.cxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.hxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.cxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.hxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.cxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.hxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/TabItem.cxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.cxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.hxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.cxx
openoffice/branches/sidebar/main/sfx2/source/sidebar/Tools.hxx
openoffice/branches/sidebar/main/svx/inc/GalleryControl.hxx
openoffice/branches/sidebar/main/svx/source/gallery2/galbrws2.cxx
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=1463459&r1=1463458&r2=1463459&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 Apr 2 09:22:29 2013
@@ -56,7 +56,7 @@
</prop>
<prop oor:name="ContextList">
<value oor:separator=";">
- any, any, visible ;
+ DrawImpress, any, visible ;
</value>
</prop>
<prop oor:name="OrderIndex" oor:type="xs:int">
Modified: openoffice/branches/sidebar/main/sfx2/Library_sfx.mk
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/Library_sfx.mk?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/Library_sfx.mk (original)
+++ openoffice/branches/sidebar/main/sfx2/Library_sfx.mk Tue Apr 2 09:22:29
2013
@@ -231,6 +231,7 @@ $(eval $(call gb_Library_add_exception_o
sfx2/source/sidebar/DeckTitleBar \
sfx2/source/sidebar/DrawHelper \
sfx2/source/sidebar/EnumContext \
+ sfx2/source/sidebar/FocusManager \
sfx2/source/sidebar/MenuButton \
sfx2/source/sidebar/Paint \
sfx2/source/sidebar/Panel \
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.cxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.cxx Tue Apr 2
09:22:29 2013
@@ -54,7 +54,7 @@ Deck::Deck (
const DeckDescriptor& rDeckDescriptor,
Window* pParentWindow,
const ::boost::function<void(void)>& rCloserAction)
- : Window(pParentWindow),
+ : Window(pParentWindow, 0),
msId(rDeckDescriptor.msId),
maIcon(),
msIconURL(rDeckDescriptor.msIconURL),
@@ -68,10 +68,12 @@ Deck::Deck (
{
SetBackground(Wallpaper());
- mpScrollClipWindow->Show();
mpScrollClipWindow->SetBackground(Wallpaper());
- mpScrollContainer->Show();
+ mpScrollClipWindow->Show();
+
+ mpScrollContainer->SetStyle(mpScrollContainer->GetStyle() |
WB_DIALOGCONTROL);
mpScrollContainer->SetBackground(Wallpaper());
+ mpScrollContainer->Show();
mpVerticalScrollBar->SetScrollHdl(LINK(this, Deck,
HandleVerticalScrollBarChange));
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.cxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.cxx
(original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.cxx Tue
Apr 2 09:22:29 2013
@@ -206,8 +206,8 @@ sal_Int32 DeckLayouter::PlacePanels (
// Assign heights and places.
IterateLayoutItems(iItem,rLayoutItems)
{
- if (iItem->mpPanel == NULL)
- continue;
+ if (iItem->mpPanel == NULL)
+ continue;
Panel& rPanel (*iItem->mpPanel);
@@ -224,10 +224,6 @@ sal_Int32 DeckLayouter::PlacePanels (
pTitleBar->SetPosSizePixel(0, nY, nWidth,
nPanelTitleBarHeight);
pTitleBar->Show();
nY += nPanelTitleBarHeight;
-
- // Separator below the panel title bar.
- aSeparators.push_back(nY);
- nY += nDeckSeparatorHeight;
}
else
{
@@ -267,6 +263,15 @@ sal_Int32 DeckLayouter::PlacePanels (
else
{
rPanel.Hide();
+
+ // Add a separator below the collapsed panel, if it is the
+ // last panel in the deck.
+ if (iItem == rLayoutItems.end()-1)
+ {
+ // Separator below the panel title bar.
+ aSeparators.push_back(nY);
+ nY += nDeckSeparatorHeight;
+ }
}
}
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckTitleBar.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckTitleBar.cxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckTitleBar.cxx
(original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckTitleBar.cxx Tue
Apr 2 09:22:29 2013
@@ -105,13 +105,6 @@ Rectangle DeckTitleBar::GetTitleArea (co
void DeckTitleBar::PaintDecoration (const Rectangle& rTitleBarBox)
{
(void)rTitleBarBox;
-
- Image aGripImage (Theme::GetImage(Theme::Image_Grip));
-
- const Point aTopLeft (
- gaLeftGripPadding,
- (GetSizePixel().Height()-aGripImage.GetSizePixel().Height())/2);
- DrawImage(aTopLeft, aGripImage);
}
Added: openoffice/branches/sidebar/main/sfx2/source/sidebar/FocusManager.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/FocusManager.cxx?rev=1463459&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/FocusManager.cxx
(added)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/FocusManager.cxx Tue
Apr 2 09:22:29 2013
@@ -0,0 +1,565 @@
+/**************************************************************
+ *
+ * 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_sfx2.hxx"
+
+#include "FocusManager.hxx"
+#include "Panel.hxx"
+#include "Tools.hxx"
+#include "TitleBar.hxx"
+#include <vcl/button.hxx>
+#include <vcl/toolbox.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+
+namespace sfx2 { namespace sidebar {
+
+namespace
+{
+ enum PanelComponent
+ {
+ PC_TitleBar,
+ PC_ToolBox,
+ PC_Content,
+ PC_None
+ };
+
+ PanelComponent GetFocusedComponent (const Panel& rPanel)
+ {
+ if (rPanel.HasFocus())
+ return PC_Content;
+ else if (rPanel.GetTitleBar() != NULL)
+ if (rPanel.GetTitleBar()->HasFocus())
+ return PC_TitleBar;
+ else if (rPanel.GetTitleBar()->GetToolBox().HasFocus())
+ return PC_ToolBox;
+ else
+ return PC_None;
+ }
+}
+
+
+FocusManager::FocusManager (void)
+ : maPanels(),
+ maButtons(),
+ mpTopLevelWindow(NULL)
+{
+}
+
+
+
+
+FocusManager::~FocusManager (void)
+{
+ Clear();
+}
+
+
+
+
+void FocusManager::GrabFocus (void)
+{
+ if ( ! maPanels.empty())
+ FocusPanel(0);
+}
+
+
+
+
+void FocusManager::Clear (void)
+{
+ ClearPanels();
+ ClearButtons();
+}
+
+
+
+void FocusManager::ClearPanels (void)
+{
+ SetTopLevelWindow(NULL);
+
+ ::std::vector<Panel*> aPanels;
+ aPanels.swap(maPanels);
+ for (::std::vector<Panel*>::iterator
iPanel(aPanels.begin()),iEnd(aPanels.end());
+ iPanel!=iEnd;
+ ++iPanel)
+ {
+ UnregisterWindow(**iPanel);
+ if ((*iPanel)->GetTitleBar() != NULL)
+ {
+ UnregisterWindow(*(*iPanel)->GetTitleBar());
+ UnregisterWindow((*iPanel)->GetTitleBar()->GetToolBox());
+ }
+ }
+}
+
+
+
+
+void FocusManager::ClearButtons (void)
+{
+ ::std::vector<Window*> aButtons;
+ for (::std::vector<Window*>::iterator
iButton(aButtons.begin()),iEnd(aButtons.end());
+ iButton!=iEnd;
+ ++iButton)
+ {
+ UnregisterWindow(**iButton);
+ }
+}
+
+
+
+
+void FocusManager::SetPanels (const SharedPanelContainer& rPanels)
+{
+ ClearPanels();
+ for(SharedPanelContainer::const_iterator
iPanel(rPanels.begin()),iEnd(rPanels.end());
+ iPanel!=iEnd;
+ ++iPanel)
+ {
+ RegisterWindow(**iPanel);
+ if ((*iPanel)->GetTitleBar() != NULL)
+ {
+ RegisterWindow(*(*iPanel)->GetTitleBar());
+ RegisterWindow((*iPanel)->GetTitleBar()->GetToolBox());
+ }
+ maPanels.push_back(iPanel->get());
+ }
+
+ RegisterTopLevelListener();
+}
+
+
+
+
+void FocusManager::SetButtons (const ::std::vector<Button*>& rButtons)
+{
+ ClearButtons();
+ for (::std::vector<Button*>::const_iterator
iButton(rButtons.begin()),iEnd(rButtons.end());
+ iButton!=iEnd;
+ ++iButton)
+ {
+ RegisterWindow(**iButton);
+ maButtons.push_back(*iButton);
+ }
+}
+
+
+
+
+void FocusManager::RegisterWindow (Window& rWindow)
+{
+ rWindow.AddEventListener(LINK(this, FocusManager, WindowEventListener));
+}
+
+
+
+
+void FocusManager::UnregisterWindow (Window& rWindow)
+{
+ rWindow.RemoveEventListener(LINK(this, FocusManager, WindowEventListener));
+}
+
+
+
+
+void FocusManager::RegisterTopLevelListener (void)
+{
+ if (maPanels.empty())
+ return;
+ Window* pWindow = maPanels.front();
+ while (pWindow != NULL && pWindow->GetParent()!=NULL)
+ {
+ pWindow = pWindow->GetParent();
+ }
+ SetTopLevelWindow(pWindow);
+}
+
+
+
+
+void FocusManager::SetTopLevelWindow (Window* pWindow)
+{
+ if (mpTopLevelWindow != pWindow)
+ {
+ if (mpTopLevelWindow != NULL)
+ {
+ UnregisterWindow(*mpTopLevelWindow);
+ mpTopLevelWindow->RemoveChildEventListener(LINK(this,
FocusManager, WindowEventListener));
+ }
+ mpTopLevelWindow = pWindow;
+ if (mpTopLevelWindow != NULL)
+ {
+ RegisterWindow(*mpTopLevelWindow);
+ mpTopLevelWindow->AddChildEventListener(LINK(this, FocusManager,
WindowEventListener));
+ }
+ }
+}
+
+
+
+
+sal_Int32 FocusManager::GetPanelIndex (const Window& rWindow) const
+{
+ for (sal_Int32 nIndex=0,nCount(maPanels.size()); nIndex<nCount; ++nIndex)
+ {
+ if (maPanels[nIndex] == &rWindow)
+ return nIndex;
+ TitleBar* pTitleBar = maPanels[nIndex]->GetTitleBar();
+ if (pTitleBar == &rWindow)
+ return nIndex;
+ if (pTitleBar!=NULL && &pTitleBar->GetToolBox()==&rWindow)
+ return nIndex;
+ }
+ return -1;
+}
+
+
+
+
+sal_Int32 FocusManager::GetButtonIndex (const Window& rWindow) const
+{
+ for (sal_Int32 nIndex=0,nCount(maButtons.size()); nIndex<nCount; ++nIndex)
+ if (maButtons[nIndex] == &rWindow)
+ return nIndex;
+ return -1;
+}
+
+
+
+
+bool FocusManager::IsAnyPanelFocused (void) const
+{
+ for (::std::vector<Panel*>::const_iterator
iPanel(maPanels.begin()),iEnd(maPanels.end());
+ iPanel!=iEnd;
+ ++iPanel)
+ {
+ if ((*iPanel)->HasFocus())
+ return true;
+ else if ((*iPanel)->HasChildPathFocus())
+ return true;
+ }
+ return false;
+}
+
+
+
+
+bool FocusManager::IsAnyButtonFocused (void) const
+{
+ for (::std::vector<Button*>::const_iterator
iButton(maButtons.begin()),iEnd(maButtons.end());
+ iButton!=iEnd;
+ ++iButton)
+ {
+ if ((*iButton)->HasFocus())
+ return true;
+ }
+ return false;
+}
+
+
+
+
+void FocusManager::FocusPanel (const sal_Int32 nPanelIndex)
+{
+ Panel& rPanel (*maPanels[nPanelIndex]);
+ TitleBar* pTitleBar = rPanel.GetTitleBar();
+ if (pTitleBar!=NULL && pTitleBar->IsVisible())
+ {
+ rPanel.SetExpanded(true);
+ pTitleBar->GrabFocus();
+ }
+ else
+ FocusPanelContent(nPanelIndex);
+}
+
+
+
+
+void FocusManager::FocusPanelContent (const sal_Int32 nPanelIndex)
+{
+ Window* pWindow =
VCLUnoHelper::GetWindow(maPanels[nPanelIndex]->GetElementWindow());
+ if (pWindow != NULL)
+ pWindow->GrabFocus();
+}
+
+
+
+
+void FocusManager::FocusButton (const sal_Int32 nButtonIndex)
+{
+ maButtons[nButtonIndex]->GrabFocus();
+ maButtons[nButtonIndex]->Invalidate();
+}
+
+
+
+
+void FocusManager::ClickButton (const sal_Int32 nButtonIndex)
+{
+ maButtons[nButtonIndex]->Click();
+ if (nButtonIndex > 0)
+ if ( ! maPanels.empty())
+ FocusPanel(0);
+ maButtons[nButtonIndex]->GetParent()->Invalidate();
+}
+
+
+
+
+void FocusManager::RemoveWindow (Window& rWindow)
+{
+ ::std::vector<Panel*>::iterator iPanel (::std::find(maPanels.begin(),
maPanels.end(), &rWindow));
+ if (iPanel != maPanels.end())
+ {
+ UnregisterWindow(rWindow);
+ if ((*iPanel)->GetTitleBar() != NULL)
+ {
+ UnregisterWindow(*(*iPanel)->GetTitleBar());
+ UnregisterWindow((*iPanel)->GetTitleBar()->GetToolBox());
+ }
+ maPanels.erase(iPanel);
+ return;
+ }
+
+ ::std::vector<Button*>::iterator iButton (::std::find(maButtons.begin(),
maButtons.end(), &rWindow));
+ if (iButton != maButtons.end())
+ {
+ UnregisterWindow(rWindow);
+ maButtons.erase(iButton);
+ return;
+ }
+}
+
+
+
+
+bool FocusManager::MoveFocusInsidePanel (
+ const sal_Int32 nPanelIndex,
+ const sal_Int32 nDirection)
+{
+ Panel& rPanel (*maPanels[nPanelIndex]);
+ switch (GetFocusedComponent(rPanel))
+ {
+ case PC_TitleBar:
+ if (nDirection > 0)
+ rPanel.GetTitleBar()->GetToolBox().GrabFocus();
+ else
+ FocusPanelContent(nPanelIndex);
+ return true;
+
+ case PC_ToolBox:
+ if (nDirection > 0)
+ FocusPanelContent(nPanelIndex);
+ else
+ rPanel.GetTitleBar()->GrabFocus();
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+
+
+
+long FocusManager::NotifyDockingWindowEvent (const KeyEvent& rKeyEvent)
+{
+ switch(rKeyEvent.GetKeyCode().GetCode())
+ {
+ case KEY_F6:
+ if (rKeyEvent.GetKeyCode().IsShift())
+ {
+ if (IsAnyButtonFocused())
+ {
+ FocusPanel(0);
+ return 1;
+ }
+ }
+ else
+ {
+ if (IsAnyPanelFocused())
+ {
+ FocusButton(0);
+ return 1;
+ }
+ }
+ break;
+ }
+ return 0;
+}
+
+
+
+
+void FocusManager::HandleKeyEvent (
+ const KeyCode& rKeyCode,
+ const Window& rWindow)
+{
+ if (rKeyCode.GetModifier() != 0)
+ return;
+
+ const sal_Int32 nPanelIndex (GetPanelIndex(rWindow));
+ const bool bIsPanelTitleFocused (nPanelIndex>=0 && maPanels[nPanelIndex]
!= &rWindow);
+ const bool bIsPanelToolBoxFocused (nPanelIndex>=0 && maPanels[nPanelIndex]
!= &rWindow);
+ sal_Int32 nButtonIndex (nPanelIndex==-1 ? GetButtonIndex(rWindow) : -1);
+
+ switch (rKeyCode.GetCode())
+ {
+ case KEY_F6:
+ if (nPanelIndex >= 0)
+ FocusButton(0);
+ else
+ return;
+ break;
+
+ case KEY_SPACE:
+ if (nPanelIndex >= 0)
+ {
+ if (GetFocusedComponent(*maPanels[nPanelIndex]) == PC_TitleBar)
+ {
+ // Toggle the expansion state.
+ maPanels[nPanelIndex]->SetExpanded( !
maPanels[nPanelIndex]->IsExpanded());
+ }
+ }
+ else if (nButtonIndex >= 0)
+ {
+ // Activate the button.
+ ClickButton(nButtonIndex);
+ }
+ return;
+
+ case KEY_RETURN:
+ if (nPanelIndex >= 0)
+ {
+ if (GetFocusedComponent(*maPanels[nPanelIndex]) == PC_TitleBar)
+ {
+ // Enter the panel.
+ FocusPanelContent(nPanelIndex);
+ }
+ }
+ else if (nButtonIndex >= 0)
+ {
+ // Activate the button.
+ ClickButton(nButtonIndex);
+ }
+ return;
+
+ case KEY_TAB:
+ if (nPanelIndex >= 0)
+ {
+ if (rKeyCode.IsShift())
+ MoveFocusInsidePanel(nPanelIndex, -1);
+ else
+ MoveFocusInsidePanel(nPanelIndex, +1);
+ }
+ break;
+
+ case KEY_LEFT:
+ case KEY_UP:
+ // Go to previous element in focus ring.
+ if (nPanelIndex >= 0)
+ {
+ FocusPanel((nPanelIndex + maPanels.size() - 1) %
maPanels.size());
+ }
+ else if (nButtonIndex >= 0)
+ {
+ FocusButton((nButtonIndex + maButtons.size() - 1) %
maButtons.size());
+ }
+ break;
+
+ case KEY_RIGHT:
+ case KEY_DOWN:
+ // Go to next element in focus ring.
+ if (nPanelIndex >= 0)
+ {
+ FocusPanel((nPanelIndex + 1) % maPanels.size());
+ }
+ else if (nButtonIndex >= 0)
+ {
+ FocusButton((nButtonIndex + 1) % maButtons.size());
+ }
+ break;
+ }
+}
+
+
+
+
+void FocusManager::HandleTopLevelEvent (VclWindowEvent& rEvent)
+{
+ switch (rEvent.GetId())
+ {
+ case VCLEVENT_WINDOW_KEYINPUT:
+ {
+ KeyEvent* pKeyEvent = static_cast<KeyEvent*>(rEvent.GetData());
+ switch (pKeyEvent->GetKeyCode().GetCode())
+ {
+ case KEY_F6:
+ OSL_TRACE("");
+ break;
+ }
+ }
+ }
+}
+
+
+
+
+IMPL_LINK(FocusManager, WindowEventListener, VclSimpleEvent*, pEvent)
+{
+ if (pEvent == NULL)
+ return 0;
+
+ if ( ! pEvent->ISA(VclWindowEvent))
+ return 0;
+
+ VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
+ Window* pSource = pWindowEvent->GetWindow();
+ if (pSource == NULL)
+ return 0;
+
+ if (pSource == mpTopLevelWindow)
+ HandleTopLevelEvent(*pWindowEvent);
+ else
+ switch (pWindowEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_KEYINPUT:
+ {
+ KeyEvent* pKeyEvent =
static_cast<KeyEvent*>(pWindowEvent->GetData());
+ HandleKeyEvent(pKeyEvent->GetKeyCode(), *pSource);
+ return 1;
+ }
+
+ case VCLEVENT_OBJECT_DYING:
+ RemoveWindow(*pSource);
+ return 1;
+
+ case VCLEVENT_WINDOW_GETFOCUS:
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ pSource->Invalidate();
+ }
+ return 0;
+}
+
+
+
+} } // end of namespace sfx2::sidebar
Added: openoffice/branches/sidebar/main/sfx2/source/sidebar/FocusManager.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/FocusManager.hxx?rev=1463459&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/FocusManager.hxx
(added)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/FocusManager.hxx Tue
Apr 2 09:22:29 2013
@@ -0,0 +1,112 @@
+/**************************************************************
+ *
+ * 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 SFX_SIDEBAR_FOCUS_MANAGER_HXX
+#define SFX_SIDEBAR_FOCUS_MANAGER_HXX
+
+#include "Panel.hxx"
+#include <tools/link.hxx>
+
+class Button;
+class KeyCode;
+class VclSimpleEvent;
+
+namespace sfx2 { namespace sidebar {
+
+/** Concentrate all focus handling in this class.
+ There are two rings of windows that accept the input focus: panels
+ and tab bar buttons.
+ Arrow keys move the focus between them. Tab moves focus between rings.
+*/
+class FocusManager
+{
+public:
+ FocusManager (void);
+ ~FocusManager (void);
+
+ /** Forget all panels and buttons. Remove all window listeners.
+ */
+ void Clear (void);
+
+ /** Transfer the focus into the sidebar tree of windows. This is
+ typically called from the SidebarChildWindow as result of
+ pressing the F6 key.
+ */
+ void GrabFocus (void);
+
+ /** Handle the key event that was sent to the docking window.
+ */
+ long NotifyDockingWindowEvent (const KeyEvent& rKeyEvent);
+
+ void SetPanels (const SharedPanelContainer& rPanels);
+
+ void SetButtons (const ::std::vector<Button*>& rButtons);
+
+private:
+ ::std::vector<Panel*> maPanels;
+ ::std::vector<Button*> maButtons;
+ Window* mpTopLevelWindow;
+
+ /** Listen for key events for panels and buttons.
+ */
+ DECL_LINK(WindowEventListener, VclSimpleEvent*);
+
+ void ClearPanels (void);
+ void ClearButtons (void);
+
+ /** Let the focus manager listen for window events for the given
+ window.
+ */
+ void RegisterWindow (Window& rWindow);
+ void UnregisterWindow (Window& rWindow);
+ void RegisterTopLevelListener (void);
+
+ /** Remove the window from the panel or the button container.
+ */
+ void RemoveWindow (Window& rWindow);
+
+ sal_Int32 GetPanelIndex (const Window& rWindow) const;
+ sal_Int32 GetButtonIndex (const Window& rWindow) const;
+ bool IsAnyPanelFocused (void) const;
+ bool IsAnyButtonFocused (void) const;
+
+ /** Set the focus to the title bar of the panel or, if the the
+ title bar is not visible, directly to the panel.
+ */
+ void FocusPanel (const sal_Int32 nPanelIndex);
+ void FocusPanelContent (const sal_Int32 nPanelIndex);
+ void FocusButton (const sal_Int32 nButtonIndex);
+ void ClickButton (const sal_Int32 nButtonIndex);
+ bool MoveFocusInsidePanel (
+ const sal_Int32 nPanelIndex,
+ const sal_Int32 nDirection);
+
+ void HandleKeyEvent (
+ const KeyCode& rKeyCode,
+ const Window& rWindow);
+
+ void SetTopLevelWindow (Window* pWindow);
+ void HandleTopLevelEvent (VclWindowEvent& rEvent);
+};
+
+} } // end of namespace sfx2::sidebar
+
+#endif
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/MenuButton.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/MenuButton.cxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/MenuButton.cxx
(original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/MenuButton.cxx Tue Apr
2 09:22:29 2013
@@ -25,6 +25,7 @@
#include "DrawHelper.hxx"
#include "Paint.hxx"
+#include "Tools.hxx"
#include "sfx2/sidebar/Theme.hxx"
using namespace ::com::sun::star;
@@ -39,6 +40,9 @@ MenuButton::MenuButton (Window* pParentW
mbIsLeftButtonDown(false),
mePaintType(PT_Theme)
{
+#ifdef DEBUG
+ SetText(A2S("MenuButton"));
+#endif
}
@@ -59,13 +63,15 @@ void MenuButton::Paint (const Rectangle&
default:
{
const bool bIsSelected (IsChecked());
- const bool bIsMouseOver (IsMouseOver());
+ const bool bIsHighlighted (IsMouseOver() || HasFocus());
DrawHelper::DrawRoundedRectangle(
*this,
Rectangle(Point(0,0), GetSizePixel()),
- 2,
- bIsMouseOver||bIsSelected ?
Theme::GetColor(Theme::Color_TabItemBorder) : Color(0xffffffff),
- bIsMouseOver
+ 3,
+ bIsHighlighted||bIsSelected
+ ? Theme::GetColor(Theme::Color_TabItemBorder)
+ : Color(0xffffffff),
+ bIsHighlighted
? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight)
: Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal));
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.hxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.hxx Tue Apr 2
09:22:29 2013
@@ -58,6 +58,7 @@ public:
bool IsTitleBarOptional (void) const;
void SetUIElement (const cssu::Reference<css::ui::XUIElement>& rxElement);
cssu::Reference<css::ui::XSidebarPanel> GetPanelComponent (void) const;
+ cssu::Reference<css::awt::XWindow> GetElementWindow (void);
void SetExpanded (const bool bIsExpanded);
bool IsExpanded (void) const;
bool HasIdPredicate (const ::rtl::OUString& rsId) const;
@@ -79,8 +80,6 @@ private:
bool mbIsExpanded;
const ::boost::function<void(void)> maDeckLayoutTrigger;
Rectangle maBoundingBox;
-
- cssu::Reference<css::awt::XWindow> GetElementWindow (void);
};
typedef ::boost::shared_ptr<Panel> SharedPanel;
typedef ::std::vector<SharedPanel> SharedPanelContainer;
Modified:
openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.cxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.cxx
(original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.cxx
Tue Apr 2 09:22:29 2013
@@ -136,6 +136,8 @@ SidebarController::~SidebarController (v
void SAL_CALL SidebarController::disposing (void)
{
+ maFocusManager.Clear();
+
cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
css::ui::ContextChangeEventMultiplexer::get(
::comphelper::getProcessComponentContext()));
@@ -353,6 +355,8 @@ void SidebarController::SwitchToDeck (
const DeckDescriptor& rDeckDescriptor,
const Context& rContext)
{
+ maFocusManager.Clear();
+
if ( ! msCurrentDeckId.equals(rDeckDescriptor.msId))
{
// When the deck changes then destroy the deck and all panels
@@ -480,6 +484,11 @@ void SidebarController::SwitchToDeck (
if (bHasPanelSetChanged)
NotifyResize();
+
+ // Tell the focus manager about the new panels and tab bar
+ // buttons.
+ maFocusManager.SetPanels(aNewPanels);
+ mpTabBar->UpdateFocusManager(maFocusManager);
}
@@ -843,6 +852,14 @@ void SidebarController::OpenDeck (void)
+FocusManager& SidebarController::GetFocusManager (void)
+{
+ return maFocusManager;
+}
+
+
+
+
bool SidebarController::CanModifyChildWindowWidth (void) const
{
SfxSplitWindow* pSplitWindow =
dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
Modified:
openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.hxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.hxx
(original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.hxx
Tue Apr 2 09:22:29 2013
@@ -22,11 +22,12 @@
#ifndef SFX_SIDEBAR_CONTROLLER_HXX
#define SFX_SIDEBAR_CONTROLLER_HXX
-#include "ResourceManager.hxx"
#include "AsynchronousCall.hxx"
-#include "TabBar.hxx"
#include "Context.hxx"
+#include "FocusManager.hxx"
#include "Panel.hxx"
+#include "ResourceManager.hxx"
+#include "TabBar.hxx"
#include <vcl/menu.hxx>
@@ -102,6 +103,8 @@ public:
*/
void OpenDeck (void);
+ FocusManager& GetFocusManager (void);
+
private:
::boost::scoped_ptr<Deck> mpCurrentDeck;
SidebarDockingWindow* mpParentWindow;
@@ -116,6 +119,7 @@ private:
so that it can be restored when the deck is reopended.
*/
sal_Int32 mnSavedSidebarWidth;
+ FocusManager maFocusManager;
DECL_LINK(WindowEventHandler, VclWindowEvent*);
void UpdateConfigurations (const Context& rContext);
Modified:
openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.cxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
---
openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.cxx
(original)
+++
openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.cxx
Tue Apr 2 09:22:29 2013
@@ -78,7 +78,32 @@ void SidebarDockingWindow::DoDispose (vo
void SidebarDockingWindow::GetFocus()
{
- SfxDockingWindow::GetFocus();
+ mpSidebarController->GetFocusManager().GrabFocus();
+}
+
+
+
+
+long SidebarDockingWindow::PreNotify (NotifyEvent& rEvent)
+{
+ switch (rEvent.GetType())
+ {
+ case EVENT_KEYINPUT:
+ {
+ const KeyEvent* pKeyEvent = rEvent.GetKeyEvent();
+ if (pKeyEvent != NULL)
+ return
mpSidebarController->GetFocusManager().NotifyDockingWindowEvent(*pKeyEvent);
+ else
+ break;
+ }
+
+ case EVENT_GETFOCUS:
+ OSL_TRACE("");
+ break;
+
+ }
+
+ return SfxDockingWindow::PreNotify(rEvent);
}
Modified:
openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.hxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
---
openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.hxx
(original)
+++
openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.hxx
Tue Apr 2 09:22:29 2013
@@ -52,6 +52,7 @@ public:
protected:
// Window overridables
virtual void GetFocus (void);
+ virtual long PreNotify (NotifyEvent& rEvent);
private:
::rtl::Reference<sfx2::sidebar::SidebarController> mpSidebarController;
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.cxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.cxx Tue Apr 2
09:22:29 2013
@@ -28,6 +28,7 @@
#include "Paint.hxx"
#include "sfx2/sidebar/Theme.hxx"
#include "Tools.hxx"
+#include "FocusManager.hxx"
#include <vcl/gradient.hxx>
#include <vcl/image.hxx>
@@ -52,7 +53,7 @@ TabBar::TabBar (
const Reference<frame::XFrame>& rxFrame,
const ::boost::function<void(const ::rtl::OUString&)>&
rDeckActivationFunctor,
const PopupMenuProvider& rPopupMenuProvider)
- : Window(pParentWindow),
+ : Window(pParentWindow, WB_DIALOGCONTROL),
mxFrame(rxFrame),
mpMenuButton(ControlFactory::CreateMenuButton(this)),
maItems(),
@@ -339,6 +340,25 @@ void TabBar::RestoreHideFlags (void)
+void TabBar::UpdateFocusManager (FocusManager& rFocusManager)
+{
+ ::std::vector<Button*> aButtons;
+ aButtons.reserve(maItems.size()+1);
+
+ aButtons.push_back(mpMenuButton.get());
+ for(ItemContainer::const_iterator
+ iItem(maItems.begin()), iEnd(maItems.end());
+ iItem!=iEnd;
+ ++iItem)
+ {
+ aButtons.push_back(iItem->mpButton.get());
+ }
+ rFocusManager.SetButtons(aButtons);
+}
+
+
+
+
IMPL_LINK(TabBar, OnToolboxClicked, void*, EMPTYARG)
{
::std::vector<DeckMenuData> aSelectionData;
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.hxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.hxx Tue Apr 2
09:22:29 2013
@@ -42,6 +42,7 @@ namespace cssu = ::com::sun::star::uno;
namespace sfx2 { namespace sidebar {
+class FocusManager;
class TabBarConfiguration;
class TabItem;
@@ -84,7 +85,9 @@ public:
const ::rtl::OUString GetDeckIdForIndex (const sal_Int32 nIndex) const;
void ToggleHideFlag (const sal_Int32 nIndex);
void RestoreHideFlags (void);
-
+
+ void UpdateFocusManager (FocusManager& rFocusManager);
+
private:
cssu::Reference<css::frame::XFrame> mxFrame;
::boost::scoped_ptr<Button> mpMenuButton;
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/TabItem.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/TabItem.cxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TabItem.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TabItem.cxx Tue Apr 2
09:22:29 2013
@@ -41,6 +41,7 @@ TabItem::TabItem (Window* pParentWindow)
mbIsLeftButtonDown(false),
mePaintType(PT_Theme)
{
+ SetStyle(GetStyle() | WB_TABSTOP | WB_DIALOGCONTROL | WB_NOPOINTERFOCUS);
SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
#ifdef DEBUG
SetText(A2S("TabItem"));
@@ -59,19 +60,22 @@ TabItem::~TabItem (void)
void TabItem::Paint (const Rectangle& rUpdateArea)
{
+ OSL_TRACE("TabItem::Paint");
switch(mePaintType)
{
case PT_Theme:
default:
{
const bool bIsSelected (IsChecked());
- const bool bIsMouseOver (IsMouseOver());
+ const bool bIsHighlighted (IsMouseOver() || HasFocus());
DrawHelper::DrawRoundedRectangle(
*this,
Rectangle(Point(0,0), GetSizePixel()),
- 2,
- bIsMouseOver||bIsSelected ?
Theme::GetColor(Theme::Color_TabItemBorder) : Color(0xffffffff),
- bIsMouseOver
+ 3,
+ bIsHighlighted||bIsSelected
+ ? Theme::GetColor(Theme::Color_TabItemBorder)
+ : Color(0xffffffff),
+ bIsHighlighted
? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight)
: Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal));
@@ -109,18 +113,12 @@ void TabItem::MouseMove (const MouseEven
void TabItem::MouseButtonDown (const MouseEvent& rMouseEvent)
{
-#if 0
- Hide();
- ImageRadioButton::MouseButtonDown(rMouseEvent);
- Show();
-#else
if (rMouseEvent.IsLeft())
{
mbIsLeftButtonDown = true;
CaptureMouse();
Invalidate();
}
-#endif
}
@@ -128,11 +126,6 @@ void TabItem::MouseButtonDown (const Mou
void TabItem::MouseButtonUp (const MouseEvent& rMouseEvent)
{
-#if 0
- Hide();
- ImageRadioButton::MouseButtonUp(rMouseEvent);
- Show();
-#else
if (IsMouseCaptured())
ReleaseMouse();
@@ -150,7 +143,6 @@ void TabItem::MouseButtonUp (const Mouse
mbIsLeftButtonDown = false;
Invalidate();
}
-#endif
}
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.cxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.cxx Tue Apr
2 09:22:29 2013
@@ -26,6 +26,7 @@
#include <tools/svborder.hxx>
#include <vcl/gradient.hxx>
+#include <vcl/lineinfo.hxx>
ToolbarValue::~ToolbarValue (void) {}
@@ -69,7 +70,7 @@ void TitleBar::Paint (const Rectangle& r
(void)rUpdateArea;
// Paint title bar background.
- Size aWindowSize( GetOutputSizePixel() );
+ Size aWindowSize (GetOutputSizePixel());
Rectangle aTitleBarBox(
0,
0,
@@ -78,7 +79,10 @@ void TitleBar::Paint (const Rectangle& r
);
PaintDecoration(aTitleBarBox);
- PaintTitle(GetTitleArea(aTitleBarBox));
+ const Rectangle aTitleBox (GetTitleArea(aTitleBarBox));
+ PaintTitle(aTitleBox);
+ if (HasFocus())
+ PaintFocus(aTitleBox);
}
@@ -112,6 +116,14 @@ void TitleBar::SetPosSizePixel (
+ToolBox& TitleBar::GetToolBox (void)
+{
+ return maToolBox;
+}
+
+
+
+
void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
{
(void)nItemIndex;
@@ -125,9 +137,7 @@ void TitleBar::PaintTitle (const Rectang
{
Push(PUSH_FONT | PUSH_TEXTCOLOR);
- // Use a bold font for the deck title.
Font aFont(GetFont());
- aFont.SetWeight(WEIGHT_BOLD);
SetFont(aFont);
// Paint title bar text.
@@ -136,7 +146,38 @@ void TitleBar::PaintTitle (const Rectang
rTitleBox,
msTitle,
TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER);
+
+ Pop();
+}
+
+
+
+
+void TitleBar::PaintFocus (const Rectangle& rFocusBox)
+{
+ Push(PUSH_FONT | PUSH_TEXTCOLOR | PUSH_LINECOLOR | PUSH_FILLCOLOR);
+
+ const Rectangle aTextBox (
+ GetTextRect(
+ rFocusBox,
+ msTitle,
+ TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER));
+ const Rectangle aLargerTextBox (
+ aTextBox.Left() - 2,
+ aTextBox.Top() - 2,
+ aTextBox.Right() + 2,
+ aTextBox.Bottom() + 2);
+
+ LineInfo aDottedStyle (LINE_DASH);
+ aDottedStyle.SetDashCount(0);
+ aDottedStyle.SetDotCount(1);
+ aDottedStyle.SetDotLen(1);
+ aDottedStyle.SetDistance(1);
+ SetFillColor();
+ SetLineColor(COL_BLACK);
+ DrawPolyLine(Polygon(aLargerTextBox), aDottedStyle);
+
Pop();
}
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.hxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.hxx Tue Apr
2 09:22:29 2013
@@ -51,11 +51,14 @@ public:
long nHeight,
sal_uInt16 nFlags = WINDOW_POSSIZE_ALL);
+ ToolBox& GetToolBox (void);
+
protected:
ToolBox maToolBox;
virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) = 0;
virtual void PaintDecoration (const Rectangle& rTitleBarBox) = 0;
+ virtual void PaintFocus (const Rectangle& rFocusBox);
virtual sidebar::Paint GetBackgroundPaint (void) = 0;
virtual Color GetTextColor (void) = 0;
virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex);
Modified:
openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.cxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.cxx
(original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.cxx
Tue Apr 2 09:22:29 2013
@@ -35,7 +35,7 @@
namespace sfx2 { namespace sidebar {
ToolBoxBackground::ToolBoxBackground (Window* pParentWindow)
- : Window(pParentWindow),
+ : Window(pParentWindow, WB_DIALOGCONTROL),
maPadding(Tools::RectangleToSvBorder(Theme::GetRectangle(Theme::Rect_ToolBoxPadding)))
{
SetBackground(Theme::GetPaint(Theme::Paint_ToolBoxBackground).GetWallpaper());
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/Tools.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/Tools.hxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/Tools.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/Tools.hxx Tue Apr 2
09:22:29 2013
@@ -31,7 +31,7 @@
#define A2S(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)))
-#define S2A(s) OUStringToOString(s, RTL_TEXTENCODING_ASCII_US).getStr()
+#define S2A(s) rtl::OUStringToOString(s, RTL_TEXTENCODING_ASCII_US).getStr()
namespace css = ::com::sun::star;
namespace cssu = ::com::sun::star::uno;
Modified: openoffice/branches/sidebar/main/svx/inc/GalleryControl.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/inc/GalleryControl.hxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/inc/GalleryControl.hxx (original)
+++ openoffice/branches/sidebar/main/svx/inc/GalleryControl.hxx Tue Apr 2
09:22:29 2013
@@ -48,6 +48,8 @@ public:
Window* pParentWindow);
virtual ~GalleryControl (void);
+ sal_Bool KeyInput( const KeyEvent& rKEvt, Window* pWindow);
+
private:
Gallery* mpGallery;
::boost::scoped_ptr<GallerySplitter> mpSplitter;
@@ -71,7 +73,6 @@ protected:
Graphic GetGraphic (void) const;
sal_Bool GetVCDrawModel (FmFormModel& rModel) const;
sal_Bool IsLinkage (void) const;
- sal_Bool KeyInput( const KeyEvent& rKEvt, Window* pWindow);
};
} } // end of namespace svx::sidebar
Modified: openoffice/branches/sidebar/main/svx/source/gallery2/galbrws2.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/gallery2/galbrws2.cxx?rev=1463459&r1=1463458&r2=1463459&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/gallery2/galbrws2.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/gallery2/galbrws2.cxx Tue Apr
2 09:22:29 2013
@@ -53,6 +53,7 @@
#include <svx/dialmgr.hxx>
#include <svx/svxdlg.hxx>
#include <svx/dialogs.hrc>
+#include "GalleryControl.hxx"
// -----------
// - Defines -
@@ -331,7 +332,7 @@ GalleryBrowser2::GalleryBrowser2( Window
mbCurActionIsLinkage( sal_False )
{
DBG_CTOR(GalleryBrowser2,NULL);
-
+
Image aDummyImage;
const Link aSelectHdl( LINK( this, GalleryBrowser2, SelectObjectHdl ) );
Font aInfoFont( maInfoBar.GetControlFont() );
@@ -574,7 +575,16 @@ sal_Bool GalleryBrowser2::KeyInput( cons
{
Point aSelPos;
const sal_uIntPtr nItemId = ImplGetSelectedItemId( NULL, aSelPos
);
- sal_Bool bRet = static_cast< GalleryBrowser* >( GetParent()
)->KeyInput( rKEvt, pWindow );
+ GalleryBrowser* pParentBrowser =
dynamic_cast<GalleryBrowser*>(GetParent());
+ sal_Bool bRet = sal_False;
+ if (pParentBrowser != NULL)
+ bRet = pParentBrowser->KeyInput( rKEvt, pWindow );
+ else
+ {
+ svx::sidebar::GalleryControl* pParentControl =
dynamic_cast<svx::sidebar::GalleryControl*>(GetParent());
+ if (pParentControl != NULL)
+ bRet = pParentControl->KeyInput(rKEvt, pWindow);
+ }
if( !bRet && !maViewBox.HasFocus() && nItemId && mpCurTheme )
{