summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-04-03 13:08:53 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-09-28 08:48:12 +0100
commitee657aeb53d5fb3bdd314b97a5b1e91d8ab92cc7 (patch)
tree9d2481447ac6edfd467235139e4aa89110ad52d8
parentc0c1c262112966a1f743045ec185e7a4c875796b (diff)
Implement "visible" from builder. Fix queueResize.
The natural place to call queueResize is from Window::StateChanged => instant-beautiful ui-previewer demo. ship it.
-rw-r--r--vcl/inc/vcl/fixed.hxx2
-rw-r--r--vcl/source/control/fixed.cxx8
-rw-r--r--vcl/source/uipreviewer/previewer.cxx30
-rw-r--r--vcl/source/window/builder.cxx5
-rw-r--r--vcl/source/window/window.cxx1
5 files changed, 28 insertions, 18 deletions
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<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 9f3bdb27367a..7a27729f2c96 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 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 );
}