diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-06-13 13:46:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-09-28 08:48:28 +0100 |
commit | 60adf7a2d1b9c47afa2c9f2c405ad7c5da4d9687 (patch) | |
tree | 4386cb5999858a7ff6bee184b1c324b38f32f062 | |
parent | 00b4b4123aa87cc1a881fb13617dd4dc1c71b8dc (diff) |
allow previewing trees without toplevel windows
-rw-r--r-- | vcl/source/uipreviewer/previewer.cxx | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/vcl/source/uipreviewer/previewer.cxx b/vcl/source/uipreviewer/previewer.cxx index c1f787b33030..5a099749cc4d 100644 --- a/vcl/source/uipreviewer/previewer.cxx +++ b/vcl/source/uipreviewer/previewer.cxx @@ -78,19 +78,24 @@ int UIPreviewApp::Main() try { - VclBuilder aBuilder(NULL, uifiles[0]); - Window *pWindow = aBuilder.get_widget_root(); - Dialog *pDialog = dynamic_cast<Dialog*>(pWindow); - if (pDialog) - { - pDialog->SetText(rtl::OUString("LibreOffice ui-previewer")); - pDialog->SetStyle(pDialog->GetStyle()|WB_CLOSEABLE); - pDialog->Execute(); - } - else + Dialog *pDialog = new Dialog(NULL, WB_STDDIALOG); + { - fprintf(stderr, "to-do: no toplevel dialog, make one\n"); + VclBuilder aBuilder(pDialog, uifiles[0]); + Dialog *pRealDialog = dynamic_cast<Dialog*>(aBuilder.get_widget_root()); + + if (!pRealDialog) + pRealDialog = pDialog; + + if (pRealDialog) + { + pRealDialog->SetText(rtl::OUString("LibreOffice ui-previewer")); + pRealDialog->SetStyle(pDialog->GetStyle()|WB_CLOSEABLE); + pRealDialog->Execute(); + } } + + delete pDialog; } catch (const uno::Exception &e) { |