summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu9
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs6
-rw-r--r--sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx2
-rw-r--r--sfx2/inc/sfx2/sidebar/Theme.hxx1
-rw-r--r--sfx2/source/sidebar/PanelDescriptor.hxx1
-rw-r--r--sfx2/source/sidebar/ResourceManager.cxx107
-rw-r--r--sfx2/source/sidebar/ResourceManager.hxx23
-rw-r--r--sfx2/source/sidebar/SidebarChildWindow.cxx23
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx448
-rw-r--r--sfx2/source/sidebar/SidebarController.hxx60
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.cxx16
-rw-r--r--sfx2/source/sidebar/TabBar.cxx36
-rw-r--r--sfx2/source/sidebar/TabBar.hxx3
-rw-r--r--sfx2/source/sidebar/TabItem.cxx5
-rw-r--r--sfx2/source/sidebar/Theme.cxx8
15 files changed, 540 insertions, 208 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
index c483ba2da7f7..de78e852c38c 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -859,6 +859,9 @@
<prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
<value>true</value>
</prop>
+ <prop oor:name="ShowForReadOnlyDocument" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
<prop oor:name="Id" oor:type="xs:string">
<value>SwNavigatorPanel</value>
</prop>
@@ -885,6 +888,9 @@
<prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
<value>true</value>
</prop>
+ <prop oor:name="ShowForReadOnlyDocument" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
<prop oor:name="Id" oor:type="xs:string">
<value>ScNavigatorPanel</value>
</prop>
@@ -911,6 +917,9 @@
<prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
<value>true</value>
</prop>
+ <prop oor:name="ShowForReadOnlyDocument" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
<prop oor:name="Id" oor:type="xs:string">
<value>SdNavigatorPanel</value>
</prop>
diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
index c2b2d587b114..556cf86e17b7 100644
--- a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
@@ -206,6 +206,12 @@
</info>
<value>10000</value>
</prop>
+ <prop oor:name="ShowForReadOnlyDocument" oor:type="xs:boolean">
+ <info>
+ <desc>This flag controls whether the panel is shown when the document in the edit view is read only.</desc>
+ </info>
+ <value>false</value>
+ </prop>
<prop oor:name="WantsCanvas" oor:type="xs:boolean">
<info>
<desc>Experimental: Set to true when panel wants to paint its content via a XCanvas.</desc>
diff --git a/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx b/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx
index e825f3dfb6ef..4562f4119311 100644
--- a/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx
+++ b/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx
@@ -44,6 +44,8 @@ public:
SfxChildWinInfo* pInfo);
SFX_DECL_CHILDWINDOW(SidebarChildWindow);
+
+ static sal_Int32 GetDefaultWidth (Window* pWindow);
};
diff --git a/sfx2/inc/sfx2/sidebar/Theme.hxx b/sfx2/inc/sfx2/sidebar/Theme.hxx
index 03952229e31d..a49aa006e69e 100644
--- a/sfx2/inc/sfx2/sidebar/Theme.hxx
+++ b/sfx2/inc/sfx2/sidebar/Theme.hxx
@@ -81,6 +81,7 @@ public:
Image_PanelMenu,
Image_ToolBoxItemSeparator,
Image_Closer,
+ Image_CloseIndicator,
__Image_Color,
diff --git a/sfx2/source/sidebar/PanelDescriptor.hxx b/sfx2/source/sidebar/PanelDescriptor.hxx
index ba83ba7e6a5c..bf0de7e5da61 100644
--- a/sfx2/source/sidebar/PanelDescriptor.hxx
+++ b/sfx2/source/sidebar/PanelDescriptor.hxx
@@ -42,6 +42,7 @@ public:
ContextList maContextList;
::rtl::OUString msImplementationURL;
sal_Int32 mnOrderIndex;
+ bool mbShowForReadOnlyDocuments;
bool mbWantsCanvas;
PanelDescriptor (void);
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index c3627e2808cd..3d250051e128 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -90,25 +90,6 @@ ResourceManager::~ResourceManager (void)
-const DeckDescriptor* ResourceManager::GetBestMatchingDeck (
- const Context& rContext,
- const Reference<frame::XFrame>& rxFrame)
-{
- ReadLegacyAddons(rxFrame);
-
- for (DeckContainer::const_iterator iDeck(maDecks.begin()), iEnd(maDecks.end());
- iDeck!=iEnd;
- ++iDeck)
- {
- if (iDeck->maContextList.GetMatch(rContext) != NULL)
- return &*iDeck;
- }
- return NULL;
-}
-
-
-
-
const DeckDescriptor* ResourceManager::GetDeckDescriptor (
const ::rtl::OUString& rsDeckId) const
{
@@ -166,14 +147,15 @@ void ResourceManager::SetIsDeckEnabled (
-const ResourceManager::IdContainer& ResourceManager::GetMatchingDecks (
- IdContainer& rDeckIds,
+const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatchingDecks (
+ DeckContextDescriptorContainer& rDecks,
const Context& rContext,
+ const bool bIsDocumentReadOnly,
const Reference<frame::XFrame>& rxFrame)
{
ReadLegacyAddons(rxFrame);
- ::std::multimap<sal_Int32,OUString> aOrderedIds;
+ ::std::multimap<sal_Int32,DeckContextDescriptor> aOrderedIds;
for (DeckContainer::const_iterator
iDeck(maDecks.begin()),
iEnd (maDecks.end());
@@ -181,22 +163,28 @@ const ResourceManager::IdContainer& ResourceManager::GetMatchingDecks (
++iDeck)
{
const DeckDescriptor& rDeckDescriptor (*iDeck);
- if (rDeckDescriptor.maContextList.GetMatch(rContext) != NULL)
- aOrderedIds.insert(::std::multimap<sal_Int32,OUString>::value_type(
- rDeckDescriptor.mnOrderIndex,
- rDeckDescriptor.msId));
+ if (rDeckDescriptor.maContextList.GetMatch(rContext) == NULL)
+ continue;
+ DeckContextDescriptor aDeckContextDescriptor;
+ aDeckContextDescriptor.msId = rDeckDescriptor.msId;
+ aDeckContextDescriptor.mbIsEnabled =
+ ! bIsDocumentReadOnly
+ || IsDeckEnabled(rDeckDescriptor.msId, rContext, rxFrame);
+ aOrderedIds.insert(::std::multimap<sal_Int32,DeckContextDescriptor>::value_type(
+ rDeckDescriptor.mnOrderIndex,
+ aDeckContextDescriptor));
}
- for (::std::multimap<sal_Int32,OUString>::const_iterator
+ for (::std::multimap<sal_Int32,DeckContextDescriptor>::const_iterator
iId(aOrderedIds.begin()),
iEnd(aOrderedIds.end());
iId!=iEnd;
++iId)
{
- rDeckIds.push_back(iId->second);
+ rDecks.push_back(iId->second);
}
- return rDeckIds;
+ return rDecks;
}
@@ -218,20 +206,21 @@ const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatc
++iPanel)
{
const PanelDescriptor& rPanelDescriptor (*iPanel);
- if (rPanelDescriptor.msDeckId.equals(rsDeckId))
- {
- const ContextList::Entry* pEntry = rPanelDescriptor.maContextList.GetMatch(rContext);
- if (pEntry != NULL)
- {
- PanelContextDescriptor aPanelContextDescriptor;
- aPanelContextDescriptor.msId = rPanelDescriptor.msId;
- aPanelContextDescriptor.msMenuCommand = pEntry->msMenuCommand;
- aPanelContextDescriptor.mbIsInitiallyVisible = pEntry->mbIsInitiallyVisible;
- aOrderedIds.insert(::std::multimap<sal_Int32,PanelContextDescriptor>::value_type(
- rPanelDescriptor.mnOrderIndex,
- aPanelContextDescriptor));
- }
- }
+ if ( ! rPanelDescriptor.msDeckId.equals(rsDeckId))
+ continue;
+
+ const ContextList::Entry* pEntry = rPanelDescriptor.maContextList.GetMatch(rContext);
+ if (pEntry == NULL)
+ continue;
+
+ PanelContextDescriptor aPanelContextDescriptor;
+ aPanelContextDescriptor.msId = rPanelDescriptor.msId;
+ aPanelContextDescriptor.msMenuCommand = pEntry->msMenuCommand;
+ aPanelContextDescriptor.mbIsInitiallyVisible = pEntry->mbIsInitiallyVisible;
+ aPanelContextDescriptor.mbShowForReadOnlyDocuments = rPanelDescriptor.mbShowForReadOnlyDocuments;
+ aOrderedIds.insert(::std::multimap<sal_Int32,PanelContextDescriptor>::value_type(
+ rPanelDescriptor.mnOrderIndex,
+ aPanelContextDescriptor));
}
for (::std::multimap<sal_Int32,PanelContextDescriptor>::const_iterator
@@ -345,6 +334,8 @@ void ResourceManager::ReadPanelList (void)
aPanelNode.getNodeValue("ImplementationURL"));
rPanelDescriptor.mnOrderIndex = ::comphelper::getINT32(
aPanelNode.getNodeValue("OrderIndex"));
+ rPanelDescriptor.mbShowForReadOnlyDocuments = ::comphelper::getBOOL(
+ aPanelNode.getNodeValue("ShowForReadOnlyDocument"));
rPanelDescriptor.mbWantsCanvas = ::comphelper::getBOOL(
aPanelNode.getNodeValue("WantsCanvas"));
const OUString sDefaultMenuCommand (::comphelper::getString(
@@ -566,6 +557,7 @@ void ResourceManager::ReadLegacyAddons (const Reference<frame::XFrame>& rxFrame)
rPanelDescriptor.msHelpURL = ::comphelper::getString(aChildNode.getNodeValue("HelpURL"));
rPanelDescriptor.maContextList.AddContextDescription(Context(sModuleName, A2S("any")), true, OUString());
rPanelDescriptor.msImplementationURL = rsNodeName;
+ rPanelDescriptor.mbShowForReadOnlyDocuments = false;
}
// When there where invalid nodes then we have to adapt the size
@@ -651,4 +643,33 @@ void ResourceManager::GetToolPanelNodeNames (
+
+bool ResourceManager::IsDeckEnabled (
+ const OUString& rsDeckId,
+ const Context& rContext,
+ const Reference<frame::XFrame>& rxFrame) const
+{
+ // Check if any panel that matches the current context can be
+ // displayed.
+ ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors;
+ ResourceManager::Instance().GetMatchingPanels(
+ aPanelContextDescriptors,
+ rContext,
+ rsDeckId,
+ rxFrame);
+
+ for (ResourceManager::PanelContextDescriptorContainer::const_iterator
+ iPanel(aPanelContextDescriptors.begin()),
+ iEnd(aPanelContextDescriptors.end());
+ iPanel!=iEnd;
+ ++iPanel)
+ {
+ if (iPanel->mbShowForReadOnlyDocuments)
+ return true;
+ }
+
+ return false;
+}
+
+
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/ResourceManager.hxx b/sfx2/source/sidebar/ResourceManager.hxx
index 0ed684721ba1..3dcd76a32ef2 100644
--- a/sfx2/source/sidebar/ResourceManager.hxx
+++ b/sfx2/source/sidebar/ResourceManager.hxx
@@ -48,10 +48,6 @@ class ResourceManager
public:
static ResourceManager& Instance (void);
- const DeckDescriptor* GetBestMatchingDeck (
- const Context& rContext,
- const cssu::Reference<css::frame::XFrame>& rxFrame);
-
const DeckDescriptor* GetDeckDescriptor (
const ::rtl::OUString& rsDeckId) const;
const PanelDescriptor* GetPanelDescriptor (
@@ -68,19 +64,28 @@ public:
const ::rtl::OUString& rsDeckId,
const bool bIsEnabled);
- typedef ::std::vector<rtl::OUString> IdContainer;
+ class DeckContextDescriptor
+ {
+ public:
+ ::rtl::OUString msId;
+ bool mbIsEnabled;
+ };
+ typedef ::std::vector<DeckContextDescriptor> DeckContextDescriptorContainer;
+
class PanelContextDescriptor
{
public:
::rtl::OUString msId;
::rtl::OUString msMenuCommand;
bool mbIsInitiallyVisible;
+ bool mbShowForReadOnlyDocuments;
};
typedef ::std::vector<PanelContextDescriptor> PanelContextDescriptorContainer;
- const IdContainer& GetMatchingDecks (
- IdContainer& rDeckDescriptors,
+ const DeckContextDescriptorContainer& GetMatchingDecks (
+ DeckContextDescriptorContainer& rDeckDescriptors,
const Context& rContext,
+ const bool bIsDocumentReadOnly,
const cssu::Reference<css::frame::XFrame>& rxFrame);
const PanelContextDescriptorContainer& GetMatchingPanels (
@@ -117,6 +122,10 @@ private:
void GetToolPanelNodeNames (
::std::vector<rtl::OUString>& rMatchingNames,
const ::utl::OConfigurationTreeRoot aRoot) const;
+ bool IsDeckEnabled (
+ const ::rtl::OUString& rsDeckId,
+ const Context& rContext,
+ const cssu::Reference<css::frame::XFrame>& rxFrame) const;
};
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx
index 839747079675..774031dfd143 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -21,11 +21,13 @@
#include "precompiled_sfx2.hxx"
+#include "TabBar.hxx"
#include "sfx2/sidebar/SidebarChildWindow.hxx"
#include "SidebarDockingWindow.hxx"
#include "sfx2/sfxsids.hrc"
#include "helpid.hrc"
#include "sfx2/dockwin.hxx"
+#include <sfx2/sidebar/propertypanel.hrc>
namespace sfx2 { namespace sidebar {
@@ -49,9 +51,9 @@ SidebarChildWindow::SidebarChildWindow (
eChildAlignment = SFX_ALIGN_RIGHT;
this->pWindow->SetHelpId(HID_SIDEBAR_WINDOW);
- this->pWindow->SetOutputSizePixel(Size(300, 450));
+ this->pWindow->SetOutputSizePixel(Size(GetDefaultWidth(this->pWindow), 450));
- SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pParentWindow);
+ SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(this->pWindow);
if (pDockingParent != NULL)
pDockingParent->Initialize(pInfo);
SetHideNotDelete(sal_True);
@@ -60,4 +62,21 @@ SidebarChildWindow::SidebarChildWindow (
}
+
+
+sal_Int32 SidebarChildWindow::GetDefaultWidth (Window* pWindow)
+{
+ if (pWindow != NULL)
+ {
+ // Width of the paragraph panel.
+ const static sal_Int32 nMaxPropertyPageWidth (115);
+
+ return pWindow->LogicToPixel(Point(nMaxPropertyPageWidth,1), MAP_APPFONT).X()
+ + TabBar::GetDefaultWidth();
+ }
+ else
+ return 0;
+}
+
+
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index b9f301258bb9..1d8e2111d8d2 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -29,6 +29,7 @@
#include "SidebarResource.hxx"
#include "TabBar.hxx"
#include "sfx2/sidebar/Theme.hxx"
+#include "sfx2/sidebar/SidebarChildWindow.hxx"
#include "SidebarDockingWindow.hxx"
#include "Context.hxx"
#include "Tools.hxx"
@@ -38,6 +39,7 @@
#include "sfx2/titledockwin.hxx"
#include "sfxlocal.hrc"
#include <vcl/floatwin.hxx>
+#include <vcl/fixed.hxx>
#include "splitwin.hxx"
#include <svl/smplhint.hxx>
#include <tools/link.hxx>
@@ -69,6 +71,15 @@ using ::rtl::OUString;
#undef VERBOSE
+namespace
+{
+ const static OUString gsReadOnlyCommandName (A2S(".uno:EditDoc"));
+ const static sal_Int32 gnMaximumSidebarWidth (400);
+ const static sal_Int32 gnWidthCloseThreshold (70);
+ const static sal_Int32 gnWidthOpenThreshold (40);
+}
+
+
namespace sfx2 { namespace sidebar {
namespace {
@@ -93,15 +104,22 @@ SidebarController::SidebarController (
mpTabBar(new TabBar(
mpParentWindow,
rxFrame,
- ::boost::bind(&SidebarController::SwitchToDeck, this, _1),
+ ::boost::bind(&SidebarController::OpenThenSwitchToDeck, this, _1),
::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2,_3))),
mxFrame(rxFrame),
maCurrentContext(OUString(), OUString()),
msCurrentDeckId(A2S("PropertyDeck")),
maPropertyChangeForwarder(::boost::bind(&SidebarController::BroadcastPropertyChange, this)),
maContextChangeUpdate(::boost::bind(&SidebarController::UpdateConfigurations, this)),
- mbIsDeckClosed(false),
- mnSavedSidebarWidth(pParentWindow->GetSizePixel().Width())
+ mbIsDeckRequestedOpen(),
+ mbIsDeckOpen(),
+ mbCanDeckBeOpened(true),
+ mnSavedSidebarWidth(pParentWindow->GetSizePixel().Width()),
+ mxReadOnlyModeDispatch(),
+ mbIsDocumentReadOnly(false),
+ mpSplitWindow(NULL),
+ mnWidthOnSplitterButtonDown(0),
+ mpCloseIndicator()
{
if (pParentWindow == NULL)
{
@@ -126,6 +144,13 @@ SidebarController::SidebarController (
A2S(""),
static_cast<css::beans::XPropertyChangeListener*>(this));
+ // Get the dispatch object as preparation to listen for changes of
+ // the read-only state.
+ const util::URL aURL (GetURL(gsReadOnlyCommandName));
+ mxReadOnlyModeDispatch = GetDispatch(aURL);
+ if (mxReadOnlyModeDispatch.is())
+ mxReadOnlyModeDispatch->addStatusListener(this, aURL);
+
SwitchToDeck(A2S("default"));
}
@@ -150,6 +175,14 @@ void SAL_CALL SidebarController::disposing (void)
xMultiplexer->removeAllContextChangeEventListeners(
static_cast<css::ui::XContextChangeEventListener*>(this));
+ if (mxReadOnlyModeDispatch.is())
+ mxReadOnlyModeDispatch->removeStatusListener(this, GetURL(gsReadOnlyCommandName));
+ if (mpSplitWindow != NULL)
+ {
+ mpSplitWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler));
+ mpSplitWindow = NULL;
+ }
+
if (mpParentWindow != NULL)
{
mpParentWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler));
@@ -211,6 +244,25 @@ void SAL_CALL SidebarController::propertyChange (const css::beans::PropertyChang
+void SAL_CALL SidebarController::statusChanged (const css::frame::FeatureStateEvent& rEvent)
+ throw(cssu::RuntimeException)
+{
+ bool bIsReadWrite (true);
+ if (rEvent.IsEnabled)
+ rEvent.State >>= bIsReadWrite;
+
+ if (mbIsDocumentReadOnly != !bIsReadWrite)
+ {
+ mbIsDocumentReadOnly = !bIsReadWrite;
+
+ // Force the current deck to update its panel list.
+ SwitchToDeck(msCurrentDeckId);
+ }
+}
+
+
+
+
void SAL_CALL SidebarController::requestLayout (void)
throw(cssu::RuntimeException)
{
@@ -245,12 +297,36 @@ void SidebarController::NotifyResize (void)
const sal_Int32 nWidth (pParentWindow->GetSizePixel().Width());
const sal_Int32 nHeight (pParentWindow->GetSizePixel().Height());
+ mbIsDeckOpen = (nWidth > TabBar::GetDefaultWidth());
+
+ if (mnSavedSidebarWidth <= 0)
+ mnSavedSidebarWidth = nWidth;
+
+ bool bIsDeckVisible;
+ if (mbCanDeckBeOpened)
+ {
+ const bool bIsOpening (nWidth > mnWidthOnSplitterButtonDown);
+ if (bIsOpening)
+ bIsDeckVisible = nWidth >= TabBar::GetDefaultWidth() + gnWidthOpenThreshold;
+ else
+ bIsDeckVisible = nWidth >= TabBar::GetDefaultWidth() + gnWidthCloseThreshold;
+ mbIsDeckRequestedOpen = bIsDeckVisible;
+ UpdateCloseIndicator(!bIsDeckVisible);
+ }
+ else
+ bIsDeckVisible = false;
+
// Place the deck.
if (mpCurrentDeck)
{
- mpCurrentDeck->SetPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight);
- mpCurrentDeck->Show();
- mpCurrentDeck->RequestLayout();
+ if (bIsDeckVisible)
+ {
+ mpCurrentDeck->SetPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight);
+ mpCurrentDeck->Show();
+ mpCurrentDeck->RequestLayout();
+ }
+ else
+ mpCurrentDeck->Hide();
}
// Place the tab bar.
@@ -265,26 +341,34 @@ void SidebarController::NotifyResize (void)
pTitleBar->SetCloserVisible(CanModifyChildWindowWidth());
}
- if (nWidth > TabBar::GetDefaultWidth())
- mnSavedSidebarWidth = nWidth;
-
RestrictWidth();
-#ifdef VERBOSE
- if (mpCurrentDeck)
+}
+
+
+
+
+void SidebarController::ProcessNewWidth (const sal_Int32 nNewWidth)
+{
+ if ( ! mbIsDeckRequestedOpen)
+ return;
+
+ if (mbIsDeckRequestedOpen.get())
+ {
+ // Deck became large enough to be shown. Show it.
+ mnSavedSidebarWidth = nNewWidth;
+ RequestOpenDeck();
+ }
+ else
{
- mpCurrentDeck->PrintWindowTree();
- sal_Int32 nPanelIndex (0);
- for (SharedPanelContainer::const_iterator
- iPanel(mpCurrentDeck->GetPanels().begin()),
- iEnd(mpCurrentDeck->GetPanels().end());
- iPanel!=iEnd;
- ++iPanel,++nPanelIndex)
- {
- OSL_TRACE("panel %d:", nPanelIndex);
- (*iPanel)->PrintWindowTree();
- }
+ // Deck became too small. Close it completely.
+ // If window is wider than the tab bar then mark the deck as being visible, even when it its not.
+ // This is to trigger an adjustment of the width to the width of the tab bar.
+ mbIsDeckOpen = true;
+ RequestCloseDeck();
+
+ if (mnWidthOnSplitterButtonDown > TabBar::GetDefaultWidth())
+ mnSavedSidebarWidth = mnWidthOnSplitterButtonDown;
}
-#endif
}
@@ -296,44 +380,56 @@ void SidebarController::UpdateConfigurations (void)
{
maCurrentContext = maRequestedContext;
- // Notify the tab bar about the updated set of decks.
- ResourceManager::IdContainer aDeckIds;
+ // Find the set of decks that could be displayed for the new context.
+ ResourceManager::DeckContextDescriptorContainer aDecks;
ResourceManager::Instance().GetMatchingDecks (
- aDeckIds,
+ aDecks,
maCurrentContext,
+ mbIsDocumentReadOnly,
mxFrame);
- mpTabBar->SetDecks(aDeckIds);
+ mpTabBar->SetDecks(aDecks);
- // Check if the current deck is among the matching decks.
- bool bCurrentDeckMatches (false);
- for (ResourceManager::IdContainer::const_iterator
- iDeck(aDeckIds.begin()),
- iEnd(aDeckIds.end());
+ // Notify the tab bar about the updated set of decks.
+ mpTabBar->SetDecks(aDecks);
+
+ // Find the new deck. By default that is the same as the old
+ // one. If that is not set or not enabled, then choose the
+ // first enabled deck.
+ OUString sNewDeckId;
+ for (ResourceManager::DeckContextDescriptorContainer::const_iterator
+ iDeck(aDecks.begin()),
+ iEnd(aDecks.end());
iDeck!=iEnd;
++iDeck)
{
- if (iDeck->equals(msCurrentDeckId))
+ if (iDeck->mbIsEnabled)
{
- bCurrentDeckMatches = true;
- break;
+ if (iDeck->msId.equals(msCurrentDeckId))
+ {
+ sNewDeckId = msCurrentDeckId;
+ break;
+ }
+ else if (sNewDeckId.getLength() == 0)
+ sNewDeckId = iDeck->msId;
}
}
- DeckDescriptor const* pDeckDescriptor = NULL;
- if ( ! bCurrentDeckMatches)
- pDeckDescriptor = ResourceManager::Instance().GetBestMatchingDeck(maCurrentContext, mxFrame);
- else
- pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(msCurrentDeckId);
- if (pDeckDescriptor != NULL)
+ if (sNewDeckId.getLength() == 0)
{
- msCurrentDeckId = pDeckDescriptor->msId;
- SwitchToDeck(*pDeckDescriptor, maCurrentContext);
+ // We did not find a valid deck.
+ RequestCloseDeck();
+ return;
// Tell the tab bar to highlight the button associated
// with the deck.
- mpTabBar->HighlightDeck(msCurrentDeckId);
+ mpTabBar->HighlightDeck(sNewDeckId);
}
+ msCurrentDeckId = sNewDeckId;
+ SwitchToDeck(
+ *ResourceManager::Instance().GetDeckDescriptor(sNewDeckId),
+ maCurrentContext);
+
#ifdef DEBUG
// Show the context name in the deck title bar.
if (mpCurrentDeck)
@@ -349,10 +445,20 @@ void SidebarController::UpdateConfigurations (void)
+void SidebarController::OpenThenSwitchToDeck (
+ const ::rtl::OUString& rsDeckId)
+{
+ RequestOpenDeck();
+ SwitchToDeck(rsDeckId);
+}
+
+
+
+
void SidebarController::SwitchToDeck (
const ::rtl::OUString& rsDeckId)
{
- if ( ! msCurrentDeckId.equals(rsDeckId) || mbIsDeckClosed)
+ if ( ! msCurrentDeckId.equals(rsDeckId) || ! mbIsDeckOpen)
{
const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(rsDeckId);
if (pDeckDescriptor != NULL)
@@ -382,9 +488,6 @@ void SidebarController::SwitchToDeck (
msCurrentDeckId = rDeckDescriptor.msId;
}
- // Reopen the deck when necessary.
- OpenDeck();
-
// Determine the panels to display in the deck.
ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors;
ResourceManager::Instance().GetMatchingPanels(
@@ -421,6 +524,12 @@ void SidebarController::SwitchToDeck (
return;
}
+ // When the document is read-only, check if there are any panels that can still be displayed.
+ if (mbIsDocumentReadOnly)
+ {
+ }
+
+
// Provide a configuration and Deck object.
if ( ! mpCurrentDeck)
{
@@ -428,7 +537,7 @@ void SidebarController::SwitchToDeck (
new Deck(
rDeckDescriptor,
mpParentWindow,
- ::boost::bind(&SidebarController::CloseDeck, this)));
+ ::boost::bind(&SidebarController::RequestCloseDeck, this)));
msCurrentDeckTitle = rDeckDescriptor.msTitle;
}
if ( ! mpCurrentDeck)
@@ -446,6 +555,11 @@ void SidebarController::SwitchToDeck (
const ResourceManager::PanelContextDescriptor& rPanelContexDescriptor (
aPanelContextDescriptors[nReadIndex]);
+ // Determine if the panel can be displayed.
+ const bool bIsPanelVisible (!mbIsDocumentReadOnly || rPanelContexDescriptor.mbShowForReadOnlyDocuments);
+ if ( ! bIsPanelVisible)
+ continue;
+
// Find the corresponding panel among the currently active
// panels.
SharedPanelContainer::const_iterator iPanel (::std::find_if(
@@ -509,28 +623,6 @@ bool SidebarController::ArePanelSetsEqual (
const SharedPanelContainer& rCurrentPanels,
const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels)
{
-#ifdef VERBOSE
- OSL_TRACE("current panel list:");
- for (SharedPanelContainer::const_iterator
- iPanel(rCurrentPanels.begin()),
- iEnd(rCurrentPanels.end());
- iPanel!=iEnd;
- ++iPanel)
- {
- OSL_TRACE(" panel %s", S2A((*iPanel)->GetId()));
- }
-
- OSL_TRACE("requested panels: ");
- for (ResourceManager::PanelContextDescriptorContainer::const_iterator
- iId(rRequestedPanels.begin()),
- iEnd(rRequestedPanels.end());
- iId!=iEnd;
- ++iId)
- {
- OSL_TRACE(" panel %s", S2A(iId->msId));
- }
-#endif
-
if (rCurrentPanels.size() != rRequestedPanels.size())
return false;
for (sal_Int32 nIndex=0,nCount=rCurrentPanels.size(); nIndex<nCount; ++nIndex)
@@ -539,6 +631,11 @@ bool SidebarController::ArePanelSetsEqual (
return false;
if ( ! rCurrentPanels[nIndex]->GetId().equals(rRequestedPanels[nIndex].msId))
return false;
+
+ // Check if the panels still can be displayed. This may not be the case when
+ // the document just become rea-only.
+ if (mbIsDocumentReadOnly && ! rRequestedPanels[nIndex].mbShowForReadOnlyDocuments)
+ return false;
}
return true;
}
@@ -634,14 +731,13 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement (
IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent)
{
- if (pEvent != NULL)
+ if (pEvent==NULL)
+ return sal_False;
+
+ if (pEvent->GetWindow() == mpParentWindow)
{
switch (pEvent->GetId())
{
- case VCLEVENT_WINDOW_GETFOCUS:
- case VCLEVENT_WINDOW_LOSEFOCUS:
- break;
-
case VCLEVENT_WINDOW_SHOW:
case VCLEVENT_WINDOW_RESIZE:
NotifyResize();
@@ -659,10 +755,34 @@ IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent)
dispose();
break;
+ case VCLEVENT_WINDOW_PAINT:
+ OSL_TRACE("Paint");
+ break;
+
default:
break;
}
}
+ else if (pEvent->GetWindow()==mpSplitWindow && mpSplitWindow!=NULL)
+ {
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_MOUSEBUTTONDOWN:
+ mnWidthOnSplitterButtonDown = mpParentWindow->GetSizePixel().Width();
+ break;
+
+ case VCLEVENT_WINDOW_MOUSEBUTTONUP:
+ {
+ ProcessNewWidth(mpParentWindow->GetSizePixel().Width());
+ mnWidthOnSplitterButtonDown = 0;
+ break;
+ }
+
+ case SFX_HINT_DYING:
+ dispose();
+ break;
+ }
+ }
return sal_True;
}
@@ -691,16 +811,8 @@ void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) co
{
try
{
- util::URL aURL;
- aURL.Complete = rsMenuCommand;
-
- const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory());
- const Reference<util::XURLTransformer> xParser (
- aComponentContext.createComponent("com.sun.star.util.URLTransformer"),
- UNO_QUERY_THROW);
- xParser->parseStrict(aURL);
- Reference<frame::XDispatchProvider> xProvider (mxFrame, UNO_QUERY_THROW);
- Reference<frame::XDispatch> xDispatch (xProvider->queryDispatch(aURL, OUString(), 0));
+ const util::URL aURL (GetURL(rsMenuCommand));
+ Reference<frame::XDispatch> xDispatch (GetDispatch(aURL));
if (xDispatch.is())
xDispatch->dispatch(aURL, Sequence<beans::PropertyValue>());
}
@@ -714,6 +826,33 @@ void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) co
+util::URL SidebarController::GetURL (const ::rtl::OUString& rsCommand) const
+{
+ util::URL aURL;
+ aURL.Complete = rsCommand;
+
+ const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory());
+ const Reference<util::XURLTransformer> xParser (
+ aComponentContext.createComponent("com.sun.star.util.URLTransformer"),
+ UNO_QUERY_THROW);
+ xParser->parseStrict(aURL);
+
+ return aURL;
+}
+
+
+
+
+Reference<frame::XDispatch> SidebarController::GetDispatch (const util::URL& rURL) const
+{
+ Reference<frame::XDispatchProvider> xProvider (mxFrame, UNO_QUERY_THROW);
+ Reference<frame::XDispatch> xDispatch (xProvider->queryDispatch(rURL, OUString(), 0));
+ return xDispatch;
+}
+
+
+
+
::boost::shared_ptr<PopupMenu> SidebarController::CreatePopupMenu (
const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const
@@ -827,35 +966,54 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, Menu*, pMenu)
-void SidebarController::CloseDeck (void)
+void SidebarController::RequestCloseDeck (void)
{
- if ( ! mbIsDeckClosed)
- {
- mbIsDeckClosed = true;
- if ( ! mpParentWindow->IsFloatingMode())
- mnSavedSidebarWidth = SetChildWindowWidth(TabBar::GetDefaultWidth());
- mpParentWindow->SetStyle(mpParentWindow->GetStyle() & ~WB_SIZEABLE);
+ mbIsDeckRequestedOpen = false;
+ UpdateDeckOpenState();
+}
- if (mpCurrentDeck)
- mpCurrentDeck->Hide();
- NotifyResize();
- }
+
+
+void SidebarController::RequestOpenDeck (void)
+{
+ mbIsDeckRequestedOpen = true;
+ UpdateDeckOpenState();
}
-void SidebarController::OpenDeck (void)
+void SidebarController::UpdateDeckOpenState (void)
{
- if (mbIsDeckClosed)
- {
- mbIsDeckClosed = false;
- SetChildWindowWidth(mnSavedSidebarWidth);
+ if ( ! mbIsDeckRequestedOpen)
+ // No state requested.
+ return;
- if (mpCurrentDeck)
- mpCurrentDeck->Show();
+ // Update (change) the open state when it either has not yet been initialized
+ // or when its value differs from the requested state.
+ if ( ! mbIsDeckOpen
+ || mbIsDeckOpen.get() != mbIsDeckRequestedOpen.get())
+ {
+ if (mbIsDeckRequestedOpen.get())
+ {
+ if (mnSavedSidebarWidth <= TabBar::GetDefaultWidth())
+ SetChildWindowWidth(SidebarChildWindow::GetDefaultWidth(mpParentWindow));
+ else
+ SetChildWindowWidth(mnSavedSidebarWidth);
+ }
+ else
+ {
+ if ( ! mpParentWindow->IsFloatingMode())
+ mnSavedSidebarWidth = SetChildWindowWidth(TabBar::GetDefaultWidth());
+ if (mnWidthOnSplitterButtonDown > TabBar::GetDefaultWidth())
+ mnSavedSidebarWidth = mnWidthOnSplitterButtonDown;
+ mpParentWindow->SetStyle(mpParentWindow->GetStyle() & ~WB_SIZEABLE);
+ }
+ mbIsDeckOpen = mbIsDeckRequestedOpen.get();
+ if (mbIsDeckOpen.get() && mpCurrentDeck)
+ mpCurrentDeck->Show(mbIsDeckOpen.get());
NotifyResize();
}
}
@@ -871,13 +1029,11 @@ FocusManager& SidebarController::GetFocusManager (void)
-bool SidebarController::CanModifyChildWindowWidth (void) const
+bool SidebarController::CanModifyChildWindowWidth (void)
{
- SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
+ SfxSplitWindow* pSplitWindow = GetSplitWindow();
if (pSplitWindow == NULL)
- {
- return 0;
- }
+ return false;
sal_uInt16 nRow (0xffff);
sal_uInt16 nColumn (0xffff);
@@ -885,7 +1041,7 @@ bool SidebarController::CanModifyChildWindowWidth (void) const
sal_uInt16 nRowCount (pSplitWindow->GetWindowCount(nColumn));
- return nRowCount == 1;
+ return nRowCount==1;
}
@@ -893,7 +1049,7 @@ bool SidebarController::CanModifyChildWindowWidth (void) const
sal_Int32 SidebarController::SetChildWindowWidth (const sal_Int32 nNewWidth)
{
- SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
+ SfxSplitWindow* pSplitWindow = GetSplitWindow();
if (pSplitWindow == NULL)
return 0;
@@ -911,6 +1067,7 @@ sal_Int32 SidebarController::SetChildWindowWidth (const sal_Int32 nNewWidth)
Size(nNewWidth, aWindowSize.Height()),
nColumn,
nRow);
+ static_cast<SplitWindow*>(pSplitWindow)->Split();
return static_cast<sal_Int32>(nColumnWidth);
}
@@ -920,23 +1077,70 @@ sal_Int32 SidebarController::SetChildWindowWidth (const sal_Int32 nNewWidth)
void SidebarController::RestrictWidth (void)
{
- SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
+ SfxSplitWindow* pSplitWindow = GetSplitWindow();
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);
+ Range(TabBar::GetDefaultWidth(), gnMaximumSidebarWidth));
+ }
+}
+
+
+
+
+SfxSplitWindow* SidebarController::GetSplitWindow (void)
+{
+ if (mpSplitWindow == NULL)
+ {
+ if (mpParentWindow != NULL)
+ {
+ mpSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
+ if (mpSplitWindow != NULL)
+ mpSplitWindow->AddEventListener(LINK(this, SidebarController, WindowEventHandler));
+ }
+ }
+
+ return mpSplitWindow;
+}
+
+
+
+
+void SidebarController::UpdateCloseIndicator (const bool bCloseAfterDrag)
+{
+ if (mpParentWindow == NULL)
+ return;
+
+ if (bCloseAfterDrag)
+ {
+ // Make sure that the indicator exists.
+ if ( ! mpCloseIndicator)
+ {
+ mpCloseIndicator.reset(new FixedImage(mpParentWindow));
+ FixedImage* pFixedImage = static_cast<FixedImage*>(mpCloseIndicator.get());
+ const Image aImage (Theme::GetImage(Theme::Image_CloseIndicator));
+ pFixedImage->SetImage(aImage);
+ pFixedImage->SetSizePixel(aImage.GetSizePixel());
+ pFixedImage->SetBackground(Theme::GetWallpaper(Theme::Paint_DeckBackground));
+ }
+
+ // Place and show the indicator.
+ const Size aWindowSize (mpParentWindow->GetSizePixel());
+ const Size aImageSize (mpCloseIndicator->GetSizePixel());
+ mpCloseIndicator->SetPosPixel(
+ Point(
+ aWindowSize.Width() - TabBar::GetDefaultWidth() - aImageSize.Width(),
+ (aWindowSize.Height() - aImageSize.Height())/2));
+ mpCloseIndicator->Show();
+ }
+ else
+ {
+ // Hide but don't delete the indicator.
+ if (mpCloseIndicator)
+ mpCloseIndicator->Hide();
}
}
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index be5d04f1f5cc..5606f5c4c014 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -33,12 +33,14 @@
#include <com/sun/star/awt/XWindowPeer.hpp>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/frame/XDispatch.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/compbase3.hxx>
+#include <boost/optional.hpp>
+#include <cppuhelper/compbase4.hxx>
#include <cppuhelper/basemutex.hxx>
namespace css = ::com::sun::star;
@@ -47,13 +49,17 @@ namespace cssu = ::com::sun::star::uno;
namespace
{
- typedef ::cppu::WeakComponentImplHelper3 <
+ typedef ::cppu::WeakComponentImplHelper4 <
css::ui::XContextChangeEventListener,
css::beans::XPropertyChangeListener,
- css::ui::XSidebar
+ css::ui::XSidebar,
+ css::frame::XStatusListener
> SidebarControllerInterfaceBase;
}
+class SfxSplitWindow;
+class FixedBitmap;
+
namespace sfx2 { namespace sidebar {
class ContentPanelDescriptor;
@@ -86,6 +92,10 @@ public:
virtual void SAL_CALL propertyChange (const css::beans::PropertyChangeEvent& rEvent)
throw(cssu::RuntimeException);
+ // frame::XStatusListener
+ virtual void SAL_CALL statusChanged (const css::frame::FeatureStateEvent& rEvent)
+ throw(cssu::RuntimeException);
+
// ui::XSidebar
virtual void SAL_CALL requestLayout (void)
throw(cssu::RuntimeException);
@@ -94,14 +104,16 @@ public:
void SwitchToDeck (
const ::rtl::OUString& rsDeckId);
+ void OpenThenSwitchToDeck (
+ const ::rtl::OUString& rsDeckId);
/** Show only the tab bar, not the deck.
*/
- void CloseDeck (void);
+ void RequestCloseDeck (void);
/** Open the deck area and restore the parent window to its old width.
*/
- void OpenDeck (void);
+ void RequestOpenDeck (void);
FocusManager& GetFocusManager (void);
@@ -116,12 +128,36 @@ private:
::rtl::OUString msCurrentDeckTitle;
AsynchronousCall maPropertyChangeForwarder;
AsynchronousCall maContextChangeUpdate;
- bool mbIsDeckClosed;
+
+ /** Two flags control whether the deck is displayed or if only the
+ tab bar remains visible.
+ The mbIsDeckOpen flag stores the current state while
+ mbIsDeckRequestedOpen stores how this state should be. User
+ actions like clicking on the deck closer affect the
+ mbIsDeckRequestedOpen. Normally both flags have the same
+ value. A document being read-only can prevent the deck from opening.
+ */
+ ::boost::optional<bool> mbIsDeckRequestedOpen;
+ ::boost::optional<bool> mbIsDeckOpen;
+ bool mbCanDeckBeOpened;
+
/** 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;
FocusManager maFocusManager;
+ cssu::Reference<css::frame::XDispatch> mxReadOnlyModeDispatch;
+ bool mbIsDocumentReadOnly;
+ SfxSplitWindow* mpSplitWindow;
+ /** When the user moves the splitter then we remember the
+ width at that time.
+ */
+ sal_Int32 mnWidthOnSplitterButtonDown;
+ /** Control that is temporarily used as replacement for the deck
+ to indicate that when the current mouse drag operation ends, the
+ sidebar will only show the tab bar.
+ */
+ ::boost::scoped_ptr<Window> mpCloseIndicator;
DECL_LINK(WindowEventHandler, VclWindowEvent*);
/** Make maRequestedContext the current context.
@@ -145,6 +181,8 @@ private:
const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
void ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) const;
+ css::util::URL GetURL (const ::rtl::OUString& rsCommand) const;
+ cssu::Reference<css::frame::XDispatch> GetDispatch (const css::util::URL& rURL) const;
::boost::shared_ptr<PopupMenu> CreatePopupMenu (
const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
@@ -155,21 +193,25 @@ private:
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;
+ bool CanModifyChildWindowWidth (void);
/** Set the child window container to a new width.
Return the old width.
*/
sal_Int32 SetChildWindowWidth (const sal_Int32 nNewWidth);
- void RestrictWidth (void);
-
/** Update the icons displayed in the title bars of the deck and
the panels. This is called once when a deck is created and
every time when a data change event is processed.
*/
void UpdateTitleBarIcons (void);
+ void UpdateDeckOpenState (void);
+ void RestrictWidth (void);
+ SfxSplitWindow* GetSplitWindow (void);
+ void ProcessNewWidth (const sal_Int32 nNewWidth);
+ void UpdateCloseIndicator (const bool bIsIndicatorVisible);
+
virtual void SAL_CALL disposing (void);
};
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index cc6c20e0f1fa..9c8f6bc0782c 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -37,22 +37,22 @@ namespace sfx2 { namespace sidebar {
SidebarDockingWindow::SidebarDockingWindow(
- SfxBindings* pBindings,
+ SfxBindings* pSfxBindings,
SidebarChildWindow& rChildWindow,
- Window* pParent,
+ Window* pParentWindow,
WinBits nBits)
- : SfxDockingWindow(pBindings, &rChildWindow, pParent, nBits),
+ : SfxDockingWindow(pSfxBindings, &rChildWindow, pParentWindow, nBits),
mpSidebarController()
{
// Get the XFrame from the bindings.
- if (pBindings==NULL || pBindings->GetDispatcher()==NULL)
+ if (pSfxBindings==NULL || pSfxBindings->GetDispatcher()==NULL)
{
- OSL_ASSERT(pBindings!=NULL);
- OSL_ASSERT(pBindings->GetDispatcher()!=NULL);
+ OSL_ASSERT(pSfxBindings!=NULL);
+ OSL_ASSERT(pSfxBindings->GetDispatcher()!=NULL);
}
else
{
- const SfxViewFrame* pViewFrame = pBindings->GetDispatcher()->GetFrame();
+ const SfxViewFrame* pViewFrame = pSfxBindings->GetDispatcher()->GetFrame();
const SfxFrame& rFrame = pViewFrame->GetFrame();
mpSidebarController.set(new sfx2::sidebar::SidebarController(this, rFrame.GetFrameInterface()));
}
@@ -123,7 +123,7 @@ sal_Bool SidebarDockingWindow::Close (void)
{
// Do not close the floating window.
// Dock it and close just the deck instead.
- mpSidebarController->CloseDeck();
+ mpSidebarController->RequestCloseDeck();
SetFloatingMode(sal_False);
mpSidebarController->NotifyResize();
return sal_False;
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index a0f513855af1..83c3ec6f369c 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -110,7 +110,7 @@ sal_Int32 TabBar::GetDefaultWidth (void)
void TabBar::SetDecks (
- const ResourceManager::IdContainer& rDeckIds)
+ const ResourceManager::DeckContextDescriptorContainer& rDecks)
{
// Remove the current buttons.
{
@@ -124,15 +124,15 @@ void TabBar::SetDecks (
maItems.clear();
}
- maItems.resize(rDeckIds.size());
+ maItems.resize(rDecks.size());
sal_Int32 nIndex (0);
- for (ResourceManager::IdContainer::const_iterator
- iDeckId(rDeckIds.begin()),
- iEnd(rDeckIds.end());
- iDeckId!=iEnd;
- ++iDeckId)
+ for (ResourceManager::DeckContextDescriptorContainer::const_iterator
+ iDeck(rDecks.begin()),
+ iEnd(rDecks.end());
+ iDeck!=iEnd;
+ ++iDeck)
{
- const DeckDescriptor* pDescriptor = ResourceManager::Instance().GetDeckDescriptor(*iDeckId);
+ const DeckDescriptor* pDescriptor = ResourceManager::Instance().GetDeckDescriptor(iDeck->msId);
if (pDescriptor == NULL)
{
OSL_ASSERT(pDescriptor!=NULL);
@@ -146,6 +146,8 @@ void TabBar::SetDecks (
rItem.maDeckActivationFunctor = maDeckActivationFunctor;
rItem.mbIsHiddenByDefault = false;
rItem.mbIsHidden = ! pDescriptor->mbIsEnabled;
+
+ rItem.mpButton->Enable(iDeck->mbIsEnabled);
}
UpdateButtonIcons();
@@ -234,16 +236,24 @@ void TabBar::Layout (void)
void TabBar::HighlightDeck (const ::rtl::OUString& rsDeckId)
{
- for (ItemContainer::const_iterator iItem(maItems.begin()),iEnd(maItems.end());
+ Item* pItem = GetItemForId(rsDeckId);
+ if (pItem != NULL)
+ pItem->mpButton->Check();
+}
+
+
+
+
+TabBar::Item* TabBar::GetItemForId (const ::rtl::OUString& rsDeckId)
+{
+ for (ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
iItem!=iEnd;
++iItem)
{
if (iItem->msDeckId.equals(rsDeckId))
- {
- iItem->mpButton->Check();
- break;
- }
+ return &*iItem;
}
+ return NULL;
}
diff --git a/sfx2/source/sidebar/TabBar.hxx b/sfx2/source/sidebar/TabBar.hxx
index 53db790b0d4a..28684aca58ca 100644
--- a/sfx2/source/sidebar/TabBar.hxx
+++ b/sfx2/source/sidebar/TabBar.hxx
@@ -74,7 +74,7 @@ public:
static sal_Int32 GetDefaultWidth (void);
void SetDecks (
- const ResourceManager::IdContainer& rDeckIds);
+ const ResourceManager::DeckContextDescriptorContainer& rDecks);
void HighlightDeck (const ::rtl::OUString& rsDeckId);
void AddPopupMenuEntries (
PopupMenu& rMenu,
@@ -108,6 +108,7 @@ private:
PopupMenuProvider maPopupMenuProvider;
RadioButton* CreateTabItem (const DeckDescriptor& rDeckDescriptor);
+ Item* GetItemForId (const ::rtl::OUString& rsId);
Image GetItemImage (const DeckDescriptor& rDeskDescriptor) const;
void Layout (void);
void UpdateButtonIcons (void);
diff --git a/sfx2/source/sidebar/TabItem.cxx b/sfx2/source/sidebar/TabItem.cxx
index f60798f34720..9aa3faacc9d7 100644
--- a/sfx2/source/sidebar/TabItem.cxx
+++ b/sfx2/source/sidebar/TabItem.cxx
@@ -60,7 +60,6 @@ TabItem::~TabItem (void)
void TabItem::Paint (const Rectangle& rUpdateArea)
{
- OSL_TRACE("TabItem::Paint");
switch(mePaintType)
{
case PT_Theme:
@@ -88,12 +87,12 @@ void TabItem::Paint (const Rectangle& rUpdateArea)
(GetSizePixel().Height() - aIconSize.Height())/2);
DrawImage(
aIconLocation,
- aIcon);
+ aIcon,
+ IsEnabled() ? 0 : IMAGE_DRAW_DISABLE);
break;
}
case PT_Native:
Button::Paint(rUpdateArea);
- // DrawImage(maIconPosition, maIcon);
break;
}
}
diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx
index 7ff4d940ad45..d7f96e5aef4f 100644
--- a/sfx2/source/sidebar/Theme.cxx
+++ b/sfx2/source/sidebar/Theme.cxx
@@ -385,6 +385,12 @@ void Theme::UpdateTheme (void)
maPropertyIdToNameMap[Image_Closer],
Any(A2S("private:graphicrepository/sfx2/res/closedoc.png")));
setPropertyValue(
+ maPropertyIdToNameMap[Image_CloseIndicator],
+ Any(
+ mbIsHighContrastMode
+ ? A2S("private:graphicrepository/res/commandimagelist/lch_decrementlevel.png")
+ : A2S("private:graphicrepository/res/commandimagelist/lc_decrementlevel.png")));
+ setPropertyValue(
maPropertyIdToNameMap[Image_ToolBoxItemSeparator],
Any(
A2S("private:graphicrepository/sfx2/res/separator.png")));
@@ -801,6 +807,7 @@ void Theme::SetupPropertyMaps (void)
AddEntry(Image_PanelMenu);
AddEntry(Image_ToolBoxItemSeparator);
AddEntry(Image_Closer);
+ AddEntry(Image_CloseIndicator);
AddEntry(Color_DeckTitleFont);
AddEntry(Color_PanelTitleFont);
@@ -870,6 +877,7 @@ Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem)
case Image_PanelMenu:
case Image_ToolBoxItemSeparator:
case Image_Closer:
+ case Image_CloseIndicator:
return PT_Image;
case Color_DeckTitleFont: