summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Godard <lgodard.libre@laposte.net>2015-08-25 16:38:43 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2015-11-20 13:33:29 +0000
commit536c259cb9644971d0eb0cdfb7d823c5383a5481 (patch)
tree9f9fd6d655fe9ff492e0f5c317be4d75e21d9ea4
parentce6170dafe0159e2a1d689133c070b25fa39dd12 (diff)
tdf#67770 store sidebar elements states
deck & panel states at user registry level when disposing a sidebar if a shared deck (with "any" context application) is modified, it apply to all applications (eg. Gallery between calc and writer); TODO ? clean ResourceManager Get/Set const/non-const add panels when deck is created & refactoring * macro example Sub Main controller = thisComponent.currentcontroller sidebar = thisComponent.currentcontroller.getSidebar() sidebar.setVisible(true) decks = sidebar.getdecks() deck = decks.getByName("PropertyDeck") deck.activate(true) deck.setTitle("new deck title") deck.moveLast() panels = deck.getPanels() panel = panels.getByName("TextPropertyPanel") panel.setTitle("new panel title") panel.expand(true) ' expand and collapse other panel.moveLast() End Sub Change-Id: I2552000af92a366ebb51a479962a094b72e400b6 Reviewed-on: https://gerrit.libreoffice.org/17992 Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
-rw-r--r--include/sfx2/sidebar/ContextList.hxx2
-rw-r--r--include/sfx2/sidebar/Deck.hxx1
-rw-r--r--include/sfx2/sidebar/DeckDescriptor.hxx2
-rw-r--r--include/sfx2/sidebar/PanelDescriptor.hxx2
-rw-r--r--include/sfx2/sidebar/ResourceManager.hxx35
-rw-r--r--include/sfx2/sidebar/SidebarController.hxx6
-rw-r--r--sfx2/source/sidebar/ResourceManager.cxx252
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx229
-rw-r--r--sfx2/source/sidebar/TabBar.cxx14
-rw-r--r--sfx2/source/sidebar/UnoDeck.cxx62
-rw-r--r--sfx2/source/sidebar/UnoPanel.cxx64
11 files changed, 436 insertions, 233 deletions
diff --git a/include/sfx2/sidebar/ContextList.hxx b/include/sfx2/sidebar/ContextList.hxx
index 7ce63eec24c2..9c56d153f7c6 100644
--- a/include/sfx2/sidebar/ContextList.hxx
+++ b/include/sfx2/sidebar/ContextList.hxx
@@ -55,6 +55,8 @@ public:
const bool bIsInitiallyVisible,
const ::rtl::OUString& rsMenuCommand);
+ const ::std::vector<Entry>& GetEntries() const {return maEntries;};
+
private:
::std::vector<Entry> maEntries;
diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx
index 0057c721de00..aa13d4392049 100644
--- a/include/sfx2/sidebar/Deck.hxx
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -94,6 +94,7 @@ private:
DECL_LINK_TYPED(HandleVerticalScrollBarChange, ScrollBar*, void);
bool ProcessWheelEvent(CommandEvent* pCommandEvent);
+
};
} } // end of namespace sfx2::sidebar
diff --git a/include/sfx2/sidebar/DeckDescriptor.hxx b/include/sfx2/sidebar/DeckDescriptor.hxx
index f3e7cd6c41d2..8c1b9efb764c 100644
--- a/include/sfx2/sidebar/DeckDescriptor.hxx
+++ b/include/sfx2/sidebar/DeckDescriptor.hxx
@@ -42,6 +42,8 @@ public:
sal_Int32 mnOrderIndex;
bool mbExperimental;
+ OUString msNodeName; // some impress deck nodes names are different from their Id
+
VclPtr<Deck> mpDeck;
DeckDescriptor();
diff --git a/include/sfx2/sidebar/PanelDescriptor.hxx b/include/sfx2/sidebar/PanelDescriptor.hxx
index 1578bfd245cf..2e1abb2d445e 100644
--- a/include/sfx2/sidebar/PanelDescriptor.hxx
+++ b/include/sfx2/sidebar/PanelDescriptor.hxx
@@ -41,6 +41,8 @@ public:
bool mbWantsCanvas;
bool mbExperimental;
+ OUString msNodeName; // some impress panel nodes names are different from their Id
+
PanelDescriptor();
PanelDescriptor (const PanelDescriptor& rPanelDescriptor);
~PanelDescriptor();
diff --git a/include/sfx2/sidebar/ResourceManager.hxx b/include/sfx2/sidebar/ResourceManager.hxx
index bd69b9e62c4f..9a86bc02566d 100644
--- a/include/sfx2/sidebar/ResourceManager.hxx
+++ b/include/sfx2/sidebar/ResourceManager.hxx
@@ -43,30 +43,18 @@ public:
ResourceManager();
~ResourceManager();
- static ResourceManager& Instance();
-
const DeckDescriptor* GetDeckDescriptor(const OUString& rsDeckId) const;
- const PanelDescriptor* GetPanelDescriptor(const OUString& rsPanelId) const;
-
- /** Excluded or include a deck from being displayed in the tab
- bar.
- Note that this value is not persistent.
- The flag can not be set directly at a DeckDescriptor object
- because the ResourceManager gives access to them only
- read-only.
- */
- void SetIsDeckEnabled(const OUString& rsDeckId, const bool bIsEnabled);
-
- void SetDeckTitle(const OUString& rsDeckId, const OUString& sTitle);
-
- void SetDeckToDescriptor(const OUString& rsDeckId, VclPtr<Deck> aDeck);
+ DeckDescriptor* GetDeckDescriptor(const OUString& rsDeckId);
- void SetDeckOrderIndex(const OUString& rsDeckId, const sal_Int32 orderIndex);
-
- void SetPanelOrderIndex(const OUString& rsPanelId, const sal_Int32 orderIndex);
+ const PanelDescriptor* GetPanelDescriptor(const OUString& rsPanelId) const;
+ PanelDescriptor* GetPanelDescriptor(const OUString& rsPanelId);
void UpdateModel(css::uno::Reference<css::frame::XModel> xModel);
+ void InitDeckContext(const Context& rContex);
+ void SaveDecksSettings(const Context& rContext);
+ void SaveDeckSettings(const DeckDescriptor* pDeckDesc);
+
void disposeDecks();
class DeckContextDescriptor
@@ -100,7 +88,6 @@ public:
const css::uno::Reference<css::frame::XController>& rxController);
/** Remember the expansions state per panel and context.
- This is not persistent past application end.
*/
void StorePanelExpansionState(const OUString& rsPanelId,
const bool bExpansionState,
@@ -123,13 +110,19 @@ private:
static void ReadContextList(const utl::OConfigurationNode& rNode,
ContextList& rContextList,
const OUString& rsDefaultMenuCommand);
+
+ css::uno::Sequence<OUString> BuildContextList (ContextList rContextList, bool isDeckEnabled);
+
void ReadLegacyAddons(const css::uno::Reference<css::frame::XController>& rxController);
static utl::OConfigurationTreeRoot GetLegacyAddonRootNode(const OUString& rsModuleName);
static void GetToolPanelNodeNames(std::vector<OUString>& rMatchingNames,
const utl::OConfigurationTreeRoot& aRoot);
- static bool IsDeckEnabled(const OUString& rsDeckId,
+ bool IsDeckEnabled(const OUString& rsDeckId,
const Context& rContext,
const css::uno::Reference<css::frame::XController>& rxController);
+
+ const DeckDescriptor* ImplGetDeckDescriptor(const OUString& rsDeckId) const;
+ const PanelDescriptor* ImplGetPanelDescriptor(const OUString& rsPanelId) const;
};
} } // end of namespace sfx2::sidebar
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index f7cc1192c2b2..c077eeb3b87e 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -151,7 +151,8 @@ public:
void SwitchToDeck ( const ::rtl::OUString& rsDeckId);
void SwitchToDefaultDeck();
- void CreateDeck(const ::rtl::OUString& rDeckId);
+ void CreateDeck(const ::rtl::OUString& rDeckId, bool bForceCreate = false);
+ void CreatePanels(const ::rtl::OUString& rDeckId);
ResourceManager::DeckContextDescriptorContainer GetMatchingDecks();
ResourceManager::PanelContextDescriptorContainer GetMatchingPanels( const ::rtl::OUString& rDeckId);
@@ -223,7 +224,8 @@ private:
const ::rtl::OUString& rsPanelId,
vcl::Window* pParentWindow,
const bool bIsInitiallyExpanded,
- const Context& rContext);
+ const Context& rContext,
+ VclPtr<Deck> pDeck);
void SwitchToDeck (
const DeckDescriptor& rDeckDescriptor,
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index 43c2367495c1..7b639c4986be 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -56,12 +56,6 @@ bool getBool(utl::OConfigurationNode const & aNode, const char* pNodeName)
} //end anonymous namespace
-ResourceManager& ResourceManager::Instance()
-{
- static ResourceManager s_SidebarResourceManagerInstance;
- return s_SidebarResourceManagerInstance;
-}
-
ResourceManager::ResourceManager()
: maDecks(),
maPanels(),
@@ -76,104 +70,66 @@ ResourceManager::~ResourceManager()
{
}
-const DeckDescriptor* ResourceManager::GetDeckDescriptor(const OUString& rsDeckId) const
+void ResourceManager::InitDeckContext(const Context& rContext)
{
- DeckContainer::const_iterator iDeck;
+ DeckContainer::iterator iDeck;
for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
{
- if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
- continue;
- if (iDeck->msId.equals(rsDeckId))
- return &*iDeck;
- }
- return nullptr;
-}
+ bool bIsEnabled;
+ const ContextList::Entry* pMatchingEntry = iDeck->maContextList.GetMatch(rContext);
-const PanelDescriptor* ResourceManager::GetPanelDescriptor(const OUString& rsPanelId) const
-{
- PanelContainer::const_iterator iPanel;
- for (iPanel = maPanels.begin(); iPanel != maPanels.end(); ++iPanel)
- {
- if (iPanel->msId.equals(rsPanelId))
- return &*iPanel;
- }
- return nullptr;
-}
+ if (pMatchingEntry)
+ bIsEnabled = pMatchingEntry->mbIsInitiallyVisible;
+ else
+ bIsEnabled = false;
-void ResourceManager::SetIsDeckEnabled(const OUString& rsDeckId, const bool bIsEnabled)
-{
- DeckContainer::iterator iDeck;
- for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
- {
- if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
- continue;
- if (iDeck->msId.equals(rsDeckId))
- {
- iDeck->mbIsEnabled = bIsEnabled;
- return;
- }
+ iDeck->mbIsEnabled = bIsEnabled;
}
}
-void ResourceManager::SetDeckTitle(const OUString& rsDeckId, const OUString& sTitle)
+const DeckDescriptor* ResourceManager::ImplGetDeckDescriptor(const OUString& rsDeckId) const
{
- DeckContainer::iterator iDeck;
+ DeckContainer::const_iterator iDeck;
+
for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
{
if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
continue;
if (iDeck->msId.equals(rsDeckId))
- {
- iDeck->msTitle = sTitle;
- iDeck->msHelpText = sTitle;
- return;
- }
+ return &*iDeck;
}
+ return NULL;
}
-
-void ResourceManager::SetDeckToDescriptor(const OUString& rsDeckId, VclPtr<Deck> aDeck)
+const DeckDescriptor* ResourceManager::GetDeckDescriptor(const OUString& rsDeckId) const
{
- DeckContainer::iterator iDeck;
- for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
- {
- if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
- continue;
- if (iDeck->msId.equals(rsDeckId))
- {
- iDeck->mpDeck = aDeck;
- return;
- }
- }
+ return ImplGetDeckDescriptor( rsDeckId );
}
-void ResourceManager::SetDeckOrderIndex(const OUString& rsDeckId, const sal_Int32 orderIndex)
+DeckDescriptor* ResourceManager::GetDeckDescriptor(const OUString& rsDeckId)
{
- DeckContainer::iterator iDeck;
- for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
- {
- if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
- continue;
- if (iDeck->msId.equals(rsDeckId))
- {
- iDeck->mnOrderIndex = orderIndex;
- return;
- }
- }
+ const ResourceManager* constMe = this;
+ return const_cast<DeckDescriptor*>( constMe->ImplGetDeckDescriptor(rsDeckId) );
}
-void ResourceManager::SetPanelOrderIndex(const OUString& rsPanelId, const sal_Int32 orderIndex)
+const PanelDescriptor* ResourceManager::ImplGetPanelDescriptor(const OUString& rsPanelId) const
{
- PanelContainer::iterator iPanel;
+ PanelContainer::const_iterator iPanel;
for (iPanel = maPanels.begin(); iPanel != maPanels.end(); ++iPanel)
{
- if (iPanel->mbExperimental && !maMiscOptions.IsExperimentalMode())
- continue;
if (iPanel->msId.equals(rsPanelId))
- {
- iPanel->mnOrderIndex = orderIndex;
- return;
- }
+ return &*iPanel;
}
+ return NULL;
+}
+const PanelDescriptor* ResourceManager::GetPanelDescriptor(const OUString& rsPanelId) const
+{
+ return ImplGetPanelDescriptor( rsPanelId );
+}
+
+PanelDescriptor* ResourceManager::GetPanelDescriptor(const OUString& rsPanelId)
+{
+ const ResourceManager* constMe = this;
+ return const_cast<PanelDescriptor*>( constMe->ImplGetPanelDescriptor(rsPanelId) );
}
const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatchingDecks (
@@ -190,14 +146,18 @@ const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatch
{
if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
continue;
+
const DeckDescriptor& rDeckDescriptor (*iDeck);
if (rDeckDescriptor.maContextList.GetMatch(rContext) == nullptr)
continue;
+
DeckContextDescriptor aDeckContextDescriptor;
aDeckContextDescriptor.msId = rDeckDescriptor.msId;
- aDeckContextDescriptor.mbIsEnabled =
- ! bIsDocumentReadOnly
- || IsDeckEnabled(rDeckDescriptor.msId, rContext, rxController);
+
+ aDeckContextDescriptor.mbIsEnabled = (! bIsDocumentReadOnly || IsDeckEnabled(rDeckDescriptor.msId, rContext, rxController) )
+ && rDeckDescriptor.mbIsEnabled;
+
+
aOrderedIds.insert(::std::multimap<sal_Int32,DeckContextDescriptor>::value_type(
rDeckDescriptor.mnOrderIndex,
aDeckContextDescriptor));
@@ -282,14 +242,17 @@ void ResourceManager::ReadDeckList()
rDeckDescriptor.msHighContrastTitleBarIconURL = getString(aDeckNode, "HighContrastTitleBarIconURL");
rDeckDescriptor.msHelpURL = getString(aDeckNode, "HelpURL");
rDeckDescriptor.msHelpText = rDeckDescriptor.msTitle;
- rDeckDescriptor.mbIsEnabled = true;
+ // rDeckDescriptor.mbIsEnabled = true; // TODO ??? update rDeckDescriptor.mbIsEnabled according to context , see IsDeckEnabled ?
rDeckDescriptor.mnOrderIndex = getInt32(aDeckNode, "OrderIndex");
rDeckDescriptor.mbExperimental = getBool(aDeckNode, "IsExperimental");
+ rDeckDescriptor.msNodeName = aDeckNodeNames[nReadIndex];
+
ReadContextList(
aDeckNode,
rDeckDescriptor.maContextList,
OUString());
+
}
// When there where invalid nodes then we have to adapt the size
@@ -298,6 +261,81 @@ void ResourceManager::ReadDeckList()
maDecks.resize(nWriteIndex);
}
+void ResourceManager::SaveDecksSettings(const Context& rContext)
+{
+
+ DeckContainer::const_iterator iDeck;
+ for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
+ {
+ const ContextList::Entry* pMatchingEntry = iDeck->maContextList.GetMatch(rContext);
+ if (pMatchingEntry)
+ {
+ const DeckDescriptor* pDeckDesc = GetDeckDescriptor(iDeck->msId);
+ if (pDeckDesc)
+ SaveDeckSettings(pDeckDesc);
+ }
+
+ }
+}
+
+void ResourceManager::SaveDeckSettings(const DeckDescriptor* pDeckDesc)
+{
+ const utl::OConfigurationTreeRoot aDeckRootNode(
+ comphelper::getProcessComponentContext(),
+ OUString("org.openoffice.Office.UI.Sidebar/Content/DeckList"),
+ true);
+ if (!aDeckRootNode.isValid())
+ return;
+
+ // save deck settings
+
+ ::uno::Sequence< OUString > sContextList = BuildContextList(pDeckDesc->maContextList, pDeckDesc->mbIsEnabled);
+
+ utl::OConfigurationNode aDeckNode (aDeckRootNode.openNode(pDeckDesc->msNodeName));
+
+ aDeckNode.setNodeValue("Title", makeAny(pDeckDesc->msTitle));
+ aDeckNode.setNodeValue("OrderIndex", makeAny(pDeckDesc->mnOrderIndex));
+ aDeckNode.setNodeValue("ContextList", makeAny( sContextList ));
+
+ aDeckRootNode.commit();
+
+ // save panel settings
+
+ const utl::OConfigurationTreeRoot aPanelRootNode(
+ comphelper::getProcessComponentContext(),
+ OUString("org.openoffice.Office.UI.Sidebar/Content/PanelList"),
+ true);
+
+ if (!aPanelRootNode.isValid())
+ return;
+
+ if (!pDeckDesc->mpDeck) // the deck has not been edited
+ return;
+
+ SharedPanelContainer rPanels = pDeckDesc->mpDeck->GetPanels();
+
+ for ( SharedPanelContainer::iterator iPanel(rPanels.begin()), iEnd(rPanels.end());
+ iPanel!=iEnd; ++iPanel)
+ {
+ Panel* aPanel = *iPanel;
+ OUString panelId = aPanel->GetId();
+ bool isExpanded = aPanel->IsExpanded();
+ const PanelDescriptor* pPanelDesc = GetPanelDescriptor(panelId);
+
+ ::uno::Sequence< OUString > sPanelContextList = BuildContextList(pPanelDesc->maContextList, isExpanded);
+
+ utl::OConfigurationNode aPanelNode (aPanelRootNode.openNode(pPanelDesc->msNodeName));
+
+ aPanelNode.setNodeValue("Title", makeAny(pPanelDesc->msTitle));
+ aPanelNode.setNodeValue("OrderIndex", makeAny(pPanelDesc->mnOrderIndex));
+ aPanelNode.setNodeValue("ContextList", makeAny( sPanelContextList ));
+
+ }
+
+ aPanelRootNode.commit();
+
+}
+
void ResourceManager::ReadPanelList()
{
const utl::OConfigurationTreeRoot aPanelRootNode(
@@ -333,6 +371,8 @@ void ResourceManager::ReadPanelList()
rPanelDescriptor.mbExperimental = getBool(aPanelNode, "IsExperimental");
const OUString sDefaultMenuCommand(getString(aPanelNode, "DefaultMenuCommand"));
+ rPanelDescriptor.msNodeName = aPanelNodeNames[nReadIndex];
+
ReadContextList(aPanelNode, rPanelDescriptor.maContextList, sDefaultMenuCommand);
}
@@ -342,6 +382,40 @@ void ResourceManager::ReadPanelList()
maPanels.resize(nWriteIndex);
}
+css::uno::Sequence<OUString> ResourceManager::BuildContextList (ContextList rContextList, bool isEnabled)
+{
+ const ::std::vector<ContextList::Entry>& entries = rContextList.GetEntries();
+
+ css::uno::Sequence<OUString> result(entries.size());
+ long i = 0;
+
+ for (::std::vector<ContextList::Entry>::const_iterator iEntry(entries.begin()), iEnd(entries.end());
+ iEntry!=iEnd; ++iEntry)
+ {
+ OUString appName = iEntry->maContext.msApplication;
+ OUString contextName = iEntry->maContext.msContext;
+ OUString menuCommand = iEntry->msMenuCommand;
+
+ OUString visibility;
+ if (isEnabled)
+ visibility = "visible";
+ else
+ visibility = "hidden";
+
+ OUString element = appName + ", " + contextName +", " + visibility;
+
+ if (menuCommand != "")
+ element += ", "+menuCommand;
+
+ result[i] = element;
+
+ i++;
+ }
+
+ return result;
+
+}
+
void ResourceManager::ReadContextList (
const utl::OConfigurationNode& rParentNode,
ContextList& rContextList,
@@ -358,6 +432,7 @@ void ResourceManager::ReadContextList (
for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
{
const OUString sValue (aValues[nIndex]);
+
sal_Int32 nCharacterIndex (0);
const OUString sApplicationName (sValue.getToken(0, ',', nCharacterIndex).trim());
if (nCharacterIndex < 0)
@@ -404,6 +479,7 @@ void ResourceManager::ReadContextList (
// for Impress).
std::vector<EnumContext::Application> aApplications;
EnumContext::Application eApplication (EnumContext::GetApplicationEnum(sApplicationName));
+
if (eApplication == EnumContext::Application_None
&& !sApplicationName.equals(EnumContext::GetApplicationName(EnumContext::Application_None)))
{
@@ -471,6 +547,7 @@ void ResourceManager::ReadContextList (
continue;
}
+
// Add context descriptors.
std::vector<EnumContext::Application>::const_iterator iApplication;
for (iApplication = aApplications.begin(); iApplication != aApplications.end(); ++iApplication)
@@ -630,20 +707,19 @@ bool ResourceManager::IsDeckEnabled (
const Context& rContext,
const Reference<frame::XController>& rxController)
{
+
// Check if any panel that matches the current context can be
// displayed.
- ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors;
+ PanelContextDescriptorContainer aPanelContextDescriptors;
- ResourceManager::Instance().GetMatchingPanels(aPanelContextDescriptors,
- rContext, rsDeckId, rxController);
+ GetMatchingPanels(aPanelContextDescriptors, rContext, rsDeckId, rxController);
- ResourceManager::PanelContextDescriptorContainer::const_iterator iPanel;
+ PanelContextDescriptorContainer::const_iterator iPanel;
for (iPanel = aPanelContextDescriptors.begin(); iPanel != aPanelContextDescriptors.end(); ++iPanel)
{
if (iPanel->mbShowForReadOnlyDocuments)
return true;
}
-
return false;
}
@@ -656,11 +732,11 @@ void ResourceManager::UpdateModel(css::uno::Reference<css::frame::XModel> xModel
const SharedPanelContainer& rContainer = itr->mpDeck->GetPanels();
- for (SharedPanelContainer::const_iterator it = rContainer.begin(); it != rContainer.end(); ++it) {
+ for (SharedPanelContainer::const_iterator it = rContainer.begin(); it != rContainer.end(); ++it)
+ {
css::uno::Reference<css::ui::XUpdateModel> xPanel((*it)->GetPanelComponent(), css::uno::UNO_QUERY);
xPanel->updateModel(xModel);
}
-
}
}
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 8cd077f58585..9fcb82b66758 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -198,6 +198,34 @@ void SAL_CALL SidebarController::disposing()
maFocusManager.Clear();
mpTabBar.disposeAndClear();
+ // save decks settings
+ // Impress shutdown : context (frame) is disposed before sidebar disposing
+ // calc writer : context (frame) is disposed after sidebar disposing
+ // so need to test if GetCurrentContext is still valid regarding msApplication
+
+ if (GetCurrentContext().msApplication != "none")
+ mpResourceManager->SaveDecksSettings(GetCurrentContext());
+
+ // clear decks
+ ResourceManager::DeckContextDescriptorContainer aDecks;
+
+ mpResourceManager->GetMatchingDecks (
+ aDecks,
+ GetCurrentContext(),
+ IsDocumentReadOnly(),
+ mxFrame->getController());
+
+ for (ResourceManager::DeckContextDescriptorContainer::const_iterator
+ iDeck(aDecks.begin()), iEnd(aDecks.end());
+ iDeck!=iEnd; ++iDeck)
+ {
+ const DeckDescriptor* deckDesc = mpResourceManager->GetDeckDescriptor(iDeck->msId);
+
+ VclPtr<Deck> aDeck = deckDesc->mpDeck;
+ if (aDeck)
+ aDeck.disposeAndClear();
+ }
+
uno::Reference<css::frame::XController> xController = mxFrame->getController();
if (!xController.is())
xController = mxCurrentController;
@@ -233,9 +261,11 @@ void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::Contex
// Update to the requested new context asynchronously to avoid
// subtle errors caused by SFX2 which in rare cases can not
// properly handle a synchronous update.
+
maRequestedContext = Context(
rEvent.ApplicationName,
rEvent.ContextName);
+
if (maRequestedContext != maCurrentContext)
{
mxCurrentController.set(rEvent.Source, css::uno::UNO_QUERY);
@@ -272,6 +302,7 @@ void SAL_CALL SidebarController::statusChanged (const css::frame::FeatureStateEv
// Force the current deck to update its panel list.
if ( ! mbIsDocumentReadOnly)
msCurrentDeckId = gsDefaultDeckId;
+
mnRequestedForceFlags |= SwitchFlag_ForceSwitch;
maAsynchronousDeckSwitch.CancelRequest();
maContextChangeUpdate.RequestCall();
@@ -401,11 +432,18 @@ void SidebarController::ProcessNewWidth (const sal_Int32 nNewWidth)
void SidebarController::UpdateConfigurations()
{
+
if (maCurrentContext != maRequestedContext
|| mnRequestedForceFlags!=SwitchFlag_NoForce)
{
+
+ if (maCurrentContext.msApplication != "none")
+ mpResourceManager->SaveDecksSettings(maCurrentContext);
+
maCurrentContext = maRequestedContext;
+ mpResourceManager->InitDeckContext(GetCurrentContext());
+
// Find the set of decks that could be displayed for the new context.
ResourceManager::DeckContextDescriptorContainer aDecks;
@@ -507,22 +545,93 @@ void SidebarController::SwitchToDeck (
}
-void SidebarController::CreateDeck(const ::rtl::OUString& rDeckId)
+void SidebarController::CreateDeck(const ::rtl::OUString& rDeckId, bool bForceCreate)
{
- const DeckDescriptor* pDeckDescriptor = mpResourceManager->GetDeckDescriptor(rDeckId);
+ DeckDescriptor* pDeckDescriptor = mpResourceManager->GetDeckDescriptor(rDeckId);
- if (pDeckDescriptor->mpDeck.get()==nullptr)
+ if (pDeckDescriptor)
{
- VclPtr<Deck> aDeck = VclPtr<Deck>::Create(
- *pDeckDescriptor,
- mpParentWindow,
- [this]() { return this->RequestCloseDeck(); });
+ VclPtr<Deck> aDeck = pDeckDescriptor->mpDeck;
+ if (aDeck.get()==nullptr || bForceCreate)
+ {
+ if (aDeck.get()!=nullptr)
+ aDeck.disposeAndClear();
- mpResourceManager->SetDeckToDescriptor(rDeckId, aDeck);
+ aDeck = VclPtr<Deck>::Create(
+ *pDeckDescriptor,
+ mpParentWindow,
+ [this]() { return this->RequestCloseDeck(); });
+ }
+ pDeckDescriptor->mpDeck = aDeck;
+ CreatePanels(rDeckId);
}
-
}
+void SidebarController::CreatePanels(const ::rtl::OUString& rDeckId)
+{
+ DeckDescriptor* pDeckDescriptor = mpResourceManager->GetDeckDescriptor(rDeckId);
+
+ // init panels bounded to that deck, do not wait them being displayed as may be accessed through API
+
+ VclPtr<Deck> pDeck = pDeckDescriptor->mpDeck;
+
+ ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors;
+
+ css::uno::Reference<css::frame::XController> xController = mxCurrentController.is() ? mxCurrentController : mxFrame->getController();
+
+ mpResourceManager->GetMatchingPanels(
+ aPanelContextDescriptors,
+ maCurrentContext,
+ rDeckId,
+ xController);
+
+ // Update the panel list.
+ const sal_Int32 nNewPanelCount (aPanelContextDescriptors.size());
+ SharedPanelContainer aNewPanels;
+
+ aNewPanels.resize(nNewPanelCount);
+ sal_Int32 nWriteIndex (0);
+
+ for (sal_Int32 nReadIndex=0; nReadIndex<nNewPanelCount; ++nReadIndex)
+ {
+ const ResourceManager::PanelContextDescriptor& rPanelContexDescriptor (
+ aPanelContextDescriptors[nReadIndex]);
+
+ // Determine if the panel can be displayed.
+ const bool bIsPanelVisible (!mbIsDocumentReadOnly || rPanelContexDescriptor.mbShowForReadOnlyDocuments);
+ if ( ! bIsPanelVisible)
+ continue;
+
+ VclPtr<Panel> aPanel = CreatePanel(
+ rPanelContexDescriptor.msId,
+ pDeck->GetPanelParentWindow(),
+ rPanelContexDescriptor.mbIsInitiallyVisible,
+ maCurrentContext,
+ pDeck);
+ if (aPanel.get()!=nullptr )
+ {
+ aNewPanels[nWriteIndex] = aPanel;
+
+ // Depending on the context we have to change the command
+ // for the "more options" dialog.
+ PanelTitleBar* pTitleBar = aNewPanels[nWriteIndex]->GetTitleBar();
+ if (pTitleBar != NULL)
+ {
+ pTitleBar->SetMoreOptionsCommand(
+ rPanelContexDescriptor.msMenuCommand,
+ mxFrame, xController);
+ }
+ ++nWriteIndex;
+ }
+
+ }
+
+ // mpCurrentPanels - may miss stuff (?)
+ aNewPanels.resize(nWriteIndex);
+ pDeck->ResetPanels(aNewPanels);
+
+ pDeckDescriptor->mpDeck = pDeck;
+}
void SidebarController::SwitchToDeck (
const DeckDescriptor& rDeckDescriptor,
@@ -578,7 +687,11 @@ void SidebarController::SwitchToDeck (
// Provide a configuration and Deck object.
- CreateDeck(rDeckDescriptor.msId);
+ CreateDeck(rDeckDescriptor.msId, bForceNewDeck);
+
+ if (bForceNewPanels && !bForceNewDeck) // already forced if bForceNewDeck
+ CreatePanels(rDeckDescriptor.msId);
+
mpCurrentDeck.reset(rDeckDescriptor.mpDeck);
if ( ! mpCurrentDeck)
@@ -591,79 +704,6 @@ void SidebarController::SwitchToDeck (
pDebugTitleBar->SetTitle(rDeckDescriptor.msTitle + " (" + maCurrentContext.msContext + ")");
#endif
-
- // Update the panel list.
- const sal_Int32 nNewPanelCount (aPanelContextDescriptors.size());
- SharedPanelContainer aNewPanels;
- const SharedPanelContainer& rCurrentPanels (mpCurrentDeck->GetPanels());
-
- aNewPanels.resize(nNewPanelCount);
- sal_Int32 nWriteIndex (0);
- bool bHasPanelSetChanged (false);
- for (sal_Int32 nReadIndex=0; nReadIndex<nNewPanelCount; ++nReadIndex)
- {
- 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 = rCurrentPanels.end();
-
- if (!bForceNewPanels)
- {
- iPanel = rCurrentPanels.end();
- for (auto a = rCurrentPanels.begin(); a != rCurrentPanels.end(); ++a)
- {
- if ((*a)->HasIdPredicate(rPanelContexDescriptor.msId))
- {
- iPanel = a;
- break;
- }
- }
- }
- if (iPanel != rCurrentPanels.end())
- {
- // Panel already exists in current deck. Reuse it.
- aNewPanels[nWriteIndex] = *iPanel;
- aNewPanels[nWriteIndex]->SetExpanded(rPanelContexDescriptor.mbIsInitiallyVisible);
- }
- else
- {
- // Panel does not yet exist or creation of new panels is forced.
- // Create it.
- aNewPanels[nWriteIndex] = CreatePanel(
- rPanelContexDescriptor.msId,
- mpCurrentDeck->GetPanelParentWindow(),
- rPanelContexDescriptor.mbIsInitiallyVisible,
- rContext);
- bHasPanelSetChanged = true;
- }
-
- if (aNewPanels[nWriteIndex] != nullptr)
- {
- // Depending on the context we have to change the command
- // for the "more options" dialog.
- PanelTitleBar* pTitleBar = aNewPanels[nWriteIndex]->GetTitleBar();
- if (pTitleBar != nullptr)
- {
- pTitleBar->SetMoreOptionsCommand(
- rPanelContexDescriptor.msMenuCommand,
- mxFrame, xController);
- }
-
- ++nWriteIndex;
- }
-
- }
- // mpCurrentPanels - may miss stuff (?)
- aNewPanels.resize(nWriteIndex);
-
-
SfxSplitWindow* pSplitWindow = GetSplitWindow();
sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor();
WindowAlign eAlign = pSplitWindow ? pSplitWindow->GetAlign() : WindowAlign::Right;
@@ -685,13 +725,11 @@ void SidebarController::SwitchToDeck (
mpParentWindow->GetSizePixel().Width() - nTabBarDefaultWidth,
mpParentWindow->GetSizePixel().Height());
- mpCurrentDeck->ResetPanels(aNewPanels);
mpCurrentDeck->Show();
mpParentWindow->SetText(rDeckDescriptor.msTitle);
- if (bHasPanelSetChanged)
- NotifyResize();
+ NotifyResize();
// Tell the focus manager about the new panels and tab bar
// buttons.
@@ -716,7 +754,8 @@ VclPtr<Panel> SidebarController::CreatePanel (
const OUString& rsPanelId,
vcl::Window* pParentWindow,
const bool bIsInitiallyExpanded,
- const Context& rContext)
+ const Context& rContext,
+ VclPtr<Deck> pDeck)
{
const PanelDescriptor* pPanelDescriptor = mpResourceManager->GetPanelDescriptor(rsPanelId);
@@ -728,7 +767,7 @@ VclPtr<Panel> SidebarController::CreatePanel (
*pPanelDescriptor,
pParentWindow,
bIsInitiallyExpanded,
- [this]() { return mpCurrentDeck.get()->RequestLayout(); },
+ [pDeck]() { return pDeck.get()->RequestLayout(); },
[this]() { return this->GetCurrentContext(); },
mxFrame);
@@ -915,7 +954,7 @@ std::shared_ptr<PopupMenu> SidebarController::CreatePopupMenu (
else
{
pCustomizationMenu->InsertItem(nSubMenuIndex, iItem->msDisplayName, MenuItemBits::CHECKABLE);
- pCustomizationMenu->CheckItem(nSubMenuIndex, iItem->mbIsActive);
+ pCustomizationMenu->CheckItem(nSubMenuIndex, iItem->mbIsEnabled && iItem->mbIsActive);
}
}
@@ -982,7 +1021,19 @@ IMPL_LINK_TYPED(SidebarController, OnMenuItemSelected, Menu*, pMenu, bool)
}
else if (nIndex >=MID_FIRST_HIDE)
if (pMenu->GetItemBits(nIndex) == MenuItemBits::CHECKABLE)
+ {
mpTabBar->ToggleHideFlag(nIndex-MID_FIRST_HIDE);
+
+ // Find the set of decks that could be displayed for the new context.
+ ResourceManager::DeckContextDescriptorContainer aDecks;
+ mpResourceManager->GetMatchingDecks (
+ aDecks,
+ GetCurrentContext(),
+ IsDocumentReadOnly(),
+ mxFrame->getController());
+ // Notify the tab bar about the updated set of decks.
+ mpTabBar->SetDecks(aDecks);
+ }
}
catch (RuntimeException&)
{
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 9e31bb8315f7..0c993175f55d 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -132,8 +132,8 @@ void TabBar::SetDecks(const ResourceManager::DeckContextDescriptorContainer& rDe
rItem.mpButton = CreateTabItem(*pDescriptor);
rItem.mpButton->SetClickHdl(LINK(&rItem, TabBar::Item, HandleClick));
rItem.maDeckActivationFunctor = maDeckActivationFunctor;
- rItem.mbIsHiddenByDefault = false;
rItem.mbIsHidden = ! pDescriptor->mbIsEnabled;
+ rItem.mbIsHiddenByDefault = rItem.mbIsHidden; // the default is the state while creating
rItem.mpButton->Enable(iDeck->mbIsEnabled);
}
@@ -335,9 +335,10 @@ void TabBar::ToggleHideFlag (const sal_Int32 nIndex)
{
maItems[nIndex].mbIsHidden = ! maItems[nIndex].mbIsHidden;
- pParentSidebarController->GetResourceManager()->SetIsDeckEnabled(
- maItems[nIndex].msDeckId,
- maItems[nIndex].mbIsHidden);
+ DeckDescriptor* pDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(maItems[nIndex].msDeckId);
+ if (pDeckDescriptor)
+ pDeckDescriptor->mbIsEnabled = ! maItems[nIndex].mbIsHidden;
+
Layout();
}
}
@@ -351,6 +352,11 @@ void TabBar::RestoreHideFlags()
{
iItem->mbIsHidden = iItem->mbIsHiddenByDefault;
bNeedsLayout = true;
+
+ DeckDescriptor* pDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iItem->msDeckId);
+ if (pDeckDescriptor)
+ pDeckDescriptor->mbIsEnabled = ! iItem->mbIsHidden;
+
}
}
if (bNeedsLayout)
diff --git a/sfx2/source/sidebar/UnoDeck.cxx b/sfx2/source/sidebar/UnoDeck.cxx
index 094fa8a54261..9305d449ed77 100644
--- a/sfx2/source/sidebar/UnoDeck.cxx
+++ b/sfx2/source/sidebar/UnoDeck.cxx
@@ -67,15 +67,19 @@ void SAL_CALL SfxUnoDeck::setTitle( const OUString& newTitle )
SidebarController* pSidebarController = getSidebarController();
pSidebarController->CreateDeck(mDeckId);
- Deck* pDeck = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mpDeck;
+ DeckDescriptor* pDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
- DeckTitleBar* pTitleBar = pDeck->GetTitleBar();
- pTitleBar->SetTitle(newTitle);
+ if (pDeckDescriptor)
+ {
+ Deck* pDeck = pDeckDescriptor->mpDeck;
+ DeckTitleBar* pTitleBar = pDeck->GetTitleBar();
+ pTitleBar->SetTitle(newTitle);
- // update the ResourceManager
- pSidebarController->GetResourceManager()->SetDeckTitle(mDeckId, newTitle);
- pSidebarController->notifyDeckTitle(mDeckId);
+ pDeckDescriptor->msTitle = newTitle;
+ pDeckDescriptor->msHelpText = newTitle;
+ pSidebarController->notifyDeckTitle(mDeckId);
+ }
}
sal_Bool SAL_CALL SfxUnoDeck::isActive()
@@ -129,10 +133,14 @@ void SAL_CALL SfxUnoDeck::setOrderIndex( const sal_Int32 newOrderIndex )
SolarMutexGuard aGuard;
SidebarController* pSidebarController = getSidebarController();
- pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, newOrderIndex);
+ DeckDescriptor* pDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
- // update the sidebar
- pSidebarController->NotifyResize();
+ if (pDeckDescriptor)
+ {
+ pDeckDescriptor->mnOrderIndex = newOrderIndex;
+ // update the sidebar
+ pSidebarController->NotifyResize();
+ }
}
void SAL_CALL SfxUnoDeck::moveFirst()
@@ -149,8 +157,13 @@ void SAL_CALL SfxUnoDeck::moveFirst()
if (curOrderIndex != minIndex) // is deck already in place ?
{
minIndex -= 1;
- pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, minIndex);
- pSidebarController->NotifyResize();
+ DeckDescriptor* pDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
+ if (pDeckDescriptor)
+ {
+ pDeckDescriptor->mnOrderIndex = minIndex;
+ // update the sidebar
+ pSidebarController->NotifyResize();
+ }
}
}
@@ -168,8 +181,13 @@ void SAL_CALL SfxUnoDeck::moveLast()
if (curOrderIndex != maxIndex) // is deck already in place ?
{
maxIndex += 1;
- pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, maxIndex);
- pSidebarController->NotifyResize();
+ DeckDescriptor* pDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
+ if (pDeckDescriptor)
+ {
+ pDeckDescriptor->mnOrderIndex = maxIndex;
+ // update the sidebar
+ pSidebarController->NotifyResize();
+ }
}
}
@@ -196,8 +214,13 @@ void SAL_CALL SfxUnoDeck::moveUp()
if (curOrderIndex != previousIndex) // is deck already in place ?
{
previousIndex -= 1;
- pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, previousIndex);
- pSidebarController->NotifyResize();
+ DeckDescriptor* pDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
+ if (pDeckDescriptor)
+ {
+ pDeckDescriptor->mnOrderIndex = previousIndex;
+ // update the sidebar
+ pSidebarController->NotifyResize();
+ }
}
}
@@ -225,8 +248,13 @@ void SAL_CALL SfxUnoDeck::moveDown()
if (curOrderIndex != nextIndex) // is deck already in place ?
{
nextIndex += 1;
- pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, nextIndex);
- pSidebarController->NotifyResize();
+ DeckDescriptor* pDeckDescriptor = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId);
+ if (pDeckDescriptor)
+ {
+ pDeckDescriptor->mnOrderIndex = nextIndex;
+ // update the sidebar
+ pSidebarController->NotifyResize();
+ }
}
}
diff --git a/sfx2/source/sidebar/UnoPanel.cxx b/sfx2/source/sidebar/UnoPanel.cxx
index e52bb27ec5c4..820515f9b8ef 100644
--- a/sfx2/source/sidebar/UnoPanel.cxx
+++ b/sfx2/source/sidebar/UnoPanel.cxx
@@ -31,9 +31,11 @@ mpPanel()
{
SidebarController* pSidebarController = getSidebarController();
+ pSidebarController->CreateDeck(mDeckId); // creates deck object is not already
mpDeck = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mpDeck;
mpPanel = mpDeck->GetPanel(mPanelId);
}
+
SidebarController* SfxUnoPanel::getSidebarController()
{
return SidebarController::GetSidebarControllerForFrame(xFrame);
@@ -61,8 +63,16 @@ void SAL_CALL SfxUnoPanel::setTitle( const OUString& newTitle )
{
SolarMutexGuard aGuard;
- PanelTitleBar* pTitleBar = mpPanel->GetTitleBar();
- pTitleBar->SetTitle(newTitle);
+ SidebarController* pSidebarController = getSidebarController();
+ PanelDescriptor* pPanelDescriptor = pSidebarController->GetResourceManager()->GetPanelDescriptor(mPanelId);
+
+ if (pPanelDescriptor)
+ {
+ pPanelDescriptor->msTitle = newTitle;
+ PanelTitleBar* pTitleBar = mpPanel->GetTitleBar();
+ if (pTitleBar)
+ pTitleBar->SetTitle(newTitle);
+ }
}
sal_Bool SAL_CALL SfxUnoPanel::isExpanded()
@@ -97,6 +107,9 @@ void SAL_CALL SfxUnoPanel::expand( const sal_Bool bCollapseOther )
}
}
+ SidebarController* pSidebarController = getSidebarController();
+ pSidebarController->NotifyResize();
+
}
void SAL_CALL SfxUnoPanel::collapse()
@@ -105,6 +118,8 @@ void SAL_CALL SfxUnoPanel::collapse()
SolarMutexGuard aGuard;
mpPanel->SetExpanded(false);
+ SidebarController* pSidebarController = getSidebarController();
+ pSidebarController->NotifyResize();
}
uno::Reference<awt::XWindow> SAL_CALL SfxUnoPanel::getDialog()
@@ -132,9 +147,14 @@ void SAL_CALL SfxUnoPanel::setOrderIndex( const sal_Int32 newOrderIndex )
SolarMutexGuard aGuard;
SidebarController* pSidebarController = getSidebarController();
- pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, newOrderIndex);
+ PanelDescriptor* pPanelDescriptor = pSidebarController->GetResourceManager()->GetPanelDescriptor(mPanelId);
- pSidebarController->NotifyResize();
+ if (pPanelDescriptor)
+ {
+ pPanelDescriptor->mnOrderIndex = newOrderIndex;
+ // update the sidebar
+ pSidebarController->NotifyResize();
+ }
}
void SAL_CALL SfxUnoPanel::moveFirst()
@@ -151,8 +171,13 @@ void SAL_CALL SfxUnoPanel::moveFirst()
if (curOrderIndex != minIndex) // is current panel already in place ?
{
minIndex -= 1;
- pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, minIndex);
- pSidebarController->NotifyResize();
+ PanelDescriptor* pPanelDescriptor = pSidebarController->GetResourceManager()->GetPanelDescriptor(mPanelId);
+ if (pPanelDescriptor)
+ {
+ pPanelDescriptor->mnOrderIndex = minIndex;
+ // update the sidebar
+ pSidebarController->NotifyResize();
+ }
}
}
@@ -170,8 +195,13 @@ void SAL_CALL SfxUnoPanel::moveLast()
if (curOrderIndex != maxIndex) // is current panel already in place ?
{
maxIndex += 1;
- pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, maxIndex);
- pSidebarController->NotifyResize();
+ PanelDescriptor* pPanelDescriptor = pSidebarController->GetResourceManager()->GetPanelDescriptor(mPanelId);
+ if (pPanelDescriptor)
+ {
+ pPanelDescriptor->mnOrderIndex = maxIndex;
+ // update the sidebar
+ pSidebarController->NotifyResize();
+ }
}
}
@@ -198,8 +228,13 @@ void SAL_CALL SfxUnoPanel::moveUp()
if (curOrderIndex != previousIndex) // is current panel already in place ?
{
previousIndex -= 1;
- pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, previousIndex);
- pSidebarController->NotifyResize();
+ PanelDescriptor* pPanelDescriptor = pSidebarController->GetResourceManager()->GetPanelDescriptor(mPanelId);
+ if (pPanelDescriptor)
+ {
+ pPanelDescriptor->mnOrderIndex = previousIndex;
+ // update the sidebar
+ pSidebarController->NotifyResize();
+ }
}
}
@@ -226,8 +261,13 @@ void SAL_CALL SfxUnoPanel::moveDown()
if (curOrderIndex != nextIndex) // is current panel already in place ?
{
nextIndex += 1;
- pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, nextIndex);
- pSidebarController->NotifyResize();
+ PanelDescriptor* pPanelDescriptor = pSidebarController->GetResourceManager()->GetPanelDescriptor(mPanelId);
+ if (pPanelDescriptor)
+ {
+ pPanelDescriptor->mnOrderIndex = nextIndex;
+ // update the sidebar
+ pSidebarController->NotifyResize();
+ }
}
}