summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/abpilot/typeselectionpage.cxx3
-rw-r--r--extensions/source/propctrlr/browserlistbox.cxx70
-rw-r--r--extensions/source/propctrlr/browserlistbox.hxx1
-rw-r--r--extensions/source/propctrlr/eventhandler.cxx41
-rw-r--r--extensions/source/propctrlr/eventhandler.hxx8
-rw-r--r--extensions/source/propctrlr/formbrowsertools.cxx15
-rw-r--r--extensions/source/propctrlr/formbrowsertools.hxx1
-rw-r--r--extensions/source/propctrlr/propcontroller.cxx7
-rw-r--r--extensions/source/propctrlr/propcontroller.hxx1
-rw-r--r--extensions/source/propctrlr/standardcontrol.hxx28
10 files changed, 170 insertions, 5 deletions
diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx
index f7cfafe39c10..c34aceb418a3 100644
--- a/extensions/source/abpilot/typeselectionpage.cxx
+++ b/extensions/source/abpilot/typeselectionpage.cxx
@@ -116,6 +116,7 @@ namespace abp
bool bFirstVisible = true;
Link aTypeSelectionHandler = LINK(this, TypeSelectionPage, OnTypeSelected );
+ const Size aSpacing( LogicToPixel( Size( 0, 3 ), MAP_APPFONT ) );
for ( ::std::vector< ButtonItem >::const_iterator loop = m_aAllTypes.begin();
loop != m_aAllTypes.end(); ++loop )
{
@@ -125,7 +126,7 @@ namespace abp
else
{
aItem.m_pItem->SetPosPixel( aTopLeft );
- aTopLeft.Y() += aItemSize.Height();
+ aTopLeft.Y() += aItemSize.Height() + aSpacing.Height();
aItem.m_pItem->SetClickHdl( aTypeSelectionHandler );
aItem.m_pItem->Show();
diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx
index 23008fc9a1de..cbf4b7e16001 100644
--- a/extensions/source/propctrlr/browserlistbox.cxx
+++ b/extensions/source/propctrlr/browserlistbox.cxx
@@ -1244,14 +1244,75 @@ namespace pcr
}
//------------------------------------------------------------------
+ long OBrowserListBox::PreNotify( NotifyEvent& _rNEvt )
+ {
+ switch ( _rNEvt.GetType() )
+ {
+ case EVENT_KEYINPUT:
+ {
+ const KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent();
+ if ( ( pKeyEvent->GetKeyCode().GetModifier() != 0 )
+ || ( ( pKeyEvent->GetKeyCode().GetCode() != KEY_PAGEUP )
+ && ( pKeyEvent->GetKeyCode().GetCode() != KEY_PAGEDOWN )
+ )
+ )
+ break;
+
+ long nScrollOffset = 0;
+ if ( m_aVScroll.IsVisible() )
+ {
+ if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEUP )
+ nScrollOffset = -m_aVScroll.GetPageSize();
+ else if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEDOWN )
+ nScrollOffset = m_aVScroll.GetPageSize();
+ }
+
+ if ( nScrollOffset )
+ {
+ long nNewThumbPos = m_aVScroll.GetThumbPos() + nScrollOffset;
+ nNewThumbPos = ::std::max( nNewThumbPos, m_aVScroll.GetRangeMin() );
+ nNewThumbPos = ::std::min( nNewThumbPos, m_aVScroll.GetRangeMax() );
+ m_aVScroll.DoScroll( nNewThumbPos );
+ nNewThumbPos = m_aVScroll.GetThumbPos();
+
+ sal_uInt16 nFocusControlPos = 0;
+ sal_uInt16 nActiveControlPos = impl_getControlPos( m_xActiveControl );
+ if ( nActiveControlPos < nNewThumbPos )
+ nFocusControlPos = (sal_uInt16)nNewThumbPos;
+ else if ( nActiveControlPos >= nNewThumbPos + CalcVisibleLines() )
+ nFocusControlPos = (sal_uInt16)nNewThumbPos + CalcVisibleLines() - 1;
+ if ( nFocusControlPos )
+ {
+ if ( nFocusControlPos < m_aOrderedLines.size() )
+ {
+ m_aOrderedLines[ nFocusControlPos ]->second.pLine->GrabFocus();
+ }
+ else
+ OSL_ENSURE( false, "OBrowserListBox::PreNotify: internal error, invalid focus control position!" );
+ }
+ }
+
+ return 1L;
+ // handled this. In particular, we also consume PageUp/Down events if we do not use them for scrolling,
+ // otherwise they would be used to scroll the document view, which does not sound like it is desired by
+ // the user.
+ }
+ break;
+ }
+ return Control::PreNotify( _rNEvt );
+ }
+
+ //------------------------------------------------------------------
long OBrowserListBox::Notify( NotifyEvent& _rNEvt )
{
- if ( EVENT_COMMAND == _rNEvt.GetType() )
+ switch ( _rNEvt.GetType() )
+ {
+ case EVENT_COMMAND:
{
const CommandEvent* pCommand = _rNEvt.GetCommandEvent();
if ( ( COMMAND_WHEEL == pCommand->GetCommand() )
- || ( COMMAND_STARTAUTOSCROLL == pCommand->GetCommand() )
- || ( COMMAND_AUTOSCROLL == pCommand->GetCommand() )
+ || ( COMMAND_STARTAUTOSCROLL == pCommand->GetCommand() )
+ || ( COMMAND_AUTOSCROLL == pCommand->GetCommand() )
)
{
// interested in scroll events if we have a scrollbar
@@ -1261,6 +1322,9 @@ namespace pcr
}
}
}
+ break;
+ }
+
return Control::Notify( _rNEvt );
}
diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx
index a89e1dc83c39..46ae1f94aaa8 100644
--- a/extensions/source/propctrlr/browserlistbox.hxx
+++ b/extensions/source/propctrlr/browserlistbox.hxx
@@ -149,6 +149,7 @@ namespace pcr
void EnableUpdate();
void DisableUpdate();
long Notify( NotifyEvent& _rNEvt );
+ long PreNotify( NotifyEvent& _rNEvt );
void SetListener( IPropertyLineListener* _pListener );
void SetObserver( IPropertyControlObserver* _pObserver );
diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx
index 4d7c09563b5d..05d0984349b4 100644
--- a/extensions/source/propctrlr/eventhandler.cxx
+++ b/extensions/source/propctrlr/eventhandler.cxx
@@ -53,6 +53,7 @@
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
#include <com/sun/star/form/XForm.hpp>
#include <com/sun/star/form/XFormController.hpp>
#include <com/sun/star/inspection/PropertyControlType.hpp>
@@ -146,6 +147,7 @@ namespace pcr
/** === end UNO using === **/
namespace PropertyControlType = ::com::sun::star::inspection::PropertyControlType;
namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
+ namespace FormComponentType = ::com::sun::star::form::FormComponentType;
//====================================================================
//= EventDescription
@@ -538,6 +540,7 @@ namespace pcr
,m_aPropertyListeners( m_aMutex )
,m_bEventsMapInitialized( false )
,m_bIsDialogElement( false )
+ ,m_nGridColumnType( -1 )
{
DBG_CTOR( EventHandler, NULL );
}
@@ -602,6 +605,7 @@ namespace pcr
m_aEvents.swap( aEmpty );
m_bIsDialogElement = false;
+ m_nGridColumnType = -1;
try
{
Reference< XPropertySetInfo > xPSI( m_xComponent->getPropertySetInfo() );
@@ -610,6 +614,15 @@ namespace pcr
&& xPSI->hasPropertyByName( PROPERTY_HEIGHT )
&& xPSI->hasPropertyByName( PROPERTY_POSITIONX )
&& xPSI->hasPropertyByName( PROPERTY_POSITIONY );
+
+ Reference< XChild > xAsChild( _rxIntrospectee, UNO_QUERY );
+ if ( xAsChild.is() && !Reference< XForm >( _rxIntrospectee, UNO_QUERY ).is() )
+ {
+ if ( FormComponentType::GRIDCONTROL == classifyComponent( xAsChild->getParent() ) )
+ {
+ m_nGridColumnType = classifyComponent( _rxIntrospectee );
+ }
+ }
}
catch( const Exception& )
{
@@ -827,12 +840,15 @@ namespace pcr
const ::rtl::OUString* pMethods = aMethods.getConstArray();
sal_uInt32 methodCount = aMethods.getLength();
- for (sal_uInt32 method = 0 ; method < methodCount ; method++,++pMethods )
+ for (sal_uInt32 method = 0 ; method < methodCount ; ++method, ++pMethods )
{
EventDescription aEvent;
if ( !lcl_getEventDescriptionForMethod( *pMethods, aEvent ) )
continue;
+ if ( !impl_filterMethod_nothrow( aEvent ) )
+ continue;
+
const_cast< EventHandler* >( this )->m_aEvents.insert( EventMap::value_type(
lcl_getEventPropertyName( sListenerClassName, *pMethods ), aEvent ) );
}
@@ -1272,6 +1288,29 @@ namespace pcr
}
}
+ //--------------------------------------------------------------------
+ bool EventHandler::impl_filterMethod_nothrow( const EventDescription& _rEvent ) const
+ {
+ // some (control-triggered) events do not make sense for certain grid control columns. However,
+ // our mechnism to retrieve control-triggered events does not know about this, so we do some
+ // late filtering here.
+ switch ( m_nGridColumnType )
+ {
+ case FormComponentType::COMBOBOX:
+ if ( UID_BRWEVT_ACTIONPERFORMED == _rEvent.nUniqueBrowseId )
+ return false;
+ break;
+ case FormComponentType::LISTBOX:
+ if ( ( UID_BRWEVT_CHANGED == _rEvent.nUniqueBrowseId )
+ || ( UID_BRWEVT_ACTIONPERFORMED == _rEvent.nUniqueBrowseId )
+ )
+ return false;
+ break;
+ }
+
+ return true;
+ }
+
//........................................................................
} // namespace pcr
//........................................................................
diff --git a/extensions/source/propctrlr/eventhandler.hxx b/extensions/source/propctrlr/eventhandler.hxx
index a68fe100afb4..dcb70f8fd2b3 100644
--- a/extensions/source/propctrlr/eventhandler.hxx
+++ b/extensions/source/propctrlr/eventhandler.hxx
@@ -107,6 +107,8 @@ namespace pcr
/// is our introspectee a dialog element?
bool m_bIsDialogElement;
// TODO: move different handling into different derived classes?
+ /// (FormComponent) type of the grid column being inspected, or -1 if we're not inspecting a grid column
+ sal_Int16 m_nGridColumnType;
public:
// XServiceInfo - static versions
@@ -248,6 +250,12 @@ namespace pcr
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
impl_getContextFrame_nothrow() const;
+ /** approves or denies a certain method to be included in the UI
+ @return
+ <TRUE/> if and only if the given method is allowed.
+ */
+ bool impl_filterMethod_nothrow( const EventDescription& _rEvent ) const;
+
private:
EventHandler(); // never implemented
EventHandler( const EventHandler& ); // never implemented
diff --git a/extensions/source/propctrlr/formbrowsertools.cxx b/extensions/source/propctrlr/formbrowsertools.cxx
index 898a618f53a0..ccce47a7346d 100644
--- a/extensions/source/propctrlr/formbrowsertools.cxx
+++ b/extensions/source/propctrlr/formbrowsertools.cxx
@@ -53,6 +53,7 @@ namespace pcr
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
+ //------------------------------------------------------------------------
::rtl::OUString GetUIHeadlineName(sal_Int16 nClassId, const Any& aUnoObj)
{
PcrClient aResourceAccess;
@@ -130,6 +131,20 @@ namespace pcr
return sClassName;
}
+ //------------------------------------------------------------------------
+ sal_Int16 classifyComponent( const Reference< XInterface >& _rxComponent )
+ {
+ Reference< XPropertySet > xComponentProps( _rxComponent, UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > xPSI( xComponentProps->getPropertySetInfo(), UNO_SET_THROW );
+
+ sal_Int16 nControlType( FormComponentType::CONTROL );
+ if ( xPSI->hasPropertyByName( PROPERTY_CLASSID ) )
+ {
+ OSL_VERIFY( xComponentProps->getPropertyValue( PROPERTY_CLASSID ) >>= nControlType );
+ }
+ return nControlType;
+ }
+
//............................................................................
} // namespace pcr
//............................................................................
diff --git a/extensions/source/propctrlr/formbrowsertools.hxx b/extensions/source/propctrlr/formbrowsertools.hxx
index 6fb0c732ea1f..760aa9cb6d42 100644
--- a/extensions/source/propctrlr/formbrowsertools.hxx
+++ b/extensions/source/propctrlr/formbrowsertools.hxx
@@ -44,6 +44,7 @@ namespace pcr
//............................................................................
::rtl::OUString GetUIHeadlineName(sal_Int16 _nClassId, const ::com::sun::star::uno::Any& _rUnoObject);
+ sal_Int16 classifyComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
//========================================================================
struct FindPropertyByHandle : public ::std::unary_function< ::com::sun::star::beans::Property, bool >
diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx
index c4dff2512a29..ac9ae434cad6 100644
--- a/extensions/source/propctrlr/propcontroller.cxx
+++ b/extensions/source/propctrlr/propcontroller.cxx
@@ -114,6 +114,7 @@ namespace pcr
,m_bContainerFocusListening( false )
,m_bSuspendingPropertyHandlers( false )
,m_bConstructed( false )
+ ,m_bBindingIntrospectee( false )
{
DBG_CTOR(OPropertyBrowserController,NULL);
}
@@ -300,7 +301,13 @@ namespace pcr
// it in order to inspect another object.
throw VetoException();
}
+ if ( m_bBindingIntrospectee )
+ throw VetoException();
+
+ m_bBindingIntrospectee = true;
impl_rebindToInspectee_nothrow( InterfaceArray( _rObjects.getConstArray(), _rObjects.getConstArray() + _rObjects.getLength() ) );
+ m_bBindingIntrospectee = false;
+
}
//--------------------------------------------------------------------
diff --git a/extensions/source/propctrlr/propcontroller.hxx b/extensions/source/propctrlr/propcontroller.hxx
index 3254294e4777..bfa55053338b 100644
--- a/extensions/source/propctrlr/propcontroller.hxx
+++ b/extensions/source/propctrlr/propcontroller.hxx
@@ -168,6 +168,7 @@ namespace pcr
bool m_bContainerFocusListening;
bool m_bSuspendingPropertyHandlers;
bool m_bConstructed;
+ bool m_bBindingIntrospectee;
protected:
DECLARE_XINTERFACE()
diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx
index ebe5b7c4ed48..d87865c0405c 100644
--- a/extensions/source/propctrlr/standardcontrol.hxx
+++ b/extensions/source/propctrlr/standardcontrol.hxx
@@ -69,6 +69,7 @@ namespace pcr
{
protected:
typedef ControlWindow< LISTBOX_WINDOW > ListBoxType;
+
public:
ListLikeControlWithModifyHandler( Window* _pParent, WinBits _nStyle )
:ListBoxType( _pParent, _nStyle )
@@ -76,8 +77,35 @@ namespace pcr
}
void SetModifyHdl( const Link& _rLink ) { ListBoxType::SetSelectHdl( _rLink ); }
+
+ protected:
+ long PreNotify( NotifyEvent& _rNEvt );
};
+ //------------------------------------------------------------------------
+ template< class LISTBOX_WINDOW >
+ long ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::PreNotify( NotifyEvent& _rNEvt )
+ {
+ if ( _rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const ::KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent();
+ if ( ( pKeyEvent->GetKeyCode().GetModifier() == 0 )
+ && ( ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEUP )
+ || ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEDOWN )
+ )
+ )
+ {
+ if ( !ListBoxType::IsInDropDown() )
+ {
+ // don't give the base class a chance to consume the event, in the property browser, it is
+ // intended to scroll the complete property page
+ return ListBoxType::GetParent()->PreNotify( _rNEvt );
+ }
+ }
+ }
+ return ListBoxType::PreNotify( _rNEvt );
+ }
+
//========================================================================
//= OTimeControl
//========================================================================