text:
namespace ww
{

using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::awt::grid;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::deployment;
using namespace ::com::sun::star::ucb;

using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::uno::UNO_SET_THROW;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::makeAny;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::XInterface;
using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::beans::PropertyValue;
using ::com::sun::star::lang::XComponent;
using ::com::sun::star::lang::XMultiComponentFactory;
using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::lang::EventObject;
using ::com::sun::star::frame::XFrame;
using ::com::sun::star::frame::XController;
using ::com::sun::star::frame::XModel;
using ::com::sun::star::frame::XDispatchHelper;
using ::com::sun::star::frame::XDispatchProvider;

using ::rtl::OUString;

// tools.cpp
Reference< XInterface > getConfig(
            const Reference< XComponentContext > & xContext,
            const OUString & sNodeName ) throw ( RuntimeException );

class SetFocusThread : public osl::Thread
{
public:
    SetFocusThread( const Reference< XWindow > & rWindow );
    virtual ~SetFocusThread();

    virtual void SAL_CALL run();

    virtual void SAL_CALL onTerminated();
private:
    ::com::sun::star::uno::WeakReferenceHelper * pWeakRefHelper;
};

SetFocusThread::SetFocusThread(
        const Reference< XWindow > & rWindow )
: pWeakRefHelper( new ::com::sun::star::uno::WeakReferenceHelper( rWindow ) )
{
}

SetFocusThread::~SetFocusThread()
{
    delete pWeakRefHelper;
    pWeakRefHelper = NULL;
}

void SAL_CALL SetFocusThread::run()
{
    // ToDo wait few hundred seconds?
    try
    {
        if ( pWeakRefHelper )
        {
            Reference< XWindow > xWindow( pWeakRefHelper->get(), UNO_QUERY_THROW );
            xWindow->setFocus();
        }
    }
    catch (...)
    {
        onTerminated();
    }
}

void SAL_CALL SetFocusThread::onTerminated()
{
    delete this;
}

Sequence< OUString > WWView::m_aResource;

WWView::WWView( const Reference< XComponentContext > & xContext,
                const Reference< XFrame > & xFrame,
                const Reference< XWindow > & xParentWindow )
 : m_pModel( NULL )
 , m_xContext( xContext )
 , m_xFrame( xFrame )
 , m_xParentWindow( xParentWindow )
 , m_bUseInputLine( true )
 , m_nRowHeight( -1 )
{
    try
    {
        ConfigReader aConfig( m_xContext );
        m_bUseInputLine = aConfig.getBoolValue( A2S( PROP_USE_INPUT_LINE ) );
        loadResource();
    }
    catch ( Exception & )
    {
    }

    createWindow();
    SetFocusThread * thread = new SetFocusThread( m_xFrame->getContainerWindow() );
    if ( thread->createSuspended() )
        thread->resume();
}

WWView::~WWView()
{
    m_pModel = NULL;
    try
    {
        if ( m_xFocusListener.is() )
            m_xFocusListener.clear();
        if ( m_xKeyHandler.is() )
        {
            controlFocusLost( Edit );
            m_xKeyHandler.clear();
        }
        if ( m_xGridKeyHandler.is() )
        {
            controlFocusLost( Grid );
            m_xGridKeyHandler.clear();
        }
        if ( m_xPopupMenu.is() )
            m_xPopupMenu.clear();

        if ( m_xWindowListener.is() )
        {
            m_xParentWindow->removeWindowListener( m_xWindowListener );
            m_xWindowListener.clear();
        }

        m_xGridRowSelection.clear();

        if ( m_xActionListener.is() )
            m_xActionListener.clear();

        Reference< XComponent > xComp;
        xComp.set( m_xContainerWindow, UNO_QUERY );
        m_xContainerWindow.clear();
        if ( xComp.is() )
            xComp->dispose();
    }
    catch ( Exception & )
    {
    }
    m_xContext.clear();
    m_xFrame.clear();
}

Reference< XWindow > WWView::getWindow() const
{
    return m_xContainerWindow;
}

void WWView::setModel( WWModel * pModel )
{
    m_pModel = pModel;
}

void WWView::disconnectModel()
{
    m_pModel = NULL;
}

void WWView::focusToDoc() const
{
    Reference< XWindow > xWindow( m_xFrame->getContainerWindow() );
    if ( xWindow.is() )
        xWindow->setFocus();
}

Reference< XMutableGridDataModel > WWView::getGridDataModel() const
{
    Reference< XControlContainer > xContainer( m_xContainerWindow, UNO_QUERY );
    if ( xContainer.is() )
    {
        Reference< XControl > xControl( xContainer->getControl( A2S( CTL_GRID ) ), UNO_QUERY );
        if ( xControl.is() )
        {
            Reference< XPropertySet > xPropSet( xControl->getModel(), UNO_QUERY );
            if ( xPropSet.is() )
            {
                 Reference< XMutableGridDataModel > xGridDataModel(
                        xPropSet->getPropertyValue( A2S( "GridDataModel" ) ), UNO_QUERY );
                return xGridDataModel;
             }
        }
    }
    return Reference< XMutableGridDataModel >();
}

Reference< XModel > WWView::getDocument() const throw ( RuntimeException )
{
    if ( m_xFrame.is() )
    {
        Reference< XController > xController( m_xFrame->getController() );
        if ( xController.is() )
        {
            Reference< XModel > xModel( xController->getModel() );
            if ( xModel.is() )
                return xController->getModel();
        }
    }
    throw RuntimeException();
}

Reference< XInterface > WWView::getSelection() const throw ( RuntimeException )
{
    return getDocument()->getCurrentSelection();
}

Sequence< sal_Int32 > WWView::getSelectedEntryIndex() const
{
    if ( m_xGridRowSelection.is() )
        return m_xGridRowSelection->getSelectedRows();
    return Sequence< sal_Int32 >();
}

bool WWView::hasGridSelection() const
{
    if ( m_xGridRowSelection.is() )
        return m_xGridRowSelection->hasSelectedRows();
    return false;
}

void WWView::selectRow( const sal_Int32 nIndex, const bool bGotoRow ) const
{
    ::osl::MutexGuard const g( m_aMutex );
    try
    {
        if ( m_xGridRowSelection.is() && m_pModel && nIndex >= 0 )
        {
            if ( nIndex < m_pModel->getRowCount() )
                m_xGridRowSelection->selectRow( nIndex );
            if ( bGotoRow )
            {
                Reference< XGridControl > xGridControl( m_xGridRowSelection, UNO_QUERY_THROW );
                xGridControl->goToCell( 0, nIndex );
            }
        }
    }
    catch ( Exception & )
    {
    }
}

void WWView::selectRow( const ::sal_Int32 nX, const ::sal_Int32 nY, const ::sal_Int16 nModifires ) const
{
    ::osl::MutexGuard const g( m_aMutex );
    try
    {
        Reference< XGridControl > xGridControl( m_xGridRowSelection, UNO_QUERY_THROW );
        const sal_Int32 nIndex = xGridControl->getRowAtPoint( nX, nY );
        if ( nIndex >= 0 )
        {
            if ( !( nModifires & ::com::sun::star::awt::KeyModifier::MOD1 ) )
                m_xGridRowSelection->deselectAllRows();
            m_xGridRowSelection->selectRow( nIndex );
        }
    }
    catch ( Exception & )
    {
    }
}

int WWView::getRowAt( const ::sal_Int32 nX, const ::sal_Int32 nY ) const
{
    Reference< XGridControl > xGridControl( m_xGridRowSelection, UNO_QUERY );
    if ( xGridControl.is() )
        return xGridControl->getRowAtPoint( nX, nY );
    return -1;
}

int WWView::getRowHeight()
{
    ::osl::MutexGuard const g( m_aMutex );
    if ( m_nRowHeight < 0 )
    {
        Reference< XGridControl > xGridControl( m_xGridRowSelection, UNO_QUERY );
        if ( xGridControl.is() )
        {
            sal_Int32 nRow = xGridControl->getRowAtPoint( 0, 0 );
            sal_Int32 nY = 0;
            for ( ; nY < 50; ++nY )
            {
                if ( xGridControl->getRowAtPoint( 0, nY ) != nRow )
                    break;
            }
            const sal_Int32 nStartY = nY;
            ++nRow;
            const sal_Int32 nNextEnd = nY + 50;
            for ( ; nY < nNextEnd; ++nY )
            {
                if ( xGridControl->getRowAtPoint( 0, nY ) != nRow )
                    break;
            }
            m_nRowHeight = nY - nStartY;
        }
    }
    return m_nRowHeight;
}

void WWView::controlFocusGained( const ControlType nType ) const
{
    ::osl::MutexGuard const g( m_aMutex );
    if ( m_xFrame.is() )
    {
        try
        {
#ifndef TASKPANE
            // If the panel is there in the sidebar,
            // keyhandler for the document controller does not take
            // any events, so events like to push enter key can not be consumed.
            // For workaround the problem, to set the keyhandler to the toolkit.
            // ToDo XExtendedToolkit is deprecated to use
            Reference< XWindowPeer > xWindowPeer(
                    m_xFrame->getContainerWindow(), UNO_QUERY_THROW );
            Reference< XExtendedToolkit > xUserInputInterception(
                    xWindowPeer->getToolkit(), UNO_QUERY_THROW );
#else
            Reference< XUserInputInterception > xUserInputInterception(
                    m_xFrame->getController(), UNO_QUERY_THROW );
#endif
            xUserInputInterception->addKeyHandler(
                nType == Edit ? m_xKeyHandler : m_xGridKeyHandler );
        }
        catch ( Exception & )
        {
        }
    }
}

void WWView::controlFocusLost( const ControlType nType ) const
{
    ::osl::MutexGuard const g( m_aMutex );
    if ( m_xFrame.is() )
    {
        try
        {
#ifndef TASKPANE
            Reference< XWindowPeer > xWindowPeer(
                    m_xFrame->getContainerWindow(), UNO_QUERY_THROW );
            Reference< XExtendedToolkit > xUserInputInterception(
                    xWindowPeer->getToolkit(), UNO_QUERY_THROW );
#else
            Reference< XUserInputInterception > xUserInputInterception(
                    m_xFrame->getController(), UNO_QUERY_THROW );
#endif
            xUserInputInterception->removeKeyHandler(
                nType == Edit ? m_xKeyHandler : m_xGridKeyHandler );
        }
        catch ( Exception & )
        {
        }
    }
}

OUString WWView::getInputLineText() const
{
    static const OUString sPropText = A2S( "Text" );

    ::osl::MutexGuard const g( m_aMutex );
    try
    {
        Reference< XControlContainer > xContainerControl( m_xContainerWindow, UNO_QUERY_THROW );
        Reference< XControl > xControl( xContainerControl->getControl( A2S( CTL_EDIT ) ), UNO_SET_THROW );
        Reference< XPropertySet > xPropSet( xControl->getModel(), UNO_QUERY_THROW );
        OUString s;
        xPropSet->getPropertyValue( sPropText ) >>= s;
        return s;
    }
    catch ( Exception & )
    {
    }
    return OUString();
}

void WWView::setInputLine( const ::rtl::OUString & rText ) const
{
    static const OUString sPropText = A2S( "Text" );

    ::osl::MutexGuard const g( m_aMutex );
    try
    {
        Reference< XControlContainer > xContainerControl( m_xContainerWindow, UNO_QUERY_THROW );
        Reference< XControl > xControl( xContainerControl->getControl( A2S( CTL_EDIT ) ), UNO_SET_THROW );
        Reference< XPropertySet > xPropSet( xControl->getModel(), UNO_QUERY_THROW );
        xPropSet->setPropertyValue( sPropText, makeAny( rText ) );
    }
    catch ( Exception & )
    {
    }
}

void WWView::updateButtonsState() const
{
    try
    {
        if ( m_xGridRowSelection.is() )
        {
            const sal_Bool bState = m_xGridRowSelection->hasSelectedRows();
            Reference< XWindow > xWindow;
            Reference< XControlContainer > xContainer( m_xContainerWindow, UNO_QUERY_THROW );
            xWindow.set( xContainer->getControl( A2S( CTL_BTN_DELETE ) ), UNO_QUERY_THROW );
            xWindow->setEnable( bState );
            xWindow.set( xContainer->getControl( A2S( CTL_BTN_GOTO ) ), UNO_QUERY_THROW );
            xWindow->setEnable( bState );
        }
    }
    catch ( Exception & )
    {
    }
}

void WWView::gridSelectionChanged() const
{
    // ToDo update button state
    ::osl::MutexGuard const g( m_aMutex );
    if ( m_pModel )
    {
        const Sequence< sal_Int32 > aIndex = getSelectedEntryIndex();
        if ( aIndex.getLength() == 1 )
            setInputLine( m_pModel->getFormula( aIndex[0] ) );
        updateButtonsState();
    }
}

void WWView::updateRowFormula() const
{
    ::osl::MutexGuard const g( m_aMutex );
    if ( m_pModel )
    {
        // ToDo multiple selection support?
        const Sequence< sal_Int32 > aIndex = getSelectedEntryIndex();
        if ( aIndex.getLength() == 1 )
            m_pModel->setFormula( aIndex[0], getInputLineText() );
    }
}

void WWView::executeCommand( const int nCommand )
{
    if ( !m_pModel )
        return;
    switch ( nCommand )
    {
        case CMD_ADD:
            m_pModel->addEntry();
            break;
        case CMD_REMOVE:
        {
            const Sequence< sal_Int32 > aIndex = getSelectedEntryIndex();
            if ( aIndex.getLength() )
            {
                m_pModel->removeEntries( aIndex );
                executeGridCommand( CMD_SELECT_CURRENT, 0 );
                //updateButtonsState();
            }
            break;
        }
        case CMD_UPDATE:
            m_pModel->updateAll();
            break;
        case CMD_GOTO:
        {
            const Sequence< sal_Int32 > aIndex = getSelectedEntryIndex();
            if ( aIndex.getLength() == 1 )
            {
                const OUString sAddress = m_pModel->getAddress( aIndex[0] );
                if ( sAddress.getLength() )
                    gotoPoint( sAddress );
            }
            break;
        }
        case CMD_OPTION:
            showOptionPopup();
            break;
        case CMD_CLEAR:
            m_pModel->removeAllEntries();
            //updateButtonsState();
            break;
        case CMD_INPUT_LINE:
            switchInputLine( !m_bUseInputLine );
            break;
        case CMD_SETTINGS:
            openOption();
            break;
        case CMD_ABOUT:
        {
            Reference< XInputStream > xInputStream;
            Reference< XDialog > xDialog;
            try
            {
                Reference< XMultiComponentFactory > xMcf( m_xContext->getServiceManager(), UNO_SET_THROW );
                const OUString sExtId = A2S( EXT_ID );

                Reference< XExtensionManager > xExtManager (
                    ::com::sun::star::deployment::ExtensionManager::get( m_xContext ) );
                Reference< XPackage > xPackage;
                xPackage.set( xExtManager->getDeployedExtension(
                    A2S( "user" ), sExtId, OUString(), Reference< XCommandEnvironment >() ) );
                if ( !xPackage.is() )
                    xPackage.set( xExtManager->getDeployedExtension(
                        A2S( "shared" ), sExtId, OUString(), Reference< XCommandEnvironment >() ) );
                if ( !xPackage.is() )
                    xPackage.set( xExtManager->getDeployedExtension(
                        A2S( "bundle" ), sExtId, OUString(), Reference< XCommandEnvironment >() ) );
                if ( !xPackage.is() )
                    return; // not installed?

                Reference< XSimpleFileAccess > xSfa (
                    xMcf->createInstanceWithContext(
                        A2S( "com.sun.star.ucb.SimpleFileAccess" ), m_xContext ), UNO_QUERY_THROW );
                xInputStream.set( xSfa->openFileRead( A2S( LICENSE_FILE ) ), UNO_QUERY_THROW );

                Reference< XTextInputStream > xTextInputStream(
                    xMcf->createInstanceWithContext(
                        A2S( "com.sun.star.io.TextInputStream" ), m_xContext ), UNO_QUERY_THROW );
                Reference< XActiveDataSink > xActiveDataSink( xTextInputStream, UNO_QUERY_THROW );
                xActiveDataSink->setInputStream( xInputStream );
                const OUString sLicense = xTextInputStream->readString( Sequence< sal_Unicode >(), sal_False );
                xInputStream->closeInput();

                Reference< XDialogProvider > xDialogProvider(
                    xMcf->createInstanceWithContext(
                        A2S( "com.sun.star.awt.DialogProvider" ), m_xContext ), UNO_QUERY_THROW );
                xDialog.set( xDialogProvider->createDialog(
                                        A2S( ABOUT_DIALOG ) ), UNO_SET_THROW );

                Reference< XControl > xControl;
                Reference< XPropertySet > xPropSet;
                Reference< XControlContainer > xContainer( xDialog, UNO_QUERY_THROW );
                xControl.set( xContainer->getControl( A2S( "label_name" ) ), UNO_SET_THROW );
                xPropSet.set( xControl->getModel(), UNO_QUERY_THROW );
                xPropSet->setPropertyValue( A2S( "Label" ), makeAny( xPackage->getName() ) );
                // ToDo display name?

                xControl.set( xContainer->getControl( A2S( "label_version" ) ), UNO_SET_THROW );
                xPropSet.set( xControl->getModel(), UNO_QUERY_THROW );
                xPropSet->setPropertyValue( A2S( "Label" ), makeAny( xPackage->getVersion() ) );

                xControl.set( xContainer->getControl( A2S( "edit_text" ) ), UNO_SET_THROW );
                xPropSet.set( xControl->getModel(), UNO_QUERY_THROW );
                xPropSet->setPropertyValue( A2S( "Text" ), makeAny( sLicense ) );

                xDialog->execute();
                Reference< XComponent > xComponent( xDialog, UNO_QUERY_THROW );
                xDialog.clear();
                xComponent->dispose();
            }
            catch ( Exception & )
            {
                if ( xInputStream.is() )
                    xInputStream->closeInput();
                if ( xDialog.is() )
                {
                    Reference< XComponent > xComponent( xDialog, UNO_QUERY );
                    if ( xComponent.is() )
                        xComponent->dispose();
                }
            }
            break;
        }
        default:
            break;
    }
}

void WWView::executeGridCommand( const int nCommand, const int nModifires )
{
    if ( !m_pModel )
        return;
    try
    {
        Reference< XGridControl > xGridControl( m_xGridRowSelection, UNO_QUERY_THROW );
        const sal_Int32 nCurrent = xGridControl->getCurrentRow();

        switch ( nCommand )
        {
            case CMD_HOME:
            case CMD_END:
            case CMD_UP:
            case CMD_DOWN:
            {
                if ( nCommand == CMD_UP && nCurrent < 0 ||
                     nCommand == CMD_DOWN && nCurrent > ( m_pModel->getRowCount() - 1 ) )
                    break;
                sal_Int32 nNextRow = 0;
                switch ( nCommand )
                {
                    case CMD_UP:
                        nNextRow = nCurrent - 1;
                        break;
                    case CMD_DOWN:
                        nNextRow = nCurrent + 1;
                        break;
                    case CMD_HOME:
                        nNextRow = 0;
                        break;
                    case CMD_END:
                        nNextRow = m_pModel->getRowCount() - 1;
                    default:
                        break;
                }
                switch ( nModifires )
                {
                    case KeyModifier::SHIFT:
                    {
                        sal_Int32 nStart = 0;
                        sal_Int32 nEnd = 0;
                        switch ( nCommand )
                        {
                            case CMD_UP:
                                nStart = nNextRow;
                                nEnd = nCurrent;
                                break;
                            case CMD_DOWN:
                                nStart = nCurrent;
                                nEnd = nNextRow;
                                break;
                            case CMD_HOME:
                                nStart = 0;
                                nEnd = nCurrent;
                                break;
                            case CMD_END:
                                nStart = nCurrent;
                                nEnd = nNextRow;
                            default:
                                break;
                        }
                        m_xGridRowSelection->deselectAllRows();
                        xGridControl->goToCell( 0, nNextRow );
                        for ( sal_Int32 nPos = nStart; nPos <= nEnd; ++nPos )
                                m_xGridRowSelection->selectRow( nPos );
                        break;
                    }
                    case KeyModifier::MOD1:
                        xGridControl->goToCell( 0, nNextRow );
                        break;
                    case KeyModifier::SHIFT | KeyModifier::MOD1:
                        break;
                    default:
                        m_xGridRowSelection->deselectRow( nCurrent );
                        xGridControl->goToCell( 0, nNextRow );
                        m_xGridRowSelection->selectRow( nNextRow );
                        break;
                }
                break;
            }
            case CMD_SELECT_CURRENT:
            {
                xGridControl->goToCell( 0, nCurrent );
                m_xGridRowSelection->selectRow( nCurrent );
                break;
            }
            case CMD_SPACE:
                if ( m_xGridRowSelection->isRowSelected( nCurrent ) )
                    m_xGridRowSelection->deselectRow( nCurrent );
                else
                    m_xGridRowSelection->selectRow( nCurrent );
                break;
            default:
                break;
        }
    }
    catch ( Exception & )
    {
    }
}

void WWView::openOption()
{
    ::osl::MutexGuard const g( m_aMutex );
    try
    {
        Reference< XPropertySet > xPropSet(
                getConfig( m_xContext, A2S( CONFIG_OPTIONS ) ), UNO_QUERY_THROW );
        OUString sOptionsPageURL;
        xPropSet->getPropertyValue( A2S( "OptionsPage" ) ) >>= sOptionsPageURL;

        Reference< ::com::sun::star::util::XMacroExpander > xMacroExpander(
            m_xContext->getValueByName(
                A2S( "/singletons/com.sun.star.util.theMacroExpander" ) ), UNO_QUERY_THROW );
        sOptionsPageURL = xMacroExpander->expandMacros( sOptionsPageURL );

        Sequence< PropertyValue > aArgs( 1 );
        aArgs[0] = PropertyValue(
            A2S( "OptionsPageURL" ),
            0,
            makeAny( sOptionsPageURL.copy( 20 ) ),
            ::com::sun::star::beans::PropertyState_DIRECT_VALUE );
        executeDispatch( A2S( ".uno:OptionsTreeDialog" ), aArgs );
    }
    catch ( Exception & )
    {
    }
}

void WWView::switchInputLine( bool bState )
{
    ::osl::MutexGuard const g( m_aMutex );
    m_bUseInputLine = bState;
    try
    {
        Reference< XControlContainer > xContainerControl( m_xContainerWindow, UNO_QUERY_THROW );
        Reference< XControl > xControl( xContainerControl->getControl( A2S( CTL_EDIT ) ) );
        Reference< XWindow > xWindow( xControl, UNO_QUERY_THROW );
        if ( m_bUseInputLine )
            xWindow->addFocusListener( m_xFocusListener );
        else
            xWindow->removeFocusListener( m_xFocusListener );

        xWindow->setVisible( m_bUseInputLine ? sal_True : sal_False );
        if ( m_xParentWindow.is() )
        {
            Rectangle aRect = m_xParentWindow->getPosSize();
            resizeWindow( aRect.Width, aRect.Height );
        }
    }
    catch ( Exception & )
    {
    }
}

void WWView::executeContextMenu( const ::sal_Int32 nX, const ::sal_Int32 nY )
{
    ::osl::MutexGuard const g( m_aMutex );

    const Sequence< sal_Int32 > aIndex = getSelectedEntryIndex();
    if ( !aIndex.getLength() )
        return;
    try
    {
        const OUString * pRes = m_aResource.getConstArray();
        const sal_Int16 nGotoId = 1000;

        Reference< XControlContainer > xContainerControl( m_xContainerWindow, UNO_QUERY_THROW );
        Reference< XControl > xControl( xContainerControl->getControl( A2S( CTL_GRID ) ), UNO_QUERY_THROW );
        Reference< XWindowPeer > xPeer( xControl->getPeer(), UNO_SET_THROW );

        if ( !m_xPopupMenu.is() )
        {
            Reference< XMultiComponentFactory > xMcf( m_xContext->getServiceManager(), UNO_QUERY_THROW );
            m_xPopupMenu.set(
                    xMcf->createInstanceWithContext(
                        A2S( "com.sun.star.awt.PopupMenu" ), m_xContext ), UNO_QUERY_THROW );

            m_xPopupMenu->hideDisabledEntries( sal_True );

            m_xPopupMenu->insertItem( (sal_Int16)CMD_GOTO, pRes[6], (sal_Int16)0, 0 );
            m_xPopupMenu->insertItem( nGotoId, pRes[13], (sal_Int16)0, 1 );
            m_xPopupMenu->insertItem( (sal_Int16)CMD_REMOVE, pRes[5], (sal_Int16)0, 2 );

#ifdef UNIFIED_MENU_API
            Reference< XPopupMenu > xPopup(
#else
            Reference< XPopupMenuExtended > xPopup(
#endif
                xMcf->createInstanceWithContext(
                        A2S( "com.sun.star.awt.PopupMenu" ), m_xContext ), UNO_QUERY_THROW );
            m_xPopupMenu->setPopupMenu( nGotoId, xPopup );
        }

        Sequence< OUString > aRefs;
        sal_Bool bGotoCellState = sal_False;
        sal_Bool bGotoState = sal_False;

        if ( aIndex.getLength() == 1 )
        {
            bGotoCellState = sal_True;

            // add formula references
#ifdef UNIFIED_MENU_API
            Reference< XPopupMenu > xPopup( m_xPopupMenu->getPopupMenu( nGotoId ) );
#else
            Reference< XPopupMenuExtended > xPopup( m_xPopupMenu->getPopupMenu( nGotoId ), UNO_QUERY_THROW );
#endif
            if ( xPopup->getItemCount() )
                xPopup->clear();

            if ( m_pModel )
            {
                aRefs = m_pModel->getCellReferences( aIndex[0] );
                if ( aRefs.getLength() )
                {
                    sal_Int32 nIndex = 0;
                    const OUString * pRefs = aRefs.getConstArray();
                    const OUString * pRefsEnd = aRefs.getConstArray() + aRefs.getLength();
                    for ( ; pRefs < pRefsEnd; ++pRefs, ++nIndex )
                        xPopup->insertItem( nGotoId + nIndex, *pRefs, (sal_Int16)0, nIndex );

                    bGotoState = sal_True;
                }
            }
        }
        m_xPopupMenu->enableItem( (sal_Int16)CMD_GOTO, bGotoCellState );
        m_xPopupMenu->enableItem( nGotoId, bGotoState );

        const sal_Int16 nId = m_xPopupMenu->execute( xPeer,
                ::com::sun::star::awt::Rectangle( nX, nY, 0, 0 ),
                ::com::sun::star::awt::PopupMenuDirection::EXECUTE_DEFAULT );
        if ( nId >= nGotoId )
        {
            const sal_Int32 n = nId - nGotoId;
            if ( 0 <= n && n < aRefs.getLength() )
                gotoPoint( aRefs[n] );
        }
        else if ( nId > 0 )
            executeCommand( (int)nId );
    }
    catch ( Exception & )
    {
    }
}

void WWView::showOptionPopup()
{
    ::osl::MutexGuard const g( m_aMutex );
    try
    {
        const OUString * pRes = m_aResource.getConstArray();

        Reference< XControl > xControl( m_xContainerWindow, UNO_QUERY_THROW );
        Reference< XWindowPeer > xPeer( xControl->getPeer(), UNO_SET_THROW );

        Reference< XControlContainer > xContainerControl( m_xContainerWindow, UNO_QUERY_THROW );
        Reference< XWindow > xWindow( xContainerControl->getControl( A2S( CTL_BTN_OPTION ) ), UNO_QUERY_THROW );
        Rectangle aRect = xWindow->getPosSize();

        Reference< XMultiComponentFactory > xMcf( m_xContext->getServiceManager(), UNO_QUERY_THROW );
#ifdef UNIFIED_MENU_API
        Reference< XPopupMenu > xPopupMenu(
#else
        Reference< ::com::sun::star::awt::XPopupMenuExtended > xPopupMenu(
#endif
                    xMcf->createInstanceWithContext(
                        A2S( "com.sun.star.awt.PopupMenu" ), m_xContext ), UNO_QUERY_THROW );

        xPopupMenu->hideDisabledEntries( sal_True );

        xPopupMenu->insertItem( (sal_Int16)CMD_CLEAR, pRes[9], (sal_Int16)0, 0 );
        xPopupMenu->insertSeparator( 1 );
        xPopupMenu->insertItem( (sal_Int16)CMD_INPUT_LINE, pRes[10], ::com::sun::star::awt::MenuItemStyle::CHECKABLE, 2 );
        //xPopupMenu->insertItem( (sal_Int16)CMD_STORE_WATCHES, A2S( "Store watches" ), ::com::sun::star::awt::MenuItemStyle::CHECKABLE, 3 );
        xPopupMenu->insertSeparator( 4 );
        // ToDo move to options
        xPopupMenu->insertItem( (sal_Int16)CMD_SETTINGS, pRes[11], (sal_Int16)0, 5 );
        xPopupMenu->insertItem( (sal_Int16)CMD_ABOUT, pRes[12], (sal_Int16)0, 6 );

        xPopupMenu->checkItem( (sal_Int16)CMD_INPUT_LINE, m_bUseInputLine );
        //xPopupMenu->checkItem( (sal_Int16)CMD_STORE_WATCHES, m_bStoreWatches );

        const sal_Int16 nId = xPopupMenu->execute( xPeer,
                ::com::sun::star::awt::Rectangle( aRect.X, aRect.Y + aRect.Height, 0, 0 ),
                ::com::sun::star::awt::PopupMenuDirection::EXECUTE_DEFAULT );
        if ( nId > 0 )
            executeCommand( (int)nId );
    }
    catch ( Exception & )
    {
    }
}

void WWView::gotoPoint( const OUString & rDesc )
{
    Sequence< PropertyValue > aArgs( 1 );
    aArgs[0] = PropertyValue( A2S( "ToPoint" ), 0, makeAny( rDesc ),
                    ::com::sun::star::beans::PropertyState_DIRECT_VALUE );

    executeDispatch( A2S( ".uno:GoToCell" ), aArgs );

    focusToDoc();
}

void WWView::executeDispatch( const OUString & rCommand, const Sequence< PropertyValue > & rArgs )
{
    if ( !m_xDispatchHelper.is() )
    {
        try
        {
            Reference< XMultiComponentFactory > xMcf( m_xContext->getServiceManager(), UNO_QUERY_THROW );
            m_xDispatchHelper.set(
                    xMcf->createInstanceWithContext(
                        A2S( "com.sun.star.frame.DispatchHelper" ), m_xContext ), UNO_QUERY_THROW );
        }
        catch (...)
        {
            return;
        }
    }
    Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
    if ( xDispatchProvider.is() )
        m_xDispatchHelper->executeDispatch(
                xDispatchProvider, rCommand, A2S( "_self" ), 0, rArgs );
}

bool WWView::startDragging( const ::sal_Int32 nX, const ::sal_Int32 nY ) const
{
    if ( hasGridSelection() )
    {
        try
        {
            // ignore on the vscroll bar, ToDo width of the vscroll
            Reference< XWindow > xWindow( m_xGridRowSelection, UNO_QUERY_THROW );
            if ( nX < ( xWindow->getPosSize().Width - 20 ) )
            {
                Reference< XGridControl > xGridControl( m_xGridRowSelection, UNO_QUERY_THROW );
                const sal_Int32 nIndex = xGridControl->getRowAtPoint( nX, nY );
                if ( nIndex >= 0 )
                {
                    const Sequence< sal_Int32 > aIndex = getSelectedEntryIndex();
                    const sal_Int32 * pIndex = aIndex.getConstArray();
                    const sal_Int32 * pIndexEnd = aIndex.getConstArray() + aIndex.getLength();
                    for ( ; pIndex < pIndexEnd; ++pIndex )
                    {
                        if ( *pIndex == nIndex )
                            return true;
                    }
                }
            }
        }
        catch ( Exception & )
        {
        }
    }
    return false;
}

void WWView::endDragging( const ::sal_Int32 nX, const ::sal_Int32 nY )
{
    const Sequence< sal_Int32 > aIndex = getSelectedEntryIndex();
    if ( aIndex.getLength() && m_pModel )
    {
        try
        {
            Reference< XGridControl > xGridControl( m_xGridRowSelection, UNO_QUERY_THROW );
            sal_Int32 nIndex = xGridControl->getRowAtPoint( nX, nY );
            if ( nIndex < 0 )
            {
                if ( nY < getRowHeight() )
                    nIndex = 0;
                else
                    nIndex = m_pModel->getRowCount();
            }
            if ( nIndex >= 0 )
                m_pModel->moveEntries( nIndex, aIndex );
        }
        catch ( Exception & )
        {
        }
    }
}

void WWView::drawDestination( const int nNewRow, const int nOldRow )
{
    int nRow = nNewRow;
    if ( nNewRow < 0 )
    {
        if ( nOldRow > 0 )
            nRow = nOldRow + 1;
        else
            return;
    }
    const int nRowHeight = getRowHeight();
    try
    {
        Reference< XControl > xControl( m_xGridRowSelection, UNO_QUERY_THROW );
        Reference< XWindowPeer > xWindowPeer( xControl->getPeer(), UNO_SET_THROW );
        Reference< XView > xView( m_xGridRowSelection, UNO_QUERY_THROW );
        Reference< XGraphics > xGraphics( xView->getGraphics() );
        if ( !xGraphics.is() )
        {
            Reference< XDevice > xDevice( xWindowPeer, UNO_QUERY_THROW );
            xGraphics.set( xDevice->createGraphics(), UNO_SET_THROW );
        }
        // erase older indicator
        const sal_Int32 nOldY = nRowHeight * ( nOldRow + 1 );
        xWindowPeer->invalidateRect( Rectangle( 1, nOldY - 1, 45, nOldY + 1 ),
                        ::com::sun::star::awt::InvalidateStyle::UPDATE );

        xGraphics->push();
        xGraphics->setLineColor( 0x000000 ); // ToDo get color from style settings
        const sal_Int32 nY = nRowHeight * ( nRow + 1 ); // including the header
        xGraphics->drawRect( 1, nY, 45, 2 );
        xGraphics->pop();
    }
    catch ( Exception & )
    {
    }
}

void WWView::setPointer( const sal_Int32 nPointer )
{
    // ToDo not working well on the grid control, issue
    ::osl::MutexGuard const g( m_aMutex );
    try
    {
        if ( !m_xPointer.is() )
        {
            Reference< XMultiComponentFactory > xMcf( m_xContext->getServiceManager(), UNO_SET_THROW );
            m_xPointer.set(
                xMcf->createInstanceWithContext(
                    A2S( "com.sun.star.awt.Pointer" ), m_xContext ), UNO_QUERY_THROW );
        }
        m_xPointer->setType( nPointer );
        Reference< XControl > xControl( m_xGridRowSelection, UNO_QUERY_THROW );
        Reference< XWindowPeer > xWindowPeer( xControl->getPeer(), UNO_QUERY_THROW );
        xWindowPeer->setPointer( m_xPointer );
    }
    catch ( Exception & )
    {
    }
}

void WWView::loadResource()
{
    ::osl::MutexGuard const g( m_aMutex );

    if ( m_aResource.getLength() == 0 )
    {
        Sequence< OUString > aRes( 15 );
        OUString * pRes = aRes.getArray();

        // ToDo map en-US to terms of specific language
        Reference< ::com::sun::star::resource::XStringResourceWithLocation > xRes(
                getResourceLoader( m_xContext, A2S( RES_DIR ), A2S( RES_NAME ) ) );
        if ( xRes.is() )
        {
            pRes[0] = xRes->resolveString( A2S( "id.sheet" ) );
            pRes[1] = xRes->resolveString( A2S( "id.cell" ) );
            pRes[2] = xRes->resolveString( A2S( "id.value" ) );
            pRes[3] = xRes->resolveString( A2S( "id.formula" ) );
            pRes[4] = xRes->resolveString( A2S( "id.add" ) );
            pRes[5] = xRes->resolveString( A2S( "id.remove" ) );
            pRes[6] = xRes->resolveString( A2S( "id.gotocell" ) );
            pRes[7] = xRes->resolveString( A2S( "id.updateall" ) );
            pRes[8] = xRes->resolveString( A2S( "id.option" ) );
            pRes[9] = xRes->resolveString( A2S( "id.clear" ) );
            pRes[10] = xRes->resolveString( A2S( "id.inputline" ) );
            pRes[11] = xRes->resolveString( A2S( "id.settings" ) );
            pRes[12] = xRes->resolveString( A2S( "id.label.about" ) );
            pRes[13] = xRes->resolveString( A2S( "id.goto" ) );
            pRes[14] = xRes->resolveString( A2S( "id.label.store" ) );
        }
        else
        {
            pRes[0] = A2S( "Sheet" );
            pRes[1] = A2S( "Cell" );
            pRes[2] = A2S( "Value" );
            pRes[3] = A2S( "Formula" );
            pRes[4] = A2S( "Add" );
            pRes[5] = A2S( "Remove" );
            pRes[6] = A2S( "Go to cell" );
            pRes[7] = A2S( "Update" );
            pRes[8] = A2S( "Options" );
            pRes[9] = A2S( "Clear all" );
            pRes[10] = A2S( "Input line" );
            pRes[11] = A2S( "Settings..." );
            pRes[12] = A2S( "About" );
            pRes[13] = A2S( "Go to" );
            pRes[14] = A2S( "Store watches" );
        }
        m_aResource = aRes;
    }
}

Sequence< ::rtl::OUString > WWView::getLabels()
{
    if ( m_aResource.getLength() > 14 )
    {
        const OUString *pResource = m_aResource.getConstArray();
        Sequence< OUString > aRes( 4 );
        OUString * pRes = aRes.getArray();
        pRes[0] = pResource[0];
        pRes[1] = pResource[1];
        pRes[2] = pResource[2];
        pRes[3] = pResource[3];
        return aRes;
    }
    return Sequence< OUString >();
}

#define LEFT_MARGIN        (sal_Int32)3
#define RIGHT_MARGIN       (sal_Int32)3
#define TOP_MARGIN         (sal_Int32)3
#define BUTTON_SEP         (sal_Int32)2
#define BUTTON_WIDTH      (sal_Int32)28
#define BUTTON_HEIGHT     (sal_Int32)28
#define INPUT_LINE_HEIGHT (sal_Int32)23

void WWView::resizeWindow( const sal_Int32 nWidth, const sal_Int32 nHeight )
{
    ::osl::MutexGuard const g( m_aMutex );
    try
    {
        Reference< XWindow > xWindow;
        Reference< XControlContainer > xContainerControl( m_xContainerWindow, UNO_QUERY_THROW );

        xWindow.set( xContainerControl->getControl( A2S( CTL_BTN_OPTION ) ), UNO_QUERY_THROW );
        xWindow->setPosSize( nWidth - BUTTON_WIDTH - RIGHT_MARGIN, 0, 0, 0,
                            ::com::sun::star::awt::PosSize::X );

        xWindow.set( xContainerControl->getControl( A2S( CTL_BTN_UPDATE ) ), UNO_QUERY_THROW );
        xWindow->setPosSize( nWidth - BUTTON_WIDTH - BUTTON_WIDTH - RIGHT_MARGIN * 2, 0, 0, 0,
                            ::com::sun::star::awt::PosSize::X );

        xWindow.set( xContainerControl->getControl( A2S( CTL_GRID ) ), UNO_QUERY_THROW );
        xWindow->setPosSize(
            0,
            TOP_MARGIN + BUTTON_HEIGHT + BUTTON_SEP + ( m_bUseInputLine ? INPUT_LINE_HEIGHT + BUTTON_SEP : 0 ),
            nWidth - LEFT_MARGIN - RIGHT_MARGIN,
            nHeight - TOP_MARGIN - BUTTON_HEIGHT - BUTTON_SEP * 2 -
                                    ( m_bUseInputLine ? ( INPUT_LINE_HEIGHT + BUTTON_SEP ) : 0 ),
            ::com::sun::star::awt::PosSize::SIZE | ::com::sun::star::awt::PosSize::Y );

        if ( m_bUseInputLine )
        {
            xWindow.set( xContainerControl->getControl( A2S( CTL_EDIT ) ), UNO_QUERY_THROW );
            xWindow->setPosSize( 0, 0, nWidth - LEFT_MARGIN - RIGHT_MARGIN, 0,
                                ::com::sun::star::awt::PosSize::WIDTH );
        }
    }
    catch ( Exception & )
    {
    }
}

void WWView::createButton(
                    const Reference< XControlContainer > & xControlContainer,
                    const OUString & sName,
                    const OUString & sHelpText,
                    const OUString & sImageURL,
                    const OUString & sActionCommand,
                    const sal_Int32 nLeft, const sal_Int32 nTop,
                    const sal_Int32 nWidth, const sal_Int32 nHeight ) throw (RuntimeException)
{
    try
    {
        Reference< XMultiComponentFactory > xMcf( m_xContext->getServiceManager(), UNO_SET_THROW );

        Reference< XControl > xControl(
            xMcf->createInstanceWithContext(
                A2S( "com.sun.star.awt.UnoControlButton" ), m_xContext ), UNO_QUERY_THROW );
        Reference< XControlModel > xControlModel(
            xMcf->createInstanceWithContext(
                A2S( "com.sun.star.awt.UnoControlButtonModel" ), m_xContext ), UNO_QUERY_THROW );
        Reference< XButton > xButton( xControl, UNO_QUERY_THROW );
        xButton->setActionCommand( sActionCommand );
        xButton->addActionListener( m_xActionListener );

        Reference< XPropertySet > xPropSet( xControlModel, UNO_QUERY_THROW );
        xPropSet->setPropertyValue( A2S( "HelpText" ), makeAny( sHelpText ) );
        xPropSet->setPropertyValue( A2S( "ImageURL" ), makeAny( sImageURL ) );

        xControl->setModel( xControlModel );
        xControlContainer->addControl( sName, xControl );

        Reference< XWindow > xWindow( xControl, UNO_QUERY_THROW );
        xWindow->setPosSize( nLeft, nTop, nWidth, nHeight,
                             ::com::sun::star::awt::PosSize::POSSIZE );
    }
    catch ( Exception & )
    {
    }
}

void WWView::createWindow()
{
    ::osl::MutexGuard const g( m_aMutex );

    if ( m_aResource.getLength() < 14 )
        return;
    try
    {
        const OUString * pRes = m_aResource.getConstArray();

        Reference< XMultiComponentFactory > xMcf( m_xContext->getServiceManager(), UNO_SET_THROW );

        Reference< XWindowPeer > xParentWindowPeer( m_xParentWindow, UNO_QUERY_THROW );
        Reference< XToolkit > xToolkit( xParentWindowPeer->getToolkit(), UNO_SET_THROW );

        Reference< XControl > xContainerControl(
            xMcf->createInstanceWithContext(
                A2S( "com.sun.star.awt.UnoControlContainer" ), m_xContext ), UNO_QUERY_THROW );
        Reference< XControlModel > xContainerControlModel(
            xMcf->createInstanceWithContext(
                A2S( "com.sun.star.awt.UnoControlContainerModel" ), m_xContext ), UNO_QUERY_THROW );
        xContainerControl->setModel( xContainerControlModel );
        xContainerControl->createPeer( xToolkit, xParentWindowPeer );
        m_xContainerWindow.set( xContainerControl, UNO_QUERY );

        Reference< XStyleSettingsSupplier > xStyleSettingsSupp( xContainerControl, UNO_QUERY_THROW );
        Reference< XStyleSettings > xStyleSettings( xStyleSettingsSupp->getStyleSettings(), UNO_SET_THROW );
        const sal_Int32 nBackgroundColor = xStyleSettings->getDialogColor();

        Reference< XControlContainer > xControlContainer( xContainerControl, UNO_QUERY_THROW );

        m_xActionListener.set( new ActionListener( this ) );
        const OUString sIconDir = xStyleSettings->getHighContrastMode() == sal_True ? A2S( IMGH_DIR ) : A2S( IMG_DIR );
        // buttons
        createButton( xControlContainer, A2S( CTL_BTN_ADD ),
                      pRes[4], sIconDir.concat( A2S( IMG_ADD ) ), A2S( "A" ),
                      LEFT_MARGIN, TOP_MARGIN,
                      BUTTON_WIDTH, BUTTON_HEIGHT );
        createButton( xControlContainer, A2S( CTL_BTN_DELETE ),
                      pRes[5], sIconDir.concat( A2S( IMG_DEL ) ), A2S( "B" ),
                      LEFT_MARGIN + BUTTON_SEP + BUTTON_WIDTH,
                      TOP_MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
        createButton( xControlContainer, A2S( CTL_BTN_GOTO ),
                      pRes[6], sIconDir.concat( A2S( IMG_GOTO ) ), A2S( "D" ),
                      LEFT_MARGIN + BUTTON_SEP * 2 + BUTTON_WIDTH * 2,
                      TOP_MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );

        createButton( xControlContainer, A2S( CTL_BTN_UPDATE ),
                      pRes[7], sIconDir.concat( A2S( IMG_UPDATE ) ), A2S( "C" ),
                      LEFT_MARGIN + BUTTON_SEP * 5 + BUTTON_WIDTH * 5,
                      TOP_MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
        createButton( xControlContainer, A2S( CTL_BTN_OPTION ),
                      pRes[8], sIconDir.concat( A2S( IMG_TUNE ) ), A2S( "G" ),
                      LEFT_MARGIN + BUTTON_SEP * 6 + BUTTON_WIDTH * 6,
                      TOP_MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );

        // ToDo throbber to show the state and to stop the iteration?

        // input line
        Reference< XControl > xEditControl(
            xMcf->createInstanceWithContext(
                A2S( "com.sun.star.awt.UnoControlEdit" ), m_xContext ), UNO_QUERY_THROW );
        Reference< XControlModel > xEditControlModel(
            xMcf->createInstanceWithContext(
                A2S( "com.sun.star.awt.UnoControlEditModel" ), m_xContext ), UNO_QUERY_THROW );
        xEditControl->setModel( xEditControlModel );
        xControlContainer->addControl( A2S( CTL_EDIT ), xEditControl );

        // ToDo helptext and help url
        Reference< XWindow > xEditWindow( xEditControl, UNO_QUERY_THROW );
        xEditWindow->setPosSize( LEFT_MARGIN, TOP_MARGIN * 2 + BUTTON_HEIGHT,
                                 (sal_Int32)100, INPUT_LINE_HEIGHT,
                                 ::com::sun::star::awt::PosSize::POSSIZE );
        m_xFocusListener.set( new FocusListener( this, Edit ) );
        xEditWindow->addFocusListener( m_xFocusListener );
        xEditWindow->setVisible( m_bUseInputLine ? sal_True : sal_False );

        // grid
        Reference< XControl > xGridControl(
            xMcf->createInstanceWithContext(
                A2S( "com.sun.star.awt.grid.UnoControlGrid" ), m_xContext ), UNO_QUERY_THROW );
        Reference< XControlModel > xGridControlModel(
            xMcf->createInstanceWithContext(
                A2S( "com.sun.star.awt.grid.UnoControlGridModel" ), m_xContext ), UNO_QUERY_THROW );

        Reference< XGridDataModel > xGridDataModel(
            xMcf->createInstanceWithContext(
                A2S( "com.sun.star.awt.grid.DefaultGridDataModel" ), m_xContext ), UNO_QUERY_THROW );

        Reference< XPropertySet > xGridPropSet( xGridControlModel, UNO_QUERY_THROW );
        // ToDo sortable or not by column tab
        xGridPropSet->setPropertyValue( A2S( "GridDataModel" ), makeAny( xGridDataModel ) );
        xGridPropSet->setPropertyValue( A2S( "Border" ), makeAny( (sal_Int16)0 ) );
        xGridPropSet->setPropertyValue( A2S( "HScroll" ), Any( sal_False, getCppuBooleanType() ) );
        xGridPropSet->setPropertyValue( A2S( "SelectionModel" ), makeAny( ::com::sun::star::view::SelectionType_MULTI ) );
        xGridPropSet->setPropertyValue( A2S( "ShowColumnHeader" ), makeAny( sal_True ) );
        xGridPropSet->setPropertyValue( A2S( "ShowRowHeader" ), makeAny( sal_False ) );
        xGridPropSet->setPropertyValue( A2S( "VScroll" ), makeAny( sal_True ) );
        xGridPropSet->setPropertyValue( A2S( "BackgroundColor" ), makeAny( nBackgroundColor ) );
        xGridPropSet->setPropertyValue( A2S( "Tabstop" ), makeAny( sal_True ) );

        xGridControl->setModel( xGridControlModel );

        Reference< XWindow > xGridWindow( xGridControl, UNO_QUERY_THROW );
        xGridWindow->setPosSize( LEFT_MARGIN, TOP_MARGIN * 3 + BUTTON_HEIGHT + INPUT_LINE_HEIGHT,
                                 280, 400,
                                 ::com::sun::star::awt::PosSize::POSSIZE );
        xGridWindow->addFocusListener( new FocusListener( this, Grid ) );

        // add columns
        Reference< XGridColumnModel > xGridColumnModel(
                xGridPropSet->getPropertyValue( A2S( "ColumnModel" ) ), UNO_QUERY_THROW );
        Reference< XGridColumn > xGridColumn;
        xGridColumn = xGridColumnModel->createColumn();
        xGridColumn->setTitle( pRes[0] );
        xGridColumnModel->addColumn( xGridColumn );
        xGridColumn = xGridColumnModel->createColumn();
        xGridColumn->setTitle( pRes[1] );
        xGridColumnModel->addColumn( xGridColumn );
        xGridColumn = xGridColumnModel->createColumn();
        xGridColumn->setTitle( pRes[2] );
        xGridColumnModel->addColumn( xGridColumn );
        xGridColumn->setHorizontalAlign(
                    ::com::sun::star::style::HorizontalAlignment_RIGHT );
        xGridColumn = xGridColumnModel->createColumn();
        xGridColumn->setTitle( pRes[3] );
        xGridColumnModel->addColumn( xGridColumn );

        xControlContainer->addControl( A2S( CTL_GRID ), xGridControl );
        m_xGridRowSelection.set( xGridControl, UNO_QUERY_THROW );
        Reference< XMouseListener > xMouseListener( new MouseListener( this ) );
        xGridWindow->addMouseListener( xMouseListener );
        Reference< XMouseMotionListener > xMouseMotionListener( xMouseListener, UNO_QUERY_THROW );
        xGridWindow->addMouseMotionListener( xMouseMotionListener );
        m_xGridRowSelection->addSelectionListener( new GridSelectionListener( this ) );

        m_xWindowListener.set( new WindowListener( this ) );
        m_xParentWindow->addWindowListener( m_xWindowListener );

        m_xKeyHandler.set( new KeyHandler( this ) );
        m_xGridKeyHandler.set( new GridKeyHandler( this ) );

        updateButtonsState();
    }
    catch ( Exception & )
    {
    }
}

} // namespace ww


text:
Q: Is ElasticSearch watch able to write data to Mysql I have some meta data in ElasticSearch, when the meta data updated I need to sync the updates to Mysql. So I'm wondering that is there an ES Watch/Triger could do this automatically please?

A: There isn't any direct action in watcher calling mysql ( that I know of ).
But you could create a simple API called by watcher that would update your database on a Webhook Action

redpajama_set_name: RedPajamaStackExchange


text:
Tag Archives: Bhopal
Bhopal gas disaster: Another year passes, core issues remain unaddressed
December 2, 2021 Newsroom24x7 Network	Leave a comment
N.D. Jayaprakash
Another year has passed with most of the core issues facing the Bhopal gas victims remaining unaddressed even 37 years after the Union Carbide disaster of December 2 and 3, 1984.
The poisonous gas leak disaster had resulted in the eventual death of at least 25,000 victims and had caused injuries in varying degree to over 550,000 others. The escape of toxic fumes from a pesticide plant's storage tank containing about 40 tons of methyl isocyanate (MIC) – an extremely hazardous chemical – had spread to about 40 sq kms of area and had affected two-thirds of the city's then population of around 900,000.
The pernicious impact on flora and fauna in the affected area was equally grave. The pesticide plant was operated by Union Carbide India Limited (UCIL). UCIL was then controlled by Union Carbide Corporation (UCC) – a company now owned by the Dow Chemical Company, a subsidiary of Dow Inc., a giant U.S. multinational chemical company.
Unfortunately, even over three and half decades after the disaster, neither the State nor the Central Government has attempted either to undertake a comprehensive assessment of the ramifications of the disaster or to take necessary remedial measures. The Supreme Court assisted Settlement of 14/15 Feb, 1989 for a sum of 470 million U.S. dollars (then about Rs,705 crores) – based on the assumption that only around 3000 victims had died and another 102,000 had suffered injuries in varying degree – was a complete sham with each gas-victim being finally awarded less than one-fifth of the sum allotted even as per the terms of that unjust settlement.
For his valuable & selfless contributions in furthering the cause of the Bhopal gas victims, the Government of India conferred the 2020 Padma Shri Award posthumously to Abdul Jabbar, former Convener, Bhopal Gas Peedith Mahila Udyog Sanghathan. Jabbar's wife, Sayra Bano, accepted the award from President of India Ramnath Kovind, at the award ceremony held at the Rashtrapati Bhavan in Delhi on 8 November 2021.
The current status of issues such as health care, compensation, prosecution of the accused, remediation of the environment, etc., may be briefly recounted as follows:
HEALTH CARE: Apart from the fact that a fairly large health-infrastructure has been built in terms of buildings and number of hospital beds (about 1000 beds exclusively for gas-victims) because of pressure exerted over the years by organizations supporting the cause of the Bhopal gas victims, the quality of health care in terms of investigation, diagnosis, treatment, research and record-keeping continue to be abysmal as ever. The persistent apathy of the Indian Council of Medical Research (ICMR) and the Government of Madhya Pradesh in monitoring the health status of the Bhopal gas victims is shocking to say the least. They have failed to maintain proper medical records of hospitals and clinics through computerization and networking and have failed to supply health-booklet to each gas-victim with his/her complete medical record. That proper protocol for treatment of most gas-related ailments has not been evolved even 37 years after the disaster speaks volumes about the apathetic attitude of the concerned authorities in this regard. Mere symptomatic treatment and over-medication due to lack of proper monitoring has resulted in increasing number of renal failures among gas-victims. What is equally shocking is that even 37 years after the disaster, most of the gas-victims seeking treatment continue to be classed as "temporarily injured" in order to deny them enhanced compensation for permanent injury.
Writ Petition (Civil) No.50 of 1998, which BGPMUS, BGIA and BGPSSS had filed on 14 January 1998 with pleas to restart disaster-related medical research, monitor & record health status of each gas-victim, improve health care facilities, develop appropriate protocol for treatment of each disaster-related ailment, etc., was upheld by the Supreme Court after 14 years of litigation on 9 August 2012. The Petitioners were further directed to pursue the matter before the High Court of Madhya Pradesh (as Writ Petition No.15658 of 2012), a task that BGPMUS & BGPSSS are actively engaged in at present. However, the matter continues to remain pending for the last nine years before the Madhya Pradesh High Court at Jabalpur since the Union of India has repeatedly failed to comply with numerous directions of the Court. As a result, several critical health needs of the gas victims remain largely unattended even 37 years after the disaster.
COMPENSATION: The failure on the part of the Supreme Court to hear the long-pending Curative Petition against the unjust settlement of 14/15 Feb, 1989, has had an adverse impact on the interests of the gas-victims. Curative Petition (Civil) Nos.345-347 of 2010, which was filed by the Union of India on 3 December 2010 to challenge the unjust settlement of 14/15 Feb, 1989 and to seek additional sum of at least another Rs.7728 crores as compensation was last listed before the Constitution Bench of the Court on 29 January 2020. However, the hearing was postponed to 11 February 2020. Sadly, the matter was never listed on that date or ever since then. Failure to dispose of the Curative Petition has also meant the indefinite postponement of the hearing of the Special Leave Petition [SLP(C) No.12893 of 2010] filed on 17 March 2010 by eight members of BGPMUS and BGPSSS seeking enhancement of settlement sum by a factor of five in terms of the magnitude of the disaster as assessed by the Claim Courts and in terms of the gravity of injuries suffered by the gas victims on the basis of their medical records. Failure to dispose of the pending Curative Petition and the SLP for over a decade has effectively denied the gas-victims several thousands of crores of additional compensation that they are legitimately entitled to.
CRIMINAL CASES: The pace at which the pending criminal cases against the perpetrators of the Bhopal disaster are proceeding is concerned, there is not the faintest hope that they would ever be prosecuted in their life time since the whole process has become an almost complete farce. On the thirty-seventh anniversary of the Bhopal disaster, the gas-victims still fervently hope that all those who have the power to render justice to the gas-victims will not be found wanting in fulfilling their obligations.
ENVIRONMENTAL REMEDIATION: The environment in and around the former Union Carbide pesticide plant continues to remain contaminated with toxic waste, which was stored/buried within the plant premises as well dumped in the solar evaporation pond (dug outside the plant and lined with thin plastic sheets) during the operation of the plant from 1976 to 1984. In a preliminary study titled "Assessment and Remediation of Hazardous Waste Contaminated Areas in and around M/s Union Carbide India Ltd., Bhopal" that was jointly carried out by the National Environmental Engineering Research Institute (NEERI), Nagpur, and the National Geophysical Research Institute (NGRI), Hyderabad, during 2009-2010, it was estimated that "the total quantum of contaminated soil requiring remediation amounts to 11,00,000 MT [metric tons]"(p.68). Another 345 tons of toxic waste is stored in a shed within the plant. Representatives of BGPMUS and BGPSSS met Shri Vishvash Sarang, Minister, Bhopal Gas Relief & Rehabilitation Department, on 29.11.2021 and urged him to take the initiative in holding a workshop of all concerned parties, including international experts, to propose ways and means to remediate the contaminated site. It is hoped that the State Government would respond positively to the proposal since necessary technical expertise is available for the purpose.
Under the Circumstances, Bhopal Gas Peedit Mahila Udyog Sangathan and Bhopal Gas Peedit Mahila Sahyog Samiti have demanded:
Speedy implementation of the Supreme Court Order dated 9 August 2012 in Writ Petition (Civil) No.50 of 1998, which had directed the Union of India to provide the best medical care to the gas-victims;
Speedy Disposal of Curative Petition (Civil) Nos.345-347 of 2010, which is currently pending before the Supreme Court of India, for enhancement of compensation and for remediation of the contaminated site in and around the UCIL plant at Bhopal;
Setting up of a Special Court for speedy trial and prosecution of all the accused, who are responsible for causing the Bhopal disaster.
Proper rehabilitation of all needy gas-victims, especially widowed gas-victims; and
Provision of safe drinking water, free medical care and compensation to all victims of contaminated water and toxic waste.
BhopalBhopal DisasterUnion Carbide
Madhya Pradesh, States
Two Madhya Pradesh cities Bhopal and Indore will have Police Commissioners
Bhopal: Madhya Pradesh Chief Minister Shivraj Singh Chouhan Sunday 21 November 2021 announced that the Police Commissioner system will be introduced in two big cities of the state – Bhopal and Indore.
The Chief Minister announced this decision at his official residence on Sunday morning.
Law and order situation in the State is good, Chouhan said adding the new system is necessary for "better control".
Chief Minister Shri Chouhan said that the decision has been taken to introduce the Police Commissioner system in view of the law and order requirements arising due to increasing population, geographical expansion and technology in Bhopal, the capital of Madhya Pradesh and commercial capital Indore, the cleanest city of the country.
BhopalInoreMadhya PradeshPolice Commissioner system
Habibganj Railway Station renamed after tribal queen Rani Kamlapati
Newsoom24x7 network
Bhopal: Madhya Pradesh Government has written to the Centre to rename Bhopal's Habibganj railway station after the tribal queen, Rani Kamlapati
Madhya Pradesh Government
Vallabh Bhavan, Bhopal
क्र 3651/2164/2021/आठ
Bhopal, dated 12/11/2021
Sub: Regarding the renaming of Habibganj Railway station as Rani Kamalapati railway station.
With refeference to the above subject it is stated that the Government of India has redeveloped the Habibganj Railway Station in Bhopal at a cost of Rs. 100 crore. This project will be dedicated to the people by the Prime Minister on 15 November 2021.
It is noteworthy that the Government of India has decided to celebrate 15th November – the birth anniversary of Lord Birsa Munda as"Tribal Pride Day" and notification in this regard has been issued.
In the 16th Century, the Bhopal region was ruled by the Gond rulers. It is believed that at that time Gond King Suraj Singh Shah's son Nizamshah was married to the tribal queen Kamalapati who had spent her whole life fighting invaders with valour and bravery.
To keep the memory of the Gond Queen Kamalapati alive and to be grateful for her sacrifice, it has been decided to rename Habibganj Railway Station as Rani Kamlapati Railway Station on the occasion of the "Tribal Pride Day" on 15 November 2020.
It is requested to take immediate action to rename the Habibganj Railway Station as Rani Kamlapati Railway Station.
-Signed-
Vandana Sharma
Deputy Secretary
Govenment of Madhya Pradesh
Copy to Chaiman Railway Board, fo necessary action
Donate for the cause of Sanatan Dharma
Donate for the cause of Sanatan Dharma that has no beginning and no end. Donate for the protection of the most ancient civilisation, tradition, knowledge, philosophy and culture. Donate for the protection of Temples. Doate all that Hindutuva stands for. Do support Sanatan Mission.
Scan the QR core right here or Click to Donate (on smart phones)
BhopalHabibganj railway stationTribal Queen Rani Kamlapati
Sony Entertainment Television picks Bhopal to shoot upcoming show – 'Kaamnaa' – Where aspirations and principles will meet face to face
Ashish Kurl
Bhopal: Sony Entertainment Television's upcoming show 'Kaamnaa' – jahan hoga khwaahishon aur usoolon ka aamna saamna (Where aspirations and principles will meet face to face) is being shot in Bhopal -the picturesque capital of the central Indian State of Madhya Pradesh.
Sony Entertainment Television has always been at the forefront of showcasing content packaged with the right mix of drama and entertainment for the audiences.
Sony Entertainment Television is bringing yet another engaging narrative through the upcoming show 'Kaamnaa' – "jahan hoga khwaahishon aur usoolon ka aamna saamna" (where aspirations and principles will meet face to face). It promises to strike the right chord with the Sony's most discerning and widespread audience .
The show starring Chandni Sharma and Abhishek Rawat in the lead roles, takes the viewers on a heartfelt journey of a middle-class couple – Manav and Akanksha with different ideologies. The entire team is now shooting in Bhopal.
Produced by Cockcrow and Shaika Entertainment, Kaamnaa is set to premiere soon only on Sony Entertainment Television. Set against the backdrop of Bhopal, Kaamnaa is a story about the constant struggles faced by middle-class families when it comes to values and aspirations. With Manav and Akanksha's journey, the show captures the contrasting ideologies of the couple where Manav believes in living an honest life based on his principles and on the other hand, Akanksha, much like her name, has big dreams and desires to move away from the stereotypical middle-class life and lead a lavish lifestyle.
Showcasing the middle-class dichotomy with Manav and Akanksha's story, Kaamnaa will make the viewers question if money can buy happiness or is love enough to lead a happy life? What will happen when Akanksha's aspirations clash with Manav's principles? Watch #Kaamnaa, jahan hoga khwaahishon aur usoolon ka aamna saamna, jald hi sirf Sony TV par!
Abhishek Rawat – portrays the character of Manav
Manav is a simple and content middle class guy who loves his family. He is a man of principles and stands by it. Manav's grounded character and beliefs mirrors every common man's thinking. Kaamnaa as a show brings alive a refreshing concept with Manav and Akanksha's journey that is rooted in the reality of the Indian households, making it relatable. Hope the audience enjoy watching the show as I am really excited for this journey. Also, shooting in Bhopal has been enjoyable. It is a beautiful city that has always had my heart. I am happy to be back to the city to shoot for our show because the warmth and hospitality the city has to offered is unmatched.
Chandni Sharma – portrays the character of Akanksha
Like most millennials, my character, Akanksha, who true to her name is a strong headed woman with big desires of living a luxurious life while moving away from the ordinary way of living. I am thrilled to have gotten the chance to play a character that resonates with the young generation who dares to dream, find happiness in the grandeur of living life king size, and believes that there is nothing wrong in wanting a little extra. Through Akanksha and Manav's journey, Kaamnaa looks at a narrative that is no different from how most people lead their lives. This character is very different from my previous characters that I have essayed before and I hope I am able to justice to it. On top of it, shooting in Bhopal is like the cherry on the cake. It's such a beautiful city, so green, with wonderful food. I won't be lying when I say I have fallen in love with Bhopal!
#KaamnaaAbhishek Rawat'Kaamnaa'BhopalChandni Sharmamnaa' – "jahan hoga khwaahishon aur usoolon ka aamna saamna"Sony Entertainment Television

redpajama_set_name: RedPajamaCommonCrawl


text:
Authorities Seize 12 Tons of Smuggled Beaver Penises
On Which Social Media Platform Do Customers Complain the Most?
You can Swim, but You can't Hide! Walking Sharks Discovered...
You can Swim, but You can't Hide! Walking Sharks Discovered in Australia
You can Swim, but You can't Hide! Walking Sharks Discovered in Australia
According to a recent study, four species of sharks that use their fins to walk have been unearthed in New Guinea and northern Australia.
Who figured sharks could walk? It may sound chilling, however, researchers claim only invertebrates and small fish need to be concerned. "At less than a meter long on average, walking sharks present no threat to people but their ability to withstand low oxygen environments and walk on their fins gives them a remarkable edge over their prey of small crustaceans and mollusks," Christine Dudgeon, a scientist at Australia's University of Queensland and study lead author, spoke in a statement.
via Interesting Engineering
The new four species nearly double the total number of identified walking shark varieties to nine. "Instead of swimming around, these little bottom-dwelling sharks actually 'walk' using their pectoral and pelvic fins, which makes it easier for them to poke their heads under coral and rocks as they look for small fish, snails and crustaceans to eat," said Mark Erdmann, study co-author of Conservation International. Walking sharks matured roughly 9 million years ago, according to Erdmann, making them the "youngest" sharks on planet Earth. "The discovery proves that modern sharks have remarkable evolutionary staying power and the ability to adapt to environmental changes," Erdmann noted to reporters.
Dudgeon added: "Data suggests the new species evolved after the sharks moved away from their original population, became genetically isolated in new areas and developed into new species. They may have moved by swimming or walking on their fins, but it's also possible they 'hitched' a ride on reefs moving westward across the top of New Guinea, about two million years ago. And they may not be the only ones still around. We believe there are more walking shark species still waiting to be discovered."
Man From Florida Jumps Off A Surfboard And Lands On A Shark
Man's Extraordinary Escape From Shark Who Took Bite Out of His Head Caught on Camera


I'mmm back!! And a Great Article about Spellbinders GRAND Nestabilities!
Well, I'm FINALLY back & recovered from that horrific bought of pneumonia & its complications!! I've missed all of you & am ramping up to have a really great social networking summer via this blog/website & my business Facebook page. BTW—please, please "LIKE" my business Facebook page because I am reeeeaaallllly trying to migrate my entire Crafting Group that was originally set up on my personal Facebook page on over to where it really should be, which is on the business side!! I set it up incorrectly at the beginning—my bad! Oh well, live & learn, LOL!!! And of course, I would also LOVE lots of new crafty members as well! So be sure to SUBSCRIBE to this blog using the email subscription (found down a ways on the right sidebar) and then please LIKE me here: http://www.facebook.com/glendascreativeplace !!! THANKS!!
There's going to be lots of fabulous things happening at Glenda's Creative Place this summer, from Featured Customers as Guest Designers (let me know if you are interested in being featured!!), other fabulous Guest Designers, as well as really, really great give-aways coming up—and there will be a seriously big, big give-away and believe me, it's one I know none of you want to miss (seriously!!!), so stay tuned in & linked up to me in every way possible (subscribe to this blog, business Facebook page...)!!!
So, onto crafting!! I'm still getting lots of questions about how best to utilize the Spellbinders GRAND Nestabilities and I thought today would be a great day to share this page from the Spellbinder's blog with you, because it helps explain a LOT about the GRAND Nesties!!! Please give it a read and let me know if you have any other questions!! And remember, I sell ALL the Spellbinder's products, among many other manufacturers. All you have to do to place an order with me is to email me at glendascreativeplace@yahoo.com with the list of what you want, then I'll invoice you and get your shipment sent out to you – easy peasy!!!
Here's the link to the Spellbinder's article from their blog (but be sure to do all your Subscriptions with me here and on Facebook before you leave me here—thanks!!): http://spellbinderspaperarts.com/blog/how-do-grand-nestabilities-work/ HTH!
Have a wonderful crafting day!! I have REALLY missed all of you!!!!!


Yesterday our site was down for a period of time. Sorry about that!
Our web hosting company was doing maintenance and all sites were unavailable during that time. Out local time was during the night (we and our web host is located in Europe). I was asleep and did not notice the downtime, but Ara was awake and brought it to my attention.
In the future I'll keep track of our web hosts and when they're doing maintenance so we can give you guys a warning!
I just came her because there was going to be cake. Turns out there was info too!
Normally I get their newsmail, but turns out there's a specific mail you have to sign up for that sends out information abuot downtime and other techy things. So I'm now signed up!
If I get any informaton from them about future downtime I'll post about it in this forum!


It definitely doesn't feel like 4 'o clock in the afternoon already! What happened? This is a thought I dwell on somewhat regularly, especially when the mountain of tasks and client emails to respond to are piling up. It's a classic case: you feel like you've been getting stuff done, but at the same time, it's as if you haven't gotten enough completed in the time spent. We all want to find ways to be more productive at work, especially so we don't have to continue fretting about job related tasks into the evening. If you feel the same, it might be time to take a look at how your work life is structured—it could be affecting your energy, ability to think creatively, and your overall health!
They're one of the biggest productivity killers, and yet we find ourselves swamped with them on a daily basis. Before you click "yes" to accept an invitation for that next meeting, ask a few questions to the organizer: what is the goal in mind for the meeting? How do you fit in? If you are just checking with a progress report or status update, could you accomplish the same feat by emailing details rather than explaining them over the course of one or several hours?
Our Seafoam head honcho and owner Nikki had an interesting revelation awhile back—when we were moving into our new office and having a meeting that morning, she said she felt much more productive and attentive while she was simultaneously moving around and unpacking things! Turns out, this is an actual strategy used by many professionals and entrepreneurs (according to this article, Mark Zuckerberg at Facebook uses walking meetings when screening key job candidates).
The act of getting up and moving about is a strategy that many creatives use to combat writer's block, and the same is true when conducting meetings. Walking around helps to boost creativity and can make your meeting go by much more productively.
Being able to manage multiple tasks is a desirable skill, but when it comes to actually working on those tasks, stick with one at a time! Splitting your brain in too many directions can lower your efficiency, and for this reason, it's better to monotask. Think of it this way: if you were back in college and studying for a major test coming up, would you want constant distractions or reminders about other things you need to do? Probably not! Block off your time for individual projects to work on, and give yourself the ability to focus exclusively on that. You'll finish things in a timely manner with less stress.
We love working remotely. So much so that we even wrote an entire post about how to have the best productivity when working from home. There's truth to it: typical office workers are often bombarded with distractions, many times from other coworkers chatting among one another, or dropping by your space for real-time communication. If you don't have the flexibility to work remotely, you can minimize office distraction by persuading your peers and superiors to transition to text based communication or collaboration tools (such as Teamwork). Having more "quiet time" in the office lets everyone work more smoothly without interruptions.
Do you have other life hacks or secret strategies for getting more efficient while at work? Let's hear 'em!


Considering how well-served the magic of the film is by the lack of explanation - aside from Phil just being a pretty bad guy - it's surprising to discover that the studio initially wanted there to be a reason for the time loop.
"While I was brainstorming I did consider various ways he got into the loop, but the arbitrariness of that enterprise convinced me that it didn't matter and when I thought of NOT having a device it gave the whole enterprise an existential flavor that I liked... I never wrote a draft with a cause. When Harold and the studio got involved we had lots of conversations about the cause, all of it painful to me but it seemed to be what the studio was pushing for. I think Harold wrote a draft where the cause had something to do with Phil crossing the wrong girl. They made me write a gypsy curse scene. But ultimately the studio came around and none of those things were shot."


text:
More like this Film Friday
Film Friday: The Last Bus
Fri 10 September 2021
In this understated tale a quiet yet determined elderly gent, Tom, embarks on a mission, which takes him on the country's longest bus ride, from John o' Groats to Land's End. There is a moment when Tom finds himself sat between two gangs of late-night revellers. Two crowds of young women and young guys taunt each other by raucously riffing on various songs, so a local drunk invites Tom to join in with their own song. The bus station falls quiet as Tom sings Amazing Grace. At the end no one speaks, and there is a momentary sense of hush and awe. Earlier, when a man on one of the buses starts harassing a female traveller and her son, Tom intervenes, only to find himself pushed backwards onto the floor. This however outrages the other travellers who stand up and demand the young man get off. Which he does. On another occasion, when Tom is told his bus pass isn't valid, another passenger offers to pay his fare. Three moments of unexpected grace. Tom Shadyac, the director of Bruce Almighty, once said that coincidence is God's way of remaining anonymous. I believe that God is often at work in the unexpected and 'ordinary'. In the moments like these. The calming effect of amazing grace in a bus station; the courage of one person defending another, and so drawing courage from others; and the generosity of a stranger offering to help. Grace at work. God turning up in the lives of others. We can perhaps spiritualise something like 'grace' and yet it is ultimately an earthy thing. Found in the life of God with skin on, as he brought calm to fraught situations, as he generously reached out and helped strangers time after time, and as he drew courage, strength and purpose from others. I'm convinced that the next time any of us do something which makes life a little better… the Creator of the ages will be right there, present in us, and in our words and actions. The king of kindness at work in us and through us.
More Film Friday...


For the three million women in the United States who've survived breast cancer, difficult health care choices come with the territory. But even after successful treatment, an important question lingers: Should they consider magnetic resonance imaging (MRI) in addition to mammography for ongoing breast cancer screening, or "surveillance"?
It's a question science hasn't yet answered. Group Health Research Institute (GHRI) Assistant Investigator Karen Wernli, PhD, is on a mission to change that with her new study, SIMBA (Surveillance Imaging Modalities for Breast Cancer Assessment). As one might expect, SIMBA will involve national data, epidemiology, and clinical knowhow. But Dr. Wernli and team have added an often-missing ingredient: first-hand feedback from women who've had breast cancer.
On March 13, Dr. Wernli's team hosted 11 breast cancer survivors from the Puget Sound region at the first official meeting of the SIMBA Advisory Board. Members represent a variety of personal and clinical experiences and will guide the study team as they develop a decision aid to help women and their doctors weigh the pros and cons of different imaging regimens.
Mammography has long been the clinical standard for surveillance, but use of MRI is rising—even without evidence that it's more effective.
That sentiment was echoed by SIMBA's clinical advisors, who described the need for "appropriate, real-world recommendations" about how both methods perform in different groups of women.
For data needed to answer such questions, SIMBA will tap the Breast Cancer Surveillance Consortium (BCSC)—the nation's largest collection of breast imaging tests and cancer outcomes. But first the researchers will ask their patient advisors which outcomes are most important and how to distill that information into an effective decision-making tool.
Leading the way are SIMBA's two patient co-investigators, Mary Bush and Dianne Johnson, who helped develop the project and serve as liaisons between the advisory board and the scientific team.
Dr. Wernli and SIMBA project manager, Susan Brandzel, MPH, will also conduct focus groups with breast cancer survivors at three BCSC sites—in North Carolina, New Hampshire, and San Francisco.
For many, it's a chance to finally have a voice in research that could save their lives.
Letting patients' perspectives drive research priorities is gaining steam, thanks in part to the Patient-Centered Outcomes Research Institute (PCORI), which funds SIMBA. The approach challenges many scientists to rewire how they've traditionally conceived of and conducted research. Studies like Dr. Wernli's can help show the way.
"Sometimes I feel like I'm writing my own cookbook," she laughs.
After Dr. Wernli's first PCORI application wasn't funded, her team collaborated on a successful resubmission, working with their patient co-investigators and staying connected with the women who would eventually become SIMBA Advisory Board members.


text:
The island mackerel (Rastrelliger faughni) is a species of true mackerel in the scombrid family (Scombridae) from the Indo-Pacific. Their maximum reported length is 20 cm, and the maximum reported weight is 0.75 kg.

While the FAO report no commercial landings of island mackerel, the IUCN report annual landings in excess of 800,000 tonnes.

References

Rastrelliger
Scombridae
Fish described in 1967

redpajama_set_name: RedPajamaWikipedia


Comments: This Silky Silver 2019 Kia Forte LXS might be just the sedan for you. We've got it for $19,932. Rocking a timeless silver exterior and a black interior, this car is a sight to see from the inside out. It has great mileage with 30 MPG in the city and 40 MPG on the highway. Connect to all your Bluetooth devices! Call today to schedule your test drive!


text:
Public Release: 22-Oct-2017
Arsenic exposure in us public drinking water declines following new EPA regulations
Study shows federal government plays critical role in protecting human health
Columbia University's Mailman School of Public Health
New research conducted at Columbia University's Mailman School of Public Health found that exposure to arsenic in drinking water was significantly reduced among Americans using public water systems following the Environmental Protection Agency (EPA) regulation on maximum levels of arsenic. Compliance with the regulation led to a decline of 17 percent in levels of urinary arsenic, equivalent to an estimated reduction of over 200 cases of lung and bladder disease every year. However, there were no improvements in arsenic exposure rates among users of private wells, which are not federally regulated. The findings reported in The Lancet Public Health confirm the critical role of federal drinking water regulations in decreasing toxic exposures and protecting human health.
This is the first study to evaluate the impact of the 2006 implementation of the maximum contaminant level on reducing arsenic exposure at the individual level or by using biomarker data.
"EPA regulation was associated with a significant decrease in urinary arsenic concentrations among Americans who use public water systems," said Anne Nigra, ScM, in the Mailman School's Department of Environmental Health Sciences, and the study's lead author. "Levels of arsenic in private wells, estimated to provide water to roughly 45.5 million Americans, vary significantly throughout the U.S. Because of the cost of testing and treating contaminated water, private well water users remain inadequately protected against arsenic exposure in drinking water, especially residents of lower socio-economic status."
Arsenic is an established carcinogen and naturally occurs in drinking water across the U.S. In 2006, public water systems were required to meet the new EPA 10 μg/L regulatory limit for the maximum arsenic level in drinking water, down from 50 μg/L. In the Southwest, many cities' public water supplies come from water sources with naturally high levels of arsenic, including Los Angeles, Albuquerque, Scottsdale and Tucson.
The researchers compared data from 14,127 participants in the National Health and Nutrition Examination Survey (NHANES) between 2003 and 2014 who tested for dimethylarsinate (DMA) - the main metabolite of inorganic arsenic in humans. They adjusted for other sources of arsenic such as diet and smoking. Arsenic was measured in spot urine samples collected during the examination in a one-third random subsample of participants 6 years of age or older.
Among public water users - approximately 70 percent of participants-- arsenic levels decreased from 3.01 μg/L in 2003-2004 to 2.49 μg/L in 2013-2014, or by 17 percent.
"The 17 percent reduction in water arsenic exposure for public water users represents a significant exposure reduction when applied at the population level," said Ana Navas-Acien, MD, PhD, professor of Environmental Health Sciences at the Mailman School, and co-author. "The decline was strongest among Mexican-Americans and supports the recent infrastructure investments in many cities in the Southwest that focused on ensuring water arsenic below 10 μg/L."
The decrease was only observed after 2009-2010, consistent with the regulatory compliance process under the Safe Drinking Water Act, which required time for testing, and time to address the problem by changing the source or installing water treatment.
The authors estimate that the reduction in exposure to arsenic is equivalent to a reduction of 200 cases of lung and bladder cancer per year, but could be as many as 900 cases.
There was no change recorded among well water users. It has been estimated that 1.7 million Americans are at risk of exposure to arsenic above the maximum contaminant level, >10 μg/L and 3.8 million to arsenic > 5 μg/L in household well water. The authors note that efforts to address arsenic levels in private wells vary between states. "To date, no state government requires homeowners to install treatment systems to reduce arsenic if test results for arsenic exceed these contaminant levels. Continuing efforts for additional state and federal initiatives are critical to help families sample, test, and address arsenic exposure from unregulated private wells," added Navas-Acien.
Co-authors of the study are Tiffany R. Sanchez, PhD, and Joseph Graziano, PhD, Mailman School of Public Health; Keeve E. Nachman, PhD, Johns Hopkins Bloomberg School of Public Health; David Harvey, MPH, Commissioned Corps Officer of the U.S. Public Health Service; and Steven N. Chillrud, PhD, Lamont-Doherty Earth Observatory, Columbia University.
The study is supported by the National Institute of Environmental Health Sciences (1R01ES025216, R01ES021367, 5P30ES009089, P42ES010349, and 5T32ES007322.
Founded in 1922, Columbia University's Mailman School of Public Health pursues an agenda of research, education, and service to address the critical and complex public health issues affecting New Yorkers, the nation and the world. The Mailman School is the third largest recipient of NIH grants among schools of public health. Its over 450 multi-disciplinary faculty members work in more than 100 countries around the world, addressing such issues as preventing infectious and chronic diseases, environmental health, maternal and child health, health policy, climate change & health, and public health preparedness. It is a leader in public health education with over 1,300 graduate students from more than 40 nations pursuing a variety of master's and doctoral degree programs. The Mailman School is also home to numerous world-renowned research centers including ICAP and the Center for Infection and Immunity. For more information, please visit http://www.mailman.columbia.edu.
sb2247@columbia.edu
@ColumbiaMSPH
http://www.mailman.hs.columbia.edu
Lancet Public Health
NIH/National Institute of Environmental Health Sciences
ECOLOGY/ENVIRONMENT
HYDROLOGY/WATER RESOURCES
PULMONARY/RESPIRATORY MEDICINE
UROGENITAL SYSTEM


9Round is a 30 minute, full body, kickboxing circuit! Workouts change everyday, no time classes, Personal trainer included. You will have fun, you will sweat and learn something new everyday!
Greg Eck has been providing self defense classes for 35 years. Their classes are done in a friendly and professional atmosphere. Their team of certified personal trainers also provides jiu jitsu, boxing, and mixed martial arts lessons.
Trying to look for kickboxing lessons for beginners? Muay thai kickboxing classes are also available. This individual is available for interested clients.
TDC MMA + FITNESS specializes in agility, kickboxing, strength conditioning, crossfit training and more. This expert specializes in martial arts training and mixed martial arts, jiu jitsu, and fitness, among others. They provide cardio kickboxing classes and boxing, jiu jitsu, and wrestling.
Championship Martial Arts is staffed with certified martial arts instructors, nutrition and mma conditioning coaches, as well as personal trainers. This professional trains at a private studio gym. They also do fitness training, nutrition counseling and more.
Ong Taekwondo Academy provides yoga, fitness, and kickboxing as well as high-level instruction in muay thai kick boxing. Tony Ong offers professional cardio kickboxing lessons and personal training. This expert also provides lessons in taekwondo, gymnastics, and fitness and more.
Consider hiring Titan Gym - Krav Maga, Martial Arts, Fitness, Yoga from Titan Gym - Krav Maga, Martial Arts, Fitness, Yoga if you need professionals who do custom work. They offer kickboxing and cardio classes. Lose weight and stay healthy by hiring them.
Michael Una is among the kickboxing instructors who offer in home and on location services. This expert also offers Una Martial Arts And Self Defense. This pro also offers bjj and cardio kickboxing workouts as well as boxing and female kickboxing.
We pride ourselves in excellence! We tailor every workout to the client's specific needs and wants! We are leaders in our field in both the workouts as well as client education.


text:
Nation Sep 23rd 2020 - 10pm
Two police officers shot amid Louisville protests over Breonna Taylor ruling
Home and Garden Jan 9th 2021 - 9am
A Christmas cactus mystery, sauerkraut cabbage, and eggshells for plants
'Impactful snowstorm' expected to hit Mitchell area on Tuesday
According to the National Weather Service in Sioux Falls, the Mitchell area is expected to see a significant snowstorm on Tuesday, extending into Tuesday night
Written By: Sam Fosness | Dec 27th 2020 - 2pm.
A Mitchell snowplow pushes snow on Jan. 17, 2020 on East First Avenue during last year's January snow storm. Mitchell is expected to experience a significant snow storm on Tuesday this week. (Sam Fosness / Republic)
The Mitchell area is expecting to see a significant amount of snow on Monday night and into Tuesday evening, as the likelihood of a snowstorm has increased.
That's according to Jeff Chapman, a meteorologist with the National Weather Service in Sioux Falls. While Chapman expects snow to hit the Mitchell area on Monday night, he said the most significant amount of snowfall will likely make its way to the Mitchell area on Tuesday, lasting into late Tuesday night.
As far as total amounts of snow, Chapman said it's unclear at this time. However, he said it's increasingly likely that the area will see an "impactful" storm on Tuesday.
"The details with this storm as far as amounts are kind of up in the air yet, but the likelihood of an impactful storm has increased somewhat," Chapman said. "Anyone who is planning on traveling on Tuesday and Tuesday night should definitely be paying attention to the forecast and watch how it could change over the next few days."
The snowstorm is expected to make its way out of the Mitchell area late Tuesday night, Chapman said.
Following Tuesday's potential storm, Chapman said the area is expected to experience a dry period heading into the New Year holiday.
"It looks like we're in for an extended period of dry weather following the storm on Tuesday night, all the way through the following weekend at this point," Chapman said.
Weather Jan 5th 2021 - 4pm
Dry 2020 follows wet 2019 for Mitchell weather
Weather Dec 29th 2020 - 7pm
Mitchell area future forecast expected to remain dry following Tuesday's snow
Columns Dec 2nd 2020 - 6am
Woster: Saturday's gift and Sunday's shift
Columns Nov 18th 2020 - 8am
Woster: Yes, it's windy in South Dakota. Duh.
Weather Nov 2nd 2020 - 3pm
Wild weather as fall 2020 sees near-record snow, wide-ranging temps


Kanye, Stevie and Jay-Z already know James Blake—now he just has to win over everyone else.
The jury's out on whether James Blake—whose second album, "Overgrown," is due April 9 through Atlas/Republic—will ever be a star in the United States. But several prominent music icons are already on a first-name basis with the English singer/songwriter/producer, thanks to his trippy amalgam of R&B and woozy electronica.
"Kanye [West] has been very supportive," Blake says from his hotel room in Austin, where he returned for another performance at South by Southwest this year. In a behind-the-scenes YouTube clip from Jay-Z and West's 2011 Watch the Throne tour, Blake is seen hanging out with the two rappers.
But A-list fans don't necessarily translate into fans elsewhere. Blake's self-titled 2011 debut LP only reached No. 123 on the Billboard 200. And while Republic co-president Avery Lipman says it's nearing 500,000 records sold worldwide, North America accounts for just 65,000 of that, according to Nielsen SoundScan.
Luckily, West hasn't been the only person helping get the word out. Blake's sullen "The Wilhelm Scream" was featured in a dramatic closing scene in an episode of HBO's "Entourage," helping make the single his biggest selling yet, moving 36,000 copies and peaking at No. 36 on the Dance/Electronic Digital Songs chart.
In the end, however, for "Overgrown" to achieve the top 10 debut Lipman hopes for—a goal he admits is "ambitious"—the music is going to have to speak for itself.
It's certainly saying plenty about one particular topic: love. Blake sang a bit about it on his debut, but had yet to fully experience the feeling for himself. That's changed.
"I'm working with an endlessly replenished palette," Blake says. "The sounds I like to use are kind of endless because they're just noises."
Blake will take his new sonics on the road stateside starting April 16 in San Francisco. There are already small but promising signs of momentum: He rocked New York's 1,500-capacity Webster Hall in 2011; in May he'll fill Terminal 5, a 3,000-seater. "Retrograde," meanwhile, has sold 11,000 copies five weeks in—his fastest-selling single yet—and its video is nearing 1.6 million YouTube views.


10% of sales are donated to the research and tagging of the Port Royal strain of Cobia that has seen a steep decline in numbers in the last couple years.
Nothing is as sweet & refreshing, and will pick you up like a cobia will. The soft tri-blend Flood Tide Co Enjoy Cobia Tee will comfort your body and mind because Flood Tide is donating 10% of sales to the research and tagging of the Port Royal strain of Cobia that has seen a steep decline in numbers in the last couple years.


Looking for a new home? You are not alone. Dogs need homes too! Adopting an animal is a great way to acquire a family pet, and there are always animals looking to find themselves a good home, as well. In particular, there are three dogs available for adoption in South Jersey which overcame incredible odds to even be alive.
Imagine rescuing a dog which recently was on the human equivalent of Death Row. The big difference is, these dogs did not do anything wrong and did not deserve to be killed. These dogs just happened to be in the wrong spot at the wrong time.
The dogs I am referring to are Joey, a 1-year old Golden Retriever; Liberty, a 1 to 2-year old Siberian Husky; and Tisha, a 2 to 3-year old Japanese Mastiff. These dogs were saved from a South Korean meat farm as part of an international effort to cease the practice of the Korean farming of dogs for meat.
"These dogs have overcome insurmountable odds, and have traveled a great distance to find someone to provide them with the love and care they deserve," said Freeholder Jeff Nash, liaison to the Camden County Animal Shelter.
The rescued dogs are available for adoption along with many other animals at the Camden County Animal Shelter. They are located at 125 County House Road in Blackwood, NJ. If you would like to find out more information on these dogs or any other animals you can call the shelter at (856) 401-1300 ext. 102.


text:
« Back to Faculty & Staff Directory
Natalie Fleury, J.D.
Adjunct Professor of Law; Program Coordinator for Dispute Resolution
natalie.fleury@marquette.edu
Accept anonymous submissions
State Bar of Wisconsin Dispute Resolution Section and Family Law Section, American Bar Association Dispute Resolution Section
Other Courses Taught:
Small Claims Mediation Clinic, Interviewing and Counseling, Mediation Advocacy
Natalie C. Fleury, J.D. is the Program Coordinator for Dispute Resolution at Marquette Law School and an Ombuds at the Medical College of Wisconsin. In addition to teaching the Small Claims Mediation Clinic and her other administrative duties, Ms. Fleury facilitates the operation of the Client Skills Board, and is responsible for overseeing all other aspects of Marquette Law School's nationally ranked dispute resolution program. She has been honored as a Best Lawyer in Wisconsin in the Dispute Resolution category each year since 2009.
In addition to her duties at Marquette, Ms. Fleury is an Ombuds at the Medical College of Wisconsin, and is also the principal of Conflict Management Concepts, LLC, a dispute resolution consulting firm offering mediation, arbitration, training, dispute resolution systems design and dispute resolution program development. Her experience includes work as an ombuds, compliance work, arbitration, mediation, and dispute resolution systems design for clients such as DaimlerChrysler, Ford Motor Company, and the Better Business Bureau.
Ms. Fleury is immediate past-Chair of the State Bar of Wisconsin Section Leaders' Council, Past-Chair of the Wisconsin State Bar's Alternative Dispute Resolution Board, past co-chair of the Association for Conflict Resolution's Consumer Section, and a member of the ABA Dispute Resolution Section. She earned her J.D. from the University of Wisconsin Law School in 1992, where she participated on the Moot Court Board. She received a Graduate Certificate in Dispute Resolution from Marquette University in 1997.