summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2017-02-07 13:29:46 +0000
committerMichael Meeks <michael.meeks@collabora.com>2017-02-07 18:56:16 +0000
commit58d4a3122ce59c68aa7a4b7e09f76bf15865be9b (patch)
tree46a67d309214ed71e3a86abb1e65ce7964264741 /sfx2
parent555e1ff4cc84682ea73f9976f8e3c6f1d0f22590 (diff)
tdf#104870 - keep reference on the TitleBar while setting title.
Unlikely to fix the issue, but may help. Change-Id: I3c319f550e86f2ab731b072d86d258dca12d34fa Reviewed-on: https://gerrit.libreoffice.org/33998 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/Deck.cxx6
-rw-r--r--sfx2/source/sidebar/DeckLayouter.cxx4
-rw-r--r--sfx2/source/sidebar/FocusManager.cxx14
-rw-r--r--sfx2/source/sidebar/Panel.cxx5
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx14
-rw-r--r--sfx2/source/sidebar/UnoDeck.cxx4
-rw-r--r--sfx2/source/sidebar/UnoPanel.cxx11
7 files changed, 31 insertions, 27 deletions
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index cc39d0283250..f8d4bcfe17e1 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -92,9 +92,9 @@ void Deck::dispose()
vcl::Window::dispose();
}
-DeckTitleBar* Deck::GetTitleBar() const
+VclPtr<DeckTitleBar> Deck::GetTitleBar() const
{
- return mpTitleBar.get();
+ return mpTitleBar;
}
Rectangle Deck::GetContentArea() const
@@ -244,7 +244,7 @@ void Deck::ShowPanel(const Panel& rPanel)
sal_Int32 nPanelTop (rPanel.GetPosPixel().Y());
const sal_Int32 nPanelBottom (nPanelTop + rPanel.GetSizePixel().Height() - 1);
// Add the title bar into the extent.
- if (rPanel.GetTitleBar() != nullptr && rPanel.GetTitleBar()->IsVisible())
+ if (rPanel.GetTitleBar() && rPanel.GetTitleBar()->IsVisible())
nPanelTop = rPanel.GetTitleBar()->GetPosPixel().Y();
// Determine what the new thumb position should be like.
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index ee3cd794e655..5c0d60dde254 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -266,8 +266,8 @@ sal_Int32 PlacePanels (
nY += nDeckSeparatorHeight;
// Place the title bar.
- PanelTitleBar* pTitleBar = rPanel.GetTitleBar();
- if (pTitleBar != nullptr)
+ VclPtr<PanelTitleBar> pTitleBar = rPanel.GetTitleBar();
+ if (pTitleBar)
{
const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight) * rPanel.GetDPIScaleFactor());
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx
index 8603aec81a04..dfd2527302f1 100644
--- a/sfx2/source/sidebar/FocusManager.cxx
+++ b/sfx2/source/sidebar/FocusManager.cxx
@@ -70,7 +70,7 @@ void FocusManager::ClearPanels()
for (auto iPanel(aPanels.begin()),iEnd(aPanels.end()); iPanel != iEnd; ++iPanel)
{
UnregisterWindow(**iPanel);
- if ((*iPanel)->GetTitleBar() != nullptr)
+ if ((*iPanel)->GetTitleBar())
{
UnregisterWindow(*(*iPanel)->GetTitleBar());
UnregisterWindow((*iPanel)->GetTitleBar()->GetToolBox());
@@ -112,7 +112,7 @@ void FocusManager::SetPanels (const SharedPanelContainer& rPanels)
for (auto iPanel = rPanels.begin(); iPanel != rPanels.end(); ++iPanel)
{
RegisterWindow(**iPanel);
- if ((*iPanel)->GetTitleBar() != nullptr)
+ if ((*iPanel)->GetTitleBar())
{
RegisterWindow(*(*iPanel)->GetTitleBar());
RegisterWindow((*iPanel)->GetTitleBar()->GetToolBox());
@@ -161,7 +161,7 @@ FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& r
{
if (maPanels[nIndex] == &rWindow)
return FocusLocation(PC_PanelContent, nIndex);
- TitleBar* pTitleBar = maPanels[nIndex]->GetTitleBar();
+ VclPtr<TitleBar> pTitleBar = maPanels[nIndex]->GetTitleBar();
if (pTitleBar == &rWindow)
return FocusLocation(PC_PanelTitle, nIndex);
if (pTitleBar!=nullptr && &pTitleBar->GetToolBox()==&rWindow)
@@ -208,8 +208,8 @@ bool FocusManager::IsPanelTitleVisible (const sal_Int32 nPanelIndex) const
if (nPanelIndex<0 || nPanelIndex>=static_cast<sal_Int32>(maPanels.size()))
return false;
- TitleBar* pTitleBar = maPanels[nPanelIndex]->GetTitleBar();
- if (pTitleBar==nullptr)
+ VclPtr<TitleBar> pTitleBar = maPanels[nPanelIndex]->GetTitleBar();
+ if (!pTitleBar)
return false;
return pTitleBar->IsVisible();
}
@@ -226,8 +226,8 @@ void FocusManager::FocusPanel (
}
Panel& rPanel (*maPanels[nPanelIndex]);
- TitleBar* pTitleBar = rPanel.GetTitleBar();
- if (pTitleBar!=nullptr && pTitleBar->IsVisible())
+ VclPtr<TitleBar> pTitleBar = rPanel.GetTitleBar();
+ if (pTitleBar && pTitleBar->IsVisible())
{
rPanel.SetExpanded(true);
pTitleBar->GrabFocus();
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index b87d0ddb57e4..fa75db898742 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -70,6 +70,7 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor,
Panel::~Panel()
{
disposeOnce();
+ assert(!mpTitleBar);
}
void Panel::ApplySettings(vcl::RenderContext& rRenderContext)
@@ -99,9 +100,9 @@ void Panel::dispose()
vcl::Window::dispose();
}
-PanelTitleBar* Panel::GetTitleBar() const
+VclPtr<PanelTitleBar> Panel::GetTitleBar() const
{
- return mpTitleBar.get();
+ return mpTitleBar;
}
void Panel::SetUIElement (const Reference<ui::XUIElement>& rxElement)
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 84e1526832c7..869cc89fa21d 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -396,8 +396,8 @@ void SidebarController::NotifyResize()
sal_Int32 nMinimalWidth = 0;
if (mpCurrentDeck && !mpCurrentDeck->isDisposed())
{
- DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar();
- if (pTitleBar != nullptr && pTitleBar->IsVisible())
+ VclPtr<DeckTitleBar> pTitleBar = mpCurrentDeck->GetTitleBar();
+ if (pTitleBar && pTitleBar->IsVisible())
pTitleBar->SetCloserVisible(CanModifyChildWindowWidth());
nMinimalWidth = mpCurrentDeck->GetMinimalWidth();
}
@@ -635,8 +635,8 @@ void SidebarController::CreatePanels(const ::rtl::OUString& rDeckId, const Conte
// Depending on the context we have to change the command
// for the "more options" dialog.
- PanelTitleBar* pTitleBar = aNewPanels[nWriteIndex]->GetTitleBar();
- if (pTitleBar != nullptr)
+ VclPtr<PanelTitleBar> pTitleBar = aNewPanels[nWriteIndex]->GetTitleBar();
+ if (pTitleBar)
{
pTitleBar->SetMoreOptionsCommand(
rPanelContexDescriptor.msMenuCommand,
@@ -718,8 +718,8 @@ void SidebarController::SwitchToDeck (
#ifdef DEBUG
// Show the context name in the deck title bar.
- DeckTitleBar* pDebugTitleBar = mpCurrentDeck->GetTitleBar();
- if (pDebugTitleBar != NULL)
+ VclPtr<DeckTitleBar> pDebugTitleBar = mpCurrentDeck->GetTitleBar();
+ if (pDebugTitleBar)
pDebugTitleBar->SetTitle(rDeckDescriptor.msTitle + " (" + maCurrentContext.msContext + ")");
#endif
@@ -1262,7 +1262,7 @@ void SidebarController::UpdateTitleBarIcons()
{
if ( ! *iPanel)
continue;
- if ((*iPanel)->GetTitleBar() == nullptr)
+ if (!(*iPanel)->GetTitleBar())
continue;
std::shared_ptr<PanelDescriptor> xPanelDescriptor = rResourceManager.GetPanelDescriptor((*iPanel)->GetId());
if (!xPanelDescriptor)
diff --git a/sfx2/source/sidebar/UnoDeck.cxx b/sfx2/source/sidebar/UnoDeck.cxx
index facddd25fa65..a87dcb7194d8 100644
--- a/sfx2/source/sidebar/UnoDeck.cxx
+++ b/sfx2/source/sidebar/UnoDeck.cxx
@@ -53,7 +53,7 @@ OUString SAL_CALL SfxUnoDeck::getTitle()
pDeck = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mpDeck;
}
- DeckTitleBar* pTitleBar = pDeck->GetTitleBar();
+ VclPtr<DeckTitleBar> pTitleBar = pDeck->GetTitleBar();
return pTitleBar->GetTitle();
}
@@ -69,7 +69,7 @@ void SAL_CALL SfxUnoDeck::setTitle( const OUString& newTitle )
if (xDeckDescriptor)
{
Deck* pDeck = xDeckDescriptor->mpDeck;
- DeckTitleBar* pTitleBar = pDeck->GetTitleBar();
+ VclPtr<DeckTitleBar> pTitleBar = pDeck->GetTitleBar();
pTitleBar->SetTitle(newTitle);
xDeckDescriptor->msTitle = newTitle;
diff --git a/sfx2/source/sidebar/UnoPanel.cxx b/sfx2/source/sidebar/UnoPanel.cxx
index ac46f80a79e1..a382fe133b4c 100644
--- a/sfx2/source/sidebar/UnoPanel.cxx
+++ b/sfx2/source/sidebar/UnoPanel.cxx
@@ -48,12 +48,15 @@ OUString SAL_CALL SfxUnoPanel::getId()
return mPanelId;
}
-OUString SAL_CALL SfxUnoPanel::getTitle()
+OUString SAL_CALL SfxUnoPanel::getTitle()
{
SolarMutexGuard aGuard;
- PanelTitleBar* pTitleBar = mpPanel->GetTitleBar();
- return pTitleBar->GetTitle();
+ VclPtr<PanelTitleBar> pTitleBar = mpPanel->GetTitleBar();
+ if (pTitleBar)
+ return pTitleBar->GetTitle();
+ else
+ return OUString();
}
void SAL_CALL SfxUnoPanel::setTitle( const OUString& newTitle )
@@ -66,7 +69,7 @@ void SAL_CALL SfxUnoPanel::setTitle( const OUString& newTitle )
if (xPanelDescriptor)
{
xPanelDescriptor->msTitle = newTitle;
- PanelTitleBar* pTitleBar = mpPanel->GetTitleBar();
+ VclPtr<PanelTitleBar> pTitleBar = mpPanel->GetTitleBar();
if (pTitleBar)
pTitleBar->SetTitle(newTitle);
}