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 [9/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...
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=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.cxx Tue Feb 19 09:09:02 2013
@@ -24,19 +24,21 @@
#include "SidebarController.hxx"
#include "Deck.hxx"
#include "DeckConfiguration.hxx"
+#include "DeckTitleBar.hxx"
#include "Panel.hxx"
#include "SidebarPanel.hxx"
#include "SidebarResource.hxx"
-#include "TitleBar.hxx"
#include "TabBar.hxx"
#include "sfx2/sidebar/Theme.hxx"
+#include "SidebarDockingWindow.hxx"
+#include "Context.hxx"
#include "sfxresid.hxx"
#include "sfx2/sfxsids.hrc"
-#include "sfx2/dockwin.hxx"
+#include "sfx2/titledockwin.hxx"
#include "sfxlocal.hrc"
#include <vcl/floatwin.hxx>
-#include <vcl/dockwin.hxx>
+#include "splitwin.hxx"
#include <svl/smplhint.hxx>
#include <tools/link.hxx>
#include <comphelper/componentfactory.hxx>
@@ -50,7 +52,7 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <boost/bind.hpp>
-#include <boost/foreach.hpp>
+#include <boost/scoped_array.hpp>
using namespace css;
@@ -75,7 +77,7 @@ namespace {
SidebarController::SidebarController (
- DockingWindow* pParentWindow,
+ SidebarDockingWindow* pParentWindow,
const cssu::Reference<css::frame::XFrame>& rxFrame)
: SidebarControllerInterfaceBase(m_aMutex),
mpCurrentConfiguration(),
@@ -86,11 +88,11 @@ SidebarController::SidebarController (
::boost::bind(&SidebarController::SwitchToDeck, this, _1),
::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2,_3))),
mxFrame(rxFrame),
- maCurrentContext(
- EnumContext::Application_Unknown,
- EnumContext::Context_Unknown),
+ maCurrentContext(OUString(), OUString()),
msCurrentDeckId(A2S("PropertyDeck")),
- maPropertyChangeForwarder(::boost::bind(&SidebarController::BroadcastPropertyChange, this))
+ maPropertyChangeForwarder(::boost::bind(&SidebarController::BroadcastPropertyChange, this)),
+ mbIsDeckClosed(false),
+ mnSavedSidebarWidth(pParentWindow->GetSizePixel().Width())
{
if (pParentWindow == NULL)
{
@@ -159,7 +161,7 @@ void SAL_CALL SidebarController::notifyC
throw(cssu::RuntimeException)
{
UpdateConfigurations(
- EnumContext(
+ Context(
rEvent.ApplicationName,
rEvent.ContextName));
}
@@ -177,12 +179,7 @@ void SAL_CALL SidebarController::disposi
mpCurrentConfiguration->Dispose();
mpCurrentConfiguration.reset();
}
- if (mpTabBar != NULL)
- {
- mpTabBar->Hide();
- delete mpTabBar;
- mpTabBar = NULL;
- }
+ mpTabBar.reset();
}
@@ -199,6 +196,17 @@ void SAL_CALL SidebarController::propert
+void SAL_CALL SidebarController::requestLayout (void)
+ throw(cssu::RuntimeException)
+{
+ if (mpCurrentConfiguration && mpCurrentConfiguration->mpDeck!=NULL)
+ mpCurrentConfiguration->mpDeck->RequestLayout();
+ RestrictWidth();
+}
+
+
+
+
void SidebarController::BroadcastPropertyChange (void)
{
DataChangedEvent aEvent (DATACHANGED_USER);
@@ -222,28 +230,61 @@ void SidebarController::NotifyResize (vo
const sal_Int32 nWidth (pParentWindow->GetSizePixel().Width());
const sal_Int32 nHeight (pParentWindow->GetSizePixel().Height());
- if (mpCurrentConfiguration != NULL)
+ // Place the deck.
+ Deck* pDeck = NULL;
+ if (mpCurrentConfiguration != NULL && ! mbIsDeckClosed)
{
- if (mpCurrentConfiguration->mpDeck==NULL)
+ pDeck = mpCurrentConfiguration->mpDeck;
+ if (pDeck == NULL)
{
OSL_ASSERT(mpCurrentConfiguration->mpDeck!=NULL);
}
- else
- {
- mpCurrentConfiguration->mpDeck->SetPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight);
- mpCurrentConfiguration->mpDeck->Show();
- mpCurrentConfiguration->mpDeck->RequestLayout();
- }
+ }
+ if (pDeck != NULL)
+ {
+ pDeck->SetPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight);
+ pDeck->Show();
+ pDeck->RequestLayout();
}
+ // Place the tab bar.
mpTabBar->SetPosSizePixel(nWidth-TabBar::GetDefaultWidth(),0,TabBar::GetDefaultWidth(),nHeight);
mpTabBar->Show();
+
+ // Determine if the closer of the deck can be shown.
+ if (pDeck!=NULL)
+ {
+ DeckTitleBar* pTitleBar = pDeck->GetTitleBar();
+ if (pTitleBar != NULL && pTitleBar->IsVisible())
+ pTitleBar->SetCloserVisible(CanModifyChildWindowWidth());
+ }
+
+ if (nWidth > TabBar::GetDefaultWidth())
+ mnSavedSidebarWidth = nWidth;
+
+ RestrictWidth();
+#ifdef DEBUG
+ if (mpCurrentConfiguration != NULL)
+ {
+ mpCurrentConfiguration->mpDeck->PrintWindowTree();
+ sal_Int32 nPanelIndex (0);
+ for (::std::vector<Panel*>::const_iterator
+ iPanel(mpCurrentConfiguration->maPanels.begin()),
+ iEnd(mpCurrentConfiguration->maPanels.end());
+ iPanel!=iEnd;
+ ++iPanel,++nPanelIndex)
+ {
+ OSL_TRACE("panel %d:", nPanelIndex);
+ (*iPanel)->PrintWindowTree();
+ }
+ }
+#endif
}
-void SidebarController::UpdateConfigurations (const EnumContext& rContext)
+void SidebarController::UpdateConfigurations (const Context& rContext)
{
if (maCurrentContext != rContext)
{
@@ -294,7 +335,7 @@ void SidebarController::UpdateConfigurat
void SidebarController::SwitchToDeck (
const ::rtl::OUString& rsDeckId)
{
- if ( ! msCurrentDeckId.equals(rsDeckId))
+ if ( ! msCurrentDeckId.equals(rsDeckId) || mbIsDeckClosed)
{
const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(rsDeckId);
if (pDeckDescriptor != NULL)
@@ -307,7 +348,7 @@ void SidebarController::SwitchToDeck (
void SidebarController::SwitchToDeck (
const DeckDescriptor& rDeckDescriptor,
- const EnumContext& rContext)
+ const Context& rContext)
{
if ( ! msCurrentDeckId.equals(rDeckDescriptor.msId))
{
@@ -321,7 +362,10 @@ void SidebarController::SwitchToDeck (
msCurrentDeckId = rDeckDescriptor.msId;
}
-
+
+ // Reopen the deck when necessary.
+ OpenDeck();
+
// Determine the panels to display in the deck.
ResourceManager::IdContainer aPanelIds;
ResourceManager::Instance().GetMatchingPanels(
@@ -334,7 +378,10 @@ void SidebarController::SwitchToDeck (
if ( ! mpCurrentConfiguration)
{
mpCurrentConfiguration.reset(new DeckConfiguration);
- mpCurrentConfiguration->mpDeck = new Deck(rDeckDescriptor, mpParentWindow);
+ mpCurrentConfiguration->mpDeck = new Deck(
+ rDeckDescriptor,
+ mpParentWindow,
+ ::boost::bind(&SidebarController::CloseDeck, this));
}
// Update the panel list.
@@ -344,9 +391,10 @@ void SidebarController::SwitchToDeck (
if (mpCurrentConfiguration)
aCurrentPanels.swap(mpCurrentConfiguration->maPanels);
aNewPanels.resize(nNewPanelCount);
- for (sal_Int32 nIndex=0; nIndex<nNewPanelCount; ++nIndex)
+ sal_Int32 nWriteIndex (0);
+ for (sal_Int32 nReadIndex=0; nReadIndex<nNewPanelCount; ++nReadIndex)
{
- const OUString& rsPanelId (aPanelIds[nIndex]);
+ const OUString& rsPanelId (aPanelIds[nReadIndex]);
// Find the corresponding panel among the currently active
// panels.
@@ -358,15 +406,20 @@ void SidebarController::SwitchToDeck (
{
// Panel already exists in current configuration. Move it
// to new configuration.
- aNewPanels[nIndex] = *iPanel;
+ aNewPanels[nWriteIndex] = *iPanel;
aCurrentPanels[::std::distance(aCurrentPanels.begin(), iPanel)] = NULL;
}
else
{
// Panel does not yet exist. Create it.
- aNewPanels[nIndex] = CreatePanel(rsPanelId, mpCurrentConfiguration->mpDeck);
+ aNewPanels[nWriteIndex] = CreatePanel(
+ rsPanelId,
+ mpCurrentConfiguration->mpDeck->GetPanelParentWindow());
}
+ if (aNewPanels[nWriteIndex] != NULL)
+ ++nWriteIndex;
}
+ aNewPanels.resize(nWriteIndex);
// Destroy all panels that are not used in the new configuration.
for (::std::vector<Panel*>::const_iterator iPanel(aCurrentPanels.begin()),iEnd(aCurrentPanels.end());
@@ -390,6 +443,10 @@ void SidebarController::SwitchToDeck (
// Tell the tab bar to highlight the button associated with the
// deck.
mpTabBar->HighlightDeck(rDeckDescriptor.msId);
+
+ mpParentWindow->SetText(rDeckDescriptor.msTitle);
+
+ NotifyResize();
}
@@ -397,17 +454,23 @@ void SidebarController::SwitchToDeck (
Panel* SidebarController::CreatePanel (
const OUString& rsPanelId,
- Deck* pDeck) const
+ ::Window* pParentWindow)
{
const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
if (pPanelDescriptor == NULL)
return NULL;
-
+
+#ifdef DEBUG
+ // Prevent the panel not being created in the same memory of an old panel.
+ ::boost::scoped_array<char> pUnused (new char[sizeof(Panel)]);
+ OSL_TRACE("allocated memory at %x", pUnused.get());
+#endif
+
// Create the panel which is the parent window of the UIElement.
Panel* pPanel = new Panel(
*pPanelDescriptor,
- pDeck,
- ::boost::bind(&Deck::RequestLayout,pDeck));
+ pParentWindow,
+ ::boost::bind(&Deck::RequestLayout,mpCurrentConfiguration->mpDeck));
// Create the XUIElement.
Reference<ui::XUIElement> xUIElement (CreateUIElement(
@@ -434,7 +497,7 @@ Panel* SidebarController::CreatePanel (
Reference<ui::XUIElement> SidebarController::CreateUIElement (
const Reference<awt::XWindowPeer>& rxWindow,
const ::rtl::OUString& rsImplementationURL,
- Panel* pPanel) const
+ Panel* pPanel)
{
try
{
@@ -443,36 +506,22 @@ Reference<ui::XUIElement> SidebarControl
aComponentContext.createComponent("com.sun.star.ui.UIElementFactoryManager"),
UNO_QUERY_THROW);
-
- // Create the XUIElement.
+ // Create the XUIElement.
::comphelper::NamedValueCollection aCreationArguments;
aCreationArguments.put("Frame", makeAny(mxFrame));
aCreationArguments.put("ParentWindow", makeAny(rxWindow));
SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(mpParentWindow);
if (pSfxDockingWindow != NULL)
aCreationArguments.put("SfxBindings", makeAny(sal_uInt64(&pSfxDockingWindow->GetBindings())));
- const Sequence<beans::PropertyValue> aProperties (aCreationArguments.getPropertyValues());
+ aCreationArguments.put("Theme", Theme::GetPropertySet());
+ aCreationArguments.put("Sidebar", makeAny(Reference<ui::XSidebar>(static_cast<ui::XSidebar*>(this))));
+
Reference<ui::XUIElement> xUIElement(
xUIElementFactory->createUIElement(
rsImplementationURL,
- aProperties),
+ Sequence<beans::PropertyValue>(aCreationArguments.getPropertyValues())),
UNO_QUERY_THROW);
- // Provide the new ui element with the XSidebarPanel object
- // that gives access to a canvas, screen coordinates of the
- // panel or the theme properties.
- if (xUIElement.is())
- {
- Reference<lang::XInitialization> xInitialization(xUIElement->getRealInterface(), UNO_QUERY);
- if (xInitialization.is())
- {
- Sequence<Any> aArguments (1);
- Reference<ui::XSidebarPanel> xPanel (SidebarPanel::Create(pPanel));
- aArguments[0] = Any(xPanel);
- xInitialization->initialize(aArguments);
- }
- }
-
return xUIElement;
}
catch(Exception& rException)
@@ -616,7 +665,7 @@ IMPL_LINK(SidebarController, OnMenuItemS
{
if (pMenu == NULL)
{
- OSL_ENSURE(pMenu!=NULL, "TaskPaneController_Impl::OnMenuItemSelected: illegal menu!");
+ OSL_ENSURE(pMenu!=NULL, "sfx2::sidebar::SidebarController::OnMenuItemSelected: illegal menu!");
return 0;
}
@@ -658,5 +707,111 @@ IMPL_LINK(SidebarController, OnMenuItemS
+void SidebarController::CloseDeck (void)
+{
+ if ( ! mbIsDeckClosed)
+ {
+ mbIsDeckClosed = true;
+ if ( ! mpParentWindow->IsFloatingMode())
+ mnSavedSidebarWidth = SetChildWindowWidth(TabBar::GetDefaultWidth());
+ mpParentWindow->SetStyle(mpParentWindow->GetStyle() & ~WB_SIZEABLE);
+
+ if (mpCurrentConfiguration && mpCurrentConfiguration->mpDeck!=NULL)
+ mpCurrentConfiguration->mpDeck->Hide();
+
+ NotifyResize();
+ }
+}
+
+
+
+
+void SidebarController::OpenDeck (void)
+{
+ if (mbIsDeckClosed)
+ {
+ mbIsDeckClosed = false;
+ SetChildWindowWidth(mnSavedSidebarWidth);
+
+ if (mpCurrentConfiguration && mpCurrentConfiguration->mpDeck!=NULL)
+ mpCurrentConfiguration->mpDeck->Show();
+
+ NotifyResize();
+ }
+}
+
+
+
+
+bool SidebarController::CanModifyChildWindowWidth (void) const
+{
+ SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
+ if (pSplitWindow == NULL)
+ {
+ OSL_ASSERT(pSplitWindow!=NULL);
+ return 0;
+ }
+
+ sal_uInt16 nRow (0xffff);
+ sal_uInt16 nColumn (0xffff);
+ pSplitWindow->GetWindowPos(mpParentWindow, nColumn, nRow);
+
+ sal_uInt16 nRowCount (pSplitWindow->GetWindowCount(nColumn));
+
+ return nRowCount == 1;
+}
+
+
+
+
+sal_Int32 SidebarController::SetChildWindowWidth (const sal_Int32 nNewWidth)
+{
+ SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
+ if (pSplitWindow == NULL)
+ return 0;
+
+ sal_uInt16 nRow (0xffff);
+ sal_uInt16 nColumn (0xffff);
+ pSplitWindow->GetWindowPos(mpParentWindow, nColumn, nRow);
+ const long nColumnWidth (pSplitWindow->GetLineSize(nColumn));
+
+ Window* pWindow = mpParentWindow;
+ const Point aWindowPosition (pWindow->GetPosPixel());
+ const Size aWindowSize (pWindow->GetSizePixel());
+
+ pSplitWindow->MoveWindow(
+ mpParentWindow,
+ Size(nNewWidth, aWindowSize.Height()),
+ nColumn,
+ nRow);
+
+ return static_cast<sal_Int32>(nColumnWidth);
+}
+
+
+
+
+void SidebarController::RestrictWidth (void)
+{
+ SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
+ if (pSplitWindow != NULL)
+ {
+ const sal_uInt16 nId (pSplitWindow->GetItemId(mpParentWindow));
+ const sal_uInt16 nSetId (pSplitWindow->GetSet(nId));
+ // Minimum width is always that of the tabbar.
+ const sal_Int32 nMinimumWidth (TabBar::GetDefaultWidth());
+ // Maximum width depends on whether the deck is open or closed.
+ const sal_Int32 nMaximumWidth (
+ mbIsDeckClosed
+ ? TabBar::GetDefaultWidth()
+ : 400);
+ pSplitWindow->SetItemSizeRange(
+ nSetId,
+ Range(nMinimumWidth, nMaximumWidth));
+ if (nMinimumWidth == nMaximumWidth)
+ pSplitWindow->SetItemSize(nSetId, nMinimumWidth);
+ }
+}
+
} } // end of namespace sfx2::sidebar
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=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.hxx Tue Feb 19 09:09:02 2013
@@ -23,9 +23,9 @@
#define SFX_SIDEBAR_CONTROLLER_HXX
#include "ResourceManager.hxx"
-#include "sfx2/sidebar/EnumContext.hxx"
#include "AsynchronousCall.hxx"
#include "TabBar.hxx"
+#include "Context.hxx"
#include <vcl/menu.hxx>
@@ -33,25 +33,25 @@
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/ui/XContextChangeEventListener.hpp>
#include <com/sun/star/ui/XUIElement.hpp>
+#include <com/sun/star/ui/XSidebar.hpp>
#include <boost/noncopyable.hpp>
-#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/compbase3.hxx>
#include <cppuhelper/basemutex.hxx>
namespace css = ::com::sun::star;
namespace cssu = ::com::sun::star::uno;
+
namespace
{
- typedef ::cppu::WeakComponentImplHelper2 <
+ typedef ::cppu::WeakComponentImplHelper3 <
css::ui::XContextChangeEventListener,
- css::beans::XPropertyChangeListener
+ css::beans::XPropertyChangeListener,
+ css::ui::XSidebar
> SidebarControllerInterfaceBase;
}
-
-class DockingWindow;
-
namespace sfx2 { namespace sidebar {
class ContentPanelDescriptor;
@@ -59,6 +59,7 @@ class Deck;
class DeckConfiguration;
class DeckDescriptor;
class Panel;
+class SidebarDockingWindow;
class TabBar;
class TabBarConfiguration;
@@ -69,7 +70,7 @@ class SidebarController
{
public:
SidebarController(
- DockingWindow* pParentWindow,
+ SidebarDockingWindow* pParentWindow,
const cssu::Reference<css::frame::XFrame>& rxFrame);
virtual ~SidebarController (void);
@@ -84,33 +85,50 @@ public:
// beans::XPropertyChangeListener
virtual void SAL_CALL propertyChange (const css::beans::PropertyChangeEvent& rEvent)
throw(cssu::RuntimeException);
+
+ // ui::XSidebar
+ virtual void SAL_CALL requestLayout (void)
+ throw(cssu::RuntimeException);
void NotifyResize (void);
void SwitchToDeck (
const ::rtl::OUString& rsDeckId);
+ /** Show only the tab bar, not the deck.
+ */
+ void CloseDeck (void);
+
+ /** Open the deck area and restore the parent window to its old width.
+ */
+ void OpenDeck (void);
+
private:
::boost::shared_ptr<DeckConfiguration> mpCurrentConfiguration;
- DockingWindow* mpParentWindow;
- TabBar* mpTabBar;
+ SidebarDockingWindow* mpParentWindow;
+ ::boost::scoped_ptr<TabBar> mpTabBar;
cssu::Reference<css::frame::XFrame> mxFrame;
- EnumContext maCurrentContext;
+ Context maCurrentContext;
::rtl::OUString msCurrentDeckId;
AsynchronousCall maPropertyChangeForwarder;
+ bool mbIsDeckClosed;
+ /** Before the deck is closed the sidebar width is saved into this variable,
+ so that it can be restored when the deck is reopended.
+ */
+ sal_Int32 mnSavedSidebarWidth;
DECL_LINK(WindowEventHandler, VclWindowEvent*);
- void UpdateConfigurations (const EnumContext& rContext);
+ void UpdateConfigurations (const Context& rContext);
cssu::Reference<css::ui::XUIElement> CreateUIElement (
const cssu::Reference<css::awt::XWindowPeer>& rxWindow,
const ::rtl::OUString& rsImplementationURL,
- Panel* pPanel) const;
+ Panel* pPanel);
Panel* CreatePanel (
const ::rtl::OUString& rsPanelId,
- Deck* pDeck) const;
+ ::Window* pParentWindow);
void SwitchToDeck (
const DeckDescriptor& rDeckDescriptor,
- const EnumContext& rContext);
+ const Context& rContext);
void ShowPopupMenu (
const Rectangle& rButtonBox,
const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
@@ -121,6 +139,19 @@ private:
DECL_LINK(OnMenuItemSelected, Menu*);
void BroadcastPropertyChange (void);
+ /** The close of the deck changes the width of the child window.
+ That is only possible if there is no other docking window docked above or below the sidebar.
+ Return whether the width of the child window can be modified.
+ */
+ bool CanModifyChildWindowWidth (void) const;
+
+ /** Set the child window container to a new width.
+ Return the old width.
+ */
+ sal_Int32 SetChildWindowWidth (const sal_Int32 nNewWidth);
+
+ void RestrictWidth (void);
+
virtual void SAL_CALL disposing (void);
};
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=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.cxx Tue Feb 19 09:09:02 2013
@@ -22,7 +22,7 @@
#include "precompiled_sfx2.hxx"
#include "SidebarDockingWindow.hxx"
-#include "SidebarChildWindow.hxx"
+#include "sfx2/sidebar/SidebarChildWindow.hxx"
#include "SidebarController.hxx"
#include "sfx2/bindings.hxx"
@@ -33,7 +33,7 @@ using namespace css;
using namespace cssu;
-namespace sfx2 {
+namespace sfx2 { namespace sidebar {
SidebarDockingWindow::SidebarDockingWindow(
@@ -84,4 +84,28 @@ void SidebarDockingWindow::GetFocus()
-} // end of namespace sfx2
+SfxChildWindow* SidebarDockingWindow::GetChildWindow (void)
+{
+ return GetChildWindow_Impl();
+}
+
+
+
+
+sal_Bool SidebarDockingWindow::Close (void)
+{
+ if (mpSidebarController.is())
+ {
+ // Do not close the floating window.
+ // Dock it and close just the deck instead.
+ mpSidebarController->CloseDeck();
+ SetFloatingMode(sal_False);
+ mpSidebarController->NotifyResize();
+ return sal_False;
+ }
+ else
+ return SfxDockingWindow::Close();
+}
+
+
+} } // end of namespace sfx2::sidebar
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=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.hxx Tue Feb 19 09:09:02 2013
@@ -23,17 +23,16 @@
#define SFX_SIDEBAR_DOCKING_WINDOW_HXX
#include "sfx2/dockwin.hxx"
+#include "sfx2/dockwin.hxx"
#include "Sidebar.hxx"
#include <rtl/ref.hxx>
-namespace sfx2 {
+namespace sfx2 { namespace sidebar {
class SidebarChildWindow;
-namespace sidebar {
- class SidebarController;
-}
+class SidebarController;
class SidebarDockingWindow
: public SfxDockingWindow
@@ -45,7 +44,11 @@ public:
Window* pParent,
WinBits nBits);
virtual ~SidebarDockingWindow (void);
+
+ virtual sal_Bool Close (void);
+ SfxChildWindow* GetChildWindow (void);
+
protected:
// Window overridables
virtual void GetFocus (void);
@@ -57,7 +60,7 @@ private:
};
-} // end of namespace sfx2
+} } // end of namespace sfx2::sidebar
#endif
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanel.hxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanel.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanel.hxx Tue Feb 19 09:09:02 2013
@@ -65,14 +65,6 @@ protected:
virtual void SAL_CALL disposing (void);
- // XSidebarPanel
- virtual cssu::Reference<css::rendering::XCanvas> SAL_CALL getCanvas (void)
- throw (cssu::RuntimeException);
- virtual css::awt::Point SAL_CALL getPositionOnScreen (void)
- throw (cssu::RuntimeException);
- virtual cssu::Reference<css::beans::XPropertySet> SAL_CALL getThemeProperties (void)
- throw (cssu::RuntimeException);
-
private:
Panel* mpPanel;
cssu::Reference<css::rendering::XCanvas> mxCanvas;
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanelBase.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanelBase.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanelBase.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanelBase.cxx Tue Feb 19 09:09:02 2013
@@ -39,13 +39,15 @@ namespace sfx2 { namespace sidebar {
Reference<ui::XUIElement> SidebarPanelBase::Create (
const ::rtl::OUString& rsResourceURL,
const cssu::Reference<css::frame::XFrame>& rxFrame,
- Control* pControl)
+ Window* pWindow,
+ const ::boost::function<void(void)>& rMenuProvider)
{
Reference<ui::XUIElement> xUIElement (
new SidebarPanelBase(
rsResourceURL,
rxFrame,
- pControl));
+ pWindow,
+ rMenuProvider));
return xUIElement;
}
@@ -55,17 +57,24 @@ Reference<ui::XUIElement> SidebarPanelBa
SidebarPanelBase::SidebarPanelBase (
const ::rtl::OUString& rsResourceURL,
const cssu::Reference<css::frame::XFrame>& rxFrame,
- Control* pControl)
+ Window* pWindow,
+ const ::boost::function<void(void)>& rMenuProvider)
: SidebarPanelBaseInterfaceBase(m_aMutex),
- msResourceURL(rsResourceURL),
mxFrame(rxFrame),
- mpControl(pControl)
+ mpControl(pWindow),
+ msResourceURL(rsResourceURL),
+ maMenuProvider(rMenuProvider)
{
- cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
- css::ui::ContextChangeEventMultiplexer::get(
- ::comphelper::getProcessComponentContext()));
- if (xMultiplexer.is())
- xMultiplexer->addContextChangeEventListener(this, mxFrame->getController());
+ if (mxFrame.is())
+ {
+ cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
+ css::ui::ContextChangeEventMultiplexer::get(
+ ::comphelper::getProcessComponentContext()));
+ if (xMultiplexer.is())
+ xMultiplexer->addContextChangeEventListener(this, mxFrame->getController());
+ }
+ if (mpControl != NULL)
+ mpControl->Show();
}
@@ -97,21 +106,36 @@ void SAL_CALL SidebarPanelBase::disposin
+void SidebarPanelBase::SetControl (::Window* pControl)
+{
+ OSL_TRACE("setting control of SidebarPanelBase at %x to %x", this, pControl);
+ mpControl = pControl;
+}
+
+
+
+
+::Window* SidebarPanelBase::GetControl (void) const
+{
+ return mpControl;
+}
+
+
+
+
// XContextChangeEventListener
void SAL_CALL SidebarPanelBase::notifyContextChangeEvent (
const ui::ContextChangeEventObject& rEvent)
throw (cssu::RuntimeException)
{
- if (mpControl != NULL)
+ ContextChangeReceiverInterface* pContextChangeReceiver
+ = dynamic_cast<ContextChangeReceiverInterface*>(mpControl);
+ if (pContextChangeReceiver != NULL)
{
const EnumContext aContext(
EnumContext::GetApplicationEnum(rEvent.ApplicationName),
EnumContext::GetContextEnum(rEvent.ContextName));
-
- ContextChangeReceiverInterface* pContextChangeReceiver
- = dynamic_cast<ContextChangeReceiverInterface*>(mpControl);
- if (pContextChangeReceiver != NULL)
- pContextChangeReceiver->HandleContextChange(aContext);
+ pContextChangeReceiver->HandleContextChange(aContext);
}
}
@@ -194,15 +218,41 @@ Reference<awt::XWindow> SAL_CALL Sidebar
-sal_Int32 SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWidth)
+ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWidth)
throw(cssu::RuntimeException)
{
if (mpControl != NULL)
- return mpControl->GetSizePixel().Height();
+ {
+ const sal_Int32 nHeight (mpControl->GetSizePixel().Height());
+ return ui::LayoutSize(nHeight,nHeight,nHeight);
+ }
else
- return -1;
+ return ui::LayoutSize(0,0,0);
+}
+
+
+
+
+void SAL_CALL SidebarPanelBase::showMenu (void)
+ throw(cssu::RuntimeException)
+{
+ if (maMenuProvider)
+ maMenuProvider();
}
+
+sal_Bool SAL_CALL SidebarPanelBase::isContextSupported (
+ const ::rtl::OUString& rsApplicationName,
+ const ::rtl::OUString& rsContextName)
+ throw(cssu::RuntimeException)
+{
+ (void)rsApplicationName;
+ (void)rsContextName;
+
+ return sal_True;
+}
+
+
} } // end of namespace sfx2::sidebar
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarToolBox.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarToolBox.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarToolBox.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarToolBox.cxx Tue Feb 19 09:09:02 2013
@@ -24,6 +24,7 @@
#include "SidebarToolBox.hxx"
#include "ToolBoxBackground.hxx"
#include "sfx2/sidebar/Theme.hxx"
+#include "Tools.hxx"
#include <vcl/gradient.hxx>
@@ -44,6 +45,9 @@ SidebarToolBox::SidebarToolBox (
{
SetBackground(Wallpaper());
SetPaintTransparent(true);
+#ifdef DEBUG
+ SetText(A2S("SidebarToolBox"));
+#endif
}
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=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.cxx Tue Feb 19 09:09:02 2013
@@ -31,6 +31,7 @@
#include <vcl/gradient.hxx>
#include <vcl/image.hxx>
+#include <vcl/wrkwin.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/componentcontext.hxx>
#include <tools/svborder.hxx>
@@ -60,15 +61,17 @@ TabBar::TabBar (
{
SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
- mpMenuButton->SetHelpText(A2S("This is the menu button"));
- mpMenuButton->SetQuickHelpText(A2S("This is the menu button"));
mpMenuButton->SetModeImage(
- Theme::GetImage(Theme::Image_Menu),
+ Theme::GetImage(Theme::Image_TabBarMenu),
Theme::IsHighContrastMode()
? BMP_COLOR_HIGHCONTRAST
: BMP_COLOR_NORMAL);
mpMenuButton->SetClickHdl(LINK(this, TabBar, OnToolboxClicked));
Layout();
+
+#ifdef DEBUG
+ SetText(A2S("TabBar"));
+#endif
}
@@ -110,13 +113,12 @@ void TabBar::SetDecks (
{
// Remove the current buttons.
{
- Window aTemporaryParent (NULL,0);
- for(ItemContainer::const_iterator
+ for(ItemContainer::iterator
iItem(maItems.begin()), iEnd(maItems.end());
iItem!=iEnd;
++iItem)
{
- removeWindow(iItem->mpButton, &aTemporaryParent);
+ iItem->mpButton.reset();
}
maItems.clear();
}
@@ -138,7 +140,7 @@ void TabBar::SetDecks (
Item& rItem (maItems[nIndex++]);
rItem.msDeckId = pDescriptor->msId;
- rItem.mpButton = CreateTabItem(*pDescriptor);
+ rItem.mpButton.reset(CreateTabItem(*pDescriptor));
rItem.mpButton->SetClickHdl(LINK(&rItem, TabBar::Item, HandleClick));
rItem.maDeckActivationFunctor = maDeckActivationFunctor;
rItem.mbIsHiddenByDefault = false;
@@ -159,7 +161,7 @@ void TabBar::UpdateButtonIcons (void)
? BMP_COLOR_HIGHCONTRAST
: BMP_COLOR_NORMAL);
- mpMenuButton->SetModeImage(Theme::GetImage(Theme::Image_Menu), eColorMode);
+ mpMenuButton->SetModeImage(Theme::GetImage(Theme::Image_TabBarMenu), eColorMode);
for(ItemContainer::const_iterator
iItem(maItems.begin()), iEnd(maItems.end());
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=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.hxx Tue Feb 19 09:09:02 2013
@@ -28,12 +28,18 @@
#include <vcl/menu.hxx>
#include <vcl/window.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
#include <boost/function.hpp>
#include <boost/tuple/tuple.hpp>
+#include <boost/scoped_ptr.hpp>
class Button;
class RadioButton;
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
namespace sfx2 { namespace sidebar {
class TabBarConfiguration;
@@ -81,12 +87,12 @@ public:
private:
cssu::Reference<css::frame::XFrame> mxFrame;
- Button* mpMenuButton;
+ ::boost::scoped_ptr<Button> mpMenuButton;
class Item
{
public:
DECL_LINK(HandleClick, Button*);
- RadioButton* mpButton;
+ ::boost::shared_ptr<RadioButton> mpButton;
::rtl::OUString msDeckId;
::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
bool mbIsHidden;
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=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TabItem.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TabItem.cxx Tue Feb 19 09:09:02 2013
@@ -25,6 +25,8 @@
#include "DrawHelper.hxx"
#include "Paint.hxx"
+#include "Tools.hxx"
+
#include "sfx2/sidebar/Theme.hxx"
using namespace ::com::sun::star;
@@ -40,6 +42,9 @@ TabItem::TabItem (Window* pParentWindow)
mePaintType(PT_Theme)
{
SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
+#ifdef DEBUG
+ SetText(A2S("TabItem"));
+#endif
}
Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/Theme.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/Theme.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/Theme.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/Theme.cxx Tue Feb 19 09:09:02 2013
@@ -119,6 +119,14 @@ const Paint& Theme::GetPaint (const Them
+const Wallpaper Theme::GetWallpaper (const ThemeItem eItem)
+{
+ return GetPaint(eItem).GetWallpaper();
+}
+
+
+
+
sal_Int32 Theme::GetInteger (const ThemeItem eItem)
{
const PropertyType eType (GetPropertyType(eItem));
@@ -322,21 +330,34 @@ void Theme::UpdateTheme (void)
maPropertyIdToNameMap[Image_Expand],
Any(
mbIsHighContrastMode
- ? A2S("private:graphicrepository/res/plus_sch.png")
- : A2S("private:graphicrepository/res/plus.png")));
+ ? A2S("private:graphicrepository/svtools/res/triangle_right_hc.png")
+ : A2S("private:graphicrepository/svtools/res/triangle_right.png")));
+ // ? A2S("private:graphicrepository/res/plus_sch.png")
+ // : A2S("private:graphicrepository/res/plus.png")));
setPropertyValue(
maPropertyIdToNameMap[Image_Collapse],
Any(
mbIsHighContrastMode
- ? A2S("private:graphicrepository/res/minus_sch.png")
- : A2S("private:graphicrepository/res/minus.png")));
+ ? A2S("private:graphicrepository/svtools/res/triangle_down_hc.png")
+ : A2S("private:graphicrepository/svtools/res/triangle_down.png")));
+ // ? A2S("private:graphicrepository/res/minus_sch.png")
+ // : A2S("private:graphicrepository/res/minus.png")));
setPropertyValue(
- maPropertyIdToNameMap[Image_Menu],
+ maPropertyIdToNameMap[Image_TabBarMenu],
Any(
mbIsHighContrastMode
? A2S("private:graphicrepository/sfx2/res/menu_hc.png")
: A2S("private:graphicrepository/sfx2/res/menu.png")));
setPropertyValue(
+ maPropertyIdToNameMap[Image_PanelMenu],
+ Any(
+ mbIsHighContrastMode
+ ? A2S("private:graphicrepository/res/imh30823.png")
+ : A2S("private:graphicrepository/res/im30823.png")));
+ setPropertyValue(
+ maPropertyIdToNameMap[Image_Closer],
+ Any(A2S("private:graphicrepository/sfx2/res/closedoc.png")));
+ setPropertyValue(
maPropertyIdToNameMap[Image_ToolBoxItemSeparator],
Any(
A2S("private:graphicrepository/sfx2/res/separator.png")));
@@ -721,8 +742,10 @@ void Theme::SetupPropertyMaps (void)
AddEntry(Image_Grip);
AddEntry(Image_Expand);
AddEntry(Image_Collapse);
- AddEntry(Image_Menu);
+ AddEntry(Image_TabBarMenu);
+ AddEntry(Image_PanelMenu);
AddEntry(Image_ToolBoxItemSeparator);
+ AddEntry(Image_Closer);
AddEntry(Color_DeckTitleFont);
AddEntry(Color_PanelTitleFont);
@@ -783,8 +806,10 @@ Theme::PropertyType Theme::GetPropertyTy
case Image_Grip:
case Image_Expand:
case Image_Collapse:
- case Image_Menu:
+ case Image_TabBarMenu:
+ case Image_PanelMenu:
case Image_ToolBoxItemSeparator:
+ case Image_Closer:
return PT_Image;
case Color_DeckTitleFont:
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=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.cxx Tue Feb 19 09:09:02 2013
@@ -34,11 +34,15 @@ namespace sfx2 { namespace sidebar {
TitleBar::TitleBar (
const ::rtl::OUString& rsTitle,
- Window* pParentWindow)
+ Window* pParentWindow,
+ const sidebar::Paint& rInitialBackgroundPaint)
: Window(pParentWindow),
+ maToolBox(this),
msTitle(rsTitle)
{
- SetBackground(Wallpaper());
+ SetBackground(rInitialBackgroundPaint.GetWallpaper());
+
+ maToolBox.SetSelectHdl(LINK(this, TitleBar, SelectionHandler));
}
@@ -64,8 +68,6 @@ void TitleBar::Paint (const Rectangle& r
aWindowSize.Height()
);
-
- PaintBackground(aTitleBarBox);
PaintDecoration(aTitleBarBox);
PaintTitle(GetTitleArea(aTitleBarBox));
}
@@ -73,29 +75,38 @@ void TitleBar::Paint (const Rectangle& r
-void TitleBar::PaintBackground (const Rectangle& rTitleBarBox)
+void TitleBar::DataChanged (const DataChangedEvent& rEvent)
{
- const sidebar::Paint aBackgroundPaint (GetBackgroundPaint());
+ (void)rEvent;
+
+ SetBackground(GetBackgroundPaint().GetWallpaper());
+}
+
+
+
+
+void TitleBar::SetPosSizePixel (
+ long nX,
+ long nY,
+ long nWidth,
+ long nHeight,
+ sal_uInt16 nFlags)
+{
+ Window::SetPosSizePixel(nX,nY,nWidth,nHeight,nFlags);
+
+ // Place the toolbox.
+ const sal_Int32 nToolBoxWidth (maToolBox.GetItemPosRect(0).GetWidth());
+ maToolBox.SetPosSizePixel(nWidth-nToolBoxWidth,0,nToolBoxWidth,nHeight);
+ maToolBox.Show();
+}
- switch(aBackgroundPaint.GetType())
- {
- case Paint::NoPaint:
- default:
- break;
-
- case Paint::ColorPaint:
- // Set title bar colors.
- Push(PUSH_LINECOLOR | PUSH_FILLCOLOR);
- SetFillColor(aBackgroundPaint.GetColor());
- SetLineColor();
- DrawRect(rTitleBarBox);
- Pop();
- break;
-
- case Paint::GradientPaint:
- DrawGradient(rTitleBarBox, aBackgroundPaint.GetGradient());
- break;
- }
+
+
+
+void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
+{
+ (void)nItemIndex;
+ // Any real processing has to be done in derived class.
}
@@ -121,4 +132,17 @@ void TitleBar::PaintTitle (const Rectang
}
+
+
+IMPL_LINK(TitleBar, SelectionHandler, ToolBox*, pToolBox)
+{
+ (void)pToolBox;
+ OSL_ASSERT(&maToolBox==pToolBox);
+ const sal_uInt16 nItemId (maToolBox.GetHighlightItemId());
+
+ HandleToolBoxItemClick(nItemId);
+
+ return sal_True;
+}
+
} } // end of namespace sfx2::sidebar
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=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.hxx Tue Feb 19 09:09:02 2013
@@ -23,7 +23,9 @@
#define SFX_SIDEBAR_TITLE_BAR_HXX
#include "Paint.hxx"
-#include "vcl/window.hxx"
+
+#include <vcl/window.hxx>
+#include <vcl/toolbox.hxx>
namespace sfx2 { namespace sidebar {
@@ -34,22 +36,33 @@ class TitleBar
public:
TitleBar (
const ::rtl::OUString& rsTitle,
- Window* pParentWindow);
+ Window* pParentWindow,
+ const sidebar::Paint& rInitialBackgroundPaint);
virtual ~TitleBar (void);
virtual void Paint (const Rectangle& rUpdateArea);
+ virtual void DataChanged (const DataChangedEvent& rEvent);
+ virtual void SetPosSizePixel (
+ long nX,
+ long nY,
+ long nWidth,
+ long nHeight,
+ sal_uInt16 nFlags = WINDOW_POSSIZE_ALL);
protected:
+ ToolBox maToolBox;
+
virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) = 0;
virtual void PaintDecoration (const Rectangle& rTitleBarBox) = 0;
virtual sidebar::Paint GetBackgroundPaint (void) = 0;
virtual Color GetTextColor (void) = 0;
-
+ virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex);
+
private:
const ::rtl::OUString msTitle;
- void PaintBackground (const Rectangle& rTitleBarBox);
void PaintTitle (const Rectangle& rTitleBox);
+ DECL_LINK(SelectionHandler, ToolBox*);
};
Added: openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBox.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBox.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBox.hxx (added)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBox.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,56 @@
+/**************************************************************
+ *
+ * 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_TOOLBOX_HXX
+#define SFX_SIDEBAR_TOOLBOX_HXX
+
+#include "vcl/toolbox.hxx"
+
+
+namespace sfx2 { namespace sidebar {
+
+class ToolBox
+ : public ::ToolBox
+{
+public:
+ MenuButton (Window* pParentWindow);
+ virtual ~MenuButton (void);
+
+ virtual void Paint (const Rectangle& rUpdateArea);
+ virtual void MouseMove (const MouseEvent& rEvent);
+ virtual void MouseButtonDown (const MouseEvent& rMouseEvent);
+ virtual void MouseButtonUp (const MouseEvent& rMouseEvent);
+
+protected:
+ using CheckBox::FillLayoutData;
+
+private:
+ bool mbIsLeftButtonDown;
+ enum PaintType {
+ PT_Native,
+ PT_Theme
+ } mePaintType;
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
Propchange: openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBox.hxx
------------------------------------------------------------------------------
svn:executable = *
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=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.cxx Tue Feb 19 09:09:02 2013
@@ -29,6 +29,7 @@
#include <vcl/toolbox.hxx>
#include <vcl/gradient.hxx>
+#include <svl/smplhint.hxx>
namespace sfx2 { namespace sidebar {
@@ -38,6 +39,10 @@ ToolBoxBackground::ToolBoxBackground (Wi
maPadding(Tools::RectangleToSvBorder(Theme::GetRectangle(Theme::Rect_ToolBoxPadding)))
{
SetBackground(Theme::GetPaint(Theme::Paint_ToolBoxBackground).GetWallpaper());
+
+#ifdef DEBUG
+ SetText(A2S("ToolBoxBackground"));
+#endif
}
@@ -88,9 +93,6 @@ void ToolBoxBackground::Paint (const Rec
{
Window::Paint(rRect);
- OSL_TRACE("paint ToolBoxBackground at %d,%d",
- GetPosPixel().X(),
- GetPosPixel().Y());
Rectangle aBox (Point(0,0), GetSizePixel());
const sidebar::Paint aTopLeftBorderPaint (Theme::GetPaint(Theme::Paint_ToolBoxBorderTopLeft));
@@ -136,6 +138,10 @@ IMPL_LINK(ToolBoxBackground, WindowEvent
Hide();
break;
+ case SFX_HINT_DYING:
+ doLazyDelete();
+ break;
+
default:
break;
}
Added: openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.hxx_
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.hxx_?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.hxx_ (added)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.hxx_ Tue Feb 19 09:09:02 2013
@@ -0,0 +1,68 @@
+/**************************************************************
+ *
+ * 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_TOOLBOX_BACKGROUND_HXX
+#define SFX_SIDEBAR_TOOLBOX_BACKGROUND_HXX
+
+#include "vcl/window.hxx"
+
+#include <tools/svborder.hxx>
+
+
+class ToolBox;
+
+namespace sfx2 { namespace sidebar {
+
+class ToolBoxBackground
+ : public Window
+{
+public:
+ ToolBoxBackground (Window* pParentWindow);
+ virtual ~ToolBoxBackground (void);
+
+ /** Call this method once to
+ a) let the ToolBoxBackground object know which ToolBox to
+ monitor and
+ b) so that position and sizes can be set up.
+ @return
+ The relative position of the child.
+ */
+ Point SetToolBoxChild (
+ ToolBox* pChild,
+ long nX,
+ long nY,
+ long nWidth,
+ long nHeight,
+ sal_uInt16 nFlags);
+
+ virtual void Paint (const Rectangle& rRect);
+ virtual void DataChanged (const DataChangedEvent& rEvent);
+
+private:
+ SvBorder maPadding;
+
+ DECL_LINK(WindowEventHandler, VclWindowEvent*);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
Propchange: openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.hxx_
------------------------------------------------------------------------------
svn:executable = *
Modified: openoffice/branches/sidebar/main/svx/inc/svx/svxids.hrc
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/inc/svx/svxids.hrc?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/inc/svx/svxids.hrc (original)
+++ openoffice/branches/sidebar/main/svx/inc/svx/svxids.hrc Tue Feb 19 09:09:02 2013
@@ -749,7 +749,7 @@
#define SID_ATTR_3D_AMBIENTCOLOR ( SID_SVX_START + 411 )
#define SID_IMPORT_GRAPH_LINK ( SID_SVX_START + 412 )
-//#define SID_SIDEBAR ( SID_SVX_START + 413 ) -> sfxsids.hrc
+//#define SID_SIDEBAR ( SID_SVX_START + 414 ) -> sfxsids.hrc
//! moved to sfx2, still in use:
//#define SID_HTML_MODE ( SID_SVX_START + 414 )
Modified: openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx Tue Feb 19 09:09:02 2013
@@ -22,12 +22,15 @@
#include "sidebar/PanelFactory.hxx"
#include "text/TextPropertyPanel.hxx"
-#include <geometry/AreaPropertyPanel.hxx>
+#include "geometry/AreaPropertyPanel.hxx"
#include <sfx2/sidebar/SidebarPanelBase.hxx>
#include <sfx2/sfxbasecontroller.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/window.hxx>
#include <rtl/ref.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+
+#include <boost/bind.hpp>
using namespace css;
@@ -98,28 +101,12 @@ Reference<ui::XUIElement> SAL_CALL Panel
RuntimeException)
{
Reference<ui::XUIElement> xElement;
- Reference<awt::XWindow> xParentWindow;
- Reference<frame::XFrame> xFrame;
- SfxBindings* pBindings = NULL;
- for (sal_Int32 nIndex(0),nCount(rArguments.getLength()); nIndex<nCount; ++nIndex)
- {
- const beans::PropertyValue& rValue (rArguments[nIndex]);
- if (rValue.Name.equalsAscii("ParentWindow"))
- {
- xParentWindow = Reference<awt::XWindow>(rValue.Value, UNO_QUERY);
- }
- else if (rValue.Name.equalsAscii("Frame"))
- {
- xFrame = Reference<frame::XFrame>(rValue.Value, UNO_QUERY);
- }
- else if (rValue.Name.equalsAscii("SfxBindings"))
- {
- sal_uInt64 nValue;
- if (rValue.Value >>= nValue)
- pBindings = reinterpret_cast<SfxBindings*>(nValue);
- }
- }
+ const ::comphelper::NamedValueCollection aArguments (rArguments);
+ Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>()));
+ Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>()));
+ const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
+ SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( ! xParentWindow.is() || pParentWindow==NULL)
@@ -138,10 +125,13 @@ Reference<ui::XUIElement> SAL_CALL Panel
if (rsResourceURL.endsWithAsciiL("/TextPropertyPanel", strlen("/TextPropertyPanel")))
{
TextPropertyPanel* pPanel = TextPropertyPanel::Create(pParentWindow, xFrame, pBindings);
+ pPanel->Show();
+ pPanel->GetParent()->Show();
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
- pPanel);
+ pPanel,
+ ::boost::bind(&TextPropertyPanel::ShowMenu, pPanel));
}
if (rsResourceURL.endsWithAsciiL("/AreaPropertyPanel", strlen("/AreaPropertyPanel")))
Modified: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.cxx Tue Feb 19 09:09:02 2013
@@ -56,6 +56,7 @@
using namespace css;
using namespace cssu;
using ::sfx2::sidebar::Theme;
+using ::sfx2::sidebar::ControlFactory;
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
@@ -113,13 +114,34 @@ TextPropertyPanel::TextPropertyPanel (
: Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)),
mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))),
maFontSizeBox (this, SVX_RES(MB_SBFONT_FONTSIZE)),
- mpToolBoxIncDec(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_INCREASE_DECREASE))),
- mpToolBoxFont(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_FONT))),
- mpToolBoxFontColor(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_FONTCOLOR))),
- mpToolBoxScript(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_SCRIPT))),
- mpToolBoxScriptSw(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_SCRIPT_SW))),
- mpToolBoxSpacing(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_SPACING))),
- mpToolBoxHighlight(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_HIGHLIGHT))),
+ mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
+ mpToolBoxIncDec(ControlFactory::CreateToolBox(
+ mpToolBoxIncDecBackground.get(),
+ SVX_RES(TB_INCREASE_DECREASE))),
+ mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)),
+ mpToolBoxFont(ControlFactory::CreateToolBox(
+ mpToolBoxFontBackground.get(),
+ SVX_RES(TB_FONT))),
+ mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
+ mpToolBoxFontColor(ControlFactory::CreateToolBox(
+ mpToolBoxFontColorBackground.get(),
+ SVX_RES(TB_FONTCOLOR))),
+ mpToolBoxScriptBackground(ControlFactory::CreateToolBoxBackground(this)),
+ mpToolBoxScript(ControlFactory::CreateToolBox(
+ mpToolBoxScriptBackground.get(),
+ SVX_RES(TB_SCRIPT))),
+ mpToolBoxScriptSwBackground(ControlFactory::CreateToolBoxBackground(this)),
+ mpToolBoxScriptSw(ControlFactory::CreateToolBox(
+ mpToolBoxScriptSwBackground.get(),
+ SVX_RES(TB_SCRIPT_SW))),
+ mpToolBoxSpacingBackground(ControlFactory::CreateToolBoxBackground(this)),
+ mpToolBoxSpacing(ControlFactory::CreateToolBox(
+ mpToolBoxSpacingBackground.get(),
+ SVX_RES(TB_SPACING))),
+ mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
+ mpToolBoxHighlight(ControlFactory::CreateToolBox(
+ mpToolBoxHighlightBackground.get(),
+ SVX_RES(TB_HIGHLIGHT))),
mpFontColorUpdater(),
mpHighlightUpdater(),
@@ -205,6 +227,24 @@ TextPropertyPanel::~TextPropertyPanel (v
delete mpPageSpacing;
delete mpFloatWinSpacing;
*/
+
+ // Destroy the toolbox windows.
+ mpToolBoxIncDec.reset();
+ mpToolBoxFont.reset();
+ mpToolBoxFontColor.reset();
+ mpToolBoxScript.reset();
+ mpToolBoxScriptSw.reset();
+ mpToolBoxSpacing.reset();
+ mpToolBoxHighlight.reset();
+
+ // Destroy the background windows of the toolboxes.
+ mpToolBoxIncDecBackground.reset();
+ mpToolBoxFontBackground.reset();
+ mpToolBoxFontColorBackground.reset();
+ mpToolBoxScriptBackground.reset();
+ mpToolBoxScriptSwBackground.reset();
+ mpToolBoxSpacingBackground.reset();
+ mpToolBoxHighlightBackground.reset();
}
@@ -1280,13 +1320,15 @@ void TextPropertyPanel::NotifyItemUpdate
const SvxBrushItem* pItem = (const SvxBrushItem*)pState;
maBackColor = pItem->GetColor();
mbBackColorAvailable = true;
- mpHighlightUpdater->Update(maBackColor);
+ if (mpHighlightUpdater)
+ mpHighlightUpdater->Update(maBackColor);
}
else
{
mbBackColorAvailable = false;
maBackColor.SetColor(COL_AUTO);
- mpHighlightUpdater->Update(maBackColor);
+ if (mpHighlightUpdater)
+ mpHighlightUpdater->Update(maBackColor);
}
break;
case SID_ATTR_CHAR_ESCAPEMENT:
@@ -1413,6 +1455,19 @@ void TextPropertyPanel::NotifyItemUpdate
+void TextPropertyPanel::ShowMenu (void)
+{
+ if (mpBindings != NULL)
+ {
+ SfxDispatcher* pDispatcher = mpBindings->GetDispatcher();
+ if (pDispatcher != NULL)
+ pDispatcher->Execute(SID_CHAR_DLG, SFX_CALLMODE_ASYNCHRON);
+ }
+}
+
+
+
+
void TextPropertyPanel::TextStyleChanged()
{
if( !mbWeightAvailable )
Modified: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hxx (original)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hxx Tue Feb 19 09:09:02 2013
@@ -39,7 +39,6 @@
class FloatingWindow;
class ToolBox;
-
namespace svx { namespace sidebar {
class SvxSBFontNameBox;
@@ -95,16 +94,25 @@ public:
const SfxItemState eState,
const SfxPoolItem* pState);
+ void ShowMenu (void);
+
private:
//ui controls
::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox;
FontSizeBox maFontSizeBox;
- ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec;
+ ::boost::scoped_ptr<Window> mpToolBoxIncDecBackground;
+ ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec;
+ ::boost::scoped_ptr<Window> mpToolBoxFontBackground;
::boost::scoped_ptr<ToolBox> mpToolBoxFont;
+ ::boost::scoped_ptr<Window> mpToolBoxFontColorBackground;
::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
+ ::boost::scoped_ptr<Window> mpToolBoxScriptBackground;
::boost::scoped_ptr<ToolBox> mpToolBoxScript;
+ ::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground;
::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw;
+ ::boost::scoped_ptr<Window> mpToolBoxSpacingBackground;
::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
+ ::boost::scoped_ptr<Window> mpToolBoxHighlightBackground;
::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater;
Modified: openoffice/branches/sidebar/main/sw/source/ui/app/swmodule.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sw/source/ui/app/swmodule.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sw/source/ui/app/swmodule.cxx (original)
+++ openoffice/branches/sidebar/main/sw/source/ui/app/swmodule.cxx Tue Feb 19 09:09:02 2013
@@ -134,7 +134,7 @@
#include <mailmergechildwindow.hxx>
#include <modcfg.hxx>
#include <fontcfg.hxx>
-#include <sfx2/SidebarChildWindow.hxx>
+#include <sfx2/sidebar/SidebarChildWindow.hxx>
#include <sfx2/taskpane.hxx>
#include <sfx2/evntconf.hxx>
#include <sfx2/appuno.hxx>
@@ -465,7 +465,7 @@ void SwDLL::RegisterControls()
::avmedia::MediaPlayer::RegisterChildWindow(0, pMod);
SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod);
- ::sfx2::SidebarChildWindow::RegisterChildWindow(NULL, pMod);
+ ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(NULL, pMod);
::sfx2::TaskPaneWrapper::RegisterChildWindow(NULL, pMod);
}
Modified: openoffice/branches/sidebar/main/sw/source/ui/uiview/view0.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sw/source/ui/uiview/view0.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sw/source/ui/uiview/view0.cxx (original)
+++ openoffice/branches/sidebar/main/sw/source/ui/uiview/view0.cxx Tue Feb 19 09:09:02 2013
@@ -43,7 +43,7 @@
#include <sfx2/templdlg.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx>
-#include <sfx2/SidebarChildWindow.hxx>
+#include <sfx2/sidebar/SidebarChildWindow.hxx>
#include <uivwimp.hxx>
#include <avmedia/mediaplayer.hxx>
//#include <swlinguconfig.hxx>
@@ -110,7 +110,7 @@ SFX_IMPL_INTERFACE( SwView, SfxViewShell
{
SFX_CHILDWINDOW_CONTEXT_REGISTRATION(SID_NAVIGATOR);
SFX_CHILDWINDOW_REGISTRATION(SID_TASKPANE);
- SFX_CHILDWINDOW_REGISTRATION(::sfx2::SidebarChildWindow::GetChildWindowId());
+ SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(SfxTemplateDialogWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(SvxSearchDialogWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(SwSpellDialogChildWindow::GetChildWindowId());