summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-02-24 18:06:08 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-02-24 18:14:32 +0100
commit6c7b85c2001edacd4f722a8cc87ad9df0385f94b (patch)
tree2c0a062a38969b53e7a9ae3eac51f92dfcb88702
parent18a0d519440b42cd90c628730b2e404b4203e8eb (diff)
Avoid bad downcasts to VclBox
At least in CppunitTest_smoektest there is a case where SystemWindow::setOptimalLayoutSize tries to downcast a VclGrid as a VclBox (stack top below), and that even appears to be unnecessary as the only place that requires the downcast is the Dialog::settingOptimalLayoutSize override. So maybe it is guaranteed that GetWindow(WINDOW_FIRSTCHILD) is a VclBox if this is a Dialog, but need not be the case if this is not a Dialog? Or the real bug is elsewhere... SystemWindow::setOptimalLayoutSize() SystemWindow::DoInitialLayout() FloatingWindow::StateChanged(StateChangedType) SfxFloatingWindow::StateChanged(StateChangedType) SmToolBoxWindow::StateChanged(StateChangedType) vcl::Window::ImplCallInitShow() vcl::Window::Show(bool, unsigned short) SfxChildWindow::Show(unsigned short) SfxWorkWindow::HidePopups_Impl(bool, bool, unsigned short) SfxDispatcher::DoActivate_Impl(bool, SfxViewFrame*) SfxViewFrame::DoActivate(bool, SfxViewFrame*) SfxApplication::SetViewFrame_Impl(SfxViewFrame*) SfxViewFrame::SetViewFrame(SfxViewFrame*) SfxViewFrame::MakeActive_Impl(bool) SfxBaseController::ConnectSfxFrame_Impl(SfxBaseController::ConnectSfxFrame) SfxBaseController::attachFrame(com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) (anonymous namespace)::SfxFrameLoader_Impl::impl_createDocumentView(com::sun::star::uno::Reference<com::sun::star::frame::XModel2> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, comphelper::NamedValueCollection const&, rtl::OUString const&) (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) framework::LoadEnv::impl_loadContent() framework::LoadEnv::startLoading() framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) ... Change-Id: I786ad451fdf73eca22860695a614ee5b889a83cd
-rw-r--r--include/vcl/dialog.hxx2
-rw-r--r--include/vcl/syswin.hxx3
-rw-r--r--vcl/source/window/dialog.cxx7
-rw-r--r--vcl/source/window/syswin.cxx4
4 files changed, 8 insertions, 8 deletions
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 0568642572a3..ab95f5297c1c 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -70,7 +70,7 @@ protected:
explicit Dialog( WindowType nType );
explicit Dialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, WindowType nType );
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
- virtual void settingOptimalLayoutSize(VclBox *pBox) SAL_OVERRIDE;
+ virtual void settingOptimalLayoutSize(Window *pBox) SAL_OVERRIDE;
protected:
friend class VclBuilder;
diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
index 1f29d45f0613..e164af894545 100644
--- a/include/vcl/syswin.hxx
+++ b/include/vcl/syswin.hxx
@@ -29,7 +29,6 @@ class ModalDialog;
class MenuBar;
class TaskPaneList;
class VclContainer;
-class VclBox;
// - Icon-Types -
#define ICON_LO_DEFAULT 1
@@ -168,7 +167,7 @@ protected:
void SetWindowStateData( const WindowStateData& rData );
- virtual void settingOptimalLayoutSize(VclBox *pBox);
+ virtual void settingOptimalLayoutSize(Window *pBox);
SAL_DLLPRIVATE void DoInitialLayout();
public:
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 18467af57eef..b2d413928bf4 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -523,12 +523,13 @@ void Dialog::set_content_area(VclBox* pContentArea)
mpContentArea = pContentArea;
}
-void Dialog::settingOptimalLayoutSize(VclBox *pBox)
+void Dialog::settingOptimalLayoutSize(Window *pBox)
{
const DialogStyle& rDialogStyle =
GetSettings().GetStyleSettings().GetDialogStyle();
- pBox->set_border_width(rDialogStyle.content_area_border);
- pBox->set_spacing(pBox->get_spacing() +
+ VclBox * pBox2 = static_cast<VclBox*>(pBox);
+ pBox2->set_border_width(rDialogStyle.content_area_border);
+ pBox2->set_spacing(pBox2->get_spacing() +
rDialogStyle.content_area_spacing);
VclButtonBox *pActionArea = getActionArea(this);
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 6b799065e4b6..5c953f3df449 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -1065,7 +1065,7 @@ OUString SystemWindow::GetText() const
return Window::GetText();
}
-void SystemWindow::settingOptimalLayoutSize(VclBox* /*pBox*/)
+void SystemWindow::settingOptimalLayoutSize(Window* /*pBox*/)
{
}
@@ -1074,7 +1074,7 @@ void SystemWindow::setOptimalLayoutSize()
maLayoutIdle.Stop();
//resize SystemWindow to fit requisition on initial show
- VclBox *pBox = static_cast<VclBox*>(GetWindow(WINDOW_FIRSTCHILD));
+ Window *pBox = GetWindow(WINDOW_FIRSTCHILD);
settingOptimalLayoutSize(pBox);