ooo-build r12961 - in trunk: . patches/dev300



Author: noelpwer
Date: Wed Jun 25 10:04:10 2008
New Revision: 12961
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12961&view=rev

Log:
2008-06-25  Noel Power  <noel power novell com>

        * patches/dev300/apply:
        * patches/dev300/dialog-groupname-persist.diff: persist the 
        groupname for radiobuttons in basic dialogs i#54689



Added:
   trunk/patches/dev300/dialog-groupname-persist.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Wed Jun 25 10:04:10 2008
@@ -516,9 +516,11 @@
 [ RadioButtons ]
 # Add a GroupName property to RadioButtons so that RadioButtons don't need to
 # share the same name to be part of the same group.
-forms-radio-button-group-names.diff, n#310052, jonp
-# depends on forms-radio-button-group-names.diff above ( needs bug id too )
-xl-import-formradiobutton.diff, noelpwer
+forms-radio-button-group-names.diff, n#310052, i#54689,jonp
+# depends on forms-radio-button-group-names.diff,
+xl-import-formradiobutton.diff, noelpwer, i#54689
+# persist the groupname for basic dialogs also
+dialog-groupname-persist.diff, noelpwer, i#54689
 
 [ SELinux ]
 # make OOo work under SELinux

Added: trunk/patches/dev300/dialog-groupname-persist.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/dialog-groupname-persist.diff	Wed Jun 25 10:04:10 2008
@@ -0,0 +1,369 @@
+Index: xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+===================================================================
+RCS file: /cvs/script/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx,v
+retrieving revision 1.38
+diff -u -p -r1.38 xmldlg_expmodels.cxx
+--- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx	11 Apr 2008 12:33:44 -0000	1.38
++++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx	24 Jun 2008 15:57:23 -0000
+@@ -388,6 +388,8 @@ void ElementDescriptor::readRadioButtonM
+                            OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
+     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
++    readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
++                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":group-name") ) );
+ 
+     sal_Int16 nState = 0;
+     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
+Index: xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+===================================================================
+RCS file: /cvs/script/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx,v
+retrieving revision 1.44
+diff -u -p -r1.44 xmldlg_impmodels.cxx
+--- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx	11 Apr 2008 12:34:21 -0000	1.44
++++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx	24 Jun 2008 15:57:23 -0000
+@@ -1377,6 +1377,9 @@ void TitledBoxElement::endElement()
+         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+                                    OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
+                                    xAttributes );
++        ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
++                                  OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
++                                  xAttributes );
+ 		
+ 		sal_Int16 nVal = 0;
+ 		sal_Bool bChecked = sal_False;
+@@ -1505,6 +1508,9 @@ void RadioGroupElement::endElement()
+         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
+                                    OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
+                                    xAttributes );
++        ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
++                                  OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
++                                  xAttributes );
+ 		sal_Int16 nVal = 0;
+ 		sal_Bool bChecked = sal_False;
+ 		if (getBoolAttr( &bChecked,
+--- svx/inc/svx/msocximex.hxx	2008-06-25 11:20:54.000000000 +0100
++++ svx/inc/svx/msocximex.hxx	2008-06-25 11:21:19.000000000 +0100
+@@ -289,6 +289,7 @@ public:
+         sal_uInt16 mnTabPos;
+ 	UniString sName;
+ 	UniString msToolTip;
++	UniString msParentName;
+ 	OCX_FontData aFontData;
+         SfxObjectShell *pDocSh;
+ protected:
+@@ -500,54 +501,8 @@ typedef std::vector<OCX_Control*>::itera
+ typedef std::vector<OCX_Control*>::const_iterator CtrlIteratorConst;
+ typedef std::vector<OCX_Control*>  CtrlList;
+ 
+-
+-
+-class RBGroup
+-{
+-    public:
+-    RBGroup():mRBGroupPos(0){}
+-    RBGroup(sal_uInt16& groupPos ):mRBGroupPos(groupPos){}
+-    sal_Int16 tabPos() const { return mRBGroupPos; }
+-    std::vector<OCX_Control*>::size_type numControls()
+-    { return mpControls.size(); }
+-    std::vector<OCX_Control*>& controls() { return mpControls; }
+-
+-    void add(OCX_Control* pRB);
+-    private:
+-    sal_uInt16 mRBGroupPos;
+-    std::vector<OCX_Control*> mpControls;
+-};
+-
+-typedef ::std::hash_map < ::rtl::OUString, RBGroup*, ::rtl::OUStringHash,
+-    ::std::equal_to< ::rtl::OUString > > RBGroupHash;
+-typedef std::vector<RBGroup*>::iterator GroupIterator;
+-
+ class OCX_OptionButton;
+ 
+-class RBGroupManager
+-{
+-public:
+-    RBGroupManager( String& defaultName );
+-    ~RBGroupManager();
+-
+-    CtrlList insertGroupsIntoControlList( const CtrlList& sourceList );
+-    void addRadioButton( OCX_OptionButton* pRButton );
+-private:
+-
+-    void addSeperator( std::vector< OCX_Control* >& dest );
+-    void copyList( std::vector< OCX_Control* >& src,
+-                  std::vector< OCX_Control* >& dest,
+-                  bool addGroupSeperator );
+-
+-    RBGroupHash rbGroups;
+-    String mSDefaultName;
+-    std::vector< RBGroup* > groupList;
+-    sal_uInt16 numRadioButtons;
+-};
+-
+-
+-
+-
+ class OCX_ContainerControl : public OCX_Control
+ {
+ public:
+@@ -586,7 +541,6 @@ protected:
+             OCX_Control* pParent = NULL );
+         rtl::OUString createSubStreamName( const sal_uInt32& subStorageID );
+ 
+-        RBGroupManager rbGroupMgr;
+         com::sun::star::uno::Reference<
+                 com::sun::star::container::XNameContainer > mxParent;
+ 	std::vector<OCX_Control*> mpControls;
+--- svx/source/msfilter/msocximex.cxx	2008-06-25 11:20:54.000000000 +0100
++++ svx/source/msfilter/msocximex.cxx	2008-06-25 11:23:05.000000000 +0100
+@@ -825,176 +825,6 @@ class ContainerRecordReaderFac
+ 
+ // ============================================================================
+ 
+-void RBGroup::add(OCX_Control* pRB)
+-{
+-    // The tab index for the group is calculated as
+-    // the lowest tab index found in the list of RadioButtons
+-    if ( pRB->mnTabPos < mRBGroupPos )
+-    {
+-        mRBGroupPos = pRB->mnTabPos;
+-        CtrlIterator aEnd = mpControls.end();
+-        for (CtrlIterator aIter = mpControls.begin(); aIter != aEnd; ++ aIter )
+-        {
+-            (*aIter)->mnTabPos = mRBGroupPos;
+-        }
+-    }
+-    mpControls.push_back( pRB );
+-}
+-
+-struct SortGroupByTabPos
+-{
+-    bool operator()( const RBGroup* a, const RBGroup* b )
+-    {
+-        return a->tabPos() < b->tabPos();
+-    }
+-};
+-
+-RBGroupManager::RBGroupManager( String& defaultName ):mSDefaultName( defaultName ),
+-    numRadioButtons(0)
+-{
+-    groupList.reserve( 8 ); // reserve far more than we expect
+-}
+-
+-RBGroupManager::~RBGroupManager()
+-{
+-    for ( GroupIterator gIter=groupList.begin(); gIter!=groupList.end(); ++gIter )
+-    {
+-        delete( *gIter );
+-    }
+-}
+-
+-// Loose description of the method below ( I sure there is a better way to do
+-// this )
+-// In order to "fake" MS grouping behavior for OptionButtons the OptionButtons
+-// in the same group need to have consecutive tab indices ( regardless of the
+-// imported tab indices of the RadioButtons ). Additionally if two
+-// groups of OptionButtons end up having all consecutive indices they
+-// will be treated as a single group by OpenOffice. In this case
+-// a dummy seperator control needs to be inserted between the groups.
+-//
+-// This method returns a new list "destinationList" containing the controls
+-// passed in "sourceList" and the OptionButtons contained in the various
+-// Groups maintained by this  class.
+-// Controls are ordered in the destination list by tab index.
+-// Each RadioButtonGroup has a tab index associated with it.
+-// ( Tab index of a RadioGroup is determined as the tab index of the
+-// OptionButton control with the lowest tab index in the group )
+-
+-
+-void RBGroupManager::addRadioButton( OCX_OptionButton* pRButton )
+-{
+-    if ( pRButton )
+-    {
+-        OUString groupName = mSDefaultName;
+-        if ( pRButton->nGroupNameLen )
+-        {
+-            groupName =
+-                lclCreateOUString(pRButton->pGroupName,
+-                    pRButton->nGroupNameLen);
+-        }
+-        ++numRadioButtons;
+-        RBGroupHash::iterator iter = rbGroups.find( groupName );
+-        if ( iter != rbGroups.end() )
+-        {
+-            iter->second->controls().push_back( pRButton );
+-        }
+-        else
+-        {
+-            RBGroup* newGroup = new RBGroup(pRButton->mnTabPos);
+-            newGroup->controls().push_back( pRButton );
+-            rbGroups[ groupName ] = newGroup;
+-            groupList.push_back( newGroup );
+-        }
+-
+-    }
+-}
+-
+-CtrlList RBGroupManager::insertGroupsIntoControlList( const CtrlList& sourceList )
+-{
+-    ::std::sort( groupList.begin(), groupList.end(), SortGroupByTabPos() );
+-    std::vector<OCX_Control*> destinationList;
+-    if ( groupList.size() )
+-    {
+-        destinationList.reserve( sourceList.size() + numRadioButtons );
+-
+-        GroupIterator groupEnd = groupList.end();
+-        CtrlIteratorConst sourceEnd = sourceList.end();
+-
+-        size_t prevGroupListSize = 0;
+-
+-        CtrlIteratorConst containees = sourceList.begin();
+-        GroupIterator groupIter=groupList.begin();
+-        while ( containees != sourceEnd ||
+-                groupIter != groupEnd )
+-        {
+-            bool addGroupSeperator = false;
+-            if ( containees != sourceEnd )
+-            {
+-                if ( groupIter != groupEnd )
+-                {
+-                    sal_Int16 groupTabPos = (*groupIter)->tabPos();
+-                    if ( (*containees)->mnTabPos >= groupTabPos )
+-                    {
+-                       if ( !(destinationList.size() >=  prevGroupListSize ))
+-                        {
+-                            addGroupSeperator = true;
+-                        }
+-                        copyList( (*groupIter)->controls(), destinationList, addGroupSeperator );
+-                        ++groupIter;
+-
+-                        prevGroupListSize = destinationList.size();
+-                    }
+-                }
+-                destinationList.push_back(*containees);
+-                ++containees;
+-            }
+-            else
+-            {
+-               if ( groupIter != groupEnd )
+-               {
+-                    if ( !(destinationList.size() >  prevGroupListSize ))
+-                    {
+-                        addGroupSeperator = true;
+-                    }
+-                    copyList( (*groupIter)->controls(), destinationList, addGroupSeperator );
+-                    ++groupIter;
+-                    prevGroupListSize = destinationList.size();
+-                }
+-            }
+-        }
+-    }
+-    else
+-    {
+-        destinationList = sourceList;
+-    }
+-    return destinationList;
+-
+-}
+-
+-
+-void RBGroupManager::addSeperator( std::vector< OCX_Control* >& dest )
+-{
+-    OCX_Control* seperator = new OCX_CommandButton;
+-    seperator->SetInDialog(true);
+-    seperator->sName = C2S("GroupSeperator");
+-    dest.push_back( seperator );
+-}
+-
+-void RBGroupManager::copyList( std::vector< OCX_Control* >& src,
+-    std::vector< OCX_Control* >& dest,
+-    bool addGroupSeperator )
+-{
+-    if ( addGroupSeperator )
+-    {
+-        addSeperator( dest );
+-    }
+-
+-    for ( CtrlIterator rbIter = src.begin(); rbIter != src.end(); ++rbIter )
+-    {
+-        dest.push_back( *rbIter );
+-    }
+-}
+-
+ class OCX_UserFormLabel : public OCX_Label
+ {
+ public:
+@@ -1709,9 +1539,26 @@ sal_Bool OCX_OptionButton::Import(com::s
+     aTmp <<= ::com::sun::star::style::VerticalAlignment_MIDDLE;
+     rPropSet->setPropertyValue( WW8_ASCII2STR("VerticalAlign"), aTmp );
+ 
+-    if ( pGroupName )
+-    {
+-        aTmp <<= lclCreateOUString( pGroupName, nGroupNameLen );
++    // If this is a dialog control then we need to  set a groupname *always*
++    // well actually pGroupName should *only* be set if this is a dialog control, 
++    // but.. you can't be too careful
++    if ( pGroupName && GetInDialog() )
++    {
++        // By default groupnames are not set in Excel, it's not unusual to have
++        // a number of groups of radiobuttons located inside frame ( or other container
++        // controls ) where there is *no* specific groupname set for the radiobuttons.
++        // But... there is implicit grouping for radio buttons in seperate containers
++        // e.g. radio buttons in a frame are by default in the same group.
++        // Unfortunately in openoffice there are no containers below the dialog itself :-(
++        // To ensure correct grouping for imported radiobuttons either with no groupname
++        // or identical groupnames that are in separate containers we *must* ensure
++        // that a suitable groupname is applied. 
++        // Because controlNames are unique even across different containers we can use the
++        // controls container (e.g. parent) name as a prefix for a group name
++        rtl::OUString sGroupName = msParentName;
++        if ( pGroupName )
++            sGroupName = sGroupName.concat( C2U( ":" ) ).concat( lclCreateOUString( pGroupName, nGroupNameLen ) );
++        aTmp <<= sGroupName;
+         rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp);
+     }
+ 
+@@ -3416,7 +3263,7 @@ OCX_ContainerControl::OCX_ContainerContr
+             const ::rtl::OUString& sN,
+             const uno::Reference< container::XNameContainer >  &rParent,
+             OCX_Control* pParent ) :
+-                OCX_Control(sN, pParent), rbGroupMgr( sName ), mxParent(rParent), nNoRecords(0), nTotalLen(0), containerType( STDCONTAINER )
++                OCX_Control(sN, pParent), mxParent(rParent), nNoRecords(0), nTotalLen(0), containerType( STDCONTAINER )
+ {
+ 
+     mContainerStorage = parent->OpenSotStorage(storageName,
+@@ -3627,6 +3474,7 @@ void OCX_ContainerControl::ProcessContro
+             // applied to all containees
+             pControl->mnStep = mnStep;
+         }
++        pControl->msParentName = sName;
+ 
+         // #117490# DR: container records provide size of substream, use it here...
+ 
+@@ -3637,17 +3485,7 @@ void OCX_ContainerControl::ProcessContro
+         // set stream to position behind substream of this control
+         oStream->Seek( nStrmPos + rec.nSubStreamLen );
+ 
+-        //need to fake grouping behaviour for radio ( option ) buttons
+-        if ( rec.nTypeIdent == OPTIONBUTTON )
+-        {
+-            OCX_OptionButton* pRButton =
+-                static_cast< OCX_OptionButton*>(pControl);
+-            rbGroupMgr.addRadioButton( pRButton );
+-        }
+-        else
+-        {
+-            mpControls.push_back( pControl );
+-        }
++        mpControls.push_back( pControl );
+     }
+ }
+ 
+@@ -3670,7 +3508,6 @@ sal_Bool OCX_ContainerControl::Read(SvSt
+     // this ensures that the default tab index created by Star/Open office
+     // reflects the "flattened" ms tab order.
+     ::std::sort( mpControls.begin(), mpControls.end(), SortOrderByTabPos() );
+-    mpControls = rbGroupMgr.insertGroupsIntoControlList( mpControls );
+ 	return true;
+ }
+ 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]