[Libreoffice-commits] .: Branch 'feature/cmclayout' - vcl/inc vcl/source

Caolán McNamara caolan at kemper.freedesktop.org
Tue Apr 3 05:12:32 PDT 2012


 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(-)

New commits:
commit e72276e03511add1abffa9d99c884c08fa40b393
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 3 13:08:53 2012 +0100

    Implement "visible" from builder. Fix queueResize.
    
    The natural place to call queueResize is from Window::StateChanged
    => instant-beautiful ui-previewer demo. ship it.

diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx
index 32e116b..a894905 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 0268295..0606073 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -429,14 +429,6 @@ void  FixedText::FillLayoutData() const
     ImplDraw( const_cast<FixedText*>(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 9f3bdb2..7a27729 100644
--- a/vcl/source/uipreviewer/previewer.cxx
+++ b/vcl/source/uipreviewer/previewer.cxx
@@ -31,6 +31,7 @@
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <comphelper/processfactory.hxx>
 #include <cppuhelper/bootstrap.hxx>
+#include <osl/file.hxx>
 #include <ucbhelper/configurationkeys.hxx>
 #include <ucbhelper/contentbroker.hxx>
 #include <vcl/builder.hxx>
@@ -49,7 +50,11 @@ int UIPreviewApp::Main()
 {
     std::vector<rtl::OUString> 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<Dialog*>(pWindow);
-    if (pDialog)
+    try
     {
-        pDialog->Execute();
+        VclBuilder aBuilder(NULL, uifiles[0]);
+        Window *pWindow = aBuilder.get_widget_root();
+        Dialog *pDialog = dynamic_cast<Dialog*>(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 ac89bfd..71f9e04 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 bf251be..dfb839f 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -4927,6 +4927,7 @@ void Window::UserEvent( sal_uLong, void* )
 
 void Window::StateChanged( StateChangedType )
 {
+    queueResize();
     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
 }
 


More information about the Libreoffice-commits mailing list