[Libreoffice-commits] core.git: 3 commits - sw/qa

Ptyl Dragon ptyl at cloudon.com
Thu Oct 24 01:31:47 PDT 2013


 sw/qa/tiledrendering/tiledrendering.cxx |    7 +++++--
 sw/qa/tiledrendering/tiledrendering.ui  |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 9fd0abe9abfe37cb1591e1db794e0c921d95b172
Author: Ptyl Dragon <ptyl at cloudon.com>
Date:   Wed Oct 23 11:55:16 2013 +0200

    added links to the image in tiled rendering
    
    Change-Id: Ic9d972fd67123e3ab04f023806f7f96c89a883a7

diff --git a/sw/qa/tiledrendering/tiledrendering.cxx b/sw/qa/tiledrendering/tiledrendering.cxx
index bfd20c3..6af94ec 100644
--- a/sw/qa/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/tiledrendering/tiledrendering.cxx
@@ -21,37 +21,68 @@
 #include <vcl/vclmain.hxx>
 #include <vcl/field.hxx>
 #include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::sfx2;
 
-class UIPreviewApp : public Application
+class TiledRenderingApp : public Application
 {
+private:
+    uno::Reference<uno::XComponentContext> xContext;
+    uno::Reference<lang::XMultiComponentFactory> xFactory;
+    uno::Reference<lang::XMultiServiceFactory> xSFactory;
+    uno::Reference<uno::XInterface> xDesktop;
+    uno::Reference<frame::XComponentLoader> xLoader;
+    uno::Reference<lang::XComponent> xComponent;
 public:
     virtual void Init();
     virtual int Main();
+    void Open(OUString & aFileUrl);
 };
 
-using namespace com::sun::star;
 
 class TiledRenderingDialog: public ModalDialog{
+private:
+    TiledRenderingApp * app;
 public:
-    TiledRenderingDialog() : ModalDialog(DIALOG_NO_PARENT, "TiledRendering", "qa/sw/ui/tiledrendering.ui")
+    TiledRenderingDialog(TiledRenderingApp * app) :
+        ModalDialog(DIALOG_NO_PARENT, "TiledRendering", "qa/sw/ui/tiledrendering.ui"),
+        app(app)
     {
         PushButton * renderButton;
         get(renderButton,"buttonRenderTile");
         renderButton->SetClickHdl( LINK( this, TiledRenderingDialog, RenderHdl));
+
+        PushButton * chooseDocumentButton;
+        get(chooseDocumentButton,"buttonChooseDocument");
+        chooseDocumentButton->SetClickHdl( LINK( this, TiledRenderingDialog, ChooseDocumentHdl));
+
         SetStyle(GetStyle()|WB_CLOSEABLE);
     }
+
     virtual ~TiledRenderingDialog()
     {
     }
 
     DECL_LINK ( RenderHdl, Button * );
+    DECL_LINK ( ChooseDocumentHdl, Button * );
 
-    sal_Int32 extractInt(const char * name)
+    sal_Int32 ExtractInt(const char * name)
     {
         NumericField * pField;
         get(pField,name);
         OUString aString(pField->GetText());
-        std::cerr << "param " << name << " returned " << aString <<"/n";
         return aString.toInt32();
     }
 
@@ -59,67 +90,79 @@ public:
 
 IMPL_LINK ( TiledRenderingDialog,  RenderHdl, Button *, EMPTYARG )
 {
-    extractInt("spinContextWidth");
-    extractInt("spinContextHeight");
-    extractInt("spinTilePosX");
-    extractInt("spinTilePosY");
-    extractInt("spinTileWidth");
-    extractInt("spinTileHeight");
+    ExtractInt("spinContextWidth");
+    ExtractInt("spinContextHeight");
+    ExtractInt("spinTilePosX");
+    ExtractInt("spinTilePosY");
+    ExtractInt("spinTileWidth");
+    ExtractInt("spinTileHeight");
+    FixedImage * pImage;
+    get(pImage,"imageTile");
+    return 1;
+}
+
+IMPL_LINK ( TiledRenderingDialog,  ChooseDocumentHdl, Button *, EMPTYARG )
+{
+    FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
+    uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+    if( aDlgHelper.Execute() == ERRCODE_NONE )
+    {
+        OUString aFileUrl =xFP->getFiles().getConstArray()[0];
+        app->Open(aFileUrl);
+    }
     return 1;
 }
 
-void UIPreviewApp::Init()
+void TiledRenderingApp::Open(OUString & aFileUrl){
+    static const OUString TARGET("_default");
+    static const Sequence<beans::PropertyValue> PROPS (0);
+    if(xComponent.get())
+    {
+        xComponent->dispose();
+        xComponent.clear();
+    }
+    xComponent.set(xLoader->loadComponentFromURL(aFileUrl,TARGET,0,PROPS));
+}
+
+void TiledRenderingApp::Init()
 {
-    uno::Reference<uno::XComponentContext> xContext =
-        cppu::defaultBootstrap_InitialComponentContext();
-    uno::Reference<lang::XMultiComponentFactory> xFactory =
-        xContext->getServiceManager();
-    uno::Reference<lang::XMultiServiceFactory> xSFactory =
-        uno::Reference<lang::XMultiServiceFactory> (xFactory, uno::UNO_QUERY_THROW);
+    xContext.set(cppu::defaultBootstrap_InitialComponentContext());
+    xFactory.set(xContext->getServiceManager());
+    xSFactory.set(uno::Reference<lang::XMultiServiceFactory> (xFactory, uno::UNO_QUERY_THROW));
     comphelper::setProcessServiceFactory(xSFactory);
 
     // Create UCB (for backwards compatibility, in case some code still uses
     // plain createInstance w/o args directly to obtain an instance):
-    ::ucb::UniversalContentBroker::create(
-        comphelper::getProcessComponentContext() );
+    ::ucb::UniversalContentBroker::create(comphelper::getProcessComponentContext() );
+
+    xDesktop.set(xFactory->createInstanceWithContext(OUString("com.sun.star.frame.Desktop"), xContext));
+    xLoader.set(frame::Desktop::create(xContext));
 }
 
-int UIPreviewApp::Main()
+int TiledRenderingApp::Main()
 {
-    //std::vector<OUString> uifiles;
-    //for (sal_uInt16 i = 0; i < GetCommandLineParamCount(); ++i)
-    //{
-    //    OUString aFileUrl;
-    //   osl::File::getFileURLFromSystemPath(GetCommandLineParam(i), aFileUrl);
-    //    uifiles.push_back(aFileUrl);
-    //}
-    //if (uifiles.empty())
-    //{
-    //    fprintf(stderr, "Usage: ui-previewer file.ui\n");
-    //    return EXIT_FAILURE;
-    //}
-
-    // turn on tooltips
+    if(GetCommandLineParamCount()>0)
+    {
+        OUString aFileUrl;
+        osl::File::getFileURLFromSystemPath(GetCommandLineParam(0), aFileUrl);
+        Open(aFileUrl);
+    }
     Help::EnableQuickHelp();
-
     try
     {
-
-        TiledRenderingDialog pDialog;
-
+        TiledRenderingDialog pDialog(this);
         pDialog.Execute();
     }
     catch (const uno::Exception &e)
     {
         fprintf(stderr, "fatal error: %s\n", OUStringToOString(e.Message, osl_getThreadTextEncoding()).getStr());
     }
-
     return EXIT_SUCCESS;
 }
 
 void vclmain::createApplication()
 {
-    static UIPreviewApp aApp;
+    static TiledRenderingApp aApp;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/tiledrendering/tiledrendering.ui b/sw/qa/tiledrendering/tiledrendering.ui
index f27939c..22222d4 100644
--- a/sw/qa/tiledrendering/tiledrendering.ui
+++ b/sw/qa/tiledrendering/tiledrendering.ui
@@ -256,7 +256,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkImage" id="image1">
+          <object class="GtkImage" id="imageTile">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="stock">gtk-missing-image</property>
commit 2d09baa7802e5d5bf30bd4baafe690f06a1275ec
Author: Ptyl Dragon <ptyl at cloudon.com>
Date:   Tue Oct 22 18:26:55 2013 +0200

    tiledrendering extracts values when clicking render
    
    Change-Id: I4b350dc6c796bb1af0740917e17ac79b2a259a0a

diff --git a/sw/qa/tiledrendering/tiledrendering.cxx b/sw/qa/tiledrendering/tiledrendering.cxx
index 9f296bd..bfd20c3 100644
--- a/sw/qa/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/tiledrendering/tiledrendering.cxx
@@ -33,21 +33,26 @@ using namespace com::sun::star;
 
 class TiledRenderingDialog: public ModalDialog{
 public:
-    TiledRenderingDialog() : ModalDialog(DIALOG_NO_PARENT, "TiledRendering", "qa/sw/ui/tiledrendering.ui"){
+    TiledRenderingDialog() : ModalDialog(DIALOG_NO_PARENT, "TiledRendering", "qa/sw/ui/tiledrendering.ui")
+    {
         PushButton * renderButton;
         get(renderButton,"buttonRenderTile");
         renderButton->SetClickHdl( LINK( this, TiledRenderingDialog, RenderHdl));
+        SetStyle(GetStyle()|WB_CLOSEABLE);
+    }
+    virtual ~TiledRenderingDialog()
+    {
     }
-    virtual ~TiledRenderingDialog(){}
 
     DECL_LINK ( RenderHdl, Button * );
 
-    sal_Int32 extractInt(const char * name){
-            NumericField * pField;
-            get(pField,name);
-            OUString aString(pField->GetText());
-            SAL_INFO("TiledRenderingDialog","param " << name << " returned " << aString);
-            return aString.toInt32();
+    sal_Int32 extractInt(const char * name)
+    {
+        NumericField * pField;
+        get(pField,name);
+        OUString aString(pField->GetText());
+        std::cerr << "param " << name << " returned " << aString <<"/n";
+        return aString.toInt32();
     }
 
 };
@@ -60,8 +65,7 @@ IMPL_LINK ( TiledRenderingDialog,  RenderHdl, Button *, EMPTYARG )
     extractInt("spinTilePosY");
     extractInt("spinTileWidth");
     extractInt("spinTileHeight");
-
-   return 1;
+    return 1;
 }
 
 void UIPreviewApp::Init()
@@ -89,7 +93,6 @@ int UIPreviewApp::Main()
     //   osl::File::getFileURLFromSystemPath(GetCommandLineParam(i), aFileUrl);
     //    uifiles.push_back(aFileUrl);
     //}
-
     //if (uifiles.empty())
     //{
     //    fprintf(stderr, "Usage: ui-previewer file.ui\n");
@@ -105,21 +108,6 @@ int UIPreviewApp::Main()
         TiledRenderingDialog pDialog;
 
         pDialog.Execute();
-/*
-        {
-            VclBuilder aBuilder(pDialog, OUString(), "sw/qa/tiledrendering/tiledrendering.ui");
-            Dialog *pRealDialog = dynamic_cast<Dialog*>(aBuilder.get_widget_root());
-
-            if (!pRealDialog)
-                pRealDialog = pDialog;
-
-            if (pRealDialog)
-            {
-                pRealDialog->SetText(OUString("LibreOffice ui-previewer"));
-                pRealDialog->SetStyle(pDialog->GetStyle()|WB_CLOSEABLE);
-                pRealDialog->Execute();
-            }
-        }*/
     }
     catch (const uno::Exception &e)
     {
@@ -129,12 +117,6 @@ int UIPreviewApp::Main()
     return EXIT_SUCCESS;
 }
 
-void render(){
-
-
-}
-
-
 void vclmain::createApplication()
 {
     static UIPreviewApp aApp;
diff --git a/sw/qa/tiledrendering/tiledrendering.glade b/sw/qa/tiledrendering/tiledrendering.glade
deleted file mode 100644
index 35cee14..0000000
--- a/sw/qa/tiledrendering/tiledrendering.glade
+++ /dev/null
@@ -1,273 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkWindow" id="window1">
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkBox" id="box1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <child>
-          <object class="GtkBox" id="box2">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
-            <child>
-              <object class="GtkBox" id="box3">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <child>
-                  <object class="GtkBox" id="box4">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="orientation">vertical</property>
-                    <child>
-                      <object class="GtkLabel" id="labelContentWidth">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">contentWidth</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="labelContentHeight">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">contentHeight</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="labelTilePosX">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">tilePosX</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="labelTilePoxY">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">tilePosY</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">3</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="labelTileWidth">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">tileWidth</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">4</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="labelTileHeight">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">tileHeight</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">5</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkBox" id="box5">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="orientation">vertical</property>
-                    <child>
-                      <object class="GtkSpinButton" id="spinContextWidth">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="progress_pulse_step">1</property>
-                        <property name="numeric">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinContextHeight">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="progress_pulse_step">1</property>
-                        <property name="numeric">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinTilePosX">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="progress_pulse_step">1</property>
-                        <property name="numeric">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinTilePosY">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="progress_pulse_step">1</property>
-                        <property name="numeric">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">3</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinTileWidth">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="progress_pulse_step">1</property>
-                        <property name="numeric">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">4</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinTileHeight">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="width_chars">1</property>
-                        <property name="progress_pulse_step">1</property>
-                        <property name="numeric">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">5</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkBox" id="box6">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <child>
-                  <object class="GtkButton" id="buttonRenderTile">
-                    <property name="label" translatable="yes">render tile</property>
-                    <property name="use_action_appearance">False</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="use_action_appearance">False</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="pack_type">end</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="buttonChooseDocument">
-                    <property name="label" translatable="yes">choose document</property>
-                    <property name="use_action_appearance">False</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="use_action_appearance">False</property>
-                    <property name="xalign">0.50999999046325684</property>
-                    <property name="yalign">0.47999998927116394</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkImage" id="image1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="stock">gtk-missing-image</property>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-  </object>
-</interface>
commit 6a2fbb827c424704e6a4e101710d31fae5d64680
Author: Ptyl Dragon <ptyl at cloudon.com>
Date:   Tue Oct 22 17:41:09 2013 +0200

    added callback for render
    
    Change-Id: I56f47926eeff6ab57903c8eedf6528465fc41c9e

diff --git a/sw/qa/tiledrendering/tiledrendering.cxx b/sw/qa/tiledrendering/tiledrendering.cxx
index fcf3f38..9f296bd 100644
--- a/sw/qa/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/tiledrendering/tiledrendering.cxx
@@ -21,145 +21,123 @@
 #include <vcl/vclmain.hxx>
 #include <vcl/field.hxx>
 #include <vcl/button.hxx>
-#include <sfx2/filedlghelper.hxx>
-#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
-#include <com/sun/star/uno/XInterface.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/frame/Desktop.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::ui::dialogs;
-using namespace ::sfx2;
 
-class TiledRenderingApp : public Application
+class UIPreviewApp : public Application
 {
-private:
-    uno::Reference<uno::XComponentContext> xContext;
-    uno::Reference<lang::XMultiComponentFactory> xFactory;
-    uno::Reference<lang::XMultiServiceFactory> xSFactory;
-    uno::Reference<uno::XInterface> xDesktop;
-    uno::Reference<frame::XComponentLoader> xLoader;
-    uno::Reference<lang::XComponent> xComponent;
 public:
     virtual void Init();
     virtual int Main();
-    void Open(OUString & aFileUrl);
 };
 
+using namespace com::sun::star;
 
 class TiledRenderingDialog: public ModalDialog{
-private:
-    TiledRenderingApp * app;
 public:
-    TiledRenderingDialog(TiledRenderingApp * app_) :
-        ModalDialog(DIALOG_NO_PARENT, "TiledRendering", "qa/sw/ui/tiledrendering.ui"),
-        app(app_)
-    {
+    TiledRenderingDialog() : ModalDialog(DIALOG_NO_PARENT, "TiledRendering", "qa/sw/ui/tiledrendering.ui"){
         PushButton * renderButton;
         get(renderButton,"buttonRenderTile");
         renderButton->SetClickHdl( LINK( this, TiledRenderingDialog, RenderHdl));
-
-        PushButton * chooseDocumentButton;
-        get(chooseDocumentButton,"buttonChooseDocument");
-        chooseDocumentButton->SetClickHdl( LINK( this, TiledRenderingDialog, ChooseDocumentHdl));
-
-        SetStyle(GetStyle()|WB_CLOSEABLE);
-    }
-
-    virtual ~TiledRenderingDialog()
-    {
     }
+    virtual ~TiledRenderingDialog(){}
 
     DECL_LINK ( RenderHdl, Button * );
-    DECL_LINK ( ChooseDocumentHdl, Button * );
 
-    sal_Int32 ExtractInt(const char * name)
-    {
-        NumericField * pField;
-        get(pField,name);
-        OUString aString(pField->GetText());
-        return aString.toInt32();
+    sal_Int32 extractInt(const char * name){
+            NumericField * pField;
+            get(pField,name);
+            OUString aString(pField->GetText());
+            SAL_INFO("TiledRenderingDialog","param " << name << " returned " << aString);
+            return aString.toInt32();
     }
 
 };
 
 IMPL_LINK ( TiledRenderingDialog,  RenderHdl, Button *, EMPTYARG )
 {
-    ExtractInt("spinContextWidth");
-    ExtractInt("spinContextHeight");
-    ExtractInt("spinTilePosX");
-    ExtractInt("spinTilePosY");
-    ExtractInt("spinTileWidth");
-    ExtractInt("spinTileHeight");
-    return 1;
+    extractInt("spinContextWidth");
+    extractInt("spinContextHeight");
+    extractInt("spinTilePosX");
+    extractInt("spinTilePosY");
+    extractInt("spinTileWidth");
+    extractInt("spinTileHeight");
+
+   return 1;
 }
 
-IMPL_LINK ( TiledRenderingDialog,  ChooseDocumentHdl, Button *, EMPTYARG )
+void UIPreviewApp::Init()
 {
-    FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
-    uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
-    if( aDlgHelper.Execute() == ERRCODE_NONE )
-    {
-        OUString aFileUrl =xFP->getFiles().getConstArray()[0];
-        app->Open(aFileUrl);
-    }
-    return 1;
-}
-
-void TiledRenderingApp::Open(OUString & aFileUrl){
-    static const OUString TARGET("_default");
-    static const Sequence<beans::PropertyValue> PROPS (0);
-    if(xComponent.get())
-    {
-        xComponent->dispose();
-        xComponent.clear();
-    }
-    xComponent.set(xLoader->loadComponentFromURL(aFileUrl,TARGET,0,PROPS));
-}
-
-void TiledRenderingApp::Init()
-{
-    xContext.set(cppu::defaultBootstrap_InitialComponentContext());
-    xFactory.set(xContext->getServiceManager());
-    xSFactory.set(uno::Reference<lang::XMultiServiceFactory> (xFactory, uno::UNO_QUERY_THROW));
+    uno::Reference<uno::XComponentContext> xContext =
+        cppu::defaultBootstrap_InitialComponentContext();
+    uno::Reference<lang::XMultiComponentFactory> xFactory =
+        xContext->getServiceManager();
+    uno::Reference<lang::XMultiServiceFactory> xSFactory =
+        uno::Reference<lang::XMultiServiceFactory> (xFactory, uno::UNO_QUERY_THROW);
     comphelper::setProcessServiceFactory(xSFactory);
 
     // Create UCB (for backwards compatibility, in case some code still uses
     // plain createInstance w/o args directly to obtain an instance):
-    ::ucb::UniversalContentBroker::create(comphelper::getProcessComponentContext() );
-
-    xDesktop.set(xFactory->createInstanceWithContext(OUString("com.sun.star.frame.Desktop"), xContext));
-    xLoader.set(frame::Desktop::create(xContext));
+    ::ucb::UniversalContentBroker::create(
+        comphelper::getProcessComponentContext() );
 }
 
-int TiledRenderingApp::Main()
+int UIPreviewApp::Main()
 {
-    if(GetCommandLineParamCount()>0)
-    {
-        OUString aFileUrl;
-        osl::File::getFileURLFromSystemPath(GetCommandLineParam(0), aFileUrl);
-        Open(aFileUrl);
-    }
+    //std::vector<OUString> uifiles;
+    //for (sal_uInt16 i = 0; i < GetCommandLineParamCount(); ++i)
+    //{
+    //    OUString aFileUrl;
+    //   osl::File::getFileURLFromSystemPath(GetCommandLineParam(i), aFileUrl);
+    //    uifiles.push_back(aFileUrl);
+    //}
+
+    //if (uifiles.empty())
+    //{
+    //    fprintf(stderr, "Usage: ui-previewer file.ui\n");
+    //    return EXIT_FAILURE;
+    //}
+
+    // turn on tooltips
     Help::EnableQuickHelp();
+
     try
     {
-        TiledRenderingDialog pDialog(this);
+
+        TiledRenderingDialog pDialog;
+
         pDialog.Execute();
+/*
+        {
+            VclBuilder aBuilder(pDialog, OUString(), "sw/qa/tiledrendering/tiledrendering.ui");
+            Dialog *pRealDialog = dynamic_cast<Dialog*>(aBuilder.get_widget_root());
+
+            if (!pRealDialog)
+                pRealDialog = pDialog;
+
+            if (pRealDialog)
+            {
+                pRealDialog->SetText(OUString("LibreOffice ui-previewer"));
+                pRealDialog->SetStyle(pDialog->GetStyle()|WB_CLOSEABLE);
+                pRealDialog->Execute();
+            }
+        }*/
     }
     catch (const uno::Exception &e)
     {
         fprintf(stderr, "fatal error: %s\n", OUStringToOString(e.Message, osl_getThreadTextEncoding()).getStr());
     }
+
     return EXIT_SUCCESS;
 }
 
+void render(){
+
+
+}
+
+
 void vclmain::createApplication()
 {
-    static TiledRenderingApp aApp;
+    static UIPreviewApp aApp;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/tiledrendering/tiledrendering.glade b/sw/qa/tiledrendering/tiledrendering.glade
new file mode 100644
index 0000000..35cee14
--- /dev/null
+++ b/sw/qa/tiledrendering/tiledrendering.glade
@@ -0,0 +1,273 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkWindow" id="window1">
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox" id="box1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <child>
+          <object class="GtkBox" id="box2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkBox" id="box3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkBox" id="box4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkLabel" id="labelContentWidth">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">contentWidth</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="labelContentHeight">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">contentHeight</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="labelTilePosX">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">tilePosX</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="labelTilePoxY">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">tilePosY</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="labelTileWidth">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">tileWidth</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="labelTileHeight">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">tileHeight</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">5</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkBox" id="box5">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkSpinButton" id="spinContextWidth">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">•</property>
+                        <property name="progress_pulse_step">1</property>
+                        <property name="numeric">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="spinContextHeight">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">•</property>
+                        <property name="progress_pulse_step">1</property>
+                        <property name="numeric">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="spinTilePosX">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">•</property>
+                        <property name="progress_pulse_step">1</property>
+                        <property name="numeric">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="spinTilePosY">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">•</property>
+                        <property name="progress_pulse_step">1</property>
+                        <property name="numeric">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="spinTileWidth">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">•</property>
+                        <property name="progress_pulse_step">1</property>
+                        <property name="numeric">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="spinTileHeight">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">•</property>
+                        <property name="width_chars">1</property>
+                        <property name="progress_pulse_step">1</property>
+                        <property name="numeric">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">5</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox" id="box6">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkButton" id="buttonRenderTile">
+                    <property name="label" translatable="yes">render tile</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_action_appearance">False</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="buttonChooseDocument">
+                    <property name="label" translatable="yes">choose document</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="xalign">0.50999999046325684</property>
+                    <property name="yalign">0.47999998927116394</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkImage" id="image1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="stock">gtk-missing-image</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list