forked from amazingfate/loongoffice
Patch contributed by Christian Lippka
impress212: #i113063# patch: dubios self assign in svx/source/dialog/framelink.cxx
http://svn.apache.org/viewvc?view=revision&revision=1167619
Patches contributed by Mathias Bauer
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394707
http://svn.apache.org/viewvc?view=revision&revision=1394326
cws mba34issues01: #i117712#: fix several resource errors introduced by
IAccessible2 implementation
http://svn.apache.org/viewvc?view=revision&revision=1172343
cws mba34issues01: #i117719#: use correct resource ID
http://svn.apache.org/viewvc?view=revision&revision=1172351
Patch contributed by Andre Fischer
Do not add targets for junit tests when junit is disabled.
http://svn.apache.org/viewvc?view=revision&revision=1241508
Patches contributed by Armin Le-Grand
#118804# corrected GraphicExporter behaviour on shortcut when pixel graphic is requested
http://svn.apache.org/viewvc?view=revision&revision=1240195
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118485# - Styles for OLEs are not saved.
http://svn.apache.org/viewvc?view=revision&revision=1182166
#118524: apply patch, followup fixes to 118485
http://svn.apache.org/viewvc?view=revision&revision=1186077 13f79535-47bb-0310-9956-ffa450edef68
Patch contributed by Regina Henschel
linecap: Reintegrating finished LineCap feature
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patch contributed by Wang Lei (leiw)
#i118760# split the first table cell vertically, then undo&redo,
the Presentation app will crash
http://svn.apache.org/viewvc?view=revision&revision=1301361
cleanup globlmn hacks, undo dependent fixmes.
151 lines
4.7 KiB
C++
151 lines
4.7 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
*/
|
|
|
|
#include <tools/shl.hxx>
|
|
#include <vcl/menu.hxx>
|
|
#include <vcl/status.hxx>
|
|
#include <svl/intitem.hxx>
|
|
#include <sfx2/dispatch.hxx>
|
|
#include <tools/urlobj.hxx>
|
|
|
|
#include <svx/selctrl.hxx>
|
|
#include <svx/dialmgr.hxx>
|
|
#include <svx/dialogs.hrc>
|
|
|
|
#include "stbctrls.h"
|
|
|
|
SFX_IMPL_STATUSBAR_CONTROL(SvxSelectionModeControl, SfxUInt16Item);
|
|
|
|
/// Popup menu to select the selection type
|
|
class SelectionTypePopup : public PopupMenu
|
|
{
|
|
public:
|
|
SelectionTypePopup( sal_uInt16 nCurrent );
|
|
};
|
|
|
|
/// Item id's cannot start from 0, so we need to convert
|
|
static sal_uInt16 id_to_state( sal_uInt16 nId )
|
|
{
|
|
switch ( nId )
|
|
{
|
|
default: // fall through
|
|
case SELECTION_STANDARD: return 0;
|
|
case SELECTION_EXTENDED: return 1;
|
|
case SELECTION_ADDED: return 2;
|
|
case SELECTION_BLOCK: return 3;
|
|
}
|
|
}
|
|
|
|
/// Item id's cannot start from 0, so we need to convert
|
|
static sal_uInt16 state_to_id( sal_uInt16 nState )
|
|
{
|
|
switch ( nState )
|
|
{
|
|
default: // fall through
|
|
case 0: return SELECTION_STANDARD;
|
|
case 1: return SELECTION_EXTENDED;
|
|
case 2: return SELECTION_ADDED;
|
|
case 3: return SELECTION_BLOCK;
|
|
}
|
|
}
|
|
|
|
SelectionTypePopup::SelectionTypePopup( sal_uInt16 nCurrent )
|
|
: PopupMenu( ResId( RID_SVXMENU_SELECTION, DIALOG_MGR() ) )
|
|
{
|
|
CheckItem( state_to_id( nCurrent ), true );
|
|
}
|
|
|
|
// class SvxSelectionModeControl -----------------------------------------
|
|
|
|
SvxSelectionModeControl::SvxSelectionModeControl( sal_uInt16 _nSlotId,
|
|
sal_uInt16 _nId,
|
|
StatusBar& rStb ) :
|
|
SfxStatusBarControl( _nSlotId, _nId, rStb ),
|
|
mnState( 0 ),
|
|
maImage( SVX_RES( RID_SVXBMP_SELECTION ) )
|
|
{
|
|
GetStatusBar().SetItemText( GetId(), String() );
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
void SvxSelectionModeControl::StateChanged( sal_uInt16, SfxItemState eState,
|
|
const SfxPoolItem* pState )
|
|
{
|
|
if ( SFX_ITEM_AVAILABLE == eState )
|
|
{
|
|
DBG_ASSERT( pState->ISA( SfxUInt16Item ), "invalid item type" );
|
|
SfxUInt16Item* pItem = (SfxUInt16Item*)pState;
|
|
mnState = pItem->GetValue();
|
|
|
|
SelectionTypePopup aPop( mnState );
|
|
GetStatusBar().SetQuickHelpText( GetId(), aPop.GetItemText( state_to_id( mnState ) ) );
|
|
}
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
sal_Bool SvxSelectionModeControl::MouseButtonDown( const MouseEvent& rEvt )
|
|
{
|
|
CaptureMouse();
|
|
SelectionTypePopup aPop( mnState );
|
|
StatusBar& rStatusbar = GetStatusBar();
|
|
|
|
if ( aPop.Execute( &rStatusbar, rEvt.GetPosPixel() ) )
|
|
{
|
|
sal_uInt16 nNewState = id_to_state( aPop.GetCurItemId() );
|
|
if ( nNewState != mnState )
|
|
{
|
|
mnState = nNewState;
|
|
|
|
::com::sun::star::uno::Any a;
|
|
SfxUInt16Item aState( GetSlotId(), mnState );
|
|
INetURLObject aObj( m_aCommandURL );
|
|
|
|
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
|
|
aArgs[0].Name = aObj.GetURLPath();
|
|
aState.QueryValue( a );
|
|
aArgs[0].Value = a;
|
|
|
|
execute( aArgs );
|
|
}
|
|
}
|
|
ReleaseMouse();
|
|
|
|
return sal_True;
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
void SvxSelectionModeControl::Paint( const UserDrawEvent& rUsrEvt )
|
|
{
|
|
const Rectangle aControlRect = getControlRect();
|
|
OutputDevice* pDev = rUsrEvt.GetDevice();
|
|
Rectangle aRect = rUsrEvt.GetRect();
|
|
|
|
Size aImgSize( maImage.GetSizePixel() );
|
|
|
|
Point aPos( aRect.Left() + ( aControlRect.GetWidth() - aImgSize.Width() ) / 2,
|
|
aRect.Top() + ( aControlRect.GetHeight() - aImgSize.Height() ) / 2 );
|
|
|
|
pDev->DrawImage( aPos, maImage );
|
|
}
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|