From ee657aeb53d5fb3bdd314b97a5b1e91d8ab92cc7 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 3 Apr 2012 13:08:53 +0100 Subject: Implement "visible" from builder. Fix queueResize. The natural place to call queueResize is from Window::StateChanged => instant-beautiful ui-previewer demo. ship it. --- vcl/inc/vcl/fixed.hxx | 2 -- vcl/source/control/fixed.cxx | 8 -------- vcl/source/uipreviewer/previewer.cxx | 30 ++++++++++++++++++++++-------- vcl/source/window/builder.cxx | 5 +++++ vcl/source/window/window.cxx | 1 + 5 files changed, 28 insertions(+), 18 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx index 4ce0d9d0c606..63f094d0509d 100644 --- a/vcl/inc/vcl/fixed.hxx +++ b/vcl/inc/vcl/fixed.hxx @@ -74,8 +74,6 @@ public: static Size CalcMinimumTextSize( Control const* pControl, long nMaxWidth = 0 ); Size CalcMinimumSize( long nMaxWidth = 0 ) const; virtual Size GetOptimalSize(WindowSizeType eType) const; - - virtual void SetText( const XubString& rStr ); }; // ------------- diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 62da59301cb4..62fae387d47e 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -429,14 +429,6 @@ void FixedText::FillLayoutData() const ImplDraw( const_cast(this), 0, Point(), GetOutputSizePixel(), true ); } - -void FixedText::SetText( const XubString& rStr ) -{ - Window::SetText(rStr); - //Text changed, tell possibly existing layout that size requisition has changed - queueResize(); -} - // ======================================================================= void FixedLine::ImplInit( Window* pParent, WinBits nStyle ) diff --git a/vcl/source/uipreviewer/previewer.cxx b/vcl/source/uipreviewer/previewer.cxx index 9f3bdb27367a..7a27729f2c96 100644 --- a/vcl/source/uipreviewer/previewer.cxx +++ b/vcl/source/uipreviewer/previewer.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -49,7 +50,11 @@ int UIPreviewApp::Main() { std::vector uifiles; for (sal_uInt16 i = 0; i < GetCommandLineParamCount(); ++i) - uifiles.push_back(GetCommandLineParam(i)); + { + rtl::OUString aFileUrl; + osl::File::getFileURLFromSystemPath(GetCommandLineParam(i), aFileUrl); + uifiles.push_back(aFileUrl); + } if (uifiles.empty()) { @@ -71,17 +76,26 @@ int UIPreviewApp::Main() aArgs[ 1 ] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UCB_CONFIGURATION_KEY2_OFFICE)); ::ucbhelper::ContentBroker::initialize(xSFactory, aArgs); - VclBuilder aBuilder(NULL, uifiles[0]); - Window *pWindow = aBuilder.get_widget_root(); - Dialog *pDialog = dynamic_cast(pWindow); - if (pDialog) + try { - pDialog->Execute(); + VclBuilder aBuilder(NULL, uifiles[0]); + Window *pWindow = aBuilder.get_widget_root(); + Dialog *pDialog = dynamic_cast(pWindow); + if (pDialog) + { + pDialog->Execute(); + } + else + { + fprintf(stderr, "to-do: no toplevel dialog, make one\n"); + } } - else + catch (const uno::Exception &e) { - fprintf(stderr, "to-do: no toplevel dialog, make one\n"); + fprintf(stderr, "fatal error: \n", rtl::OUStringToOString(e.Message, osl_getThreadTextEncoding()).getStr()); } + return false; + ::ucbhelper::ContentBroker::deinitialize(); diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index ac89bfd46bb5..71f9e048b811 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -142,6 +142,11 @@ Window *VclBuilder::insertObject(Window *pParent, const rtl::OString &rClass, st const rtl::OString &rValue = aI->second; if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("label"))) pCurrentChild->SetText(rtl::OStringToOUString(rValue, RTL_TEXTENCODING_UTF8)); + else if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("visible"))) + { + bool bIsVisible = (rValue[0] == 't' || rValue[0] == 'T' || rValue[0] == '1'); + pCurrentChild->Show(bIsVisible); + } else if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("xalign"))) { WinBits nBits = pCurrentChild->GetStyle(); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 38247c39d893..c818768ce341 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -4913,6 +4913,7 @@ void Window::UserEvent( sal_uLong, void* ) void Window::StateChanged( StateChangedType ) { + queueResize(); DBG_CHKTHIS( Window, ImplDbgCheckWindow ); } -- cgit v1.2.3