summaryrefslogtreecommitdiff
path: root/svx/source/form
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/form')
-rw-r--r--svx/source/form/datanavi.cxx9
-rw-r--r--svx/source/form/fmshell.cxx101
-rw-r--r--svx/source/form/fmshimp.cxx135
-rw-r--r--svx/source/form/fmtextcontrolshell.cxx2
-rw-r--r--svx/source/form/fmtools.cxx2
-rw-r--r--svx/source/form/fmundo.cxx47
-rw-r--r--svx/source/form/fmview.cxx4
-rw-r--r--svx/source/form/fmvwimp.cxx101
-rw-r--r--svx/source/form/formcontrolfactory.cxx8
-rw-r--r--svx/source/form/navigatortree.cxx2
-rw-r--r--svx/source/form/tabwin.cxx58
11 files changed, 339 insertions, 130 deletions
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 6070adb015..c1e5967936 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -43,7 +43,7 @@
#include <svtools/miscopt.hxx>
#include <unotools/pathoptions.hxx>
#include <unotools/viewoptions.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <sfx2/app.hxx>
#include <sfx2/filedlghelper.hxx>
#include <sfx2/objitem.hxx>
@@ -3683,11 +3683,8 @@ namespace svxform
m_aURLED.DisableHistory();
m_aFilePickerBtn.SetClickHdl( LINK( this, AddInstanceDialog, FilePickerHdl ) );
- // load the filter name from svtools resource
- ByteString aResMgrName( "svt" );
- ResMgr* pSvtResMgr = ResMgr::CreateResMgr(
- aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
- m_sAllFilterName = String( ResId( STR_FILTERNAME_ALL, *pSvtResMgr ) );
+ // load the filter name from fps_office resource
+ m_sAllFilterName = String( ResId( STR_FILTERNAME_ALL, *CREATEVERSIONRESMGR(fps_office) ) );
}
AddInstanceDialog::~AddInstanceDialog()
diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx
index c40841f221..4a9a859c0e 100644
--- a/svx/source/form/fmshell.cxx
+++ b/svx/source/form/fmshell.cxx
@@ -78,6 +78,7 @@
#include <svx/fmglob.hxx>
#include <svl/eitem.hxx>
#include <tools/shl.hxx>
+#include <tools/diagnose_ex.h>
#include <svx/svdpage.hxx>
#include <svx/fmmodel.hxx>
#include <svx/dialmgr.hxx>
@@ -98,6 +99,8 @@
#include <svx/svxdlg.hxx> //CHINA001
#include <svx/dialogs.hrc> //CHINA001
+#include "svx/sdrobjectfilter.hxx"
+
#define HANDLE_SQL_ERRORS( action, successflag, context, message ) \
try \
{ \
@@ -544,7 +547,7 @@ void FmFormShell::Execute(SfxRequest &rReq)
case SID_FM_SCROLLBAR:
case SID_FM_SPINBUTTON:
{
- SFX_REQUEST_ARG( rReq, pGrabFocusItem, SfxBoolItem, SID_FM_GRABCONTROLFOCUS, sal_False );
+ SFX_REQUEST_ARG( rReq, pGrabFocusItem, SfxBoolItem, SID_FM_TOGGLECONTROLFOCUS, sal_False );
if ( pGrabFocusItem && pGrabFocusItem->GetValue() )
{ // see below
SfxViewShell* pShell = GetViewShell();
@@ -572,9 +575,9 @@ void FmFormShell::Execute(SfxRequest &rReq)
{
// #99013# if selected with control key, return focus to current view
// do this asynchron, so that the creation can be finished first
- // reusing the SID_FM_GRABCONTROLFOCUS is somewhat hacky ... which it wouldn't if it would have another
+ // reusing the SID_FM_TOGGLECONTROLFOCUS is somewhat hacky ... which it wouldn't if it would have another
// name, so I do not really have a big problem with this ....
- SfxBoolItem aGrabFocusIndicatorItem( SID_FM_GRABCONTROLFOCUS, sal_True );
+ SfxBoolItem aGrabFocusIndicatorItem( SID_FM_TOGGLECONTROLFOCUS, sal_True );
GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( nSlot, SFX_CALLMODE_ASYNCHRON,
&aGrabFocusIndicatorItem, NULL );
}
@@ -595,11 +598,27 @@ void FmFormShell::Execute(SfxRequest &rReq)
}
break;
- case SID_FM_GRABCONTROLFOCUS:
+ case SID_FM_TOGGLECONTROLFOCUS:
{
FmFormView* pFormView = GetFormView();
- if ( pFormView )
+ if ( !pFormView )
+ break;
+
+ // if we execute this ourself, then either the application does not implement an own handling for this,
+ // of we're on the top of the dispatcher stack, which means a control has the focus.
+ // In the latter case, we put the focus to the document window, otherwise, we focus the first control
+ const bool bHasControlFocus = GetImpl()->HasControlFocus();
+ if ( bHasControlFocus )
+ {
+ const OutputDevice* pDevice = GetCurrentViewDevice();
+ Window* pWindow = dynamic_cast< Window* >( const_cast< OutputDevice* >( pDevice ) );
+ if ( pWindow )
+ pWindow->GrabFocus();
+ }
+ else
+ {
pFormView->GrabFirstControlFocus( );
+ }
}
break;
@@ -1353,6 +1372,78 @@ namespace
}
//------------------------------------------------------------------------
+void FmFormShell::ToggleControlFocus( const SdrUnoObj& i_rUnoObject, const SdrView& i_rView, OutputDevice& i_rDevice ) const
+{
+ try
+ {
+ // check if the focus currently is in a control
+ // Well, okay, do it the other way 'round: Check whether the current control of the active controller
+ // actually has the focus. This should be equivalent.
+ const bool bHasControlFocus = GetImpl()->HasControlFocus();
+
+ if ( bHasControlFocus )
+ {
+ Window* pWindow( dynamic_cast< Window* >( &i_rDevice ) );
+ OSL_ENSURE( pWindow, "FmFormShell::ToggleControlFocus: I need a Window, really!" );
+ if ( pWindow )
+ pWindow->GrabFocus();
+ }
+ else
+ {
+ Reference< XControl > xControl;
+ GetFormControl( i_rUnoObject.GetUnoControlModel(), i_rView, i_rDevice, xControl );
+ Reference< XWindow > xControlWindow( xControl, UNO_QUERY );
+ if ( xControlWindow.is() )
+ xControlWindow->setFocus();
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------
+namespace
+{
+ class FocusableControlsFilter : public ::svx::ISdrObjectFilter
+ {
+ public:
+ FocusableControlsFilter( const SdrView& i_rView, const OutputDevice& i_rDevice )
+ :m_rView( i_rView )
+ ,m_rDevice( i_rDevice )
+ {
+ }
+
+ public:
+ virtual bool includeObject( const SdrObject& i_rObject ) const
+ {
+ const SdrUnoObj* pUnoObj = dynamic_cast< const SdrUnoObj* >( &i_rObject );
+ if ( !pUnoObj )
+ return false;
+
+ Reference< XControl > xControl = pUnoObj->GetUnoControl( m_rView, m_rDevice );
+ return FmXFormView::isFocusable( xControl );
+ }
+
+ private:
+ const SdrView& m_rView;
+ const OutputDevice& m_rDevice;
+ };
+}
+
+//------------------------------------------------------------------------
+::std::auto_ptr< ::svx::ISdrObjectFilter > FmFormShell::CreateFocusableControlFilter( const SdrView& i_rView, const OutputDevice& i_rDevice ) const
+{
+ ::std::auto_ptr< ::svx::ISdrObjectFilter > pFilter;
+
+ if ( !i_rView.IsDesignMode() )
+ pFilter.reset( new FocusableControlsFilter( i_rView, i_rDevice ) );
+
+ return pFilter;
+}
+
+//------------------------------------------------------------------------
SdrUnoObj* FmFormShell::GetFormControl( const Reference< XControlModel >& _rxModel, const SdrView& _rView, const OutputDevice& _rDevice, Reference< XControl >& _out_rxControl ) const
{
if ( !_rxModel.is() )
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index d4028a3b18..0cff58e487 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -56,6 +56,7 @@
#include "svx/svxids.hrc"
/** === begin UNO includes === **/
+#include <com/sun/star/awt/XWindow2.hpp>
#include <com/sun/star/awt/XCheckBox.hpp>
#include <com/sun/star/awt/XListBox.hpp>
#include <com/sun/star/awt/XTextComponent.hpp>
@@ -941,7 +942,6 @@ void SAL_CALL FmXFormShell::formDeactivated(const EventObject& rEvent) throw( Ru
void FmXFormShell::disposing()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::disposing" );
- OSL_TRACE( "--- FmXFormShell::disposing : %p, ........, ........", this );
impl_checkDisposed();
FmXFormShell_BASE::disposing();
@@ -1579,22 +1579,25 @@ void FmXFormShell::ExecuteSearch()
return;
// filter out the forms which do not contain valid controls at all
- FmFormArray::reverse_iterator form = m_aSearchForms.rbegin();
- ::std::vector< String >::reverse_iterator contextName = aContextNames.rbegin();
- sal_Int32 i = m_aSearchForms.size();
- for ( ;
- form != m_aSearchForms.rend();
- ++form, ++contextName, --i
- )
{
- FmSearchContext aTestContext;
- aTestContext.nContext = static_cast< sal_Int16 >( i-1 );
- sal_uInt32 nValidControls = OnSearchContextRequest( &aTestContext );
- if ( nValidControls == 0 )
+ FmFormArray aValidForms;
+ ::std::vector< String > aValidContexts;
+ FmFormArray::const_iterator form = m_aSearchForms.begin();
+ ::std::vector< String >::const_iterator contextName = aContextNames.begin();
+ for ( ; form != m_aSearchForms.end(); ++form, ++contextName )
{
- m_aSearchForms.erase( form.base() - 1 );
- aContextNames.erase( contextName.base() - 1 );
+ FmSearchContext aTestContext;
+ aTestContext.nContext = static_cast< sal_Int16 >( form - m_aSearchForms.begin() );
+ sal_uInt32 nValidControls = OnSearchContextRequest( &aTestContext );
+ if ( nValidControls > 0 )
+ {
+ aValidForms.push_back( *form );
+ aValidContexts.push_back( *contextName );
+ }
}
+
+ m_aSearchForms.swap( aValidForms );
+ aContextNames.swap( aValidContexts );
}
if (m_aSearchForms.size() == 0)
@@ -1606,7 +1609,7 @@ void FmXFormShell::ExecuteSearch()
// jetzt brauche ich noch einen 'initial context'
sal_Int16 nInitialContext = 0;
Reference< XForm> xActiveForm( getActiveForm());
- for (i=0; i<(sal_Int32)m_aSearchForms.size(); ++i)
+ for ( size_t i=0; i<m_aSearchForms.size(); ++i )
{
if (m_aSearchForms.at(i) == xActiveForm)
{
@@ -2373,6 +2376,8 @@ IMPL_LINK(FmXFormShell, OnFoundData, FmFoundRecordInformation*, pfriWhere)
FmFormObj* pFormObject = FmFormObj::GetFormObject( pObject );
Reference< XControlModel > xControlModel( pFormObject ? pFormObject->GetUnoControlModel() : Reference< XControlModel >() );
DBG_ASSERT( xControlModel.is(), "FmXFormShell::OnFoundData: invalid control!" );
+ if ( !xControlModel.is() )
+ return 0;
// disable the permanent cursor for the last grid we found a record
if (m_xLastGridFound.is() && (m_xLastGridFound != xControlModel))
@@ -2390,7 +2395,7 @@ IMPL_LINK(FmXFormShell, OnFoundData, FmFoundRecordInformation*, pfriWhere)
sal_Int32 nGridColumn = m_arrRelativeGridColumn.GetObject(pfriWhere->nFieldPos);
if (nGridColumn != -1)
{ // dummer weise muss ich mir das Control erst wieder besorgen
- Reference< XControl> xControl( GetControlFromModel(xControlModel));
+ Reference< XControl> xControl( impl_getControl( xControlModel, *pFormObject ) );
Reference< XGrid> xGrid(xControl, UNO_QUERY);
DBG_ASSERT(xGrid.is(), "FmXFormShell::OnFoundData : ungueltiges Control !");
// wenn eine der Asserts anschlaegt, habe ich beim Aufbauen von m_arrSearchedControls wohl was falsch gemacht
@@ -2402,7 +2407,8 @@ IMPL_LINK(FmXFormShell, OnFoundData, FmFoundRecordInformation*, pfriWhere)
xModelSet->setPropertyValue( FM_PROP_CURSORCOLOR, makeAny( sal_Int32( COL_LIGHTRED ) ) );
m_xLastGridFound = xControlModel;
- xGrid->setCurrentColumnPosition((sal_Int16)nGridColumn);
+ if ( xGrid.is() )
+ xGrid->setCurrentColumnPosition((sal_Int16)nGridColumn);
}
// als der Cursor neu positioniert wurde, habe ich (in positioned) meine Formularleisten-Slots invalidiert, aber das greift
@@ -2510,7 +2516,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn
// ... nach der ControlSource-Eigenschaft fragen
SearchableControlIterator iter( xCurrentFormComponent );
- Reference< XControl> xControlBehindModel;
+ Reference< XControl> xControl;
// das Control, das als Model xControlModel hat
// (das folgende while kann mehrmals durchlaufen werden, ohne dass das Control sich aendert, dann muss
// ich nicht jedesmal neu suchen)
@@ -2522,10 +2528,12 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn
if ( sControlSource.getLength() == 0 )
{ // das aktuelle Element hat keine ControlSource, also ist es ein GridControl (das ist das einzige, was
// der SearchableControlIterator noch zulaesst)
- xControlBehindModel = GetControlFromModel(xControlModel);
- DBG_ASSERT(xControlBehindModel.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !");
+ xControl = impl_getControl( xControlModel, *pFormObject );
+ DBG_ASSERT(xControl.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !");
- Reference< XGridPeer> xGridPeer(xControlBehindModel->getPeer(), UNO_QUERY);
+ Reference< XGridPeer> xGridPeer;
+ if ( xControl.is() )
+ xGridPeer.set( xControl->getPeer(), UNO_QUERY );
do
{
if (!xGridPeer.is())
@@ -2579,13 +2587,13 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn
if (sControlSource.getLength() && xValidFormFields->hasByName(sControlSource))
{
// jetzt brauche ich das Control zum SdrObject
- if (!xControlBehindModel.is())
+ if (!xControl.is())
{
- xControlBehindModel = GetControlFromModel(xControlModel);
- DBG_ASSERT(xControlBehindModel.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !");
+ xControl = impl_getControl( xControlModel, *pFormObject );
+ DBG_ASSERT(xControl.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !");
}
- if (IsSearchableControl(xControlBehindModel))
+ if (IsSearchableControl(xControl))
{ // alle Tests ueberstanden -> in die Liste mit aufnehmen
strFieldList += sControlSource.getStr();
strFieldList += ';';
@@ -2601,7 +2609,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn
m_arrRelativeGridColumn.Insert(-1, m_arrRelativeGridColumn.Count());
// und fuer die formatierte Suche ...
- pfmscContextInfo->arrFields.push_back(Reference< XInterface>(xControlBehindModel, UNO_QUERY));
+ pfmscContextInfo->arrFields.push_back(Reference< XInterface>(xControl, UNO_QUERY));
}
}
}
@@ -2975,24 +2983,48 @@ void FmXFormShell::SetDesignMode(sal_Bool bDesign)
}
//------------------------------------------------------------------------------
-Reference< XControl> FmXFormShell::GetControlFromModel(const Reference< XControlModel>& xModel)
+Reference< XControl> FmXFormShell::impl_getControl( const Reference< XControlModel >& i_rxModel, const FmFormObj& i_rKnownFormObj )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::GetControlFromModel" );
if ( impl_checkDisposed() )
return NULL;
- Reference< XControlContainer> xControlContainer( getControlContainerForView() );
+ Reference< XControl > xControl;
+ try
+ {
+ Reference< XControlContainer> xControlContainer( getControlContainerForView(), UNO_SET_THROW );
+
+ Sequence< Reference< XControl > > seqControls( xControlContainer->getControls() );
+ const Reference< XControl >* pControls = seqControls.getArray();
+ // ... die ich dann durchsuchen kann
+ for (sal_Int32 i=0; i<seqControls.getLength(); ++i)
+ {
+ xControl.set( pControls[i], UNO_SET_THROW );
+ Reference< XControlModel > xCurrentModel( xControl->getModel() );
+ if ( xCurrentModel == i_rxModel )
+ break;
+ xControl.clear();
+ }
+
+ if ( !xControl.is() )
+ {
+ // fallabck (some controls might not have been created, yet, since they were never visible so far)
+ Reference< XControl > xContainerControl( xControlContainer, UNO_QUERY_THROW );
+ const Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerControl->getPeer() );
+ ENSURE_OR_THROW( pContainerWindow, "unexpected control container implementation" );
+
+ const SdrView* pSdrView = m_pShell ? m_pShell->GetFormView() : NULL;
+ ENSURE_OR_THROW( pSdrView, "no current view" );
- Sequence< Reference< XControl> > seqControls( xControlContainer->getControls() );
- Reference< XControl>* pControls = seqControls.getArray();
- // ... die ich dann durchsuchen kann
- for (int i=0; i<seqControls.getLength(); ++i)
+ xControl.set( i_rKnownFormObj.GetUnoControl( *pSdrView, *pContainerWindow ), UNO_QUERY_THROW );
+ }
+ }
+ catch( const Exception& )
{
- Reference< XControlModel> xSearchLoopModel( pControls[i]->getModel());
- if ((XControlModel*)xSearchLoopModel.get() == (XControlModel*)xModel.get())
- return pControls[i];
+ DBG_UNHANDLED_EXCEPTION();
}
- return Reference< XControl>(NULL);
+
+ OSL_ENSURE( xControl.is(), "FmXFormShell::impl_getControl: no control found!" );
+ return xControl;
}
//------------------------------------------------------------------------------
@@ -3761,7 +3793,6 @@ void FmXFormShell::SetWizardUsing(sal_Bool _bUseThem)
void FmXFormShell::viewDeactivated( FmFormView& _rCurrentView, sal_Bool _bDeactivateController /* = sal_True */ )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::viewDeactivated" );
- OSL_TRACE( "--- FmXFormShell::viewDeactivated: %p, %p, ........", this, &_rCurrentView );
if ( _rCurrentView.GetImpl() && !_rCurrentView.IsDesignMode() )
{
@@ -3796,7 +3827,6 @@ void FmXFormShell::viewDeactivated( FmFormView& _rCurrentView, sal_Bool _bDeacti
// remove callbacks at the page
if ( pPage )
{
- OSL_TRACE( "--- FmXFormShell::resetHandler : %p, ........, %p", this, pPage );
pPage->GetImpl().SetFormsCreationHdl( Link() );
}
UpdateForms( sal_True );
@@ -3835,7 +3865,6 @@ IMPL_LINK( FmXFormShell, OnFormsCreated, FmFormPage*, /*_pPage*/ )
void FmXFormShell::viewActivated( FmFormView& _rCurrentView, sal_Bool _bSyncAction /* = sal_False */ )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::viewActivated" );
- OSL_TRACE( "--- FmXFormShell::viewActivated : %p, %p, ........", this, &_rCurrentView );
FmFormPage* pPage = _rCurrentView.GetCurPage();
@@ -3865,7 +3894,6 @@ void FmXFormShell::viewActivated( FmFormView& _rCurrentView, sal_Bool _bSyncActi
// set callbacks at the page
if ( pPage )
{
- OSL_TRACE( "--- FmXFormShell::setHandler : %p, ........, %p", this, pPage );
pPage->GetImpl().SetFormsCreationHdl( LINK( this, FmXFormShell, OnFormsCreated ) );
}
@@ -4156,6 +4184,31 @@ void FmXFormShell::handleMouseButtonDown( const SdrViewEvent& _rViewEvent )
}
}
+//------------------------------------------------------------------------------
+bool FmXFormShell::HasControlFocus() const
+{
+ bool bHasControlFocus = false;
+
+ try
+ {
+ Reference< XFormController > xController( getActiveController() );
+ Reference< XControl > xCurrentControl;
+ if ( xController.is() )
+ xCurrentControl.set( xController->getCurrentControl() );
+ if ( xCurrentControl.is() )
+ {
+ Reference< XWindow2 > xPeerWindow( xCurrentControl->getPeer(), UNO_QUERY_THROW );
+ bHasControlFocus = xPeerWindow->hasFocus();
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return bHasControlFocus;
+}
+
//==============================================================================
//==============================================================================
SearchableControlIterator::SearchableControlIterator(Reference< XInterface> xStartingPoint)
diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx
index c55d15781c..501420329e 100644
--- a/svx/source/form/fmtextcontrolshell.cxx
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -130,7 +130,6 @@ namespace svx
SID_ATTR_LRSPACE, /* 48 */
SID_ATTR_ULSPACE, /* 49 */
SID_ATTR_CHAR_AUTOKERN,
- SID_ATTR_CHAR_OVERLINE,
SID_SET_SUPER_SCRIPT,
SID_SET_SUB_SCRIPT,
SID_CHAR_DLG,
@@ -141,6 +140,7 @@ namespace svx
SID_ATTR_CHAR_RELIEF,
SID_ATTR_PARA_LEFT_TO_RIGHT, /* 950 */
SID_ATTR_PARA_RIGHT_TO_LEFT,
+ SID_ATTR_CHAR_OVERLINE,
0
};
diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx
index e1d139dd10..3409125a5f 100644
--- a/svx/source/form/fmtools.cxx
+++ b/svx/source/form/fmtools.cxx
@@ -72,6 +72,8 @@
/** === end UNO includes === **/
#include <basic/sbxvar.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
#include <comphelper/container.hxx>
#include <comphelper/extract.hxx>
#include <comphelper/processfactory.hxx>
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index 3900c5b694..c674648e08 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -90,25 +90,7 @@ class ScriptEventListenerWrapper : public ScriptEventListener_BASE
public:
ScriptEventListenerWrapper( FmFormModel& _rModel) throw ( RuntimeException ) : pModel(&_rModel)
{
- Reference < XPropertySet > xProps(
- ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- if ( xProps.is() )
- {
- Reference< XComponentContext > xCtx( xProps->getPropertyValue(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY );
- if ( xCtx.is() )
- {
- Reference< XMultiComponentFactory > xMFac(
- xCtx->getServiceManager(), UNO_QUERY );
- if ( xMFac.is() )
- {
- m_vbaListener.set( xMFac->createInstanceWithContext(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "ooo.vba.EventListener" ) ), xCtx ),
- UNO_QUERY_THROW );
- }
- }
- }
+
}
// XEventListener
virtual void SAL_CALL disposing(const EventObject& ) throw( RuntimeException ){}
@@ -136,6 +118,33 @@ public:
private:
void setModel()
{
+ if ( !m_vbaListener.is() )
+ {
+ Reference < XPropertySet > xProps(
+ ::comphelper::getProcessServiceFactory(), UNO_QUERY );
+ if ( xProps.is() )
+ {
+ Reference< XComponentContext > xCtx( xProps->getPropertyValue(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY );
+ if ( xCtx.is() )
+ {
+ Reference< XMultiComponentFactory > xMFac(
+ xCtx->getServiceManager(), UNO_QUERY );
+ SfxObjectShellRef xObjSh = pModel->GetObjectShell();
+ Reference< XMultiServiceFactory > xDocFac;
+ if ( xObjSh.Is() )
+ xDocFac.set( xObjSh->GetModel(), UNO_QUERY );
+
+ if ( xMFac.is() )
+ {
+ m_vbaListener.set( xMFac->createInstanceWithContext(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "ooo.vba.EventListener" ) ), xCtx ),
+ UNO_QUERY_THROW );
+ }
+ }
+ }
+ }
Reference< XPropertySet > xProps( m_vbaListener, UNO_QUERY );
if ( xProps.is() )
{
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 0df6f9d86e..17c2776de0 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -339,8 +339,6 @@ void FmFormView::GrabFirstControlFocus( sal_Bool _bForceSync )
//------------------------------------------------------------------------
SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage)
{
- OSL_TRACE( "--- FmFormView::ShowSdrPage : ........, %p, %p", this, pPage );
-
SdrPageView* pPV = E3dView::ShowSdrPage(pPage);
if (pPage)
@@ -377,8 +375,6 @@ SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage)
//------------------------------------------------------------------------
void FmFormView::HideSdrPage()
{
- OSL_TRACE( "--- FmFormView::HideSdrPage : ........, %p, %p", this, GetCurPage() );
-
// --- 1. deactivate controls
if ( !IsDesignMode() )
DeactivateControls(GetSdrPageView());
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 8d75e4a882..802cbb59dd 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -823,6 +823,48 @@ void FmXFormView::AutoFocus( sal_Bool _bSync )
else
m_nAutoFocusEvent = Application::PostUserEvent(LINK(this, FmXFormView, OnAutoFocus));
}
+
+// -----------------------------------------------------------------------------
+bool FmXFormView::isFocusable( const Reference< XControl >& i_rControl )
+{
+ if ( !i_rControl.is() )
+ return false;
+
+ try
+ {
+ Reference< XPropertySet > xModelProps( i_rControl->getModel(), UNO_QUERY_THROW );
+
+ // only enabled controls are allowed to participate
+ sal_Bool bEnabled = sal_False;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_ENABLED ) >>= bEnabled );
+ if ( !bEnabled )
+ return false;
+
+ // check the class id of the control model
+ sal_Int16 nClassId = FormComponentType::CONTROL;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId );
+
+ // controls which are not focussable
+ if ( ( FormComponentType::CONTROL != nClassId )
+ && ( FormComponentType::IMAGEBUTTON != nClassId )
+ && ( FormComponentType::GROUPBOX != nClassId )
+ && ( FormComponentType::FIXEDTEXT != nClassId )
+ && ( FormComponentType::HIDDENCONTROL != nClassId )
+ && ( FormComponentType::IMAGECONTROL != nClassId )
+ && ( FormComponentType::SCROLLBAR != nClassId )
+ && ( FormComponentType::SPINBUTTON!= nClassId )
+ )
+ {
+ return true;
+ }
+ }
+ catch( const Exception& e )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return false;
+}
+
// -----------------------------------------------------------------------------
static Reference< XControl > lcl_firstFocussableControl( const Sequence< Reference< XControl > >& _rControls )
{
@@ -833,47 +875,19 @@ static Reference< XControl > lcl_firstFocussableControl( const Sequence< Referen
const Reference< XControl >* pControlsEnd = _rControls.getConstArray() + _rControls.getLength();
for ( ; pControls != pControlsEnd; ++pControls )
{
- try
- {
- if ( !pControls->is() )
- continue;
-
- Reference< XPropertySet > xModelProps( (*pControls)->getModel(), UNO_QUERY_THROW );
-
- // only enabled controls are allowed to participate
- sal_Bool bEnabled = sal_False;
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_ENABLED ) >>= bEnabled );
- if ( !bEnabled )
- continue;
-
- // check the class id of the control model
- sal_Int16 nClassId = FormComponentType::CONTROL;
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId );
-
- // controls which are not focussable
- if ( ( FormComponentType::CONTROL != nClassId )
- && ( FormComponentType::IMAGEBUTTON != nClassId )
- && ( FormComponentType::GROUPBOX != nClassId )
- && ( FormComponentType::FIXEDTEXT != nClassId )
- && ( FormComponentType::HIDDENCONTROL != nClassId )
- && ( FormComponentType::IMAGECONTROL != nClassId )
- && ( FormComponentType::SCROLLBAR != nClassId )
- && ( FormComponentType::SPINBUTTON!= nClassId )
- )
- {
- xReturn = *pControls;
- break;
- }
- }
- catch( const Exception& e )
+ if ( !pControls->is() )
+ continue;
+
+ if ( FmXFormView::isFocusable( *pControls ) )
{
- (void)e; // make compiler happy
+ xReturn = *pControls;
+ break;
}
-
- if ( !xReturn.is() && _rControls.getLength() )
- xReturn = _rControls[0];
}
+ if ( !xReturn.is() && _rControls.getLength() )
+ xReturn = _rControls[0];
+
return xReturn;
}
@@ -1008,11 +1022,6 @@ IMPL_LINK(FmXFormView, OnAutoFocus, void*, /*EMPTYTAG*/)
}
// -----------------------------------------------------------------------------
-namespace
-{
-}
-
-// -----------------------------------------------------------------------------
void FmXFormView::onCreatedFormObject( FmFormObj& _rFormObject )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::onCreatedFormObject" );
@@ -1590,7 +1599,13 @@ bool FmXFormView::createControlLabelPair( const ::comphelper::ComponentContext&
xLabelModel.set( pLabel->GetUnoControlModel(), UNO_QUERY );
if ( xLabelModel.is() )
{
- xLabelModel->setPropertyValue( FM_PROP_LABEL, makeAny( sFieldName + _rFieldPostfix ) );
+ ::rtl::OUString sLabel;
+ if ( _rxField.is() && _rxField->getPropertySetInfo()->hasPropertyByName(FM_PROP_LABEL) )
+ _rxField->getPropertyValue(FM_PROP_LABEL) >>= sLabel;
+ if ( !sLabel.getLength() )
+ sLabel = sFieldName;
+
+ xLabelModel->setPropertyValue( FM_PROP_LABEL, makeAny( sLabel + _rFieldPostfix ) );
String sObjectLabel( SVX_RES( RID_STR_OBJECT_LABEL ) );
sObjectLabel.SearchAndReplaceAllAscii( "#object#", sFieldName );
xLabelModel->setPropertyValue( FM_PROP_NAME, makeAny( ::rtl::OUString( sObjectLabel ) ) );
diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx
index 089b6986e0..e68d525f52 100644
--- a/svx/source/form/formcontrolfactory.cxx
+++ b/svx/source/form/formcontrolfactory.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/form/XFormComponent.hpp>
#include <com/sun/star/form/FormComponentType.hpp>
#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <com/sun/star/awt/MouseWheelBehavior.hpp>
#include <com/sun/star/form/XGridColumnFactory.hpp>
#include <com/sun/star/style/VerticalAlignment.hpp>
#include <com/sun/star/awt/LineEndFormat.hpp>
@@ -97,6 +98,7 @@ namespace svxform
/** === end UNO using === **/
namespace FormComponentType = ::com::sun::star::form::FormComponentType;
namespace ScrollBarOrientation = ::com::sun::star::awt::ScrollBarOrientation;
+ namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior;
namespace LineEndFormat = ::com::sun::star::awt::LineEndFormat;
namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
namespace DataType = ::com::sun::star::sdbc::DataType;
@@ -506,6 +508,12 @@ namespace svxform
_rxControlModel->setPropertyValue( FM_PROP_STRICTFORMAT, makeAny( sal_Bool( sal_True ) ) );
}
+ // mouse wheel: don't use it for scrolling by default (i110036)
+ if ( xPSI->hasPropertyByName( FM_PROP_MOUSE_WHEEL_BEHAVIOR ) )
+ {
+ _rxControlModel->setPropertyValue( FM_PROP_MOUSE_WHEEL_BEHAVIOR, makeAny( MouseWheelBehavior::SCROLL_DISABLED ) );
+ }
+
if ( xPSI->hasPropertyByName( FM_PROP_WRITING_MODE ) )
_rxControlModel->setPropertyValue( FM_PROP_WRITING_MODE, makeAny( WritingMode2::CONTEXT ) );
}
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index 4e1a0b3f95..2adf2854ed 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -2232,7 +2232,7 @@ namespace svxform
{
SdrPaintWindow* pPaintWindow = pFormView->GetPaintWindow( i );
OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
- if ( OUTDEV_WINDOW == rOutDev.GetOutDevType() )
+ if ( ( OUTDEV_WINDOW == rOutDev.GetOutDevType() ) && !aMarkRect.IsEmpty() )
{
pFormView->MakeVisible( aMarkRect, (Window&)rOutDev );
}
diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx
index 0165212e24..8ecaa916ea 100644
--- a/svx/source/form/tabwin.cxx
+++ b/svx/source/form/tabwin.cxx
@@ -91,9 +91,46 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::form;
using namespace ::com::sun::star::container;
+using namespace ::com::sun::star;
using namespace ::svxform;
using namespace ::svx;
+
+struct ColumnInfo
+{
+ ::rtl::OUString sColumnName;
+ ::rtl::OUString sLabel;
+ bool bColumn;
+ ColumnInfo(const ::rtl::OUString& i_sColumnName,const ::rtl::OUString& i_sLabel)
+ : sColumnName(i_sColumnName)
+ , sLabel(i_sLabel)
+ , bColumn(true)
+ {
+ }
+ ColumnInfo(const ::rtl::OUString& i_sColumnName)
+ : sColumnName(i_sColumnName)
+ , bColumn(false)
+ {
+ }
+};
+
+void lcl_addToList( SvTreeListBox& _rListBox, const uno::Reference< container::XNameAccess>& i_xColumns )
+{
+ uno::Sequence< ::rtl::OUString > aEntries = i_xColumns->getElementNames();
+ const ::rtl::OUString* pEntries = aEntries.getConstArray();
+ sal_Int32 nEntries = aEntries.getLength();
+ for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries )
+ {
+ uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),UNO_QUERY_THROW);
+ ::rtl::OUString sLabel;
+ if ( xColumn->getPropertySetInfo()->hasPropertyByName(FM_PROP_LABEL) )
+ xColumn->getPropertyValue(FM_PROP_LABEL) >>= sLabel;
+ if ( sLabel.getLength() )
+ _rListBox.InsertEntry( sLabel,NULL,FALSE,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) );
+ else
+ _rListBox.InsertEntry( *pEntries,NULL,FALSE,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) );
+ }
+}
//==================================================================
// class FmFieldWinListBox
//==================================================================
@@ -149,7 +186,8 @@ void FmFieldWinListBox::StartDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPi
aDescriptor[ daConnection ] <<= pTabWin->GetConnection().getTyped();
aDescriptor[ daCommand ] <<= pTabWin->GetObjectName();
aDescriptor[ daCommandType ]<<= pTabWin->GetObjectType();
- aDescriptor[ daColumnName ] <<= ::rtl::OUString( GetEntryText( pSelected ) );
+ ColumnInfo* pInfo = static_cast<ColumnInfo*>(pSelected->GetUserData());
+ aDescriptor[ daColumnName ] <<= pInfo->sColumnName;
TransferableHelper* pTransferColumn = new OColumnTransferable(
aDescriptor, CTF_FIELD_DESCRIPTOR | CTF_CONTROL_EXCHANGE | CTF_COLUMN_DESCRIPTOR
@@ -238,7 +276,8 @@ sal_Bool FmFieldWin::createSelectionControls( )
aDescr[ daCommand ] <<= GetObjectName();
aDescr[ daCommandType ] <<= GetObjectType();
- aDescr[ daColumnName ] <<= ::rtl::OUString( pListBox->GetEntryText( pSelected) );
+ ColumnInfo* pInfo = static_cast<ColumnInfo*>(pSelected->GetUserData());
+ aDescr[ daColumnName ] <<= pInfo->sColumnName;//::rtl::OUString( pListBox->GetEntryText( pSelected) );
// transfer this to the SFX world
SfxUnoAnyItem aDescriptorItem( SID_FM_DATACCESS_DESCRIPTOR, makeAny( aDescr.createPropertyValueSequence() ) );
@@ -344,15 +383,14 @@ void FmFieldWin::UpdateContent(const ::com::sun::star::uno::Reference< ::com::su
// the place, and connectRowset should be replaced with ensureRowSetConnection
// get the fields of the object
- Sequence< ::rtl::OUString> aFieldNames;
+
if ( m_aConnection.is() && m_aObjectName.getLength() )
- aFieldNames = getFieldNamesByCommandDescriptor( m_aConnection, m_nObjectType, m_aObjectName );
-
- // put them into the list
- const ::rtl::OUString* pFieldNames = aFieldNames.getConstArray();
- sal_Int32 nFieldsCount = aFieldNames.getLength();
- for ( sal_Int32 i = 0; i < nFieldsCount; ++i, ++pFieldNames)
- pListBox->InsertEntry( * pFieldNames);
+ {
+ Reference< XComponent > xKeepFieldsAlive;
+ Reference< XNameAccess > xColumns = getFieldsByCommandDescriptor( m_aConnection, m_nObjectType, m_aObjectName,xKeepFieldsAlive );
+ if ( xColumns.is() )
+ lcl_addToList(*pListBox,xColumns);
+ }
// Prefix setzen
UniString aPrefix;