[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Michael Meeks
michael.meeks at collabora.com
Tue Feb 7 18:56:37 UTC 2017
include/sfx2/sidebar/Deck.hxx | 2 +-
include/sfx2/sidebar/Panel.hxx | 2 +-
sfx2/source/sidebar/Deck.cxx | 6 +++---
sfx2/source/sidebar/DeckLayouter.cxx | 4 ++--
sfx2/source/sidebar/FocusManager.cxx | 14 +++++++-------
sfx2/source/sidebar/Panel.cxx | 5 +++--
sfx2/source/sidebar/SidebarController.cxx | 14 +++++++-------
sfx2/source/sidebar/UnoDeck.cxx | 4 ++--
sfx2/source/sidebar/UnoPanel.cxx | 11 +++++++----
9 files changed, 33 insertions(+), 29 deletions(-)
New commits:
commit 58d4a3122ce59c68aa7a4b7e09f76bf15865be9b
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Tue Feb 7 13:29:46 2017 +0000
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 at libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx
index cdd58b2..fa27ec5 100644
--- a/include/sfx2/sidebar/Deck.hxx
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -46,7 +46,7 @@ public:
const OUString& GetId() const { return msId; }
- DeckTitleBar* GetTitleBar() const;
+ VclPtr<DeckTitleBar> GetTitleBar() const;
Rectangle GetContentArea() const;
void ResetPanels (const SharedPanelContainer& rPanels);
const SharedPanelContainer& GetPanels() const { return maPanels; }
diff --git a/include/sfx2/sidebar/Panel.hxx b/include/sfx2/sidebar/Panel.hxx
index 6793999..4ed7b74 100644
--- a/include/sfx2/sidebar/Panel.hxx
+++ b/include/sfx2/sidebar/Panel.hxx
@@ -46,7 +46,7 @@ public:
virtual ~Panel() override;
virtual void dispose() override;
- PanelTitleBar* GetTitleBar() const;
+ VclPtr<PanelTitleBar> GetTitleBar() const;
bool IsTitleBarOptional() const { return mbIsTitleBarOptional;}
void SetUIElement (const css::uno::Reference<css::ui::XUIElement>& rxElement);
const css::uno::Reference<css::ui::XSidebarPanel>& GetPanelComponent() const { return mxPanelComponent;}
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index cc39d02..f8d4bcf 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 ee3cd79..5c0d60d 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 8603aec..dfd2527 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 b87d0dd..fa75db8 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 84e1526..869cc89 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 facddd2..a87dcb7 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 ac46f80..a382fe1 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);
}
More information about the Libreoffice-commits
mailing list