[Libreoffice-commits] core.git: extras/source formula/source formula/uiconfig

Caolán McNamara caolanm at redhat.com
Tue Jun 17 12:43:20 PDT 2014


 extras/source/glade/libreoffice-catalog.xml.in |    3 -
 formula/source/ui/dlg/ControlHelper.hxx        |   20 -------
 formula/source/ui/dlg/formula.cxx              |   22 ++++----
 formula/source/ui/dlg/funcutl.cxx              |   66 -------------------------
 formula/uiconfig/ui/formuladialog.ui           |    6 +-
 5 files changed, 15 insertions(+), 102 deletions(-)

New commits:
commit b15230153ce620f2063e78e4ec61d0436b61dd10
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 17 17:06:24 2014 +0100

    I could fight with ValWnd to fix it, or I could replace it
    
    it's not handling resizing and redrawing well, so just drop
    it in favour of a read-only edit
    
    Change-Id: I5e6f85cf9326b908bf1bf835d8da0c49ca9209c9

diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 9c2806b..e426585 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -611,9 +611,6 @@
     <glade-widget-class title="Edit" name="foruilo-ArgEdit"
                         generic-name="Edit" parent="GtkEntry"
                         icon-name="widget-gtk-textentry"/>
-    <glade-widget-class title="Value entry" name="foruilo-ValWnd"
-                        generic-name="Value entry" parent="GtkEntry"
-                        icon-name="widget-gtk-textentry"/>
     <glade-widget-class title="Edit Box" name="foruilo-EditBox"
                         generic-name="Edit Box" parent="GtkTextView"
                         icon-name="widget-gtk-textview"/>
diff --git a/formula/source/ui/dlg/ControlHelper.hxx b/formula/source/ui/dlg/ControlHelper.hxx
index 16ce61d..75b2f4f 100644
--- a/formula/source/ui/dlg/ControlHelper.hxx
+++ b/formula/source/ui/dlg/ControlHelper.hxx
@@ -24,26 +24,6 @@
 namespace formula
 {
 
-
-// class ValWnd
-class ValWnd : public Window
-{
-public:
-            ValWnd( Window* pParent, WinBits nBits );
-
-    void    SetValue( const OUString& rStrVal );
-
-protected:
-    virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
-    virtual void    Resize() SAL_OVERRIDE;
-    virtual Size    GetOptimalSize() const SAL_OVERRIDE;
-
-private:
-    OUString    aStrValue;
-    Rectangle   aRectOut;
-};
-
-
 // class EditBox
 class EditBox : public Control
 {
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 49f1ac5..f5402ba 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -157,7 +157,7 @@ namespace formula
         FixedText       *m_pFtEditName;
 
         FixedText       *m_pFtResult;
-        ValWnd          *m_pWndResult;
+        Edit            *m_pWndResult;
 
         FixedText       *m_pFtFormula;
         EditBox         *m_pMEFormula;
@@ -173,7 +173,7 @@ namespace formula
         RefButton       *m_pRefBtn;
 
         FixedText       *m_pFtFormResult;
-        ValWnd          *m_pWndFormResult;
+        Edit            *m_pWndFormResult;
 
         RefEdit*        pTheRefEdit;
         RefButton*      pTheRefButton;
@@ -597,15 +597,15 @@ void FormulaDlg_Impl::UpdateValues()
     OUString aStrResult;
 
     if ( CalcValue( pFuncDesc->getFormula( m_aArguments ), aStrResult ) )
-        m_pWndResult->SetValue( aStrResult );
+        m_pWndResult->SetText( aStrResult );
 
     aStrResult = "";
     if ( CalcValue(m_pHelper->getCurrentFormula(), aStrResult ) )
-        m_pWndFormResult->SetValue( aStrResult );
+        m_pWndFormResult->SetText( aStrResult );
     else
     {
         aStrResult = "";
-        m_pWndFormResult->SetValue( aStrResult );
+        m_pWndFormResult->SetText( aStrResult );
     }
     CalcStruct(pMEdit->GetText());
 }
@@ -633,7 +633,7 @@ bool FormulaDlg_Impl::CalcStruct( const OUString& rStrExp)
             OUString aStrResult;
 
             if ( CalcValue(aString, aStrResult ) )
-                m_pWndFormResult->SetValue( aStrResult );
+                m_pWndFormResult->SetText( aStrResult );
 
             UpdateTokenArray(aString);
             fillTree(pStructPage);
@@ -776,11 +776,11 @@ void FormulaDlg_Impl::FillDialog(bool nFlag)
     OUString aStrResult;
 
     if ( CalcValue(m_pHelper->getCurrentFormula(), aStrResult ) )
-        m_pWndFormResult->SetValue( aStrResult );
+        m_pWndFormResult->SetText( aStrResult );
     else
     {
         aStrResult = "";
-        m_pWndFormResult->SetValue( aStrResult );
+        m_pWndFormResult->SetText( aStrResult );
     }
 }
 
@@ -922,7 +922,7 @@ void FormulaDlg_Impl::ClearAllParas()
     DeleteArgs();
     pFuncDesc = NULL;
     pParaWin->ClearAll();
-    m_pWndResult->SetValue(OUString());
+    m_pWndResult->SetText(OUString());
     m_pFtFuncName->SetText(OUString());
     FuncSelHdl(NULL);
 
@@ -1281,11 +1281,11 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FormulaHdl)
     OUString aStrResult;
 
     if ( CalcValue(m_pHelper->getCurrentFormula(), aStrResult ) )
-        m_pWndFormResult->SetValue( aStrResult );
+        m_pWndFormResult->SetText( aStrResult );
     else
     {
         aStrResult = "";
-        m_pWndFormResult->SetValue( aStrResult );
+        m_pWndFormResult->SetText( aStrResult );
     }
     CalcStruct(aString);
 
diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index 4775197..62ca955 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -32,73 +32,7 @@
 namespace formula
 {
 
-// class ValWnd
-ValWnd::ValWnd(Window* pParent, WinBits nBits)
-    : Window(pParent, nBits)
-{
-    Font aFnt( GetFont() );
-    aFnt.SetTransparent( true );
-    aFnt.SetWeight( WEIGHT_LIGHT );
-    if ( pParent->IsBackground() )
-    {
-        fprintf(stderr, "one\n");
-        Wallpaper aBack = pParent->GetBackground();
-        SetFillColor( aBack.GetColor() );
-        SetBackground( aBack );
-        aFnt.SetFillColor( aBack.GetColor() );
-    }
-    else
-    {
-        fprintf(stderr, "two\n");
-        SetFillColor();
-        SetBackground();
-    }
-    SetFont( aFnt );
-    SetLineColor();
-
-    SetAccessibleRole( ::com::sun::star::accessibility::AccessibleRole::LABEL );
-}
-
-Size ValWnd::GetOptimalSize() const
-{
-    return LogicToPixel(Size(60, 12), MAP_APPFONT);
-}
-
-void ValWnd::Resize()
-{
-    Window::Resize();
-
-    Size aSzWnd  = GetOutputSizePixel();
-    long nHeight = GetTextHeight();
-    long nDiff   = aSzWnd.Height()-nHeight;
-
-    aRectOut = Rectangle( Point( 1, ( nDiff<2 ) ? 1 : nDiff/2),
-                          Size ( aSzWnd.Width()-2, nHeight ) );
-    SetClipRegion( Region( aRectOut ) );
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeValWnd(Window *pParent, VclBuilder::stringmap &)
-{
-    return new ValWnd(pParent, WB_BORDER);
-}
-
-void ValWnd::Paint( const Rectangle& )
-{
-    DrawText( aRectOut.TopLeft(), aStrValue );
-}
-
-void ValWnd::SetValue( const OUString& rStrVal )
-{
-    if ( aStrValue != rStrVal )
-    {
-        aStrValue = rStrVal;
-        DrawRect( aRectOut );   // delete old text
-        Paint( aRectOut );      // repaint
-    }
-}
-
 // class ArgEdit
-
 ArgEdit::ArgEdit( Window* pParent, WinBits nBits )
     :   RefEdit( pParent, NULL, nBits ),
         pEdPrev ( NULL ),
diff --git a/formula/uiconfig/ui/formuladialog.ui b/formula/uiconfig/ui/formuladialog.ui
index 8a9ff81..7afd500 100644
--- a/formula/uiconfig/ui/formuladialog.ui
+++ b/formula/uiconfig/ui/formuladialog.ui
@@ -211,10 +211,11 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="foruilo-ValWnd" id="result">
+                          <object class="GtkEntry" id="result">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">end</property>
+                            <property name="editable">False</property>
                           </object>
                           <packing>
                             <property name="left_attach">3</property>
@@ -381,10 +382,11 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="foruilo-ValWnd" id="formula_result">
+                          <object class="GtkEntry" id="formula_result">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">end</property>
+                            <property name="editable">False</property>
                           </object>
                           <packing>
                             <property name="left_attach">2</property>


More information about the Libreoffice-commits mailing list