ooo-build r11650 - trunk/patches/test/vba



Author: noelpwer
Date: Wed Feb 20 17:24:47 2008
New Revision: 11650
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11650&view=rev

Log:
rejigged & re-written patch, cut'n'paste etc. removed, import now uses ftRboData
sub-record now to determine and apply grouping properties


Modified:
   trunk/patches/test/vba/formradiobuttongroup.diff

Modified: trunk/patches/test/vba/formradiobuttongroup.diff
==============================================================================
--- trunk/patches/test/vba/formradiobuttongroup.diff	(original)
+++ trunk/patches/test/vba/formradiobuttongroup.diff	Wed Feb 20 17:24:47 2008
@@ -1,12 +1,10 @@
-? sc/source/filter/build.log
-? sc/source/filter/excel/.xiescher.cxx.swp
 Index: sc/source/filter/excel/xiescher.cxx
 ===================================================================
 RCS file: /cvs/sc/sc/source/filter/excel/xiescher.cxx,v
 retrieving revision 1.54
 diff -u -p -r1.54 xiescher.cxx
 --- sc/source/filter/excel/xiescher.cxx	6 Jul 2007 12:37:20 -0000	1.54
-+++ sc/source/filter/excel/xiescher.cxx	20 Feb 2008 10:48:41 -0000
++++ sc/source/filter/excel/xiescher.cxx	20 Feb 2008 17:21:49 -0000
 @@ -221,6 +221,7 @@
  #include "xicontent.hxx"
  #endif
@@ -15,303 +13,315 @@
  using ::rtl::OUString;
  using ::rtl::OUStringBuffer;
  using ::com::sun::star::uno::Reference;
-@@ -327,6 +328,171 @@ SdrTextVertAdjust lclGetSvxVerAlignment(
+@@ -424,7 +425,7 @@ XclImpDrawObjBase::~XclImpDrawObjBase()
+ {
+ }
  
- } // namespace
+-XclImpDrawObjRef XclImpDrawObjBase::ReadObjCmo( XclImpStream& rStrm )
++XclImpDrawObjRef XclImpDrawObjBase::ReadObjCmo( XclImpObjectManager& rObjMgr, XclImpStream& rStrm )
+ {
+     XclImpDrawObjRef xDrawObj;
+ 
+@@ -457,7 +458,7 @@ XclImpDrawObjRef XclImpDrawObjBase::Read
+         case EXC_OBJ_CMO_COMBOBOX:
+         case EXC_OBJ_CMO_SPIN:
+         case EXC_OBJ_CMO_SCROLLBAR:
+-            xDrawObj.reset( new XclImpTbxControlObj( rStrm.GetRoot() ) );
++            xDrawObj.reset( new XclImpTbxControlObj( rObjMgr, rStrm.GetRoot() ) );
+         break;
+         case EXC_OBJ_CMO_PICTURE:
+             xDrawObj.reset( new XclImpOleObj( rStrm.GetRoot() ) );
+@@ -739,23 +740,31 @@ ScfPropertySet XclImpControlObjHelper::G
+     return ScfPropertySet( mxCtrlModel );
+ }
  
+-void XclImpControlObjHelper::ConvertSheetLinks( const XclImpRoot& rRoot, SdrObject& /* rSdrObj */ ) const
++// get service factory from Calc document
++Reference< XMultiServiceFactory > lclGetFactoryFromRoot( const XclImpRoot& rRoot )
+ {
+     // get service factory from Calc document
+     Reference< XMultiServiceFactory > xFactory;
+     if( SfxObjectShell* pDocShell = rRoot.GetDocShell() )
+         xFactory.set( pDocShell->GetModel(), UNO_QUERY );
++    return xFactory;
++}
 +
-+bool XclRadioButtonManager::objectIDSort::operator()( const SdrObjectInfo& a, const SdrObjectInfo& b )
++void XclImpControlObjHelper::ConvertSheetLinks( const XclImpRoot& rRoot, const ScfRef< ScAddress >& rxCellLink ) const
 +{
-+    return a.mID < b.mID;
++    Reference< XMultiServiceFactory > xFactory = lclGetFactoryFromRoot( rRoot );
++
+     if( !mxCtrlModel.is() || !xFactory.is() )
+         return;
+ 
+     // *** cell link *** ------------------------------------------------------
+ 
+     Reference< XBindableValue > xBindable( mxCtrlModel, UNO_QUERY );
+-    if( mxCellLink.is() && xBindable.is() )
++    if( rxCellLink.is() && xBindable.is() )
+     {
+         // create argument sequence for createInstanceWithArguments()
+         CellAddress aApiAddress;
+-        ScUnoConversion::FillApiAddress( aApiAddress, *mxCellLink );
++        ScUnoConversion::FillApiAddress( aApiAddress, *rxCellLink );
+ 
+         NamedValue aValue;
+         aValue.Name = CREATE_OUSTRING( SC_UNONAME_BOUNDCELL );
+@@ -792,14 +801,24 @@ void XclImpControlObjHelper::ConvertShee
+             xBindable->setValueBinding( xBinding );
+     }
+ 
++
 +}
 +
-+bool
-+XclRadioButtonManager::AddSdrObject( const XclImpDrawObjBase& rDrawObj, SdrObject* pSdrObj )
++void XclImpControlObjHelper::ConvertSheetLinks( const XclImpRoot& rRoot, const ScfRef< ScRange >& rxSrcRange ) const
 +{
-+    const XclImpTbxControlObj* pFormObj = dynamic_cast< const XclImpTbxControlObj* >(&rDrawObj );
-+    OSL_TRACE("XclRadioButtonManager::AddSdrObject ObjectID 0x%x ShapeID 0x%x", rDrawObj.GetObjId().mnObjId, rDrawObj.GetShapeId() );
-+    if (  !mDfltGroupName.getLength() )
-+    {
-+        mDfltGroupName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Sheet ") ) + rtl::OUString::valueOf( static_cast< sal_Int32 >( rDrawObj.GetScTab() ) + 1 );
-+    } 
-+    switch( rDrawObj.GetObjType() )
-+    {
-+        case EXC_OBJ_CMO_OPTIONBUTTON:
-+            mRadioButtons.push_back( SdrObjectInfo( rDrawObj.GetAnchorRect(), pSdrObj, pFormObj->GetControlPropSet(), rDrawObj.GetObjId(), rDrawObj.GetShapeId() ) );
-+            break;
-+        case EXC_OBJ_CMO_GROUPBOX:
-+            mGroupBoxes.push_back( SdrObjectInfo( rDrawObj.GetAnchorRect(), pSdrObj, pFormObj->GetControlPropSet(), rDrawObj.GetObjId(), rDrawObj.GetShapeId() ) );
-+            break;
-+        default:
-+            return false;
-+            break;
-+    }
-+    return true;
++    Reference< XMultiServiceFactory > xFactory = lclGetFactoryFromRoot( rRoot );
++
++    if( !mxCtrlModel.is() || !xFactory.is() )
++        return;
++
+     // *** source range *** ---------------------------------------------------
+ 
+     Reference< XListEntrySink > xEntrySink( mxCtrlModel, UNO_QUERY );
+-    if( mxSrcRange.is() && xEntrySink.is() )
++    if( rxSrcRange.is() && xEntrySink.is() )
+     {
+         // create argument sequence for createInstanceWithArguments()
+         CellRangeAddress aApiRange;
+-        ScUnoConversion::FillApiRange( aApiRange, *mxSrcRange );
++        ScUnoConversion::FillApiRange( aApiRange, *rxSrcRange );
+ 
+         NamedValue aValue;
+         aValue.Name = CREATE_OUSTRING( SC_UNONAME_CELLRANGE );
+@@ -824,13 +843,27 @@ void XclImpControlObjHelper::ConvertShee
+         if( xEntrySource.is() )
+             xEntrySink->setListEntrySource( xEntrySource );
+     }
++
 +}
 +
-+// total hack, this is just some experimental foo to try and poke
-+// the imported radio buttons into life
-+void
-+XclRadioButtonManager::Reprocess( XclImpObjectManager& rObjMgr ) 
++void XclImpControlObjHelper::ConvertSheetLinks( const XclImpRoot& rRoot, SdrObject& /* rSdrObj */ ) const
 +{
-+    Objects::iterator it_rbs = mRadioButtons.begin(); 
-+    Objects::iterator it_rbs_end = mRadioButtons.end(); 
-+    for ( ; it_rbs != it_rbs_end; ++it_rbs )
-+    {
-+        if( XclImpTbxControlObj* pDrawObj = dynamic_cast< XclImpTbxControlObj* >( rObjMgr.FindDrawObj( it_rbs->mObjID ).get() ) )
-+        {
-+            // reprocess 
-+            pDrawObj->DoProcessSdrObj( *it_rbs->mpObject );
-+        }
++    // *** cell link *** ------------------------------------------------------
 +
-+    }
-+}
++    ConvertSheetLinks( rRoot, mxCellLink );
++
++    // *** source range *** ---------------------------------------------------
 +
-+void
-+XclRadioButtonManager::ApplyGrouping() 
++    ConvertSheetLinks( rRoot, mxSrcRange );
+ }
+ 
+ // ----------------------------------------------------------------------------
+ 
+-XclImpTbxControlObj::XclImpTbxControlObj( const XclImpRoot& rRoot ) :
++XclImpTbxControlObj::XclImpTbxControlObj( XclImpObjectManager& rObjMgr, const XclImpRoot& rRoot ) :
+     XclImpDrawingObj( rRoot, true ),
+     XclImpControlObjHelper( EXC_CTRL_BINDPOSITION ),
++    mrObjManager( rObjMgr ),
++    mbGroupLeader( false ),
+     mnState( EXC_OBJ_CBLS_STATE_UNCHECK ),
+     mnSelEntry( 0 ),
+     mnSelType( EXC_OBJ_LBS_SEL_SIMPLE ),
+@@ -866,6 +899,9 @@ void XclImpTbxControlObj::ReadSubRecord(
+         case EXC_ID_OBJ_FTGBODATA:
+             ReadGboData( rStrm );
+         break;
++        case EXC_ID_OBJ_FTRBODATA:
++            ReadRboData( rStrm );
++        break;
+         default:
+             XclImpDrawObjBase::ReadSubRecord( rStrm, nSubRecId, nSubRecSize );
+     }
+@@ -904,7 +940,6 @@ void XclImpTbxControlObj::DoProcessSdrOb
+ 
+     namespace AwtVisualEffect = ::com::sun::star::awt::VisualEffect;
+     namespace AwtScrollOrient = ::com::sun::star::awt::ScrollBarOrientation;
+-    using ::com::sun::star::style::VerticalAlignment_MIDDLE;
+ 
+     // control name, printable, sheet links -----------------------------------
+ 
+@@ -944,24 +979,29 @@ void XclImpTbxControlObj::DoProcessSdrOb
+         case EXC_OBJ_CMO_CHECKBOX:
+         case EXC_OBJ_CMO_OPTIONBUTTON:
+         {
+-            bool bCheckBox = GetObjType() == EXC_OBJ_CMO_CHECKBOX;
+-
+-            sal_Int16 nApiState = 0;
+-            switch( mnState )
++            if( GetObjType() == EXC_OBJ_CMO_CHECKBOX )
++                SetCBRBCommonProps();
++            else
+             {
+-                case EXC_OBJ_CBLS_STATE_UNCHECK:    nApiState = 0;                  break;
+-                case EXC_OBJ_CBLS_STATE_CHECK:      nApiState = 1;                  break;
+-                case EXC_OBJ_CBLS_STATE_TRI:        nApiState = bCheckBox ? 2 : 1;  break;
++                XclImpTbxControlObj* pTbxObj = dynamic_cast< XclImpTbxControlObj* >( mrObjManager.FindDrawObj( mNextRBInGroupId ).get() );
++                if ( ( pTbxObj && pTbxObj->mbGroupLeader ) )
++                {
++                    // Group has terminated
++                    // traverse each RadioButton in group and 
++                    //     a) apply the groupname 
++                    //     b) propagate the linked cell from the lead radiobutton
++                    //     c) apply the correct Ref value
++                    XclImpTbxControlObj* pLeader = pTbxObj;
++                    XclObjId rLeaderId = pLeader->GetObjId();
++                    sal_Int32 nRefVal = 1;
++                    do 
++                    {
++                        pTbxObj->ApplyGroupingBits( *pLeader, nRefVal++ );
++                        pTbxObj = dynamic_cast< XclImpTbxControlObj* >( mrObjManager.FindDrawObj( pTbxObj->mNextRBInGroupId ).get() );
++                    } while ( pTbxObj && !pTbxObj->mbGroupLeader );
++                } 
++               
+             }
+-            if( bCheckBox )
+-                aPropSet.SetBoolProperty( CREATE_OUSTRING( "TriState" ), nApiState == 2 );
+-            aPropSet.SetProperty( CREATE_OUSTRING( "DefaultState" ), nApiState );
+-
+-            sal_Int16 nApiBorder = mbFlatButton ? AwtVisualEffect::FLAT : AwtVisualEffect::LOOK3D;
+-            aPropSet.SetProperty( CREATE_OUSTRING( "VisualEffect" ), nApiBorder );
+-
+-            // #i40279# always centered vertically
+-            aPropSet.SetProperty( CREATE_OUSTRING( "VerticalAlign" ), VerticalAlignment_MIDDLE );
+         }
+         break;
+ 
+@@ -1111,6 +1151,45 @@ void XclImpTbxControlObj::ReadLbsData( X
+     }
+ }
+ 
++void XclImpTbxControlObj::ApplyGroupingBits( XclImpTbxControlObj& rLeadRB, sal_Int32 nRefVal )
 +{
-+    OUString sGroupName = mDfltGroupName;
-+    Objects::iterator it_rbs = mRadioButtons.begin(); 
-+    Objects::iterator it_rbs_end = mRadioButtons.end(); 
-+    for ( ; it_rbs != it_rbs_end; ++it_rbs )
++    ScfPropertySet aProps = GetControlPropSet();
++    // shape Id is formed from object id + sheet id
++    rtl::OUString sGroupName = rtl::OUString::valueOf( static_cast< sal_Int32 >( rLeadRB.GetShapeId() ) );
++    aProps.SetStringProperty( CREATE_OUSTRING( "GroupName" ), sGroupName );
++    aProps.SetStringProperty( CREATE_OUSTRING( "RefValue" ), rtl::OUString::valueOf( nRefVal ) );
++    // propagate cell link info
++    if ( rLeadRB.HasCellLink() && !HasCellLink() )
 +    {
-+        String sRBName;
-+        it_rbs->mObjProps.GetStringProperty( sRBName, CREATE_OUSTRING( "Name" ));
-+        Objects::iterator it_gb = mGroupBoxes.begin();
-+        Objects::iterator it_gb_end = mGroupBoxes.end();
-+        for ( ; it_gb != it_gb_end; ++it_gb )
-+        {
-+            // mmm I just discovered a more accurate way of determining the 
-+            // radio group ( the converted dimensions here may not be accurate )
-+            // the format of the ftRboData field is
-+            // ftRboData
-+            //     sal_uInt16 nextShapeID; // the next radio button in the group
-+            //     sal_uInt8  unknown1; // the next radio button in the group
-+            //     sal_uInt8  bPrimaryGroupMember:1; // set if this is the lead radio-button in the group
-+            //     sal_uInt8  unknown2:7; // unknown
-+            if ( it_gb->mArea.IsInside( it_rbs->mArea ) )
-+            {
-+                String sTmpName;
-+                it_gb->mObjProps.GetStringProperty( sTmpName, CREATE_OUSTRING( "Name" ));
-+                sGroupName = sTmpName;
-+                break;
-+            }
-+            else
-+                sGroupName = mDfltGroupName;
-+  
-+        }
-+        // this isn't really necessary for form control radiobuttons IF there
-+        // is a linked cell associated with the group
-+        it_rbs->mObjProps.SetStringProperty( CREATE_OUSTRING( "GroupName" ), sGroupName );
-+        // we shouldn't really need to store the groups except I am hacking a 
-+        // reprocess step and I want to remember the groups
-+        mRadioGroups[ sGroupName ].push_back( *it_rbs );
++        ScfRef< ScAddress > xAddress( new ScAddress( *rLeadRB.GetCellLink() ) );
++        ConvertSheetLinks( GetRoot(), xAddress ); 
 +    }
-+    // sort radiobuttons in each group by objectID, this determines the value 
-+    // of the Radio button ( lowest objectID is in the group will have ref val set to 1 )
-+    RadioGroups::iterator it_groups = mRadioGroups.begin(); 
-+    RadioGroups::iterator it_groups_end = mRadioGroups.end(); 
-+    for ( ; it_groups != it_groups_end; ++it_groups )
-+    {
-+        Objects::iterator it = it_groups->second.begin();
-+        Objects::iterator it_end = it_groups->second.end();
-+        ::std::sort( it, it_end, objectIDSort() );
-+    } 
-+    for ( it_groups = mRadioGroups.begin(); it_groups != it_groups_end; ++it_groups )
++    SetCBRBCommonProps();
++}
++
++void XclImpTbxControlObj::SetCBRBCommonProps() const
++{
++    sal_Int16 nApiState = 0;
++    bool bCheckBox = ( GetObjType() == EXC_OBJ_CMO_CHECKBOX );
++    switch( mnState )
 +    {
-+        Objects::iterator it = it_groups->second.begin();
-+        Objects::iterator it_end = it_groups->second.end();
-+        sal_Int32 refValue = 1;
-+        CellAddress aCellLink;        
-+        for ( ; it != it_end; ++it, ++refValue )
-+        {
-+            Reference< XBindableValue > xBindable( it->mObjProps.GetApiPropertySet(), UNO_QUERY );
-+            // Each radiobutton in the group *must* have the same
-+            // ValueBinding, propagate the binding to group members that
-+            // don't have it set
-+
-+            it->mObjProps.SetStringProperty( CREATE_OUSTRING( "RefValue" ), rtl::OUString::valueOf( refValue ) );
-+
-+            if ( xBindable.is() )
-+            {
-+                Reference< XValueBinding > xBinding( xBindable->getValueBinding() );
-+                // The assumption here is the lead radiobutton is the first
-+                // we process ( e.g. the one with the lowest object id )
-+                // we should check if that is not the case and assert or
-+                // something
-+                if ( xBinding.is() )
-+                {
-+                    // extract the binding
-+                    ScfPropertySet bindProps( xBinding );
-+                    Any cellLinkAsAny;
-+                    bindProps.GetAnyProperty( cellLinkAsAny,  CREATE_OUSTRING(SC_UNONAME_BOUNDCELL  ) );
-+                    cellLinkAsAny >>= aCellLink;
-+                }
-+                else
-+                {
-+                    // create a binding
-+                    // get service factory from Calc document
-+                    Reference< XMultiServiceFactory > xFactory;
-+                    if( SfxObjectShell* pDocShell = GetRoot().GetDocShell() )
-+                        xFactory.set( pDocShell->GetModel(), UNO_QUERY );                    
-+                    if ( !xFactory.is() )
-+                        return; // we should report this problem 
-+
-+                    NamedValue aValue;
-+                    aValue.Name = CREATE_OUSTRING( SC_UNONAME_BOUNDCELL );
-+                    aValue.Value <<= aCellLink; 
-+
-+                    Sequence< Any > aArgs( 1 );
-+                    aArgs[ 0 ] <<= aValue;
-+
-+                    xBinding.set( xFactory->createInstanceWithArguments(
-+                        CREATE_OUSTRING( SC_SERVICENAME_LISTCELLBIND ), aArgs ), UNO_QUERY );
-+                    if ( !xBinding.is() )
-+                        return; // we should report this problem
-+
-+                    xBindable->setValueBinding( xBinding );
-+                }
-+            }
-+        }
++        case EXC_OBJ_CBLS_STATE_UNCHECK:    nApiState = 0;                  break;
++        case EXC_OBJ_CBLS_STATE_CHECK:      nApiState = 1;                  break;
++        case EXC_OBJ_CBLS_STATE_TRI:        nApiState = bCheckBox ? 2 : 1;  break;
 +    }
++    ScfPropertySet aPropSet = GetControlPropSet();
++    if ( bCheckBox )
++        aPropSet.SetBoolProperty( CREATE_OUSTRING( "TriState" ), nApiState == 2 );
++    namespace AwtVisualEffect = ::com::sun::star::awt::VisualEffect;
++    using ::com::sun::star::style::VerticalAlignment_MIDDLE;
++
++    aPropSet.SetProperty( CREATE_OUSTRING( "DefaultState" ), nApiState );
++    sal_Int16 nApiBorder = mbFlatButton ? AwtVisualEffect::FLAT : AwtVisualEffect::LOOK3D;
++    aPropSet.SetProperty( CREATE_OUSTRING( "VisualEffect" ), nApiBorder );
++    // #i40279# always centered vertically
++    aPropSet.SetProperty( CREATE_OUSTRING( "VerticalAlign" ), VerticalAlignment_MIDDLE );
 +}
 +
-+
-+void
-+XclRadioButtonManager::Init()
+ void XclImpTbxControlObj::ReadSbs( XclImpStream& rStrm )
+ {
+     sal_uInt16 nOrient, nStyle;
+@@ -1131,6 +1210,17 @@ void XclImpTbxControlObj::ReadGboData( X
+     mbFlatBorder = ::get_flag( nStyle, EXC_OBJ_GBO_FLAT );
+ }
+ 
++void XclImpTbxControlObj::ReadRboData( XclImpStream& rStrm )
 +{
-+    mRadioButtons.clear();
-+    mGroupBoxes.clear();
-+    mDfltGroupName  = rtl::OUString();  
++    sal_Int16 mnNextRBInGroup;
++    rStrm >> mnNextRBInGroup;
++    sal_uInt8 nGroupLeader;
++    rStrm >> nGroupLeader;
++    sal_uInt8 unknown;
++    rStrm >> unknown;
++    mbGroupLeader = ( nGroupLeader & 0x1 );
++    mNextRBInGroupId = XclObjId( GetScTab(), mnNextRBInGroup );
 +}
  // ----------------------------------------------------------------------------
  
- XclImpTxoData::XclImpTxoData( const XclImpRoot& rRoot ) :
-@@ -917,7 +1083,6 @@ void XclImpTbxControlObj::DoProcessSdrOb
-         aCtrlName = XclControlObjHelper::GetTbxControlName( GetObjType() );
-     if( aCtrlName.getLength() > 0 )
-         aPropSet.SetProperty( CREATE_OUSTRING( "Name" ), aCtrlName );
--
-     // sheet links
-     ConvertSheetLinks( GetRoot(), rSdrObj );
- 
-@@ -956,6 +1121,7 @@ void XclImpTbxControlObj::DoProcessSdrOb
-             if( bCheckBox )
-                 aPropSet.SetBoolProperty( CREATE_OUSTRING( "TriState" ), nApiState == 2 );
-             aPropSet.SetProperty( CREATE_OUSTRING( "DefaultState" ), nApiState );
-+            OSL_TRACE("DefaultState %s for radiobutton is 0x%d",  rtl::OUStringToOString( aCtrlName, RTL_TEXTENCODING_UTF8 ).getStr(), nApiState );
- 
-             sal_Int16 nApiBorder = mbFlatButton ? AwtVisualEffect::FLAT : AwtVisualEffect::LOOK3D;
-             aPropSet.SetProperty( CREATE_OUSTRING( "VisualEffect" ), nApiBorder );
-@@ -1547,6 +1713,7 @@ XclImpDffManager::XclImpDffManager(
-     XclImpRoot( rRoot ),
-     mrObjManager( rObjManager ),
-     mxOcxConverter( new XclImpOcxConverter( rRoot ) ),
-+    maRadioButtonManager( rRoot ), 
-     mnOleImpFlags( 0 )
- {
-     SetSvxMSDffSettings( SVXMSDFF_SETTINGS_CROP_BITMAPS | SVXMSDFF_SETTINGS_IMPORT_EXCEL | SVXMSDFF_SETTINGS_IMPORT_IAS );
-@@ -1713,6 +1880,7 @@ SdrObject* XclImpDffManager::ProcessObj(
-     // process the SdrObject
-     if( xSdrObj.get() )
-     {
-+	
-         // maybe if there is no color, we could do this in ApplyAttributes (writer?, calc?)
-         if( GetPropertyBool( DFF_Prop_fFilled ) && !IsProperty( DFF_Prop_fillColor ) )
-             xSdrObj->SetMergedItem( XFillColorItem( EMPTY_STRING, Color( COL_WHITE ) ) );
-@@ -1749,7 +1917,13 @@ SdrObject* XclImpDffManager::ProcessObj(
-         be done here (and not in InsertSdrObject() function), otherwise all
-         SdrObjects embedded in groups would be lost. */
-     if( xSdrObj.get() )
-+    {
-+        // add formcontrol radiobuttons and groupboxes to 
-+        if ( xDrawObj.is() 
-+        && ( ( xDrawObj->GetObjType() == EXC_OBJ_CMO_OPTIONBUTTON ) || ( xDrawObj->GetObjType() == EXC_OBJ_CMO_GROUPBOX ) ) )
-+            maRadioButtonManager.AddSdrObject( *xDrawObj, xSdrObj.get() );
-         maSolverCont.InsertSdrObjectInfo( *xDrawObj, xSdrObj.get() );
-+    }
- 
-     return xSdrObj.release();
- }
-@@ -1835,6 +2009,11 @@ void XclImpDffManager::ProcessDgContaine
-     maSolverCont.UpdateConnectorRules();
-     SolveSolver( maSolverCont );
-     maSolverCont.RemoveConnectorRules();
-+    maRadioButtonManager.ApplyGrouping();
-+//    hack to reapply the default state ( and unfortunately everthing else )
-+//    after grouping is applied. 
-+//    maRadioButtonManager.Reprocess( mrObjManager );
-+    maRadioButtonManager.Init();
- }
- 
- void XclImpDffManager::ProcessShGrContainer( SvStream& rEscherStrm, const DffRecordHeader& rShGrHeader )
+ XclImpOleObj::XclImpOleObj( const XclImpRoot& rRoot ) :
+@@ -2224,7 +2314,7 @@ void XclImpObjectManager::ReadObj8( XclI
+             break;
+             case EXC_ID_OBJ_FTCMO:
+                 DBG_ASSERT( !xDrawObj, "XclImpObjectManager::ReadObj8 - multiple FTCMO subrecords" );
+-                xDrawObj = XclImpDrawObjBase::ReadObjCmo( rStrm );
++                xDrawObj = XclImpDrawObjBase::ReadObjCmo( *this, rStrm );
+                 bLoop = xDrawObj.is();
+             break;
+             default:
 Index: sc/source/filter/inc/xiescher.hxx
 ===================================================================
 RCS file: /cvs/sc/sc/source/filter/inc/xiescher.hxx,v
 retrieving revision 1.27
 diff -u -p -r1.27 xiescher.hxx
 --- sc/source/filter/inc/xiescher.hxx	6 Jul 2007 12:38:40 -0000	1.27
-+++ sc/source/filter/inc/xiescher.hxx	20 Feb 2008 10:48:42 -0000
-@@ -310,6 +310,7 @@ private:
-     bool                mbFlatButton;   /// False = 3D button style; True = Flat button style.
-     bool                mbFlatBorder;   /// False = 3D border style; True = Flat border style.
-     bool                mbScrollHor;    /// Scrollbar: true = horizontal.
-+friend class XclRadioButtonManager;
- };
- 
- // ----------------------------------------------------------------------------
-@@ -435,6 +436,46 @@ private:
-     XclImpSdrInfoMap    maSdrInfoMap;   /// Maps shape IDs to SdrObjects.
- };
- 
-+class XclRadioButtonManager : protected XclImpRoot
-+{
-+public:
-+    XclRadioButtonManager( const XclImpRoot& rRoot ) : XclImpRoot( rRoot ) {} 
-+    // Only RadioButtons and GroupBoxes are added ( per sheet )
-+    // The class expects to operate in a sheet context and be re-initialised
-+    // after processing each sheet
-+    bool AddSdrObject( const XclImpDrawObjBase& rDrawObj, SdrObject* pSdrObj );
-+    // ApplyGrouping
-+    // - Sorts RadioButtons into groups
-+    // - applies groupname property to underlying  uno object
-+    // - assumes that all the objects added by 'AddSdrObject' are located on
-+    //   the same sheet 
-+    void ApplyGrouping();
-+    void Reprocess( XclImpObjectManager& rObjMgr );
-+    void Init();
-+private:
-+    rtl::OUString mDfltGroupName;
-+    struct SdrObjectInfo
-+    {
-+       	XclObjId mObjID; 
-+       	sal_Int32 mID; 
-+        Rectangle mArea;
-+	ScfPropertySet mObjProps;
-+        SdrObject* mpObject;
-+        SdrObjectInfo( const Rectangle& rRect, SdrObject* pObject, const ScfPropertySet& rProps, const XclObjId& rObjId, sal_Int32 aID ): mObjID( rObjId ), mID( aID ), mArea( rRect ), mObjProps( rProps ), mpObject( pObject ) {}
-+    };
-+    struct objectIDSort
-+    {
-+        bool operator()( const SdrObjectInfo& a, const SdrObjectInfo& b );
-+    };
-+
-+    typedef std::vector< SdrObjectInfo > Objects;
-+    typedef std::map< rtl::OUString, Objects > RadioGroups;
-+
-+    Objects mGroupBoxes;
-+    Objects mRadioButtons;
-+    RadioGroups mRadioGroups;
-+};
-+
- // ----------------------------------------------------------------------------
- 
- class XclImpObjectManager;
-@@ -521,6 +562,7 @@ private:
-     ScRangeMap          maUsedAreaMap;      /// Used ranges for all sheets.
-     ScfProgressBarRef   mxProgress;         /// The progress bar used in ProcessObj().
-     XclImpOcxConvRef    mxOcxConverter;     /// The form controls converter.
-+    XclRadioButtonManager maRadioButtonManager; /// applies grouping for radio buttons
-     sal_uInt32          mnOleImpFlags;      /// Application OLE import settings.
- };
- 
++++ sc/source/filter/inc/xiescher.hxx	20 Feb 2008 17:21:50 -0000
+@@ -99,7 +99,7 @@ public:
+     virtual             ~XclImpDrawObjBase();
+ 
+     /** Reads the FTCMO subrecord (common object data) in an OBJ record, returns a new object. */
+-    static XclImpDrawObjRef ReadObjCmo( XclImpStream& rStrm );
++    static XclImpDrawObjRef ReadObjCmo( XclImpObjectManager& rObjMrg, XclImpStream& rStrm );
+     /** Reads the contents of the specified subrecord of an OBJ record from stream. */
+     virtual void        ReadSubRecord( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
+     /** Reads the client anchor from an msofbtClientAnchor Escher record. */
+@@ -254,6 +254,9 @@ protected:
+     ScfPropertySet      GetControlPropSet() const;
+     /** Tries to set a spreadsheet cell link and source range link at the passed form control. */
+     void                ConvertSheetLinks( const XclImpRoot& rRoot, SdrObject& rSdrObj ) const;
++    void                ConvertSheetLinks( const XclImpRoot& rRoot, const ScfRef< ScAddress >& rxCellLink ) const;
++    void                ConvertSheetLinks( const XclImpRoot& rRoot, const ScfRef< ScRange >& rxSrcRange ) const;
++    ScAddress*          GetCellLink(){ return mxCellLink.get(); }
+ 
+ private:
+     XControlModelRef    mxCtrlModel;    /// Model of the created form control object.
+@@ -268,7 +271,7 @@ private:
+ class XclImpTbxControlObj : public XclImpDrawingObj, public XclImpControlObjHelper
+ {
+ public:
+-    explicit            XclImpTbxControlObj( const XclImpRoot& rRoot );
++    explicit            XclImpTbxControlObj( XclImpObjectManager& rObjMgr, const XclImpRoot& rRoot );
+ 
+     /** Reads the contents of the specified subrecord of an OBJ record from stream. */
+     virtual void        ReadSubRecord( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
+@@ -295,8 +298,15 @@ private:
+     void                ReadSbs( XclImpStream& rStrm );
+     /** Reads the contents of the ftGboData sub structure in an OBJ record. */
+     void                ReadGboData( XclImpStream& rStrm );
++    /** Reads the contents of the ftRboData sub structure in an OBJ record. */
++    void                ReadRboData( XclImpStream& rStrm );
+ 
+ private:
++    void SetCBRBCommonProps() const;
++    void ApplyGroupingBits( XclImpTbxControlObj& rTbxObj, sal_Int32 nRefVal );
++    XclImpObjectManager&  mrObjManager;
++    bool                mbGroupLeader;  /// Identifies start of group
++    XclObjId            mNextRBInGroupId;    /// 
+     ScfInt16Vec         maMultiSel;     /// Indexes of all selected entries in a multi selection.
+     sal_uInt16          mnState;        /// Checked/unchecked state.
+     sal_Int16           mnSelEntry;     /// Index of selected entry (1-based).
+Index: sc/source/filter/inc/xlescher.hxx
+===================================================================
+RCS file: /cvs/sc/sc/source/filter/inc/xlescher.hxx,v
+retrieving revision 1.21
+diff -u -p -r1.21 xlescher.hxx
+--- sc/source/filter/inc/xlescher.hxx	22 Jan 2007 13:22:23 -0000	1.21
++++ sc/source/filter/inc/xlescher.hxx	20 Feb 2008 17:21:50 -0000
+@@ -75,6 +75,7 @@ const sal_uInt16 EXC_ID_OBJ_FTCBLS      
+ const sal_uInt16 EXC_ID_OBJ_FTSBS           = 0x000C;   /// Scroll bar data.
+ const sal_uInt16 EXC_ID_OBJ_FTSBSFMLA       = 0x000E;   /// Scroll bar/list box/combo box cell link.
+ const sal_uInt16 EXC_ID_OBJ_FTGBODATA       = 0x000F;   /// Group box data.
++const sal_uInt16 EXC_ID_OBJ_FTRBODATA       = 0x0011;   /// Radiobutton data.
+ const sal_uInt16 EXC_ID_OBJ_FTLBSDATA       = 0x0013;   /// List box/combo box data.
+ const sal_uInt16 EXC_ID_OBJ_FTCBLSFMLA      = 0x0014;   /// Check box/radio button cell link.
+ const sal_uInt16 EXC_ID_OBJ_FTCMO           = 0x0015;   /// Common object settings.



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