[Libreoffice-commits] core.git: 3 commits - cui/source sc/inc sc/source sc/uiconfig sc/UI_scalc.mk sw/source vcl/inc vcl/source xmlsecurity/source

Caolán McNamara caolanm at redhat.com
Thu Mar 7 06:06:37 PST 2013


 cui/source/dialogs/SpellDialog.cxx           |    2 
 cui/source/options/fontsubs.cxx              |    3 
 cui/source/options/webconninfo.cxx           |    4 
 sc/UI_scalc.mk                               |    1 
 sc/inc/scabstdlg.hxx                         |    2 
 sc/source/ui/attrdlg/scdlgfact.cxx           |   17 --
 sc/source/ui/attrdlg/scdlgfact.hxx           |    2 
 sc/source/ui/inc/namedlg.hxx                 |    2 
 sc/source/ui/inc/namemgrtable.hxx            |   22 +--
 sc/source/ui/inc/namepast.hxx                |   10 -
 sc/source/ui/miscdlgs/anyrefdg.cxx           |    4 
 sc/source/ui/namedlg/namedlg.cxx             |    2 
 sc/source/ui/namedlg/namemgrtable.cxx        |   94 +++++++++------
 sc/source/ui/namedlg/namepast.cxx            |   37 +++---
 sc/source/ui/view/cellsh1.cxx                |    2 
 sc/source/ui/view/editsh.cxx                 |    2 
 sc/uiconfig/scalc/ui/insertname.ui           |  159 +++++++--------------------
 sw/source/ui/dialog/wordcountdialog.cxx      |    2 
 vcl/inc/svids.hrc                            |    1 
 vcl/inc/vcl/dialog.hxx                       |    4 
 vcl/inc/vcl/layout.hxx                       |    4 
 vcl/source/src/btntext.src                   |    7 +
 vcl/source/window/builder.cxx                |    2 
 vcl/source/window/dialog.cxx                 |    9 +
 vcl/source/window/layout.cxx                 |    8 +
 xmlsecurity/source/dialogs/macrosecurity.cxx |   10 +
 26 files changed, 181 insertions(+), 231 deletions(-)

New commits:
commit 5ecb308bd3e8381d86f57206c0eed5f32d459956
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 7 14:05:33 2013 +0000

    rename setInitialLayoutSize to setOptimalLayoutSize
    
    and add a mechanism to know that we're in true
    initial layout mode
    
    Change-Id: I4ff61160ae67a7ccf1cb8b25c41870c195d32b94

diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 412a0b8..f098a28 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -371,7 +371,7 @@ void SpellDialog::UpdateBoxes_Impl()
     }
 
     if (bOldShowExplain != (bool) m_pExplainLink->IsVisible() || bOldShowGrammar != (bool) m_pCheckGrammarCB->IsVisible())
-        setInitialLayoutSize();
+        setOptimalLayoutSize();
 }
 // -----------------------------------------------------------------------
 
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
index 2f94e8b..0702c99 100644
--- a/cui/source/options/fontsubs.cxx
+++ b/cui/source/options/fontsubs.cxx
@@ -410,7 +410,8 @@ void SvxFontSubstCheckListBox::setColSizes()
 void SvxFontSubstCheckListBox::Resize()
 {
     SvxSimpleTable::Resize();
-    setColSizes();
+    if (isInitialLayout(this))
+        setColSizes();
 }
 
 void SvxFontSubstCheckListBox::SetTabs()
diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
index eb59b4e..d56ebb8 100644
--- a/cui/source/options/webconninfo.cxx
+++ b/cui/source/options/webconninfo.cxx
@@ -28,6 +28,7 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/docpasswordrequest.hxx>
 #include "svtools/treelistentry.hxx"
+#include <vcl/layout.hxx>
 
 using namespace ::com::sun::star;
 
@@ -78,7 +79,8 @@ void PasswordTable::Resort( bool bForced )
 void PasswordTable::Resize()
 {
     SvxSimpleTable::Resize();
-    setColWidths();
+    if (isInitialLayout(this))
+        setColWidths();
 }
 
 void PasswordTable::setColWidths()
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index d5b0fed..6af81de 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -401,7 +401,7 @@ void ScFormulaReferenceHelper::RefInputDone( bool bForced )
             Dialog* pResizeDialog = pRefEdit->GetParentDialog();
             pResizeDialog->set_border_width(m_nOldBorderWidth);
             pResizeDialog->get_action_area()->Show();
-            pResizeDialog->setInitialLayoutSize();
+            pResizeDialog->setOptimalLayoutSize();
         }
 
         pRefEdit = NULL;
@@ -573,7 +573,7 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula::
             m_nOldBorderWidth = pResizeDialog->get_border_width();
             pResizeDialog->set_border_width(0);
             pResizeDialog->get_action_area()->Hide();
-            pResizeDialog->setInitialLayoutSize();
+            pResizeDialog->setOptimalLayoutSize();
         }
     }
 }
diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx
index 7c9ee05..163cd84 100644
--- a/sc/source/ui/namedlg/namemgrtable.cxx
+++ b/sc/source/ui/namedlg/namemgrtable.cxx
@@ -94,7 +94,8 @@ ScRangeManagerTable::ScRangeManagerTable( SvxSimpleTableContainer& rParent, boos
 void ScRangeManagerTable::Resize()
 {
     SvxSimpleTable::Resize();
-    setColWidths();
+    if (isInitialLayout(this))
+        setColWidths();
 }
 
 void ScRangeManagerTable::setColWidths()
diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx
index 6d8d738..66b64fa 100644
--- a/sw/source/ui/dialog/wordcountdialog.cxx
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -71,7 +71,7 @@ void SwWordCountFloatDlg::SetValues(const SwDocStat& rCurrent, const SwDocStat&
     if (bToggleCJK)
     {
         showCJK(bShowCJK);
-        setInitialLayoutSize(); //force resize of dialog
+        setOptimalLayoutSize(); //force resize of dialog
     }
 }
 
diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx
index 7fc2a4d..1f14ae1 100644
--- a/vcl/inc/vcl/dialog.hxx
+++ b/vcl/inc/vcl/dialog.hxx
@@ -52,6 +52,7 @@ private:
     sal_Bool            mbInClose;
     sal_Bool            mbModalMode;
     bool            mbIsDefferedInit;
+    bool            mbIsCalculatingInitialLayoutSize;
     Timer           maLayoutTimer;
 
     SAL_DLLPRIVATE void    ImplInitDialogData();
@@ -94,7 +95,8 @@ public:
     virtual Size    GetOptimalSize() const;
     virtual void    Resize();
     bool            isLayoutEnabled() const;
-    void            setInitialLayoutSize();
+    void            setOptimalLayoutSize();
+    bool            isCalculatingInitialLayoutSize() const { return mbIsCalculatingInitialLayoutSize; }
     virtual void queue_layout();
     virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue);
     VclButtonBox* get_action_area();
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index 6327725..cd06ae6 100644
--- a/vcl/inc/vcl/layout.hxx
+++ b/vcl/inc/vcl/layout.hxx
@@ -670,6 +670,10 @@ VCL_DLLPUBLIC inline bool isContainerWindow(const Window *pWindow)
     return pWindow && isContainerWindow(*pWindow);
 }
 
+//Returns true if the containing dialog is doing its initial
+//layout and isn't visible yet
+VCL_DLLPUBLIC bool isInitialLayout(const Window *pWindow);
+
 // retro-fitting utilities //
 
 //Get a Size which is large enough to contain all children with
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 467de4b..a756b27 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -354,6 +354,7 @@ void Dialog::ImplInitDialogData()
     mbOldSaveBack           = sal_False;
     mbInClose               = sal_False;
     mbModalMode             = sal_False;
+    mbIsCalculatingInitialLayoutSize = false;
     mnMousePositioned       = 0;
     mpDialogImpl            = new DialogImpl;
 
@@ -655,7 +656,7 @@ Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize)
     return Size(w, h);
 }
 
-void Dialog::setInitialLayoutSize()
+void Dialog::setOptimalLayoutSize()
 {
     maLayoutTimer.Stop();
 
@@ -696,7 +697,11 @@ void Dialog::StateChanged( StateChangedType nType )
     if ( nType == STATE_CHANGE_INITSHOW )
     {
         if (isLayoutEnabled())
-            setInitialLayoutSize();
+        {
+            mbIsCalculatingInitialLayoutSize = true;
+            setOptimalLayoutSize();
+            mbIsCalculatingInitialLayoutSize = false;
+        }
 
         if ( GetSettings().GetStyleSettings().GetAutoMnemonic() )
             ImplWindowAutoMnemonic( this );
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index c488e20..4d98640 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1368,7 +1368,7 @@ IMPL_LINK( VclExpander, ClickHdl, DisclosureButton*, pBtn )
         queue_resize();
         Dialog* pResizeDialog = m_bResizeTopLevel ? GetParentDialog() : NULL;
         if (pResizeDialog)
-            pResizeDialog->setInitialLayoutSize();
+            pResizeDialog->setOptimalLayoutSize();
     }
     return 0;
 }
@@ -1645,4 +1645,10 @@ bool isLayoutEnabled(const Window *pWindow)
     return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(WINDOW_NEXT);
 }
 
+bool isInitialLayout(const Window *pWindow)
+{
+    Dialog *pParentDialog = pWindow ? pWindow->GetParentDialog() : NULL;
+    return pParentDialog && pParentDialog->isCalculatingInitialLayoutSize();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx
index fe77313..3a0a745 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -25,6 +25,7 @@
 
 #include <osl/file.hxx>
 #include <vcl/help.hxx>
+#include <vcl/layout.hxx>
 
 
 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
@@ -334,9 +335,12 @@ public:
     virtual void Resize()
     {
         SvxSimpleTable::Resize();
-        const long nControlWidth = GetSizePixel().Width();
-        long aTabLocs[] = { 3, 0, 35*nControlWidth/100, 70*nControlWidth/100 };
-        SvxSimpleTable::SetTabs(aTabLocs, MAP_PIXEL);
+        if (isInitialLayout(this))
+        {
+            const long nControlWidth = GetSizePixel().Width();
+            long aTabLocs[] = { 3, 0, 35*nControlWidth/100, 70*nControlWidth/100 };
+            SvxSimpleTable::SetTabs(aTabLocs, MAP_PIXEL);
+        }
     }
 };
 
commit 69b76536a033cefed8e024557742a9988b949d62
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 6 16:57:29 2013 +0000

    adapt code to use insertnamedialog .ui
    
    Change-Id: I1449b69a4291f1b3cb76f549cb8f1d50e9bc6924

diff --git a/sc/UI_scalc.mk b/sc/UI_scalc.mk
index 9c7e1da..46afc89 100644
--- a/sc/UI_scalc.mk
+++ b/sc/UI_scalc.mk
@@ -12,6 +12,7 @@ $(eval $(call gb_UI_UI,modules/scalc))
 $(eval $(call gb_UI_add_uifiles,modules/scalc,\
 	sc/uiconfig/scalc/ui/cellprotectionpage \
 	sc/uiconfig/scalc/ui/definename \
+	sc/uiconfig/scalc/ui/insertname \
 	sc/uiconfig/scalc/ui/insertsheet \
 	sc/uiconfig/scalc/ui/printeroptions \
 	sc/uiconfig/scalc/ui/sortcriteriapage \
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 9873658..1683d3d 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -420,7 +420,7 @@ public:
 
     virtual AbstractScNameCreateDlg * CreateScNameCreateDlg ( Window * pParent, sal_uInt16 nFlags, int nId ) = 0; //add for ScNameCreateDlg
 
-    virtual AbstractScNamePasteDlg * CreateScNamePasteDlg ( Window * pParent, ScDocShell* pShell, int nId , bool bInsList=true ) = 0; // add for ScNamePasteDlg
+    virtual AbstractScNamePasteDlg * CreateScNamePasteDlg ( Window * pParent, ScDocShell* pShell, bool bInsList=true ) = 0; // add for ScNamePasteDlg
 
     virtual AbstractScPivotFilterDlg * CreateScPivotFilterDlg ( Window* pParent, //add for ScPivotFilterDlg
                                                                 const SfxItemSet&   rArgSet, sal_uInt16 nSourceTab , int nId ) = 0;
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 52d9c58..ca1bfd4 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -1119,21 +1119,10 @@ AbstractScNameCreateDlg * ScAbstractDialogFactory_Impl::CreateScNameCreateDlg (
 
 
 
-AbstractScNamePasteDlg * ScAbstractDialogFactory_Impl::CreateScNamePasteDlg ( Window * pParent, ScDocShell* pShell, int nId , bool bInsList )
+AbstractScNamePasteDlg * ScAbstractDialogFactory_Impl::CreateScNamePasteDlg ( Window * pParent, ScDocShell* pShell, bool bInsList )
 {
-    ScNamePasteDlg * pDlg=NULL;
-    switch ( nId )
-    {
-        case RID_SCDLG_NAMES_PASTE :
-            pDlg = new ScNamePasteDlg( pParent, pShell, bInsList );
-            break;
-        default:
-            break;
-    }
-
-    if ( pDlg )
-        return new AbstractScNamePasteDlg_Impl( pDlg );
-    return 0;
+    ScNamePasteDlg * pDlg = new ScNamePasteDlg( pParent, pShell, bInsList );
+    return new AbstractScNamePasteDlg_Impl( pDlg );
 }
 
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 59390ed..f0cca3d 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -489,7 +489,7 @@ public:
 
     virtual AbstractScNameCreateDlg * CreateScNameCreateDlg ( Window * pParent, sal_uInt16 nFlags, int nId ); //add for ScNameCreateDlg
 
-    virtual AbstractScNamePasteDlg * CreateScNamePasteDlg ( Window * pParent, ScDocShell* pShell, int nId , bool bInsList=true ); //add for ScNamePasteDlg
+    virtual AbstractScNamePasteDlg * CreateScNamePasteDlg ( Window * pParent, ScDocShell* pShell, bool bInsList=true ); //add for ScNamePasteDlg
 
     virtual AbstractScPivotFilterDlg * CreateScPivotFilterDlg ( Window* pParent, //add for ScPivotFilterDlg
                                                                 const SfxItemSet&   rArgSet, sal_uInt16 nSourceTab , int nId );
diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx
index 86bb8cf..933af35 100644
--- a/sc/source/ui/inc/namedlg.hxx
+++ b/sc/source/ui/inc/namedlg.hxx
@@ -69,7 +69,7 @@ private:
     FixedLine       maFlDiv;
     FixedText       maFtInfo;
 
-    ScRangeManagerCtrl maNameMgrCtrl;
+    SvxSimpleTableContainer maNameMgrCtrl;
     ScRangeManagerTable* mpRangeManagerTable;
 
     const rtl::OUString maGlobalNameStr;
diff --git a/sc/source/ui/inc/namemgrtable.hxx b/sc/source/ui/inc/namemgrtable.hxx
index f4c37c8..d82ce5c 100644
--- a/sc/source/ui/inc/namemgrtable.hxx
+++ b/sc/source/ui/inc/namemgrtable.hxx
@@ -26,8 +26,7 @@
  * instead of those above.
  */
 
-#include <svtools/headbar.hxx>
-#include <svtools/svtabbx.hxx>
+#include <svx/simptabl.hxx>
 #include <vcl/ctrl.hxx>
 
 #include "scresid.hxx"
@@ -46,24 +45,13 @@ struct ScRangeNameLine
     rtl::OUString aScope;
 };
 
-/** Implements the Control behind the table
- *  It controls the size of the table
- */
-class ScRangeManagerCtrl : public Control
-{
-public:
-    ScRangeManagerCtrl(Window* pParent, const ScResId& rResId):
-        Control( pParent, rResId) {}
-};
-
 //Implements the table for the manage names dialog
 //TODO: cache the lines for performance improvements
 //otherwise handling of a large set of range names might get extremely slow
 //Need some sort of a filter to handle several range names
-class SC_DLLPUBLIC ScRangeManagerTable : public SvTabListBox
+class SC_DLLPUBLIC ScRangeManagerTable : public SvxSimpleTable
 {
 private:
-    HeaderBar maHeaderBar;
     rtl::OUString maGlobalString;
 
     // should be const because we should not modify it here
@@ -79,10 +67,14 @@ private:
     void CheckForFormulaString();
     const ScRangeData* findRangeData(const ScRangeNameLine& rLine);
 
+    void setColWidths();
+
 public:
-    ScRangeManagerTable( Window* pParent, boost::ptr_map<rtl::OUString, ScRangeName>& aTabRangeNames, const ScAddress& rPos );
+    ScRangeManagerTable( SvxSimpleTableContainer& rParent, boost::ptr_map<rtl::OUString, ScRangeName>& aTabRangeNames, const ScAddress& rPos );
     virtual ~ScRangeManagerTable();
 
+    virtual void Resize();
+
     void addEntry( const ScRangeNameLine& rLine, bool bSetCurEntry = true );
     void DeleteSelectedEntries();
     void SetEntry( const ScRangeNameLine& rLine );
diff --git a/sc/source/ui/inc/namepast.hxx b/sc/source/ui/inc/namepast.hxx
index 4e245c7..ba4098c 100644
--- a/sc/source/ui/inc/namepast.hxx
+++ b/sc/source/ui/inc/namepast.hxx
@@ -37,13 +37,9 @@ class ScNamePasteDlg : public ModalDialog
     DECL_LINK( ButtonHdl, Button * );
 
 private:
-    PushButton      maBtnPasteAll;
-    PushButton      maBtnPaste;
-    HelpButton      maHelpButton;
-    PushButton      maBtnClose;
-    FixedLine       maFlDiv;
-
-    ScRangeManagerCtrl maCtrl;
+    PushButton* m_pBtnPasteAll;
+    PushButton* m_pBtnPaste;
+    PushButton* m_pBtnClose;
 
     ScRangeManagerTable* mpTable;
 
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index 04a44a8..ec102ae 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -125,7 +125,7 @@ void ScNameDlg::Init()
     //init UI
     maFtInfo.SetStyle(WB_VCENTER);
 
-    mpRangeManagerTable = new ScRangeManagerTable(&maNameMgrCtrl, maRangeMap, maCursorPos);
+    mpRangeManagerTable = new ScRangeManagerTable(maNameMgrCtrl, maRangeMap, maCursorPos);
     mpRangeManagerTable->SetSelectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) );
     mpRangeManagerTable->SetDeselectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) );
 
diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx
index 30f4685..7c9ee05 100644
--- a/sc/source/ui/namedlg/namemgrtable.cxx
+++ b/sc/source/ui/namedlg/namemgrtable.cxx
@@ -57,38 +57,29 @@ String createEntryString(const ScRangeNameLine& rLine)
     return aRet;
 }
 
-ScRangeManagerTable::ScRangeManagerTable( Window* pWindow, boost::ptr_map<rtl::OUString, ScRangeName>& rRangeMap, const ScAddress& rPos ):
-    SvTabListBox( pWindow, WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ),
-    maHeaderBar( pWindow, WB_BUTTONSTYLE | WB_BOTTOMBORDER ),
+ScRangeManagerTable::ScRangeManagerTable( SvxSimpleTableContainer& rParent, boost::ptr_map<rtl::OUString, ScRangeName>& rRangeMap, const ScAddress& rPos ):
+    SvxSimpleTable( rParent, WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ),
     maGlobalString( ScGlobal::GetRscString(STR_GLOBAL_SCOPE)),
     mrRangeMap( rRangeMap ),
     maPos( rPos )
 {
-    Size aBoxSize( pWindow->GetOutputSizePixel() );
+    static long aStaticTabs[] = {3, 0, 0, 0 };
+    SetTabs( &aStaticTabs[0], MAP_PIXEL );
 
-    maHeaderBar.SetPosSizePixel( Point(0, 0), Size( aBoxSize.Width(), 16 ) );
+    OUString aNameStr(ScGlobal::GetRscString(STR_HEADER_NAME));
+    OUString aRangeStr(ScGlobal::GetRscString(STR_HEADER_RANGE));
+    OUString aScopeStr(ScGlobal::GetRscString(STR_HEADER_SCOPE));
 
-    String aNameStr(ScGlobal::GetRscString(STR_HEADER_NAME));
-    String aRangeStr(ScGlobal::GetRscString(STR_HEADER_RANGE));
-    String aScopeStr(ScGlobal::GetRscString(STR_HEADER_SCOPE));
-
-    long nTabSize = aBoxSize.Width()/3;
-    maHeaderBar.InsertItem( ITEMID_NAME, aNameStr, nTabSize, HIB_LEFT| HIB_VCENTER );
-    maHeaderBar.InsertItem( ITEMID_RANGE, aRangeStr, nTabSize, HIB_LEFT| HIB_VCENTER );
-    maHeaderBar.InsertItem( ITEMID_SCOPE, aScopeStr, nTabSize, HIB_LEFT| HIB_VCENTER );
-
-    static long nTabs[] = {3, 0, nTabSize, 2*nTabSize };
-    Size aHeadSize( maHeaderBar.GetSizePixel() );
-
-    //pParent->SetFocusControl( this );
-    SetPosSizePixel( Point( 0, aHeadSize.Height() ), Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
-    SetTabs( &nTabs[0], MAP_PIXEL );
-
-    maHeaderBar.SetEndDragHdl( LINK( this, ScRangeManagerTable, HeaderEndDragHdl ) );
+    HeaderBar& rHeaderBar = GetTheHeaderBar();
+    rHeaderBar.InsertItem( ITEMID_NAME, aNameStr, 0, HIB_LEFT| HIB_VCENTER );
+    rHeaderBar.InsertItem( ITEMID_RANGE, aRangeStr, 0, HIB_LEFT| HIB_VCENTER );
+    rHeaderBar.InsertItem( ITEMID_SCOPE, aScopeStr, 0, HIB_LEFT| HIB_VCENTER );
+    rHeaderBar.SetEndDragHdl( LINK( this, ScRangeManagerTable, HeaderEndDragHdl ) );
 
+    setColWidths();
+    UpdateViewSize();
     Init();
-    Show();
-    maHeaderBar.Show();
+    ShowTable();
     SetSelectionMode(MULTIPLE_SELECTION);
     if (GetEntryCount())
     {
@@ -100,6 +91,27 @@ ScRangeManagerTable::ScRangeManagerTable( Window* pWindow, boost::ptr_map<rtl::O
     HeaderEndDragHdl(pNull);
 }
 
+void ScRangeManagerTable::Resize()
+{
+    SvxSimpleTable::Resize();
+    setColWidths();
+}
+
+void ScRangeManagerTable::setColWidths()
+{
+    HeaderBar &rHeaderBar = GetTheHeaderBar();
+    if (rHeaderBar.GetItemCount() < 3)
+        return;
+    long nTabSize = GetSizePixel().Width() / 3;
+    rHeaderBar.SetItemSize( ITEMID_NAME, nTabSize);
+    rHeaderBar.SetItemSize( ITEMID_RANGE, nTabSize);
+    rHeaderBar.SetItemSize( ITEMID_SCOPE, nTabSize);
+    static long aStaticTabs[] = {3, 0, nTabSize, 2*nTabSize };
+    SetTabs( &aStaticTabs[0], MAP_PIXEL );
+    void* pNull = NULL;
+    HeaderEndDragHdl(pNull);
+}
+
 ScRangeManagerTable::~ScRangeManagerTable()
 {
     Clear();
@@ -269,24 +281,25 @@ void CalculateItemSize(const long& rTableSize, long& rItemNameSize, long& rItemR
 
 IMPL_LINK_NOARG(ScRangeManagerTable, HeaderEndDragHdl)
 {
-    long aTableSize = maHeaderBar.GetSizePixel().Width();
-    long aItemNameSize = maHeaderBar.GetItemSize(ITEMID_NAME);
-    long aItemRangeSize = maHeaderBar.GetItemSize(ITEMID_RANGE);
+    HeaderBar& rHeaderBar = GetTheHeaderBar();
+
+    long nTableSize = rHeaderBar.GetSizePixel().Width();
+    long nItemNameSize = rHeaderBar.GetItemSize(ITEMID_NAME);
+    long nItemRangeSize = rHeaderBar.GetItemSize(ITEMID_RANGE);
 
     //calculate column size based on user input and minimum size
-    CalculateItemSize(aTableSize, aItemNameSize, aItemRangeSize);
-    long aItemScopeSize = aTableSize - aItemNameSize - aItemRangeSize;
-
-    Size aSz;
-    aSz.Width() = aItemNameSize;
-    SetTab( ITEMID_NAME, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
-    maHeaderBar.SetItemSize(ITEMID_NAME, aItemNameSize);
-    aSz.Width() += aItemRangeSize;
-    SetTab( ITEMID_RANGE, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
-    maHeaderBar.SetItemSize(ITEMID_RANGE, aItemRangeSize);
-    aSz.Width() += aItemScopeSize;
-    SetTab( ITEMID_SCOPE, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
-    maHeaderBar.SetItemSize(ITEMID_SCOPE, aItemScopeSize);
+    CalculateItemSize(nTableSize, nItemNameSize, nItemRangeSize);
+    long nItemScopeSize = nTableSize - nItemNameSize - nItemRangeSize;
+
+    Size aSz(nItemNameSize, 0);
+    rHeaderBar.SetItemSize(ITEMID_NAME, nItemNameSize);
+    rHeaderBar.SetItemSize(ITEMID_RANGE, nItemRangeSize);
+    rHeaderBar.SetItemSize(ITEMID_SCOPE, nItemScopeSize);
+
+    SetTab(0, 0, MAP_APPFONT );
+    SetTab(1, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
+    aSz.Width() += nItemRangeSize;
+    SetTab(2, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
 
     return 0;
 }
diff --git a/sc/source/ui/namedlg/namepast.cxx b/sc/source/ui/namedlg/namepast.cxx
index 29b0ed2..b2f0544 100644
--- a/sc/source/ui/namedlg/namepast.cxx
+++ b/sc/source/ui/namedlg/namepast.cxx
@@ -35,14 +35,12 @@
 //==================================================================
 
 ScNamePasteDlg::ScNamePasteDlg( Window * pParent, ScDocShell* pShell, bool )
-    : ModalDialog( pParent, ScResId( RID_SCDLG_NAMES_PASTE ) ),
-    maBtnPasteAll    ( this, ScResId( BTN_PASTE_ALL ) ),
-    maBtnPaste       ( this, ScResId( BTN_PASTE ) ),
-    maHelpButton     ( this, ScResId( BTN_HELP ) ),
-    maBtnClose       ( this, ScResId( BTN_CLOSE ) ),
-    maFlDiv          ( this, ScResId( FL_DIV ) ),
-    maCtrl           ( this, ScResId( CTRL_TABLE ) )
+    : ModalDialog( pParent, "InsertNameDialog", "modules/scalc/ui/insertname.ui" )
 {
+    get(m_pBtnPasteAll, "pasteall");
+    get(m_pBtnPaste, "paste");
+    get(m_pBtnClose, "close");
+
     ScDocument* pDoc = pShell->GetDocument();
     std::map<rtl::OUString, ScRangeName*> aCopyMap;
     pDoc->GetRangeNameMap(aCopyMap);
@@ -55,19 +53,22 @@ ScNamePasteDlg::ScNamePasteDlg( Window * pParent, ScDocShell* pShell, bool )
 
     ScViewData* pViewData = pShell->GetViewData();
     ScAddress aPos(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo());
-    mpTable = new ScRangeManagerTable(&maCtrl, maRangeMap, aPos);
+    SvxSimpleTableContainer *pContainer = get<SvxSimpleTableContainer>("ctrl");
+    Size aControlSize(210, 0);
+    aControlSize = LogicToPixel(aControlSize, MAP_APPFONT);
+    pContainer->set_width_request(aControlSize.Width());
+    pContainer->set_height_request(10 * GetTextHeight());
+    mpTable = new ScRangeManagerTable(*pContainer, maRangeMap, aPos);
 
-    maBtnPaste.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl) );
-    maBtnPasteAll.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl));
-    maBtnClose.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl));
+    m_pBtnPaste->SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl) );
+    m_pBtnPasteAll->SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl));
+    m_pBtnClose->SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl));
 
     if (!mpTable->GetEntryCount())
     {
-        maBtnPaste.Disable();
-        maBtnPasteAll.Disable();
+        m_pBtnPaste->Disable();
+        m_pBtnPasteAll->Disable();
     }
-
-    FreeResource();
 }
 
 ScNamePasteDlg::~ScNamePasteDlg()
@@ -79,11 +80,11 @@ ScNamePasteDlg::~ScNamePasteDlg()
 
 IMPL_LINK( ScNamePasteDlg, ButtonHdl, Button *, pButton )
 {
-    if( pButton == &maBtnPasteAll )
+    if( pButton == m_pBtnPasteAll )
     {
         EndDialog( BTN_PASTE_LIST );
     }
-    else if( pButton == &maBtnPaste )
+    else if( pButton == m_pBtnPaste )
     {
         std::vector<ScRangeNameLine> aSelectedLines = mpTable->GetSelectedEntries();
         for (std::vector<ScRangeNameLine>::const_iterator itr = aSelectedLines.begin();
@@ -93,7 +94,7 @@ IMPL_LINK( ScNamePasteDlg, ButtonHdl, Button *, pButton )
         }
         EndDialog( BTN_PASTE_NAME );
     }
-    else if( pButton == &maBtnClose )
+    else if( pButton == m_pBtnClose )
     {
         EndDialog( BTN_PASTE_CLOSE );
     }
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index c32ed5d..93353d6 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1995,7 +1995,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
                 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-                AbstractScNamePasteDlg* pDlg = pFact->CreateScNamePasteDlg( pTabViewShell->GetDialogParent(), GetViewData()->GetDocShell(), RID_SCDLG_NAMES_PASTE );
+                AbstractScNamePasteDlg* pDlg = pFact->CreateScNamePasteDlg( pTabViewShell->GetDialogParent(), GetViewData()->GetDocShell() );
                 OSL_ENSURE(pDlg, "Dialog create fail!");
                 switch( pDlg->Execute() )
                 {
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 4a9a149..20c33ce 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -399,7 +399,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
                 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
                 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-                AbstractScNamePasteDlg* pDlg = pFact->CreateScNamePasteDlg( pViewData->GetDialogParent(), pViewData->GetDocShell(), RID_SCDLG_NAMES_PASTE, false );
+                AbstractScNamePasteDlg* pDlg = pFact->CreateScNamePasteDlg( pViewData->GetDialogParent(), pViewData->GetDocShell(), false );
                 OSL_ENSURE(pDlg, "Dialog create fail!");
                 short nRet = pDlg->Execute();
                 // pDlg is needed below
diff --git a/sc/uiconfig/scalc/ui/insertname.ui b/sc/uiconfig/scalc/ui/insertname.ui
index 5986ec7..c4e8e33 100644
--- a/sc/uiconfig/scalc/ui/insertname.ui
+++ b/sc/uiconfig/scalc/ui/insertname.ui
@@ -1,78 +1,42 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkAction" id="action1"/>
-  <object class="GtkWindow" id="Paste Names">
+  <object class="GtkDialog" id="InsertNameDialog">
     <property name="can_focus">False</property>
-    <child>
-      <object class="GtkBox" id="box1">
-        <property name="visible">True</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Paste Names</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">6</property>
-        <child>
-          <object class="GtkBox" id="box4">
-            <property name="visible">True</property>
+        <property name="spacing">12</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
+            <property name="layout_style">end</property>
             <child>
-              <object class="GtkBox" id="box5">
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="spacing">100</property>
-                <child>
-                  <object class="GtkLabel" id="label1">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Name</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label2">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Range</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label3">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Scope</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">0</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkScrolledWindow" id="scrolledwindow1">
+              <object class="GtkButton" id="pasteall">
+                <property name="label" translatable="yes">_Paste All</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="shadow_type">in</property>
-                <child>
-                  <placeholder/>
-                </child>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -80,34 +44,26 @@
                 <property name="position">1</property>
               </packing>
             </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkBox" id="box2">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <child>
-              <object class="GtkButton" id="button1">
-                <property name="label" translatable="yes">_Paste All</property>
+              <object class="GtkButton" id="paste">
+                <property name="label">gtk-paste</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_underline">True</property>
+                <property name="use_stock">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">0</property>
+                <property name="pack_type">end</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="paste">
-                <property name="label">gtk-paste</property>
+              <object class="GtkButton" id="close">
+                <property name="label">gtk-close</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -117,68 +73,37 @@
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="pack_type">end</property>
-                <property name="position">1</property>
+                <property name="position">3</property>
               </packing>
             </child>
           </object>
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkSeparator" id="separator1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
           </packing>
         </child>
         <child>
-          <object class="GtkBox" id="box3">
+          <object class="svxcorelo-SvxSimpleTableContainer" id="ctrl">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <child>
-              <object class="GtkButton" id="help">
-                <property name="label">gtk-help</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="close">
-                <property name="label">gtk-close</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="pack_type">end</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
           </object>
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">3</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </object>
     </child>
+    <action-widgets>
+      <action-widget response="0">help</action-widget>
+      <action-widget response="0">pasteall</action-widget>
+      <action-widget response="0">paste</action-widget>
+      <action-widget response="0">close</action-widget>
+    </action-widgets>
   </object>
 </interface>
commit b42ea2ad00895ef63a60f82e9159f4e21e946120
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 6 16:56:12 2013 +0000

    add stock button text for paste, and map to gtk-paste
    
    Change-Id: I38a49ccc744060271be77c9eba2e6bd300630092

diff --git a/vcl/inc/svids.hrc b/vcl/inc/svids.hrc
index d97b0b4..d7d42af 100644
--- a/vcl/inc/svids.hrc
+++ b/vcl/inc/svids.hrc
@@ -160,6 +160,7 @@
 #define SV_BUTTONTEXT_OK_NOMNEMONIC         10119
 #define SV_BUTTONTEXT_CANCEL_NOMNEMONIC     10120
 #define SV_BUTTONTEXT_UNDO                  10121
+#define SV_BUTTONTEXT_PASTE                 10122
 
 #define SV_STDTEXT_FIRST                    SV_STDTEXT_SERVICENOTAVAILABLE
 #define SV_STDTEXT_SERVICENOTAVAILABLE      10210
diff --git a/vcl/source/src/btntext.src b/vcl/source/src/btntext.src
index e605895..5883119 100644
--- a/vcl/source/src/btntext.src
+++ b/vcl/source/src/btntext.src
@@ -127,5 +127,10 @@ String SV_BUTTONTEXT_SAVE
 
 String SV_BUTTONTEXT_UNDO
 {
-    Text [ en-US ] = "~Undo " ;
+    Text [ en-US ] = "~Undo" ;
+};
+
+String SV_BUTTONTEXT_PASTE
+{
+    Text [ en-US ] = "~Paste" ;
 };
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 58afbe4..9355c9e 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -580,6 +580,8 @@ namespace
             return (VclResId(SV_BUTTONTEXT_SAVE).toString());
         else if (rType == "gtk-undo")
             return (VclResId(SV_BUTTONTEXT_UNDO).toString());
+        else if (rType == "gtk-paste")
+            return (VclResId(SV_BUTTONTEXT_PASTE).toString());
         SAL_WARN("vcl.layout", "unknown stock type: " << rType.getStr());
         return OUString();
     }


More information about the Libreoffice-commits mailing list