Lines 1617-1639
Link Here
|
1617 |
return; |
1617 |
return; |
1618 |
|
1618 |
|
1619 |
// filter out the forms which do not contain valid controls at all |
1619 |
// filter out the forms which do not contain valid controls at all |
1620 |
FmFormArray::reverse_iterator form = m_aSearchForms.rbegin(); |
1620 |
{ |
1621 |
::std::vector< String >::reverse_iterator contextName = aContextNames.rbegin(); |
1621 |
FmFormArray aValidForms; |
1622 |
sal_Int32 i = m_aSearchForms.size(); |
1622 |
::std::vector< String > aValidContexts; |
1623 |
for ( ; |
1623 |
FmFormArray::const_iterator form = m_aSearchForms.begin(); |
1624 |
form != m_aSearchForms.rend(); |
1624 |
::std::vector< String >::const_iterator contextName = aContextNames.begin(); |
1625 |
++form, ++contextName, --i |
1625 |
for ( ; form != m_aSearchForms.end(); ++form, ++contextName ) |
1626 |
) |
1626 |
{ |
1627 |
{ |
1627 |
FmSearchContext aTestContext; |
1628 |
FmSearchContext aTestContext; |
1628 |
aTestContext.nContext = static_cast< sal_Int16 >( form - m_aSearchForms.begin() ); |
1629 |
aTestContext.nContext = static_cast< sal_Int16 >( i-1 ); |
1629 |
sal_uInt32 nValidControls = OnSearchContextRequest( &aTestContext ); |
1630 |
sal_uInt32 nValidControls = OnSearchContextRequest( &aTestContext ); |
1630 |
if ( nValidControls > 0 ) |
1631 |
if ( nValidControls == 0 ) |
1631 |
{ |
1632 |
{ |
1632 |
aValidForms.push_back( *form ); |
1633 |
m_aSearchForms.erase( form.base() - 1 ); |
1633 |
aValidContexts.push_back( *contextName ); |
1634 |
aContextNames.erase( contextName.base() - 1 ); |
1634 |
} |
1635 |
} |
1635 |
} |
1636 |
} |
1636 |
|
|
|
1637 |
m_aSearchForms.swap( aValidForms ); |
1638 |
aContextNames.swap( aValidContexts ); |
1639 |
} |
1637 |
|
1640 |
|
1638 |
if (m_aSearchForms.size() == 0) |
1641 |
if (m_aSearchForms.size() == 0) |
1639 |
{ // es gibt keine Controls, die alle Bedingungen fuer eine Suche erfuellen |
1642 |
{ // es gibt keine Controls, die alle Bedingungen fuer eine Suche erfuellen |
Lines 1644-1650
Link Here
|
1644 |
// jetzt brauche ich noch einen 'initial context' |
1647 |
// jetzt brauche ich noch einen 'initial context' |
1645 |
sal_Int16 nInitialContext = 0; |
1648 |
sal_Int16 nInitialContext = 0; |
1646 |
Reference< XForm> xActiveForm( getActiveForm()); |
1649 |
Reference< XForm> xActiveForm( getActiveForm()); |
1647 |
for (i=0; i<(sal_Int32)m_aSearchForms.size(); ++i) |
1650 |
for ( size_t i=0; i<(sal_Int32)m_aSearchForms.size(); ++i ) |
1648 |
{ |
1651 |
{ |
1649 |
if (m_aSearchForms.at(i) == xActiveForm) |
1652 |
if (m_aSearchForms.at(i) == xActiveForm) |
1650 |
{ |
1653 |
{ |
Lines 2419-2424
Link Here
|
2419 |
FmFormObj* pFormObject = FmFormObj::GetFormObject( pObject ); |
2422 |
FmFormObj* pFormObject = FmFormObj::GetFormObject( pObject ); |
2420 |
Reference< XControlModel > xControlModel( pFormObject ? pFormObject->GetUnoControlModel() : Reference< XControlModel >() ); |
2423 |
Reference< XControlModel > xControlModel( pFormObject ? pFormObject->GetUnoControlModel() : Reference< XControlModel >() ); |
2421 |
DBG_ASSERT( xControlModel.is(), "FmXFormShell::OnFoundData: invalid control!" ); |
2424 |
DBG_ASSERT( xControlModel.is(), "FmXFormShell::OnFoundData: invalid control!" ); |
|
|
2425 |
if ( !xControlModel.is() ) |
2426 |
return 0; |
2422 |
|
2427 |
|
2423 |
// disable the permanent cursor for the last grid we found a record |
2428 |
// disable the permanent cursor for the last grid we found a record |
2424 |
if (m_xLastGridFound.is() && (m_xLastGridFound != xControlModel)) |
2429 |
if (m_xLastGridFound.is() && (m_xLastGridFound != xControlModel)) |
Lines 2436-2442
Link Here
|
2436 |
sal_Int32 nGridColumn = m_arrRelativeGridColumn.GetObject(pfriWhere->nFieldPos); |
2441 |
sal_Int32 nGridColumn = m_arrRelativeGridColumn.GetObject(pfriWhere->nFieldPos); |
2437 |
if (nGridColumn != -1) |
2442 |
if (nGridColumn != -1) |
2438 |
{ // dummer weise muss ich mir das Control erst wieder besorgen |
2443 |
{ // dummer weise muss ich mir das Control erst wieder besorgen |
2439 |
Reference< XControl> xControl( GetControlFromModel(xControlModel)); |
2444 |
Reference< XControl> xControl( impl_getControl( xControlModel, *pFormObject ) ); |
2440 |
Reference< XGrid> xGrid(xControl, UNO_QUERY); |
2445 |
Reference< XGrid> xGrid(xControl, UNO_QUERY); |
2441 |
DBG_ASSERT(xGrid.is(), "FmXFormShell::OnFoundData : ungueltiges Control !"); |
2446 |
DBG_ASSERT(xGrid.is(), "FmXFormShell::OnFoundData : ungueltiges Control !"); |
2442 |
// wenn eine der Asserts anschlaegt, habe ich beim Aufbauen von m_arrSearchedControls wohl was falsch gemacht |
2447 |
// wenn eine der Asserts anschlaegt, habe ich beim Aufbauen von m_arrSearchedControls wohl was falsch gemacht |
Lines 2448-2454
Link Here
|
2448 |
xModelSet->setPropertyValue( FM_PROP_CURSORCOLOR, makeAny( sal_Int32( COL_LIGHTRED ) ) ); |
2453 |
xModelSet->setPropertyValue( FM_PROP_CURSORCOLOR, makeAny( sal_Int32( COL_LIGHTRED ) ) ); |
2449 |
m_xLastGridFound = xControlModel; |
2454 |
m_xLastGridFound = xControlModel; |
2450 |
|
2455 |
|
2451 |
xGrid->setCurrentColumnPosition((sal_Int16)nGridColumn); |
2456 |
if ( xGrid.is() ) |
|
|
2457 |
xGrid->setCurrentColumnPosition((sal_Int16)nGridColumn); |
2452 |
} |
2458 |
} |
2453 |
|
2459 |
|
2454 |
// als der Cursor neu positioniert wurde, habe ich (in positioned) meine Formularleisten-Slots invalidiert, aber das greift |
2460 |
// als der Cursor neu positioniert wurde, habe ich (in positioned) meine Formularleisten-Slots invalidiert, aber das greift |
Lines 2556-2562
Link Here
|
2556 |
|
2562 |
|
2557 |
// ... nach der ControlSource-Eigenschaft fragen |
2563 |
// ... nach der ControlSource-Eigenschaft fragen |
2558 |
SearchableControlIterator iter( xCurrentFormComponent ); |
2564 |
SearchableControlIterator iter( xCurrentFormComponent ); |
2559 |
Reference< XControl> xControlBehindModel; |
2565 |
Reference< XControl> xControl; |
2560 |
// das Control, das als Model xControlModel hat |
2566 |
// das Control, das als Model xControlModel hat |
2561 |
// (das folgende while kann mehrmals durchlaufen werden, ohne dass das Control sich aendert, dann muss |
2567 |
// (das folgende while kann mehrmals durchlaufen werden, ohne dass das Control sich aendert, dann muss |
2562 |
// ich nicht jedesmal neu suchen) |
2568 |
// ich nicht jedesmal neu suchen) |
Lines 2568-2577
Link Here
|
2568 |
if ( sControlSource.getLength() == 0 ) |
2574 |
if ( sControlSource.getLength() == 0 ) |
2569 |
{ // das aktuelle Element hat keine ControlSource, also ist es ein GridControl (das ist das einzige, was |
2575 |
{ // das aktuelle Element hat keine ControlSource, also ist es ein GridControl (das ist das einzige, was |
2570 |
// der SearchableControlIterator noch zulaesst) |
2576 |
// der SearchableControlIterator noch zulaesst) |
2571 |
xControlBehindModel = GetControlFromModel(xControlModel); |
2577 |
xControl = impl_getControl( xControlModel, *pFormObject ); |
2572 |
DBG_ASSERT(xControlBehindModel.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !"); |
2578 |
DBG_ASSERT(xControl.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !"); |
2573 |
|
2579 |
|
2574 |
Reference< XGridPeer> xGridPeer(xControlBehindModel->getPeer(), UNO_QUERY); |
2580 |
Reference< XGridPeer> xGridPeer; |
|
|
2581 |
if ( xControl.is() ) |
2582 |
xGridPeer.set( xControl->getPeer(), UNO_QUERY ); |
2575 |
do |
2583 |
do |
2576 |
{ |
2584 |
{ |
2577 |
if (!xGridPeer.is()) |
2585 |
if (!xGridPeer.is()) |
Lines 2625-2637
Link Here
|
2625 |
if (sControlSource.getLength() && xValidFormFields->hasByName(sControlSource)) |
2633 |
if (sControlSource.getLength() && xValidFormFields->hasByName(sControlSource)) |
2626 |
{ |
2634 |
{ |
2627 |
// jetzt brauche ich das Control zum SdrObject |
2635 |
// jetzt brauche ich das Control zum SdrObject |
2628 |
if (!xControlBehindModel.is()) |
2636 |
if (!xControl.is()) |
2629 |
{ |
2637 |
{ |
2630 |
xControlBehindModel = GetControlFromModel(xControlModel); |
2638 |
xControl = impl_getControl( xControlModel, *pFormObject ); |
2631 |
DBG_ASSERT(xControlBehindModel.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !"); |
2639 |
DBG_ASSERT(xControl.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !"); |
2632 |
} |
2640 |
} |
2633 |
|
2641 |
|
2634 |
if (IsSearchableControl(xControlBehindModel)) |
2642 |
if (IsSearchableControl(xControl)) |
2635 |
{ // alle Tests ueberstanden -> in die Liste mit aufnehmen |
2643 |
{ // alle Tests ueberstanden -> in die Liste mit aufnehmen |
2636 |
strFieldList += sControlSource.getStr(); |
2644 |
strFieldList += sControlSource.getStr(); |
2637 |
strFieldList += ';'; |
2645 |
strFieldList += ';'; |
Lines 2647-2653
Link Here
|
2647 |
m_arrRelativeGridColumn.Insert(-1, m_arrRelativeGridColumn.Count()); |
2655 |
m_arrRelativeGridColumn.Insert(-1, m_arrRelativeGridColumn.Count()); |
2648 |
|
2656 |
|
2649 |
// und fuer die formatierte Suche ... |
2657 |
// und fuer die formatierte Suche ... |
2650 |
pfmscContextInfo->arrFields.push_back(Reference< XInterface>(xControlBehindModel, UNO_QUERY)); |
2658 |
pfmscContextInfo->arrFields.push_back(Reference< XInterface>(xControl, UNO_QUERY)); |
2651 |
} |
2659 |
} |
2652 |
} |
2660 |
} |
2653 |
} |
2661 |
} |
Lines 3021-3044
Link Here
|
3021 |
} |
3029 |
} |
3022 |
|
3030 |
|
3023 |
//------------------------------------------------------------------------------ |
3031 |
//------------------------------------------------------------------------------ |
3024 |
Reference< XControl> FmXFormShell::GetControlFromModel(const Reference< XControlModel>& xModel) |
3032 |
Reference< XControl> FmXFormShell::impl_getControl( const Reference< XControlModel >& i_rxModel, const FmFormObj& i_rKnownFormObj ) |
3025 |
{ |
3033 |
{ |
3026 |
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::GetControlFromModel" ); |
|
|
3027 |
if ( impl_checkDisposed() ) |
3034 |
if ( impl_checkDisposed() ) |
3028 |
return NULL; |
3035 |
return NULL; |
3029 |
|
3036 |
|
3030 |
Reference< XControlContainer> xControlContainer( getControlContainerForView() ); |
3037 |
Reference< XControl > xControl; |
3031 |
|
3038 |
try |
3032 |
Sequence< Reference< XControl> > seqControls( xControlContainer->getControls() ); |
3039 |
{ |
3033 |
Reference< XControl>* pControls = seqControls.getArray(); |
3040 |
Reference< XControlContainer> xControlContainer( getControlContainerForView(), UNO_SET_THROW ); |
3034 |
// ... die ich dann durchsuchen kann |
3041 |
|
3035 |
for (int i=0; i<seqControls.getLength(); ++i) |
3042 |
Sequence< Reference< XControl > > seqControls( xControlContainer->getControls() ); |
3036 |
{ |
3043 |
const Reference< XControl >* pControls = seqControls.getArray(); |
3037 |
Reference< XControlModel> xSearchLoopModel( pControls[i]->getModel()); |
3044 |
// ... die ich dann durchsuchen kann |
3038 |
if ((XControlModel*)xSearchLoopModel.get() == (XControlModel*)xModel.get()) |
3045 |
for (sal_Int32 i=0; i<seqControls.getLength(); ++i) |
3039 |
return pControls[i]; |
3046 |
{ |
3040 |
} |
3047 |
xControl.set( pControls[i], UNO_SET_THROW ); |
3041 |
return Reference< XControl>(NULL); |
3048 |
Reference< XControlModel > xCurrentModel( xControl->getModel() ); |
|
|
3049 |
if ( xCurrentModel == i_rxModel ) |
3050 |
break; |
3051 |
xControl.clear(); |
3052 |
} |
3053 |
|
3054 |
if ( !xControl.is() ) |
3055 |
{ |
3056 |
// fallabck (some controls might not have been created, yet, since they were never visible so far) |
3057 |
Reference< XControl > xContainerControl( xControlContainer, UNO_QUERY_THROW ); |
3058 |
const Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerControl->getPeer() ); |
3059 |
ENSURE_OR_THROW( pContainerWindow, "unexpected control container implementation" ); |
3060 |
|
3061 |
const SdrView* pSdrView = m_pShell ? m_pShell->GetFormView() : NULL; |
3062 |
ENSURE_OR_THROW( pSdrView, "no current view" ); |
3063 |
|
3064 |
xControl.set( i_rKnownFormObj.GetUnoControl( *pSdrView, *pContainerWindow ), UNO_QUERY_THROW ); |
3065 |
} |
3066 |
} |
3067 |
catch( const Exception& ) |
3068 |
{ |
3069 |
DBG_UNHANDLED_EXCEPTION(); |
3070 |
} |
3071 |
|
3072 |
OSL_ENSURE( xControl.is(), "FmXFormShell::impl_getControl: no control found!" ); |
3073 |
return xControl; |
3042 |
} |
3074 |
} |
3043 |
|
3075 |
|
3044 |
//------------------------------------------------------------------------------ |
3076 |
//------------------------------------------------------------------------------ |