diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-06-17 17:06:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-06-17 20:42:35 +0100 |
commit | b15230153ce620f2063e78e4ec61d0436b61dd10 (patch) | |
tree | a36f3fdb7526a7220aea2886e0d4567f5ca60e27 | |
parent | 0cf14968aacfbf2e51f884242a1c243a645cb7fc (diff) |
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
-rw-r--r-- | extras/source/glade/libreoffice-catalog.xml.in | 3 | ||||
-rw-r--r-- | formula/source/ui/dlg/ControlHelper.hxx | 20 | ||||
-rw-r--r-- | formula/source/ui/dlg/formula.cxx | 22 | ||||
-rw-r--r-- | formula/source/ui/dlg/funcutl.cxx | 66 | ||||
-rw-r--r-- | formula/uiconfig/ui/formuladialog.ui | 6 |
5 files changed, 15 insertions, 102 deletions
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 9c2806b80582..e4265857e49f 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 16ce61dd8082..75b2f4f98371 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 49f1ac575b5e..f5402ba51935 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 4775197ea1f4..62ca9555d4f1 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 8a9ff8132361..7afd50050086 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> |