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

Efe Gürkan YALAMAN efeyalaman at gmail.com
Mon Sep 9 07:53:30 PDT 2013


 cui/source/options/optaboutconfig.cxx     |  311 +++++++++++++++++++++---------
 cui/source/options/optaboutconfig.hxx     |   41 ++-
 cui/uiconfig/ui/aboutconfigvaluedialog.ui |    5 
 3 files changed, 250 insertions(+), 107 deletions(-)

New commits:
commit ebf0a4d1e338201c09620752f8fdf32dc6580427
Author: Efe Gürkan YALAMAN <efeyalaman at gmail.com>
Date:   Sat Aug 31 02:05:23 2013 +0300

    Various improvements Expert Config
    
    Loads all options now in a plausibletime.
    Handles all short, long, hyper, double and float types.
    Also handles []hyper type. Also using a custom edit widget for prevent
    errors for integer types.
    
    Change-Id: Idb4f2cb49381e7f92e27a5e89107d48a334f0a26

diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index e6809e7..a1213d0 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -9,6 +9,7 @@
 
 #include "optaboutconfig.hxx"
 #include "optHeaderTabListbox.hxx"
+
 #include <svtools/svlbitm.hxx>
 #include <svtools/treelistentry.hxx>
 #include <comphelper/processfactory.hxx>
@@ -29,6 +30,10 @@ using namespace ::com::sun::star;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::container;
 
+#define SHORT_LEN_LIMIT     7
+#define LONG_LEN_LIMIT      11
+#define HYPER_LEN_LIMIT     20
+
 #define ITEMID_PREFNAME     1
 #define ITEMID_PROPERTY     2
 #define ITEMID_TYPE         3
@@ -44,32 +49,66 @@ struct Prop_Impl
         : Name( sName )
         , Property( sProperty )
         , Value( aValue )
-    {
-    }
+    {}
 };
 
-CuiAboutConfigTabPage::CuiAboutConfigTabPage( Window* pParent, const SfxItemSet& rItemSet )
-    :SfxTabPage( pParent, "AboutConfig", "cui/ui/aboutconfigdialog.ui", rItemSet)
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeCuiCustomMultilineEdit(Window *pParent, VclBuilder::stringmap &)
 {
-    get(m_pDefaultBtn,"default");
-    get(m_pEditBtn, "edit");
+    return new CuiCustomMultilineEdit(pParent, WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK);
+}
+
+
+void CuiCustomMultilineEdit::KeyInput( const KeyEvent& rKeyEvent )
+{
+    OUString aText;
+
+    bool bValid;
+    bool bNonSpace = rKeyEvent.GetKeyCode().GetCode() != KEY_SPACE;
+    if( bNumericOnly && bNonSpace )
+    {
+        const KeyCode& rKeyCode = rKeyEvent.GetKeyCode();
+        sal_uInt16 nGroup = rKeyCode.GetGroup();
+        sal_uInt16 nKey = rKeyCode.GetCode();
+        bValid = ( KEYGROUP_NUM == nGroup || KEYGROUP_CURSOR == nGroup ||
+                 ( KEYGROUP_MISC == nGroup &&
+                 ( nKey == KEY_SUBTRACT || nKey == KEY_COMMA || nKey == KEY_POINT
+                   || nKey < KEY_ADD || nKey > KEY_EQUAL ) ) );
+        if ( !bValid && ( rKeyCode.IsMod1() && (
+             KEY_A == nKey || KEY_C == nKey || KEY_V == nKey || KEY_X == nKey || KEY_Z == nKey ) ) )
+            bValid = sal_True;
+    }
+    else
+        bValid = sal_True;
+    if( bValid )
+        Edit::KeyInput( rKeyEvent );
+}
 
-    m_pPrefCtrl = get<SvSimpleTableContainer>("preferences");
+void CuiCustomMultilineEdit::setBehaviour( bool bNumeric, int nLimit )
+{
+    bNumericOnly = bNumeric;
+    SetMaxTextLen(nLimit);
+}
 
+CuiAboutConfigTabPage::CuiAboutConfigTabPage( Window* pParent, const SfxItemSet& rItemSet ) :
+    SfxTabPage( pParent, "AboutConfig", "cui/ui/aboutconfigdialog.ui", rItemSet),
+    m_pPrefCtrl( get<SvSimpleTableContainer>("preferences") ),
+    m_pDefaultBtn( get<PushButton>("default") ),
+    m_pEditBtn( get<PushButton>("edit") ),
+    m_vectorOfModified(),
+    m_pPrefBox( new OptHeaderTabListBox( *m_pPrefCtrl,
+                                         WB_SCROLL | WB_HSCROLL | WB_VSCROLL ) )
+{
     Size aControlSize(200,200);
     m_pPrefCtrl->set_width_request(aControlSize.Width());
     m_pPrefCtrl->set_height_request(aControlSize.Height());
 
-    WinBits nBits = WB_SCROLL | WB_SORT | WB_HSCROLL | WB_VSCROLL;
-    pPrefBox = new svx::OptHeaderTabListBox( *m_pPrefCtrl, nBits );
-
     m_pEditBtn->SetClickHdl( LINK( this, CuiAboutConfigTabPage, StandardHdl_Impl ) );
 
-    HeaderBar &rBar = pPrefBox->GetTheHeaderBar();
-    rBar.InsertItem( ITEMID_PREFNAME, get<FixedText>("preference")->GetText(), 0, HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_UPARROW);
-    rBar.InsertItem( ITEMID_PROPERTY, get<FixedText>("property")->GetText(), 0,  HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_UPARROW );
-    rBar.InsertItem( ITEMID_TYPE, get<FixedText>("type")->GetText(), 0,  HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_UPARROW );
-    rBar.InsertItem( ITEMID_VALUE, get<FixedText>("value")->GetText(), 0,  HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_UPARROW );
+    HeaderBar &rBar = m_pPrefBox->GetTheHeaderBar();
+    rBar.InsertItem( ITEMID_PREFNAME, get<FixedText>("preference")->GetText(), 0, HIB_LEFT | HIB_VCENTER );
+    rBar.InsertItem( ITEMID_PROPERTY, get<FixedText>("property")->GetText(), 0,  HIB_LEFT | HIB_VCENTER );
+    rBar.InsertItem( ITEMID_TYPE, get<FixedText>("type")->GetText(), 0,  HIB_LEFT | HIB_VCENTER );
+    rBar.InsertItem( ITEMID_VALUE, get<FixedText>("value")->GetText(), 0,  HIB_LEFT | HIB_VCENTER );
 
     long aTabs[] = {4,120,50,50,50};//TODO: Not works correctly hardcoded for now.
 
@@ -77,13 +116,7 @@ CuiAboutConfigTabPage::CuiAboutConfigTabPage( Window* pParent, const SfxItemSet&
     aTabs[3] += aTabs[2] + 160; //rBar.GetTextWidth(rBar.GetItemText(2));
     aTabs[4] += aTabs[3] + 40; //rBar.GetTextWidth(rBar.GetItemText(3));
 
-    pPrefBox->SetTabs(aTabs, MAP_PIXEL);
-
-}
-
-CuiAboutConfigTabPage::~CuiAboutConfigTabPage()
-{
-    delete pPrefBox;
+    m_pPrefBox->SetTabs(aTabs, MAP_PIXEL);
 }
 
 SfxTabPage* CuiAboutConfigTabPage::Create( Window* pParent, const SfxItemSet& rItemSet )
@@ -101,45 +134,33 @@ void CuiAboutConfigTabPage::InsertEntry( OUString& rProp, OUString&  rStatus, OU
     pEntry->AddItem( new SvLBoxString( pEntry, 0, rType));
     pEntry->AddItem( new SvLBoxString( pEntry, 0, rValue));
 
-    pPrefBox->Insert( pEntry );
+    m_pPrefBox->Insert( pEntry );
 }
 
 void CuiAboutConfigTabPage::Reset( const SfxItemSet& )
 {
-    OUString sRootNodePath = "/";
-    pPrefBox->Clear();
+    OUString sRootNodePath = "";
+    m_pPrefBox->Clear();
 
-    VectorOfModified.clear();
+    m_vectorOfModified.clear();
+    m_pPrefBox->GetModel()->SetSortMode( SortNone );
 
     m_pDefaultBtn->Enable(sal_False);
-    //m_pEditBtn->Enable(sal_False);
 
-    const char* entries[] = {
-           "/org.openoffice.Office.Common",
-           "/org.openoffice.Office.Math",
-           "/org.openoffice.Office.Addons" };
-
-    for (size_t nInd = 0; nInd < SAL_N_ELEMENTS(entries); ++nInd )
-    {
-        sRootNodePath = OUString::createFromAscii( entries[nInd] );
-        Reference< XNameAccess > xConfigAccess = getConfigAccess( sRootNodePath, sal_False );
-        FillItems( xConfigAccess, sRootNodePath );
-    }
+    m_pPrefBox->SetUpdateMode(sal_False);
+    Reference< XNameAccess > xConfigAccess = getConfigAccess( sRootNodePath, sal_False );
+    FillItems( xConfigAccess, sRootNodePath );
+    m_pPrefBox->SetUpdateMode(sal_True);
 }
 
 sal_Bool CuiAboutConfigTabPage::FillItemSet( SfxItemSet& )
 {
     sal_Bool bModified = sal_False;
     Reference< XNameAccess > xUpdateAccess = getConfigAccess( "/", sal_True );
-    //Reference< XNameReplace > xNameReplace( xUpdateAccess, UNO_QUERY_THROW );
-
-    //if( !xNameReplace.is() )
-        //return bModified;
 
-    for( size_t nInd = 0; nInd < VectorOfModified.size(); ++nInd )
+    for( size_t nInd = 0; nInd < m_vectorOfModified.size(); ++nInd )
     {
-        //beans::NamedValue aNamedValue = VectorOfModified[ nInd ];
-        Prop_Impl* aNamedValue = VectorOfModified[ nInd ];
+        Prop_Impl* aNamedValue = m_vectorOfModified[ nInd ];
 
         xUpdateAccess = getConfigAccess( aNamedValue->Name , sal_True );
         Reference< XNameReplace > xNameReplace( xUpdateAccess, UNO_QUERY_THROW );
@@ -153,7 +174,6 @@ sal_Bool CuiAboutConfigTabPage::FillItemSet( SfxItemSet& )
     xChangesBatch->commitChanges();
 
     return bModified;
-
 }
 
 void CuiAboutConfigTabPage::FillItems( Reference< XNameAccess >xNameAccess, OUString sPath)
@@ -162,7 +182,6 @@ void CuiAboutConfigTabPage::FillItems( Reference< XNameAccess >xNameAccess, OUSt
 
     Reference< XHierarchicalNameAccess > xHierarchicalNameAccess( xNameAccess, uno::UNO_QUERY_THROW );
 
-    pPrefBox->SetUpdateMode(sal_False);
 
     uno::Sequence< OUString > seqItems = xNameAccess->getElementNames();
     for( sal_Int16 i = 0; i < seqItems.getLength(); ++i )
@@ -186,7 +205,7 @@ void CuiAboutConfigTabPage::FillItems( Reference< XNameAccess >xNameAccess, OUSt
 
         if( bIsLeafNode )
         {
-            Any aProp = xHierarchicalNameAccess->getByHierarchicalName(seqItems[i]); //xProperty->getAsProperty();
+            Any aProp = xHierarchicalNameAccess->getByHierarchicalName(seqItems[i]);
 
             OUString sValue;
             if( aProp.hasValue() )
@@ -240,7 +259,7 @@ void CuiAboutConfigTabPage::FillItems( Reference< XNameAccess >xNameAccess, OUSt
                             uno::Sequence<sal_Int32> seqLong;
                             if( aProp >>= seqLong )
                             {
-                                for(sal_Int16 nInd=0;  nInd < seqLong.getLength(); ++nInd)
+                                for(int nInd=0;  nInd < seqLong.getLength(); ++nInd)
                                 {
                                     OUString sNumber( OUString::number(seqLong[nInd]) );
                                     sValue += sNumber;
@@ -260,23 +279,43 @@ void CuiAboutConfigTabPage::FillItems( Reference< XNameAccess >xNameAccess, OUSt
                                 }
                             }
                         }
+
+                        if( OUString("[]hyper") == aProp.getValueTypeName() )
+                        {
+                            uno::Sequence< sal_Int64 > seqHyp;
+                            if( aProp >>= seqHyp )
+                            {
+                                for(int nInd = 0; nInd < seqHyp.getLength(); ++nInd)
+                                {
+                                    OUString sHyper( OUString::number( seqHyp[nInd] ) );
+                                    sValue += sHyper;
+                                    sValue += OUString(",");
+                                }
+                            }
+                        }
                     }
                     break;
 
                     default:
                     {
-                        sValue = OUString("");
+                        if( OUString("hyper") == aProp.getValueTypeName() )
+                        {
+                            sal_Int64 nHyp = 0;
+                            if(aProp >>= nHyp)
+                            {
+                                OUString aHyp( OUString::number( nHyp ) );
+                                sValue = aHyp;
+                            }
+                        }else
+                            sValue = OUString("");
                     }
                 }
             }
 
             OUString sType = aProp.getValueTypeName();
-            //OUString sPrefName = sPath + OUString("-") + seqItems[i] ;
             InsertEntry( sPath, seqItems [ i ], sType, sValue);
         }
     }
-
-    pPrefBox->SetUpdateMode(sal_True);
 }
 
 Reference< XNameAccess > CuiAboutConfigTabPage::getConfigAccess( OUString sNodePath, sal_Bool bUpdate )
@@ -286,6 +325,8 @@ Reference< XNameAccess > CuiAboutConfigTabPage::getConfigAccess( OUString sNodeP
     uno::Reference< lang::XMultiServiceFactory > xConfigProvider(
                 com::sun::star::configuration::theDefaultProvider::get( xContext  ) );
 
+    if( sNodePath == OUString("") )
+        sNodePath = OUString("/");
     beans::NamedValue aProperty;
     aProperty.Name = "nodepath";
     aProperty.Value = uno::makeAny( sNodePath );
@@ -308,56 +349,82 @@ Reference< XNameAccess > CuiAboutConfigTabPage::getConfigAccess( OUString sNodeP
     return xNameAccess;
 }
 
-//void CuiAboutConfigTabPage::AddToModifiedVector( beans::NamedValue& rProp )
 void CuiAboutConfigTabPage::AddToModifiedVector( Prop_Impl* rProp )
 {
     bool isModifiedBefore = false;
     //Check if value modified before
-    for( size_t nInd = 0; nInd < VectorOfModified.size() ; ++nInd )
+    for( size_t nInd = 0; nInd < m_vectorOfModified.size() ; ++nInd )
     {
-        if( rProp->Name == VectorOfModified[nInd]->Name && rProp->Value == VectorOfModified[nInd]->Value )
+        if( rProp->Name == m_vectorOfModified[nInd]->Name && rProp->Value == m_vectorOfModified[nInd]->Value )
         {
             //property modified before. assing reference to the modified value
             //do your changes on this object. They will be saved later.
-            VectorOfModified[nInd] = rProp;
+            m_vectorOfModified[nInd] = rProp;
             isModifiedBefore = true;
             break;
         }
     }
 
     if( !isModifiedBefore )
-    {
-        VectorOfModified.push_back( rProp );
-    }
+        m_vectorOfModified.push_back( rProp );
     //property is not modified be
 }
 
-CuiAboutConfigValueDialog::CuiAboutConfigValueDialog( Window* pWindow, const OUString& rValue )
-    :ModalDialog( pWindow, "AboutConfigValueDialog", "cui/ui/aboutconfigvaluedialog.ui" )
+CuiAboutConfigValueDialog::CuiAboutConfigValueDialog( Window* pWindow,
+                                                      const OUString& rValue,
+                                                      int limit ) :
+    ModalDialog( pWindow, "AboutConfigValueDialog", "cui/ui/aboutconfigvalue   dialog.ui" ),
+    m_pEDValue( get<CuiCustomMultilineEdit>("valuebox") )
 {
-    get(m_pEDValue, "valuebox");
-
+    if( limit != 0)
+    {
+        //numericonly, limit
+        m_pEDValue->setBehaviour( true, limit );
+    }
+    else if ( limit == 0 )
+        m_pEDValue->setBehaviour( false, EDIT_NOLIMIT );
     m_pEDValue->SetText( rValue );
 
 }
 
-CuiAboutConfigValueDialog::~CuiAboutConfigValueDialog()
+IMPL_LINK( CuiAboutConfigTabPage, HeaderSelect_Impl, HeaderBar*, /*pBar*/ )
 {
+    return 0;
 }
 
+    //if ( pBar && pBar->GetCurItemId() != ITEMID_TYPE )
+        //return 0;
+
+    //HeaderBarItemBits nBits = pBar->GetItemBits(ITEMID_TYPE);
+    //sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
+    //SvSortMode eMode = SortAscending;
+
+    //if ( bUp )
+    //{
+        //nBits &= ~HIB_UPARROW;
+        //nBits |= HIB_DOWNARROW;
+        //eMode = SortDescending;
+    //}
+    //else
+    //{
+        //nBits &= ~HIB_DOWNARROW;
+        //nBits |= HIB_UPARROW;
+    //}
+    //pBar->SetItemBits( ITEMID_TYPE, nBits );
+    //SvTreeList* pModel = m_pPrefBox->GetModel();
+    //pModel->SetSortMode( eMode );
+    //pModel->Resort();
+    //return 1;
+    //}
+
 IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl )
 {
-    SvTreeListEntry* pEntry = pPrefBox->FirstSelected();
-
-    OUString sPropertyPath = pPrefBox->GetEntryText( pEntry, 0 );
-    OUString sPropertyName = pPrefBox->GetEntryText( pEntry, 1 );
-    OUString sPropertyType = pPrefBox->GetEntryText( pEntry, 2 );
-    OUString sPropertyValue = pPrefBox->GetEntryText( pEntry, 3 );
-
-
-    //beans::NamedValue aProperty;
+    SvTreeListEntry* pEntry = m_pPrefBox->FirstSelected();
 
-    //aProperty.Name = sPropertyPath + OUString("/") + sPropertyName;
+    OUString sPropertyPath = m_pPrefBox->GetEntryText( pEntry, 0 );
+    OUString sPropertyName = m_pPrefBox->GetEntryText( pEntry, 1 );
+    OUString sPropertyType = m_pPrefBox->GetEntryText( pEntry, 2 );
+    OUString sPropertyValue = m_pPrefBox->GetEntryText( pEntry, 3 );
 
     Prop_Impl* pProperty = new Prop_Impl( sPropertyPath, sPropertyName, makeAny( sPropertyValue ) );
 
@@ -381,39 +448,99 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl )
 
         pProperty->Value = uno::makeAny( bValue );
         bOpenDialog = false;
-    }else// if ( sPropertyType == OUString( "string" ) )
+    }
+    else// if ( sPropertyType == OUString( "string" ) )
     {
         //TODO: handle void etc.
         sDialogValue = sPropertyValue;
         bOpenDialog = true;
     }
 
-
-    if( bOpenDialog )
+    try
     {
-        CuiAboutConfigValueDialog* pValueDialog = new CuiAboutConfigValueDialog(0, sDialogValue);
-
-        bool ret = pValueDialog->Execute();
-        if( ret == RET_OK )
+        if( bOpenDialog )
         {
-            sNewValue = pValueDialog->getValue();
-            //TODO: parse the value according to the type?
-            pProperty->Value = uno::makeAny( sNewValue );
-            AddToModifiedVector( pProperty );
+            //Cosmetic length limit for integer values.
+            int limit=0;
+            if( sPropertyType == OUString("short") )
+                limit = SHORT_LEN_LIMIT;
+            else if( sPropertyType == OUString("long") )
+                limit = LONG_LEN_LIMIT;
+            else if( sPropertyType == OUString("hyper") )
+                limit = HYPER_LEN_LIMIT;
+
+            CuiAboutConfigValueDialog* pValueDialog = new CuiAboutConfigValueDialog(0, sDialogValue, limit);
+
+            bool ret = pValueDialog->Execute();
+            if( ret == RET_OK )
+            {
+                sNewValue = pValueDialog->getValue();
+                if ( sPropertyType == OUString("short"))
+                {
+                    sal_Int16 nShort;
+                    sal_Int32 nNumb = sNewValue.toInt32();
+
+                    //if the value is 0 and length is not 1, there is something wrong
+                    if( !( nNumb==0 && sNewValue.getLength()!=1 ) && nNumb < SAL_MAX_INT16 && nNumb > SAL_MIN_INT16)
+                        nShort = (sal_Int16) nNumb;
+                    else
+                        throw uno::Exception();
+                    pProperty->Value = uno::makeAny( nShort );
+                }
+                else
+                    if( sPropertyType == OUString("long"))
+                    {
+                        sal_Int32 nLong = sNewValue.toInt32();
+                        if( !( nLong==0 && sNewValue.getLength()!=1 ) && nLong < SAL_MAX_INT32 && nLong > SAL_MIN_INT32)
+                            pProperty->Value = uno::makeAny( nLong );
+                        else
+                            throw uno::Exception();
+                    }
+                    else if( sPropertyType == OUString("hyper"))
+                    {
+                        sal_Int64 nHyper = sNewValue.toInt64();
+                        if( !( nHyper==0 && sNewValue.getLength()!=1 ) && nHyper < SAL_MAX_INT32 && nHyper > SAL_MIN_INT32)
+                            pProperty->Value = uno::makeAny( nHyper );
+                        else
+                            throw uno::Exception();
+                    }
+                    else if( sPropertyType == OUString("double"))
+                    {
+                        double nDoub;
+                        if( !( nDoub ==0 && sNewValue.getLength()!=1 ) && nDoub < SAL_MAX_INT32 && nDoub > SAL_MIN_INT32)
+                            pProperty->Value = uno::makeAny( nDoub );
+                        else
+                            throw uno::Exception();
+                    }
+                    else if( sPropertyType == OUString("float"))
+                    {
+                        float nFloat;
+                        if( !( nFloat ==0 && sNewValue.getLength()!=1 ) && nFloat < SAL_MAX_INT32 && nFloat > SAL_MIN_INT32)
+                            pProperty->Value = uno::makeAny( nFloat );
+                        else
+                            throw uno::Exception();
+                    }
+                    else
+                        pProperty->Value = uno::makeAny( sNewValue );
 
-            sDialogValue = sNewValue;
+                AddToModifiedVector( pProperty );
+                sDialogValue = sNewValue;
+            }
+            else
+                delete pProperty;
         }
         else
             delete pProperty;
+
+        //update listbox value.
+        m_pPrefBox->SetEntryText( sDialogValue,  pEntry, 3 );
     }
-    else
+    catch( uno::Exception& )
+    {
         delete pProperty;
-
-    pPrefBox->SetEntryText( sDialogValue,  pEntry, 3 );
-    //TODO:update listbox value.
+    }
 
     return 0;
-
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx
index d0b9e28..7a706f5 100644
--- a/cui/source/options/optaboutconfig.hxx
+++ b/cui/source/options/optaboutconfig.hxx
@@ -10,22 +10,37 @@
 #ifndef INCLUDED_CUI_OPTABOUTCONFIG_HXX
 #define INCLUDED_CUI_OPTABOUTCONFIG_HXX
 
-#include <sfx2/tabdlg.hxx>
-#include <svtools/simptabl.hxx>
-#include "optHeaderTabListbox.hxx"
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/beans/NamedValue.hpp>
+
+#include <sfx2/tabdlg.hxx>
+#include <svtools/simptabl.hxx>
 #include <vcl/edit.hxx>
+
 #include <vector>
+#include <boost/scoped_ptr.hpp>
 
-namespace svx
-{
-    class OptHeaderTabListBox;
-}
+namespace svx { class OptHeaderTabListBox; }
 class CuiAboutConfigTabPage;
 class CuiAboutConfigValueDialog;
 struct Prop_Impl;
 
+class CuiCustomMultilineEdit : public Edit
+{
+private:
+    bool bNumericOnly;
+
+public:
+    CuiCustomMultilineEdit( Window* pParent, WinBits nStyle )
+        : Edit( pParent, nStyle )
+        , bNumericOnly(false)
+    {}
+
+    virtual void KeyInput( const KeyEvent& rKeyEvent );
+    //virtual void Modify();
+    void setBehaviour( bool bNumeric, int nLengthLimit);
+};
+
 class CuiAboutConfigTabPage : public SfxTabPage
 {
 private:
@@ -33,14 +48,15 @@ private:
     PushButton* m_pDefaultBtn;
     PushButton* m_pEditBtn;
 
-    std::vector< Prop_Impl* > VectorOfModified;
+    std::vector< Prop_Impl* > m_vectorOfModified;
+    boost::scoped_ptr< svx::OptHeaderTabListBox > m_pPrefBox;
 
-    ::svx::OptHeaderTabListBox* pPrefBox;
     CuiAboutConfigTabPage( Window* pParent, const SfxItemSet& rItemSet );
-    ~CuiAboutConfigTabPage();
     void AddToModifiedVector( Prop_Impl* rProp );
 
+    DECL_LINK( HeaderSelect_Impl, HeaderBar * );
     DECL_LINK( StandardHdl_Impl, void * );
+
 public:
    static SfxTabPage* Create( Window* pParent, const SfxItemSet& rItemset );
 
@@ -54,11 +70,10 @@ public:
 class CuiAboutConfigValueDialog : public ModalDialog
 {
 private:
-    VclMultiLineEdit*    m_pEDValue;
+    CuiCustomMultilineEdit* m_pEDValue;
 
 public:
-    CuiAboutConfigValueDialog( Window* pWindow, const OUString& rValue );
-    ~CuiAboutConfigValueDialog();
+    CuiAboutConfigValueDialog( Window* pWindow, const OUString& rValue , int limit = 0);
 
     OUString getValue()
     {
diff --git a/cui/uiconfig/ui/aboutconfigvaluedialog.ui b/cui/uiconfig/ui/aboutconfigvaluedialog.ui
index b00c062..e6ce50b 100644
--- a/cui/uiconfig/ui/aboutconfigvaluedialog.ui
+++ b/cui/uiconfig/ui/aboutconfigvaluedialog.ui
@@ -69,6 +69,7 @@
         </child>
         <child>
           <object class="GtkBox" id="box1">
+            <property name="width_request">500</property>
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="hexpand">True</property>
@@ -88,7 +89,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkTextView" id="valuebox">
+              <object class="cuilo-CuiCustomMultilineEdit" id="valuebox">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="vexpand">True</property>
@@ -96,7 +97,7 @@
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="fill">True</property>
+                <property name="fill">False</property>
                 <property name="position">1</property>
               </packing>
             </child>


More information about the Libreoffice-commits mailing list