1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_svx.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "fmprop.hrc" 32*cdf0e10cSrcweir #include "svx/fmresids.hrc" 33*cdf0e10cSrcweir #include "fmtextcontroldialogs.hxx" 34*cdf0e10cSrcweir #include "fmtextcontrolfeature.hxx" 35*cdf0e10cSrcweir #include "fmtextcontrolshell.hxx" 36*cdf0e10cSrcweir #include "editeng/crsditem.hxx" 37*cdf0e10cSrcweir #include "svx/dialmgr.hxx" 38*cdf0e10cSrcweir #include "editeng/editeng.hxx" 39*cdf0e10cSrcweir #include "editeng/eeitem.hxx" 40*cdf0e10cSrcweir #include "svx/fmglob.hxx" 41*cdf0e10cSrcweir #include "editeng/scriptspaceitem.hxx" 42*cdf0e10cSrcweir #include "svx/svxids.hrc" 43*cdf0e10cSrcweir #include "editeng/udlnitem.hxx" 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir /** === begin UNO includes === **/ 46*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp> 48*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/form/XForm.hpp> 50*cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp> 51*cdf0e10cSrcweir #include <com/sun/star/awt/XFocusListener.hpp> 52*cdf0e10cSrcweir #include <com/sun/star/awt/XMouseListener.hpp> 53*cdf0e10cSrcweir /** === end UNO includes === **/ 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir #include <comphelper/componentcontext.hxx> 56*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 57*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 58*cdf0e10cSrcweir #include <sfx2/app.hxx> 59*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 60*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 61*cdf0e10cSrcweir #include <sfx2/msgpool.hxx> 62*cdf0e10cSrcweir #include <sfx2/objsh.hxx> 63*cdf0e10cSrcweir #include <sfx2/request.hxx> 64*cdf0e10cSrcweir #include <sfx2/sfxuno.hxx> 65*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 66*cdf0e10cSrcweir #include <svl/eitem.hxx> 67*cdf0e10cSrcweir #include <svl/intitem.hxx> 68*cdf0e10cSrcweir #include <svl/itempool.hxx> 69*cdf0e10cSrcweir #include <svl/languageoptions.hxx> 70*cdf0e10cSrcweir #include <svtools/stringtransfer.hxx> 71*cdf0e10cSrcweir #include <svl/whiter.hxx> 72*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 73*cdf0e10cSrcweir #include <tools/diagnose_ex.h> 74*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 75*cdf0e10cSrcweir #include <vcl/outdev.hxx> 76*cdf0e10cSrcweir #include <vos/mutex.hxx> 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir #include <memory> 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir //........................................................................ 81*cdf0e10cSrcweir namespace svx 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir //........................................................................ 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir using namespace ::com::sun::star; 86*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 87*cdf0e10cSrcweir using namespace ::com::sun::star::awt; 88*cdf0e10cSrcweir using namespace ::com::sun::star::form; 89*cdf0e10cSrcweir using namespace ::com::sun::star::form::runtime; 90*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 91*cdf0e10cSrcweir using namespace ::com::sun::star::frame; 92*cdf0e10cSrcweir using namespace ::com::sun::star::util; 93*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 94*cdf0e10cSrcweir using namespace ::com::sun::star::container; 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir //==================================================================== 97*cdf0e10cSrcweir typedef sal_uInt16 WhichId; 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir //==================================================================== 100*cdf0e10cSrcweir static SfxSlotId pTextControlSlots[] = 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir SID_CLIPBOARD_FORMAT_ITEMS, 103*cdf0e10cSrcweir SID_CUT, 104*cdf0e10cSrcweir SID_COPY, 105*cdf0e10cSrcweir SID_PASTE, 106*cdf0e10cSrcweir SID_SELECTALL, 107*cdf0e10cSrcweir // SID_ATTR_TABSTOP, /* 2 */ 108*cdf0e10cSrcweir SID_ATTR_CHAR_FONT, 109*cdf0e10cSrcweir SID_ATTR_CHAR_POSTURE, 110*cdf0e10cSrcweir SID_ATTR_CHAR_WEIGHT, 111*cdf0e10cSrcweir SID_ATTR_CHAR_SHADOWED, 112*cdf0e10cSrcweir SID_ATTR_CHAR_WORDLINEMODE, 113*cdf0e10cSrcweir SID_ATTR_CHAR_CONTOUR, 114*cdf0e10cSrcweir SID_ATTR_CHAR_STRIKEOUT, 115*cdf0e10cSrcweir SID_ATTR_CHAR_UNDERLINE, 116*cdf0e10cSrcweir SID_ATTR_CHAR_FONTHEIGHT, 117*cdf0e10cSrcweir SID_ATTR_CHAR_COLOR, 118*cdf0e10cSrcweir SID_ATTR_CHAR_KERNING, 119*cdf0e10cSrcweir SID_ATTR_CHAR_LANGUAGE, /* 20 */ 120*cdf0e10cSrcweir SID_ATTR_CHAR_ESCAPEMENT, 121*cdf0e10cSrcweir SID_ATTR_PARA_ADJUST, /* 28 */ 122*cdf0e10cSrcweir SID_ATTR_PARA_ADJUST_LEFT, 123*cdf0e10cSrcweir SID_ATTR_PARA_ADJUST_RIGHT, 124*cdf0e10cSrcweir SID_ATTR_PARA_ADJUST_CENTER, 125*cdf0e10cSrcweir SID_ATTR_PARA_ADJUST_BLOCK, 126*cdf0e10cSrcweir SID_ATTR_PARA_LINESPACE, /* 33 */ 127*cdf0e10cSrcweir SID_ATTR_PARA_LINESPACE_10, 128*cdf0e10cSrcweir SID_ATTR_PARA_LINESPACE_15, 129*cdf0e10cSrcweir SID_ATTR_PARA_LINESPACE_20, 130*cdf0e10cSrcweir SID_ATTR_LRSPACE, /* 48 */ 131*cdf0e10cSrcweir SID_ATTR_ULSPACE, /* 49 */ 132*cdf0e10cSrcweir SID_ATTR_CHAR_AUTOKERN, 133*cdf0e10cSrcweir SID_SET_SUPER_SCRIPT, 134*cdf0e10cSrcweir SID_SET_SUB_SCRIPT, 135*cdf0e10cSrcweir SID_CHAR_DLG, 136*cdf0e10cSrcweir SID_PARA_DLG, 137*cdf0e10cSrcweir // SID_TEXTDIRECTION_LEFT_TO_RIGHT, /* 907 */ 138*cdf0e10cSrcweir // SID_TEXTDIRECTION_TOP_TO_BOTTOM, 139*cdf0e10cSrcweir SID_ATTR_CHAR_SCALEWIDTH, /* 911 */ 140*cdf0e10cSrcweir SID_ATTR_CHAR_RELIEF, 141*cdf0e10cSrcweir SID_ATTR_PARA_LEFT_TO_RIGHT, /* 950 */ 142*cdf0e10cSrcweir SID_ATTR_PARA_RIGHT_TO_LEFT, 143*cdf0e10cSrcweir SID_ATTR_CHAR_OVERLINE, 144*cdf0e10cSrcweir 0 145*cdf0e10cSrcweir }; 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir // slots which we are not responsible for on the SfxShell level, but 148*cdf0e10cSrcweir // need to handle during the "paragraph attributes" and/or "character 149*cdf0e10cSrcweir // attributes" dialogs 150*cdf0e10cSrcweir static SfxSlotId pDialogSlots[] = 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir SID_ATTR_TABSTOP, 153*cdf0e10cSrcweir SID_ATTR_PARA_HANGPUNCTUATION, 154*cdf0e10cSrcweir SID_ATTR_PARA_FORBIDDEN_RULES, 155*cdf0e10cSrcweir SID_ATTR_PARA_SCRIPTSPACE, 156*cdf0e10cSrcweir SID_ATTR_CHAR_LATIN_LANGUAGE, 157*cdf0e10cSrcweir SID_ATTR_CHAR_CJK_LANGUAGE, 158*cdf0e10cSrcweir SID_ATTR_CHAR_CTL_LANGUAGE, 159*cdf0e10cSrcweir SID_ATTR_CHAR_LATIN_FONT, 160*cdf0e10cSrcweir SID_ATTR_CHAR_CJK_FONT, 161*cdf0e10cSrcweir SID_ATTR_CHAR_CTL_FONT, 162*cdf0e10cSrcweir SID_ATTR_CHAR_LATIN_FONTHEIGHT, 163*cdf0e10cSrcweir SID_ATTR_CHAR_CJK_FONTHEIGHT, 164*cdf0e10cSrcweir SID_ATTR_CHAR_CTL_FONTHEIGHT, 165*cdf0e10cSrcweir SID_ATTR_CHAR_LATIN_WEIGHT, 166*cdf0e10cSrcweir SID_ATTR_CHAR_CJK_WEIGHT, 167*cdf0e10cSrcweir SID_ATTR_CHAR_CTL_WEIGHT, 168*cdf0e10cSrcweir SID_ATTR_CHAR_LATIN_POSTURE, 169*cdf0e10cSrcweir SID_ATTR_CHAR_CJK_POSTURE, 170*cdf0e10cSrcweir SID_ATTR_CHAR_CTL_POSTURE, 171*cdf0e10cSrcweir SID_ATTR_CHAR_EMPHASISMARK, 172*cdf0e10cSrcweir 0 173*cdf0e10cSrcweir }; 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir //==================================================================== 176*cdf0e10cSrcweir //= FmFocusListenerAdapter 177*cdf0e10cSrcweir //==================================================================== 178*cdf0e10cSrcweir typedef ::cppu::WeakImplHelper1 < XFocusListener 179*cdf0e10cSrcweir > FmFocusListenerAdapter_Base; 180*cdf0e10cSrcweir class FmFocusListenerAdapter : public FmFocusListenerAdapter_Base 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir private: 183*cdf0e10cSrcweir IFocusObserver* m_pObserver; 184*cdf0e10cSrcweir Reference< XWindow > m_xWindow; 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir public: 187*cdf0e10cSrcweir FmFocusListenerAdapter( const Reference< XControl >& _rxControl, IFocusObserver* _pObserver ); 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir // clean up the instance 190*cdf0e10cSrcweir void dispose(); 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir protected: 193*cdf0e10cSrcweir ~FmFocusListenerAdapter(); 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir protected: 196*cdf0e10cSrcweir virtual void SAL_CALL focusGained( const FocusEvent& e ) throw (RuntimeException); 197*cdf0e10cSrcweir virtual void SAL_CALL focusLost( const FocusEvent& e ) throw (RuntimeException); 198*cdf0e10cSrcweir virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException); 199*cdf0e10cSrcweir }; 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir //-------------------------------------------------------------------- 202*cdf0e10cSrcweir DBG_NAME( FmFocusListenerAdapter ) 203*cdf0e10cSrcweir //-------------------------------------------------------------------- 204*cdf0e10cSrcweir FmFocusListenerAdapter::FmFocusListenerAdapter( const Reference< XControl >& _rxControl, IFocusObserver* _pObserver ) 205*cdf0e10cSrcweir :m_pObserver( _pObserver ) 206*cdf0e10cSrcweir ,m_xWindow( _rxControl, UNO_QUERY ) 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir DBG_CTOR( FmFocusListenerAdapter, NULL ); 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir DBG_ASSERT( m_xWindow.is(), "FmFocusListenerAdapter::FmFocusListenerAdapter: invalid control!" ); 211*cdf0e10cSrcweir osl_incrementInterlockedCount( &m_refCount ); 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir try 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir if ( m_xWindow.is() ) 216*cdf0e10cSrcweir m_xWindow->addFocusListener( this ); 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir catch( const Exception& ) 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir osl_decrementInterlockedCount( &m_refCount ); 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir //-------------------------------------------------------------------- 227*cdf0e10cSrcweir FmFocusListenerAdapter::~FmFocusListenerAdapter() 228*cdf0e10cSrcweir { 229*cdf0e10cSrcweir acquire(); 230*cdf0e10cSrcweir dispose(); 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir DBG_DTOR( FmFocusListenerAdapter, NULL ); 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir //-------------------------------------------------------------------- 236*cdf0e10cSrcweir void FmFocusListenerAdapter::dispose() 237*cdf0e10cSrcweir { 238*cdf0e10cSrcweir if ( m_xWindow.is() ) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir m_xWindow->removeFocusListener( this ); 241*cdf0e10cSrcweir m_xWindow.clear(); 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir //-------------------------------------------------------------------- 246*cdf0e10cSrcweir void SAL_CALL FmFocusListenerAdapter::focusGained( const FocusEvent& e ) throw (RuntimeException) 247*cdf0e10cSrcweir { 248*cdf0e10cSrcweir if ( m_pObserver ) 249*cdf0e10cSrcweir m_pObserver->focusGained( e ); 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir //-------------------------------------------------------------------- 253*cdf0e10cSrcweir void SAL_CALL FmFocusListenerAdapter::focusLost( const FocusEvent& e ) throw (RuntimeException) 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir if ( m_pObserver ) 256*cdf0e10cSrcweir m_pObserver->focusLost( e ); 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir //-------------------------------------------------------------------- 260*cdf0e10cSrcweir void SAL_CALL FmFocusListenerAdapter::disposing( const EventObject& Source ) throw (RuntimeException) 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir (void)Source; 263*cdf0e10cSrcweir DBG_ASSERT( Source.Source == m_xWindow, "FmFocusListenerAdapter::disposing: where did this come from?" ); 264*cdf0e10cSrcweir m_xWindow.clear(); 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir //==================================================================== 268*cdf0e10cSrcweir //= FmMouseListenerAdapter 269*cdf0e10cSrcweir //==================================================================== 270*cdf0e10cSrcweir typedef ::cppu::WeakImplHelper1 < XMouseListener 271*cdf0e10cSrcweir > FmMouseListenerAdapter_Base; 272*cdf0e10cSrcweir class FmMouseListenerAdapter : public FmMouseListenerAdapter_Base 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir private: 275*cdf0e10cSrcweir IContextRequestObserver* m_pObserver; 276*cdf0e10cSrcweir Reference< XWindow > m_xWindow; 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir public: 279*cdf0e10cSrcweir FmMouseListenerAdapter( const Reference< XControl >& _rxControl, IContextRequestObserver* _pObserver ); 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir // clean up the instance 282*cdf0e10cSrcweir void dispose(); 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir protected: 285*cdf0e10cSrcweir ~FmMouseListenerAdapter(); 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir protected: 288*cdf0e10cSrcweir virtual void SAL_CALL mousePressed( const awt::MouseEvent& e ) throw (RuntimeException); 289*cdf0e10cSrcweir virtual void SAL_CALL mouseReleased( const awt::MouseEvent& e ) throw (RuntimeException); 290*cdf0e10cSrcweir virtual void SAL_CALL mouseEntered( const awt::MouseEvent& e ) throw (RuntimeException); 291*cdf0e10cSrcweir virtual void SAL_CALL mouseExited( const awt::MouseEvent& e ) throw (RuntimeException); 292*cdf0e10cSrcweir virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException); 293*cdf0e10cSrcweir }; 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir //==================================================================== 296*cdf0e10cSrcweir //= FmMouseListenerAdapter 297*cdf0e10cSrcweir //==================================================================== 298*cdf0e10cSrcweir //-------------------------------------------------------------------- 299*cdf0e10cSrcweir DBG_NAME( FmMouseListenerAdapter ) 300*cdf0e10cSrcweir //-------------------------------------------------------------------- 301*cdf0e10cSrcweir FmMouseListenerAdapter::FmMouseListenerAdapter( const Reference< XControl >& _rxControl, IContextRequestObserver* _pObserver ) 302*cdf0e10cSrcweir :m_pObserver( _pObserver ) 303*cdf0e10cSrcweir ,m_xWindow( _rxControl, UNO_QUERY ) 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir DBG_CTOR( FmMouseListenerAdapter, NULL ); 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir DBG_ASSERT( m_xWindow.is(), "FmMouseListenerAdapter::FmMouseListenerAdapter: invalid control!" ); 308*cdf0e10cSrcweir osl_incrementInterlockedCount( &m_refCount ); 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir try 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir if ( m_xWindow.is() ) 313*cdf0e10cSrcweir m_xWindow->addMouseListener( this ); 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir catch( const Exception& ) 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir osl_decrementInterlockedCount( &m_refCount ); 321*cdf0e10cSrcweir } 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir //-------------------------------------------------------------------- 324*cdf0e10cSrcweir FmMouseListenerAdapter::~FmMouseListenerAdapter() 325*cdf0e10cSrcweir { 326*cdf0e10cSrcweir acquire(); 327*cdf0e10cSrcweir dispose(); 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir DBG_DTOR( FmMouseListenerAdapter, NULL ); 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir //-------------------------------------------------------------------- 333*cdf0e10cSrcweir void FmMouseListenerAdapter::dispose() 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir if ( m_xWindow.is() ) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir m_xWindow->removeMouseListener( this ); 338*cdf0e10cSrcweir m_xWindow.clear(); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir //-------------------------------------------------------------------- 343*cdf0e10cSrcweir void SAL_CALL FmMouseListenerAdapter::mousePressed( const awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 346*cdf0e10cSrcweir // is this a request for a context menu? 347*cdf0e10cSrcweir if ( _rEvent.PopupTrigger ) 348*cdf0e10cSrcweir { 349*cdf0e10cSrcweir if ( m_pObserver ) 350*cdf0e10cSrcweir m_pObserver->contextMenuRequested( _rEvent ); 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir //-------------------------------------------------------------------- 355*cdf0e10cSrcweir void SAL_CALL FmMouseListenerAdapter::mouseReleased( const awt::MouseEvent& /*e*/ ) throw (::com::sun::star::uno::RuntimeException) 356*cdf0e10cSrcweir { 357*cdf0e10cSrcweir // not interested in 358*cdf0e10cSrcweir } 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir //-------------------------------------------------------------------- 361*cdf0e10cSrcweir void SAL_CALL FmMouseListenerAdapter::mouseEntered( const awt::MouseEvent& /*e*/ ) throw (::com::sun::star::uno::RuntimeException) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir // not interested in 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir //-------------------------------------------------------------------- 367*cdf0e10cSrcweir void SAL_CALL FmMouseListenerAdapter::mouseExited( const awt::MouseEvent& /*e*/ ) throw (::com::sun::star::uno::RuntimeException) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir // not interested in 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir //-------------------------------------------------------------------- 373*cdf0e10cSrcweir void SAL_CALL FmMouseListenerAdapter::disposing( const EventObject& Source ) throw (RuntimeException) 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir (void)Source; 376*cdf0e10cSrcweir DBG_ASSERT( Source.Source == m_xWindow, "FmMouseListenerAdapter::disposing: where did this come from?" ); 377*cdf0e10cSrcweir m_xWindow.clear(); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir //==================================================================== 381*cdf0e10cSrcweir //= FmTextControlShell 382*cdf0e10cSrcweir //==================================================================== 383*cdf0e10cSrcweir //------------------------------------------------------------------------ 384*cdf0e10cSrcweir namespace 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir //.................................................................... 387*cdf0e10cSrcweir void lcl_translateUnoStateToItem( SfxSlotId _nSlot, const Any& _rUnoState, SfxItemSet& _rSet ) 388*cdf0e10cSrcweir { 389*cdf0e10cSrcweir WhichId nWhich = _rSet.GetPool()->GetWhich( _nSlot ); 390*cdf0e10cSrcweir if ( !_rUnoState.hasValue() ) 391*cdf0e10cSrcweir { 392*cdf0e10cSrcweir if ( ( _nSlot != SID_CUT ) 393*cdf0e10cSrcweir && ( _nSlot != SID_COPY ) 394*cdf0e10cSrcweir && ( _nSlot != SID_PASTE ) 395*cdf0e10cSrcweir ) 396*cdf0e10cSrcweir { 397*cdf0e10cSrcweir _rSet.InvalidateItem( nWhich ); 398*cdf0e10cSrcweir } 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir else 401*cdf0e10cSrcweir { 402*cdf0e10cSrcweir switch ( _rUnoState.getValueType().getTypeClass() ) 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir case TypeClass_BOOLEAN: 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir sal_Bool bState = sal_False; 407*cdf0e10cSrcweir _rUnoState >>= bState; 408*cdf0e10cSrcweir if ( _nSlot == SID_ATTR_PARA_SCRIPTSPACE ) 409*cdf0e10cSrcweir _rSet.Put( SvxScriptSpaceItem( bState, nWhich ) ); 410*cdf0e10cSrcweir else 411*cdf0e10cSrcweir _rSet.Put( SfxBoolItem( nWhich, bState ) ); 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir break; 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir default: 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir Sequence< PropertyValue > aComplexState; 418*cdf0e10cSrcweir if ( _rUnoState >>= aComplexState ) 419*cdf0e10cSrcweir { 420*cdf0e10cSrcweir if ( !aComplexState.getLength() ) 421*cdf0e10cSrcweir _rSet.InvalidateItem( nWhich ); 422*cdf0e10cSrcweir else 423*cdf0e10cSrcweir { 424*cdf0e10cSrcweir SfxAllItemSet aAllItems( _rSet ); 425*cdf0e10cSrcweir TransformParameters( _nSlot, aComplexState, aAllItems ); 426*cdf0e10cSrcweir const SfxPoolItem* pTransformed = aAllItems.GetItem( nWhich ); 427*cdf0e10cSrcweir OSL_ENSURE( pTransformed, "lcl_translateUnoStateToItem: non-empty parameter sequence leading to empty item?" ); 428*cdf0e10cSrcweir if ( pTransformed ) 429*cdf0e10cSrcweir _rSet.Put( *pTransformed ); 430*cdf0e10cSrcweir else 431*cdf0e10cSrcweir _rSet.InvalidateItem( nWhich ); 432*cdf0e10cSrcweir } 433*cdf0e10cSrcweir } 434*cdf0e10cSrcweir else 435*cdf0e10cSrcweir { 436*cdf0e10cSrcweir DBG_ERROR( "lcl_translateUnoStateToItem: invalid state!" ); 437*cdf0e10cSrcweir } 438*cdf0e10cSrcweir } 439*cdf0e10cSrcweir } 440*cdf0e10cSrcweir } 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir //.................................................................... 444*cdf0e10cSrcweir ::rtl::OUString lcl_getUnoSlotName( SfxApplication&, SfxSlotId _nSlotId ) 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir ::rtl::OUString sSlotUnoName; 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( NULL ); 449*cdf0e10cSrcweir const SfxSlot* pSlot = rSlotPool.GetSlot( _nSlotId ); 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir const sal_Char* pAsciiUnoName = NULL; 452*cdf0e10cSrcweir if ( pSlot ) 453*cdf0e10cSrcweir { 454*cdf0e10cSrcweir pAsciiUnoName = pSlot->GetUnoName(); 455*cdf0e10cSrcweir } 456*cdf0e10cSrcweir else 457*cdf0e10cSrcweir { 458*cdf0e10cSrcweir // some hard-coded slots, which do not have a UNO name at SFX level, but which 459*cdf0e10cSrcweir // we nevertheless need to transport via UNO mechanisms, so we need a name 460*cdf0e10cSrcweir switch ( _nSlotId ) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir case SID_ATTR_PARA_HANGPUNCTUATION: pAsciiUnoName = "AllowHangingPunctuation"; break; 463*cdf0e10cSrcweir case SID_ATTR_PARA_FORBIDDEN_RULES: pAsciiUnoName = "ApplyForbiddenCharacterRules"; break; 464*cdf0e10cSrcweir case SID_ATTR_PARA_SCRIPTSPACE: pAsciiUnoName = "UseScriptSpacing"; break; 465*cdf0e10cSrcweir } 466*cdf0e10cSrcweir } 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir if ( pAsciiUnoName ) 469*cdf0e10cSrcweir { 470*cdf0e10cSrcweir sSlotUnoName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:" ) ); 471*cdf0e10cSrcweir sSlotUnoName += ::rtl::OUString::createFromAscii( pAsciiUnoName ); 472*cdf0e10cSrcweir } 473*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 474*cdf0e10cSrcweir else 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir ::rtl::OString sMessage( "lcl_getUnoSlotName: invalid slot id, or invalid slot, or no UNO name!\n" ); 477*cdf0e10cSrcweir sMessage += "(slot id: "; 478*cdf0e10cSrcweir sMessage += ::rtl::OString::valueOf( (sal_Int32)_nSlotId ); 479*cdf0e10cSrcweir sMessage += ")"; 480*cdf0e10cSrcweir DBG_ERROR( sMessage ); 481*cdf0e10cSrcweir } 482*cdf0e10cSrcweir #endif 483*cdf0e10cSrcweir return sSlotUnoName; 484*cdf0e10cSrcweir } 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir //.................................................................... 487*cdf0e10cSrcweir bool lcl_determineReadOnly( const Reference< XControl >& _rxControl ) 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir bool bIsReadOnlyModel = true; 490*cdf0e10cSrcweir try 491*cdf0e10cSrcweir { 492*cdf0e10cSrcweir Reference< XPropertySet > xModelProps; 493*cdf0e10cSrcweir if ( _rxControl.is() ) 494*cdf0e10cSrcweir xModelProps = xModelProps.query( _rxControl->getModel() ); 495*cdf0e10cSrcweir Reference< XPropertySetInfo > xModelPropInfo; 496*cdf0e10cSrcweir if ( xModelProps.is() ) 497*cdf0e10cSrcweir xModelPropInfo = xModelProps->getPropertySetInfo(); 498*cdf0e10cSrcweir 499*cdf0e10cSrcweir if ( !xModelPropInfo.is() || !xModelPropInfo->hasPropertyByName( FM_PROP_READONLY ) ) 500*cdf0e10cSrcweir bIsReadOnlyModel = true; 501*cdf0e10cSrcweir else 502*cdf0e10cSrcweir { 503*cdf0e10cSrcweir sal_Bool bReadOnly = sal_True; 504*cdf0e10cSrcweir xModelProps->getPropertyValue( FM_PROP_READONLY ) >>= bReadOnly; 505*cdf0e10cSrcweir bIsReadOnlyModel = bReadOnly; 506*cdf0e10cSrcweir } 507*cdf0e10cSrcweir } 508*cdf0e10cSrcweir catch( const Exception& ) 509*cdf0e10cSrcweir { 510*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir return bIsReadOnlyModel; 513*cdf0e10cSrcweir } 514*cdf0e10cSrcweir 515*cdf0e10cSrcweir //.................................................................... 516*cdf0e10cSrcweir static Window* lcl_getWindow( const Reference< XControl >& _rxControl ) 517*cdf0e10cSrcweir { 518*cdf0e10cSrcweir Window* pWindow = NULL; 519*cdf0e10cSrcweir try 520*cdf0e10cSrcweir { 521*cdf0e10cSrcweir Reference< XWindowPeer > xControlPeer; 522*cdf0e10cSrcweir if ( _rxControl.is() ) 523*cdf0e10cSrcweir xControlPeer = _rxControl->getPeer(); 524*cdf0e10cSrcweir if ( xControlPeer.is() ) 525*cdf0e10cSrcweir pWindow = VCLUnoHelper::GetWindow( xControlPeer ); 526*cdf0e10cSrcweir } 527*cdf0e10cSrcweir catch( const Exception& ) 528*cdf0e10cSrcweir { 529*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 530*cdf0e10cSrcweir } 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir return pWindow; 533*cdf0e10cSrcweir } 534*cdf0e10cSrcweir 535*cdf0e10cSrcweir //.................................................................... 536*cdf0e10cSrcweir bool lcl_isRichText( const Reference< XControl >& _rxControl ) 537*cdf0e10cSrcweir { 538*cdf0e10cSrcweir if ( !_rxControl.is() ) 539*cdf0e10cSrcweir return false; 540*cdf0e10cSrcweir 541*cdf0e10cSrcweir bool bIsRichText = false; 542*cdf0e10cSrcweir try 543*cdf0e10cSrcweir { 544*cdf0e10cSrcweir Reference< XPropertySet > xModelProps( _rxControl->getModel(), UNO_QUERY ); 545*cdf0e10cSrcweir Reference< XPropertySetInfo > xPSI; 546*cdf0e10cSrcweir if ( xModelProps.is() ) 547*cdf0e10cSrcweir xPSI = xModelProps->getPropertySetInfo(); 548*cdf0e10cSrcweir ::rtl::OUString sRichTextPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RichText" ) ); 549*cdf0e10cSrcweir if ( xPSI.is() && xPSI->hasPropertyByName( sRichTextPropertyName ) ) 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir OSL_VERIFY( xModelProps->getPropertyValue( sRichTextPropertyName ) >>= bIsRichText ); 552*cdf0e10cSrcweir } 553*cdf0e10cSrcweir } 554*cdf0e10cSrcweir catch( const Exception& ) 555*cdf0e10cSrcweir { 556*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 557*cdf0e10cSrcweir } 558*cdf0e10cSrcweir return bIsRichText; 559*cdf0e10cSrcweir } 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir 562*cdf0e10cSrcweir //------------------------------------------------------------------------ 563*cdf0e10cSrcweir FmTextControlShell::FmTextControlShell( SfxViewFrame* _pFrame ) 564*cdf0e10cSrcweir :m_bActiveControl( false ) 565*cdf0e10cSrcweir ,m_bActiveControlIsReadOnly( true ) 566*cdf0e10cSrcweir ,m_bActiveControlIsRichText( false ) 567*cdf0e10cSrcweir ,m_pViewFrame( _pFrame ) 568*cdf0e10cSrcweir ,m_rBindings( _pFrame->GetBindings() ) 569*cdf0e10cSrcweir ,m_bNeedClipboardInvalidation( true ) 570*cdf0e10cSrcweir { 571*cdf0e10cSrcweir m_aClipboardInvalidation.SetTimeoutHdl( LINK( this, FmTextControlShell, OnInvalidateClipboard ) ); 572*cdf0e10cSrcweir m_aClipboardInvalidation.SetTimeout( 200 ); 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir //------------------------------------------------------------------------ 576*cdf0e10cSrcweir FmTextControlShell::~FmTextControlShell() 577*cdf0e10cSrcweir { 578*cdf0e10cSrcweir dispose(); 579*cdf0e10cSrcweir } 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir //------------------------------------------------------------------------ 582*cdf0e10cSrcweir IMPL_LINK( FmTextControlShell, OnInvalidateClipboard, void*, /*_pNotInterestedIn*/ ) 583*cdf0e10cSrcweir { 584*cdf0e10cSrcweir if ( m_bNeedClipboardInvalidation ) 585*cdf0e10cSrcweir { 586*cdf0e10cSrcweir DBG_TRACE( "FmTextControlShell::ClipBoard: invalidating clipboard slots" ); 587*cdf0e10cSrcweir m_rBindings.Invalidate( SID_CUT ); 588*cdf0e10cSrcweir m_rBindings.Invalidate( SID_COPY ); 589*cdf0e10cSrcweir m_rBindings.Invalidate( SID_PASTE ); 590*cdf0e10cSrcweir m_bNeedClipboardInvalidation = false; 591*cdf0e10cSrcweir } 592*cdf0e10cSrcweir return 0L; 593*cdf0e10cSrcweir } 594*cdf0e10cSrcweir 595*cdf0e10cSrcweir //------------------------------------------------------------------------ 596*cdf0e10cSrcweir void FmTextControlShell::transferFeatureStatesToItemSet( ControlFeatures& _rDispatchers, SfxAllItemSet& _rSet, bool _bTranslateLatin ) 597*cdf0e10cSrcweir { 598*cdf0e10cSrcweir SfxItemPool& rPool = *_rSet.GetPool(); 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir for ( ControlFeatures::const_iterator aFeature = _rDispatchers.begin(); 601*cdf0e10cSrcweir aFeature != _rDispatchers.end(); 602*cdf0e10cSrcweir ++aFeature 603*cdf0e10cSrcweir ) 604*cdf0e10cSrcweir { 605*cdf0e10cSrcweir SfxSlotId nSlotId( aFeature->first ); 606*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 607*cdf0e10cSrcweir ::rtl::OUString sUnoSlotName; 608*cdf0e10cSrcweir if ( SFX_APP() ) 609*cdf0e10cSrcweir sUnoSlotName = lcl_getUnoSlotName( *SFX_APP(), nSlotId ); 610*cdf0e10cSrcweir else 611*cdf0e10cSrcweir sUnoSlotName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "<unknown>" ) ); 612*cdf0e10cSrcweir ::rtl::OString sUnoSlotNameAscii( "\"" ); 613*cdf0e10cSrcweir sUnoSlotNameAscii += ::rtl::OString( sUnoSlotName.getStr(), sUnoSlotName.getLength(), RTL_TEXTENCODING_ASCII_US ); 614*cdf0e10cSrcweir sUnoSlotNameAscii += "\""; 615*cdf0e10cSrcweir #endif 616*cdf0e10cSrcweir 617*cdf0e10cSrcweir if ( _bTranslateLatin ) 618*cdf0e10cSrcweir { 619*cdf0e10cSrcweir // A rich text control offers a dispatcher for the "Font" slot/feature. 620*cdf0e10cSrcweir // Sadly, the semantics of the dispatches is that the feature "Font" depends 621*cdf0e10cSrcweir // on the current cursor position: If it's on latin text, it's the "latin font" 622*cdf0e10cSrcweir // which is set up at the control. If it's on CJK text, it's the "CJK font", and 623*cdf0e10cSrcweir // aequivalent for "CTL font". 624*cdf0e10cSrcweir // The same holds for some other font related features/slots. 625*cdf0e10cSrcweir // Thus, we have separate dispatches for "Latin Font", "Latin Font Size", etc, 626*cdf0e10cSrcweir // which are only "virtual", in a sense that there exist no item with this id. 627*cdf0e10cSrcweir // So when we encounter such a dispatcher for, say, "Latin Font", we need to 628*cdf0e10cSrcweir // put an item into the set which has the "Font" id. 629*cdf0e10cSrcweir 630*cdf0e10cSrcweir switch ( nSlotId ) 631*cdf0e10cSrcweir { 632*cdf0e10cSrcweir case SID_ATTR_CHAR_LATIN_FONT: nSlotId = SID_ATTR_CHAR_FONT; break; 633*cdf0e10cSrcweir case SID_ATTR_CHAR_LATIN_FONTHEIGHT:nSlotId = SID_ATTR_CHAR_FONTHEIGHT; break; 634*cdf0e10cSrcweir case SID_ATTR_CHAR_LATIN_LANGUAGE: nSlotId = SID_ATTR_CHAR_LANGUAGE; break; 635*cdf0e10cSrcweir case SID_ATTR_CHAR_LATIN_POSTURE: nSlotId = SID_ATTR_CHAR_POSTURE; break; 636*cdf0e10cSrcweir case SID_ATTR_CHAR_LATIN_WEIGHT: nSlotId = SID_ATTR_CHAR_WEIGHT; break; 637*cdf0e10cSrcweir } 638*cdf0e10cSrcweir } 639*cdf0e10cSrcweir 640*cdf0e10cSrcweir WhichId nWhich = rPool.GetWhich( nSlotId ); 641*cdf0e10cSrcweir bool bIsInPool = rPool.IsInRange( nWhich ); 642*cdf0e10cSrcweir if ( bIsInPool ) 643*cdf0e10cSrcweir { 644*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 645*cdf0e10cSrcweir bool bFeatureIsEnabled = aFeature->second->isFeatureEnabled(); 646*cdf0e10cSrcweir ::rtl::OString sMessage( "FmTextControlShell::transferFeatureStatesToItemSet: found a feature state for " ); 647*cdf0e10cSrcweir sMessage += sUnoSlotNameAscii; 648*cdf0e10cSrcweir if ( !bFeatureIsEnabled ) 649*cdf0e10cSrcweir sMessage += " (disabled)"; 650*cdf0e10cSrcweir DBG_TRACE( sMessage ); 651*cdf0e10cSrcweir #endif 652*cdf0e10cSrcweir 653*cdf0e10cSrcweir lcl_translateUnoStateToItem( nSlotId, aFeature->second->getFeatureState(), _rSet ); 654*cdf0e10cSrcweir } 655*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 656*cdf0e10cSrcweir else 657*cdf0e10cSrcweir { 658*cdf0e10cSrcweir ::rtl::OString sMessage( "FmTextControlShell::transferFeatureStatesToItemSet: found a feature state for " ); 659*cdf0e10cSrcweir sMessage += sUnoSlotNameAscii; 660*cdf0e10cSrcweir sMessage += ", but could not translate it into an item!"; 661*cdf0e10cSrcweir DBG_TRACE( sMessage ); 662*cdf0e10cSrcweir } 663*cdf0e10cSrcweir #endif 664*cdf0e10cSrcweir } 665*cdf0e10cSrcweir } 666*cdf0e10cSrcweir 667*cdf0e10cSrcweir //------------------------------------------------------------------------ 668*cdf0e10cSrcweir void FmTextControlShell::executeAttributeDialog( AttributeSet _eSet, SfxRequest& _rReq ) 669*cdf0e10cSrcweir { 670*cdf0e10cSrcweir const SvxFontListItem* pFontList = PTR_CAST( SvxFontListItem, m_pViewFrame->GetObjectShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ); 671*cdf0e10cSrcweir DBG_ASSERT( pFontList, "FmTextControlShell::executeAttributeDialog: no font list item!" ); 672*cdf0e10cSrcweir if ( !pFontList ) 673*cdf0e10cSrcweir return; 674*cdf0e10cSrcweir 675*cdf0e10cSrcweir SfxItemPool* pPool = EditEngine::CreatePool(); 676*cdf0e10cSrcweir pPool->FreezeIdRanges(); 677*cdf0e10cSrcweir ::std::auto_ptr< SfxItemSet > pPureItems( new SfxItemSet( *pPool ) ); 678*cdf0e10cSrcweir 679*cdf0e10cSrcweir // put the current states of the items into the set 680*cdf0e10cSrcweir ::std::auto_ptr< SfxAllItemSet > pCurrentItems( new SfxAllItemSet( *pPureItems ) ); 681*cdf0e10cSrcweir transferFeatureStatesToItemSet( m_aControlFeatures, *pCurrentItems ); 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir // additional items, which we are not responsible for at the SfxShell level, 684*cdf0e10cSrcweir // but which need to be forwarded to the dialog, anyway 685*cdf0e10cSrcweir ControlFeatures aAdditionalFestures; 686*cdf0e10cSrcweir fillFeatureDispatchers( m_xActiveControl, pDialogSlots, aAdditionalFestures ); 687*cdf0e10cSrcweir transferFeatureStatesToItemSet( aAdditionalFestures, *pCurrentItems, true ); 688*cdf0e10cSrcweir 689*cdf0e10cSrcweir ::std::auto_ptr< SfxTabDialog > pDialog ( _eSet == eCharAttribs 690*cdf0e10cSrcweir ? static_cast< SfxTabDialog* >( new TextControlCharAttribDialog( NULL, *pCurrentItems, *pFontList ) ) 691*cdf0e10cSrcweir : static_cast< SfxTabDialog* >( new TextControlParaAttribDialog( NULL, *pCurrentItems ) ) ); 692*cdf0e10cSrcweir if ( RET_OK == pDialog->Execute() ) 693*cdf0e10cSrcweir { 694*cdf0e10cSrcweir const SfxItemSet& rModifiedItems = *pDialog->GetOutputItemSet(); 695*cdf0e10cSrcweir for ( WhichId nWhich = pPool->GetFirstWhich(); nWhich <= pPool->GetLastWhich(); ++nWhich ) 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir if ( rModifiedItems.GetItemState( nWhich ) == SFX_ITEM_SET ) 698*cdf0e10cSrcweir { 699*cdf0e10cSrcweir SfxSlotId nSlotForItemSet = pPool->GetSlotId( nWhich ); 700*cdf0e10cSrcweir const SfxPoolItem* pModifiedItem = rModifiedItems.GetItem( nWhich ); 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir 703*cdf0e10cSrcweir SfxSlotId nSlotForDispatcher = nSlotForItemSet; 704*cdf0e10cSrcweir switch ( nSlotForDispatcher ) 705*cdf0e10cSrcweir { 706*cdf0e10cSrcweir case SID_ATTR_CHAR_FONT: nSlotForDispatcher = SID_ATTR_CHAR_LATIN_FONT; break; 707*cdf0e10cSrcweir case SID_ATTR_CHAR_FONTHEIGHT:nSlotForDispatcher = SID_ATTR_CHAR_LATIN_FONTHEIGHT; break; 708*cdf0e10cSrcweir case SID_ATTR_CHAR_LANGUAGE: nSlotForDispatcher = SID_ATTR_CHAR_LATIN_LANGUAGE; break; 709*cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE: nSlotForDispatcher = SID_ATTR_CHAR_LATIN_POSTURE; break; 710*cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT: nSlotForDispatcher = SID_ATTR_CHAR_LATIN_WEIGHT; break; 711*cdf0e10cSrcweir } 712*cdf0e10cSrcweir 713*cdf0e10cSrcweir // do we already have a dispatcher for this slot/feature? 714*cdf0e10cSrcweir ControlFeatures::const_iterator aFeaturePos = m_aControlFeatures.find( nSlotForDispatcher ); 715*cdf0e10cSrcweir bool bFound = aFeaturePos != m_aControlFeatures.end( ); 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir if ( !bFound ) 718*cdf0e10cSrcweir { 719*cdf0e10cSrcweir aFeaturePos = aAdditionalFestures.find( nSlotForDispatcher ); 720*cdf0e10cSrcweir bFound = aFeaturePos != aAdditionalFestures.end( ); 721*cdf0e10cSrcweir } 722*cdf0e10cSrcweir 723*cdf0e10cSrcweir if ( bFound ) 724*cdf0e10cSrcweir { 725*cdf0e10cSrcweir Sequence< PropertyValue > aArgs; 726*cdf0e10cSrcweir // temporarily put the modified item into a "clean" set, 727*cdf0e10cSrcweir // and let TransformItems calc the respective UNO parameters 728*cdf0e10cSrcweir pPureItems->Put( *pModifiedItem ); 729*cdf0e10cSrcweir TransformItems( nSlotForItemSet, *pPureItems, aArgs ); 730*cdf0e10cSrcweir pPureItems->ClearItem( nWhich ); 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir if ( ( nSlotForItemSet == SID_ATTR_PARA_HANGPUNCTUATION ) 733*cdf0e10cSrcweir || ( nSlotForItemSet == SID_ATTR_PARA_FORBIDDEN_RULES ) 734*cdf0e10cSrcweir || ( nSlotForItemSet == SID_ATTR_PARA_SCRIPTSPACE ) 735*cdf0e10cSrcweir ) 736*cdf0e10cSrcweir { 737*cdf0e10cSrcweir // these are no UNO slots, they need special handling since TransformItems cannot 738*cdf0e10cSrcweir // handle them 739*cdf0e10cSrcweir DBG_ASSERT( aArgs.getLength() == 0, "FmTextControlShell::executeAttributeDialog: these are no UNO slots - are they?" ); 740*cdf0e10cSrcweir 741*cdf0e10cSrcweir const SfxBoolItem* pBoolItem = PTR_CAST( SfxBoolItem, pModifiedItem ); 742*cdf0e10cSrcweir DBG_ASSERT( pBoolItem, "FmTextControlShell::executeAttributeDialog: no bool item?!" ); 743*cdf0e10cSrcweir if ( pBoolItem ) 744*cdf0e10cSrcweir { 745*cdf0e10cSrcweir aArgs.realloc( 1 ); 746*cdf0e10cSrcweir aArgs[ 0 ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enable" ) ); 747*cdf0e10cSrcweir aArgs[ 0 ].Value <<= (sal_Bool)pBoolItem->GetValue(); 748*cdf0e10cSrcweir } 749*cdf0e10cSrcweir } 750*cdf0e10cSrcweir 751*cdf0e10cSrcweir // dispatch this 752*cdf0e10cSrcweir aFeaturePos->second->dispatch( aArgs ); 753*cdf0e10cSrcweir } 754*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 755*cdf0e10cSrcweir else 756*cdf0e10cSrcweir { 757*cdf0e10cSrcweir ::rtl::OString sError( "FmTextControShell::executeAttributeDialog: Could not handle the following item:" ); 758*cdf0e10cSrcweir sError += "\n SlotID: "; sError += ::rtl::OString::valueOf( (sal_Int32)nSlotForItemSet ); 759*cdf0e10cSrcweir sError += "\n WhichID: "; sError += ::rtl::OString::valueOf( (sal_Int32)nWhich ); 760*cdf0e10cSrcweir sError += "\n UNO name: "; 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir ::rtl::OUString sUnoSlotName = lcl_getUnoSlotName( *SFX_APP(), nSlotForItemSet ); 763*cdf0e10cSrcweir if ( sUnoSlotName.getLength() ) 764*cdf0e10cSrcweir sError += ::rtl::OString( sUnoSlotName.getStr(), sUnoSlotName.getLength(), RTL_TEXTENCODING_ASCII_US ); 765*cdf0e10cSrcweir else 766*cdf0e10cSrcweir sError += "unknown (no SfxSlot)"; 767*cdf0e10cSrcweir DBG_ERROR( sError.getStr() ); 768*cdf0e10cSrcweir } 769*cdf0e10cSrcweir #endif 770*cdf0e10cSrcweir } 771*cdf0e10cSrcweir } 772*cdf0e10cSrcweir _rReq.Done( rModifiedItems ); 773*cdf0e10cSrcweir } 774*cdf0e10cSrcweir 775*cdf0e10cSrcweir pDialog.reset(); 776*cdf0e10cSrcweir pCurrentItems.reset(); 777*cdf0e10cSrcweir pPureItems.reset(); 778*cdf0e10cSrcweir SfxItemPool::Free(pPool); 779*cdf0e10cSrcweir } 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir //------------------------------------------------------------------------ 782*cdf0e10cSrcweir bool FmTextControlShell::executeSelectAll( ) 783*cdf0e10cSrcweir { 784*cdf0e10cSrcweir try 785*cdf0e10cSrcweir { 786*cdf0e10cSrcweir if ( m_xActiveTextComponent.is() ) 787*cdf0e10cSrcweir { 788*cdf0e10cSrcweir sal_Int32 nTextLen = m_xActiveTextComponent->getText().getLength(); 789*cdf0e10cSrcweir m_xActiveTextComponent->setSelection( awt::Selection( 0, nTextLen ) ); 790*cdf0e10cSrcweir return true; 791*cdf0e10cSrcweir } 792*cdf0e10cSrcweir } 793*cdf0e10cSrcweir catch( const Exception& ) 794*cdf0e10cSrcweir { 795*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 796*cdf0e10cSrcweir } 797*cdf0e10cSrcweir return false; // not handled 798*cdf0e10cSrcweir } 799*cdf0e10cSrcweir 800*cdf0e10cSrcweir //------------------------------------------------------------------------ 801*cdf0e10cSrcweir bool FmTextControlShell::executeClipboardSlot( SfxSlotId _nSlot ) 802*cdf0e10cSrcweir { 803*cdf0e10cSrcweir try 804*cdf0e10cSrcweir { 805*cdf0e10cSrcweir if ( m_xActiveTextComponent.is() ) 806*cdf0e10cSrcweir { 807*cdf0e10cSrcweir switch ( _nSlot ) 808*cdf0e10cSrcweir { 809*cdf0e10cSrcweir case SID_COPY: 810*cdf0e10cSrcweir case SID_CUT: 811*cdf0e10cSrcweir { 812*cdf0e10cSrcweir ::rtl::OUString sSelectedText( m_xActiveTextComponent->getSelectedText() ); 813*cdf0e10cSrcweir ::svt::OStringTransfer::CopyString( sSelectedText, lcl_getWindow( m_xActiveControl ) ); 814*cdf0e10cSrcweir if ( SID_CUT == _nSlot ) 815*cdf0e10cSrcweir { 816*cdf0e10cSrcweir awt::Selection aSelection( m_xActiveTextComponent->getSelection() ); 817*cdf0e10cSrcweir m_xActiveTextComponent->insertText( aSelection, ::rtl::OUString() ); 818*cdf0e10cSrcweir } 819*cdf0e10cSrcweir } 820*cdf0e10cSrcweir break; 821*cdf0e10cSrcweir case SID_PASTE: 822*cdf0e10cSrcweir { 823*cdf0e10cSrcweir ::rtl::OUString sClipboardContent; 824*cdf0e10cSrcweir OSL_VERIFY( ::svt::OStringTransfer::PasteString( sClipboardContent, lcl_getWindow( m_xActiveControl ) ) ); 825*cdf0e10cSrcweir awt::Selection aSelection( m_xActiveTextComponent->getSelection() ); 826*cdf0e10cSrcweir m_xActiveTextComponent->insertText( aSelection, sClipboardContent ); 827*cdf0e10cSrcweir } 828*cdf0e10cSrcweir break; 829*cdf0e10cSrcweir default: 830*cdf0e10cSrcweir OSL_ENSURE( sal_False, "FmTextControlShell::executeClipboardSlot: invalid slot!" ); 831*cdf0e10cSrcweir } 832*cdf0e10cSrcweir return true; 833*cdf0e10cSrcweir } 834*cdf0e10cSrcweir } 835*cdf0e10cSrcweir catch( const Exception& ) 836*cdf0e10cSrcweir { 837*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 838*cdf0e10cSrcweir } 839*cdf0e10cSrcweir return false; // not handled 840*cdf0e10cSrcweir } 841*cdf0e10cSrcweir 842*cdf0e10cSrcweir //------------------------------------------------------------------------ 843*cdf0e10cSrcweir void FmTextControlShell::ExecuteTextAttribute( SfxRequest& _rReq ) 844*cdf0e10cSrcweir { 845*cdf0e10cSrcweir SfxSlotId nSlot = _rReq.GetSlot(); 846*cdf0e10cSrcweir 847*cdf0e10cSrcweir ControlFeatures::const_iterator aFeaturePos = m_aControlFeatures.find( nSlot ); 848*cdf0e10cSrcweir if ( aFeaturePos == m_aControlFeatures.end() ) 849*cdf0e10cSrcweir { 850*cdf0e10cSrcweir // special slots 851*cdf0e10cSrcweir switch ( nSlot ) 852*cdf0e10cSrcweir { 853*cdf0e10cSrcweir case SID_CHAR_DLG: 854*cdf0e10cSrcweir executeAttributeDialog( eCharAttribs, _rReq ); 855*cdf0e10cSrcweir break; 856*cdf0e10cSrcweir 857*cdf0e10cSrcweir case SID_PARA_DLG: 858*cdf0e10cSrcweir executeAttributeDialog( eParaAttribs, _rReq ); 859*cdf0e10cSrcweir break; 860*cdf0e10cSrcweir 861*cdf0e10cSrcweir case SID_SELECTALL: 862*cdf0e10cSrcweir executeSelectAll(); 863*cdf0e10cSrcweir break; 864*cdf0e10cSrcweir 865*cdf0e10cSrcweir case SID_CUT: 866*cdf0e10cSrcweir case SID_COPY: 867*cdf0e10cSrcweir case SID_PASTE: 868*cdf0e10cSrcweir executeClipboardSlot( nSlot ); 869*cdf0e10cSrcweir break; 870*cdf0e10cSrcweir 871*cdf0e10cSrcweir default: 872*cdf0e10cSrcweir DBG_ASSERT( aFeaturePos != m_aControlFeatures.end(), "FmTextControShell::ExecuteTextAttribute: I have no such dispatcher, and cannot handle it at all!" ); 873*cdf0e10cSrcweir return; 874*cdf0e10cSrcweir } 875*cdf0e10cSrcweir } 876*cdf0e10cSrcweir else 877*cdf0e10cSrcweir { 878*cdf0e10cSrcweir // slots which are dispatched to the control 879*cdf0e10cSrcweir 880*cdf0e10cSrcweir switch ( nSlot ) 881*cdf0e10cSrcweir { 882*cdf0e10cSrcweir case SID_ATTR_CHAR_STRIKEOUT: 883*cdf0e10cSrcweir case SID_ATTR_CHAR_UNDERLINE: 884*cdf0e10cSrcweir case SID_ATTR_CHAR_OVERLINE: 885*cdf0e10cSrcweir { 886*cdf0e10cSrcweir SfxItemSet aToggled( *_rReq.GetArgs() ); 887*cdf0e10cSrcweir 888*cdf0e10cSrcweir lcl_translateUnoStateToItem( nSlot, aFeaturePos->second->getFeatureState(), aToggled ); 889*cdf0e10cSrcweir WhichId nWhich = aToggled.GetPool()->GetWhich( nSlot ); 890*cdf0e10cSrcweir const SfxPoolItem* pItem = aToggled.GetItem( nWhich ); 891*cdf0e10cSrcweir if ( ( SID_ATTR_CHAR_UNDERLINE == nSlot ) || ( SID_ATTR_CHAR_OVERLINE == nSlot ) ) 892*cdf0e10cSrcweir { 893*cdf0e10cSrcweir const SvxOverlineItem* pTextLine = PTR_CAST( SvxOverlineItem, pItem ); 894*cdf0e10cSrcweir DBG_ASSERT( pTextLine, "FmTextControlShell::ExecuteTextAttribute: ooops - no underline/overline item!" ); 895*cdf0e10cSrcweir if ( pTextLine ) 896*cdf0e10cSrcweir { 897*cdf0e10cSrcweir FontUnderline eTL = pTextLine->GetLineStyle(); 898*cdf0e10cSrcweir if ( SID_ATTR_CHAR_UNDERLINE == nSlot ) { 899*cdf0e10cSrcweir aToggled.Put( SvxUnderlineItem( eTL == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, nWhich ) ); 900*cdf0e10cSrcweir } else { 901*cdf0e10cSrcweir aToggled.Put( SvxOverlineItem( eTL == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, nWhich ) ); 902*cdf0e10cSrcweir } 903*cdf0e10cSrcweir } 904*cdf0e10cSrcweir } 905*cdf0e10cSrcweir else 906*cdf0e10cSrcweir { 907*cdf0e10cSrcweir const SvxCrossedOutItem* pCrossedOut = PTR_CAST( SvxCrossedOutItem, pItem ); 908*cdf0e10cSrcweir DBG_ASSERT( pCrossedOut, "FmTextControlShell::ExecuteTextAttribute: ooops - no CrossedOut item!" ); 909*cdf0e10cSrcweir if ( pCrossedOut ) 910*cdf0e10cSrcweir { 911*cdf0e10cSrcweir FontStrikeout eFS = pCrossedOut->GetStrikeout(); 912*cdf0e10cSrcweir aToggled.Put( SvxCrossedOutItem( eFS == STRIKEOUT_SINGLE ? STRIKEOUT_NONE : STRIKEOUT_SINGLE, nWhich ) ); 913*cdf0e10cSrcweir } 914*cdf0e10cSrcweir } 915*cdf0e10cSrcweir 916*cdf0e10cSrcweir Sequence< PropertyValue > aArguments; 917*cdf0e10cSrcweir TransformItems( nSlot, aToggled, aArguments ); 918*cdf0e10cSrcweir aFeaturePos->second->dispatch( aArguments ); 919*cdf0e10cSrcweir } 920*cdf0e10cSrcweir break; 921*cdf0e10cSrcweir 922*cdf0e10cSrcweir case SID_ATTR_CHAR_FONTHEIGHT: 923*cdf0e10cSrcweir case SID_ATTR_CHAR_FONT: 924*cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE: 925*cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT: 926*cdf0e10cSrcweir case SID_ATTR_CHAR_SHADOWED: 927*cdf0e10cSrcweir case SID_ATTR_CHAR_CONTOUR: 928*cdf0e10cSrcweir case SID_SET_SUPER_SCRIPT: 929*cdf0e10cSrcweir case SID_SET_SUB_SCRIPT: 930*cdf0e10cSrcweir { 931*cdf0e10cSrcweir const SfxItemSet* pArgs = _rReq.GetArgs(); 932*cdf0e10cSrcweir Sequence< PropertyValue > aArgs; 933*cdf0e10cSrcweir if ( pArgs ) 934*cdf0e10cSrcweir TransformItems( nSlot, *pArgs, aArgs ); 935*cdf0e10cSrcweir aFeaturePos->second->dispatch( aArgs ); 936*cdf0e10cSrcweir } 937*cdf0e10cSrcweir break; 938*cdf0e10cSrcweir 939*cdf0e10cSrcweir default: 940*cdf0e10cSrcweir if ( aFeaturePos->second->isFeatureEnabled() ) 941*cdf0e10cSrcweir aFeaturePos->second->dispatch(); 942*cdf0e10cSrcweir break; 943*cdf0e10cSrcweir } 944*cdf0e10cSrcweir } 945*cdf0e10cSrcweir _rReq.Done(); 946*cdf0e10cSrcweir } 947*cdf0e10cSrcweir 948*cdf0e10cSrcweir //------------------------------------------------------------------------ 949*cdf0e10cSrcweir void FmTextControlShell::GetTextAttributeState( SfxItemSet& _rSet ) 950*cdf0e10cSrcweir { 951*cdf0e10cSrcweir SfxWhichIter aIter( _rSet ); 952*cdf0e10cSrcweir sal_uInt16 nSlot = aIter.FirstWhich(); 953*cdf0e10cSrcweir while ( nSlot ) 954*cdf0e10cSrcweir { 955*cdf0e10cSrcweir if ( ( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT ) 956*cdf0e10cSrcweir || ( nSlot == SID_ATTR_PARA_RIGHT_TO_LEFT ) 957*cdf0e10cSrcweir ) 958*cdf0e10cSrcweir { 959*cdf0e10cSrcweir if ( !SvtLanguageOptions().IsCTLFontEnabled() ) 960*cdf0e10cSrcweir { 961*cdf0e10cSrcweir _rSet.DisableItem( nSlot ); 962*cdf0e10cSrcweir nSlot = aIter.NextWhich(); 963*cdf0e10cSrcweir continue; 964*cdf0e10cSrcweir } 965*cdf0e10cSrcweir } 966*cdf0e10cSrcweir 967*cdf0e10cSrcweir ControlFeatures::const_iterator aFeaturePos = m_aControlFeatures.find( nSlot ); 968*cdf0e10cSrcweir if ( aFeaturePos != m_aControlFeatures.end() ) 969*cdf0e10cSrcweir { 970*cdf0e10cSrcweir if ( aFeaturePos->second->isFeatureEnabled() ) 971*cdf0e10cSrcweir lcl_translateUnoStateToItem( nSlot, aFeaturePos->second->getFeatureState(), _rSet ); 972*cdf0e10cSrcweir else 973*cdf0e10cSrcweir _rSet.DisableItem( nSlot ); 974*cdf0e10cSrcweir } 975*cdf0e10cSrcweir else 976*cdf0e10cSrcweir { 977*cdf0e10cSrcweir bool bDisable = false; 978*cdf0e10cSrcweir 979*cdf0e10cSrcweir bool bNeedWriteableControl = false; 980*cdf0e10cSrcweir bool bNeedTextComponent = false; 981*cdf0e10cSrcweir bool bNeedSelection = false; 982*cdf0e10cSrcweir 983*cdf0e10cSrcweir switch ( nSlot ) 984*cdf0e10cSrcweir { 985*cdf0e10cSrcweir case SID_CHAR_DLG: 986*cdf0e10cSrcweir case SID_PARA_DLG: 987*cdf0e10cSrcweir bDisable |= m_aControlFeatures.empty(); 988*cdf0e10cSrcweir bNeedWriteableControl = true; 989*cdf0e10cSrcweir break; 990*cdf0e10cSrcweir 991*cdf0e10cSrcweir case SID_CUT: 992*cdf0e10cSrcweir bNeedSelection = true; 993*cdf0e10cSrcweir bNeedTextComponent = true; 994*cdf0e10cSrcweir bNeedWriteableControl = true; 995*cdf0e10cSrcweir DBG_TRACE( "FmTextControlShell::ClipBoard: need to invalidate again" ); 996*cdf0e10cSrcweir m_bNeedClipboardInvalidation = true; 997*cdf0e10cSrcweir break; 998*cdf0e10cSrcweir 999*cdf0e10cSrcweir case SID_PASTE: 1000*cdf0e10cSrcweir { 1001*cdf0e10cSrcweir Window* pActiveControlVCLWindow = lcl_getWindow( m_xActiveControl ); 1002*cdf0e10cSrcweir if ( pActiveControlVCLWindow ) 1003*cdf0e10cSrcweir { 1004*cdf0e10cSrcweir TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pActiveControlVCLWindow) ); 1005*cdf0e10cSrcweir bDisable |= !aDataHelper.HasFormat( SOT_FORMAT_STRING ); 1006*cdf0e10cSrcweir } 1007*cdf0e10cSrcweir else 1008*cdf0e10cSrcweir bDisable |= true; 1009*cdf0e10cSrcweir 1010*cdf0e10cSrcweir bNeedTextComponent = true; 1011*cdf0e10cSrcweir bNeedWriteableControl = true; 1012*cdf0e10cSrcweir } 1013*cdf0e10cSrcweir break; 1014*cdf0e10cSrcweir 1015*cdf0e10cSrcweir case SID_COPY: 1016*cdf0e10cSrcweir bNeedTextComponent = true; 1017*cdf0e10cSrcweir bNeedSelection = true; 1018*cdf0e10cSrcweir break; 1019*cdf0e10cSrcweir 1020*cdf0e10cSrcweir case SID_SELECTALL: 1021*cdf0e10cSrcweir bNeedTextComponent = true; 1022*cdf0e10cSrcweir break; 1023*cdf0e10cSrcweir 1024*cdf0e10cSrcweir default: 1025*cdf0e10cSrcweir // slot is unknown at all 1026*cdf0e10cSrcweir bDisable |= true; 1027*cdf0e10cSrcweir break; 1028*cdf0e10cSrcweir } 1029*cdf0e10cSrcweir OSL_POSTCOND( !bNeedSelection || bNeedTextComponent, "FmTextControlShell::GetTextAttributeState: bNeedSelection should imply bNeedTextComponent!" ); 1030*cdf0e10cSrcweir 1031*cdf0e10cSrcweir if ( !bDisable && bNeedWriteableControl ) 1032*cdf0e10cSrcweir bDisable |= !IsActiveControl( ) || m_bActiveControlIsReadOnly; 1033*cdf0e10cSrcweir 1034*cdf0e10cSrcweir if ( !bDisable && bNeedTextComponent ) 1035*cdf0e10cSrcweir bDisable |= !m_xActiveTextComponent.is(); 1036*cdf0e10cSrcweir 1037*cdf0e10cSrcweir if ( !bDisable && bNeedSelection ) 1038*cdf0e10cSrcweir { 1039*cdf0e10cSrcweir awt::Selection aSelection = m_xActiveTextComponent->getSelection(); 1040*cdf0e10cSrcweir bDisable |= aSelection.Min == aSelection.Max; 1041*cdf0e10cSrcweir } 1042*cdf0e10cSrcweir 1043*cdf0e10cSrcweir if ( bDisable ) 1044*cdf0e10cSrcweir _rSet.DisableItem( nSlot ); 1045*cdf0e10cSrcweir } 1046*cdf0e10cSrcweir 1047*cdf0e10cSrcweir nSlot = aIter.NextWhich(); 1048*cdf0e10cSrcweir } 1049*cdf0e10cSrcweir } 1050*cdf0e10cSrcweir 1051*cdf0e10cSrcweir //------------------------------------------------------------------------ 1052*cdf0e10cSrcweir bool FmTextControlShell::IsActiveControl( bool _bCountRichTextOnly ) const 1053*cdf0e10cSrcweir { 1054*cdf0e10cSrcweir if ( _bCountRichTextOnly && !m_bActiveControlIsRichText ) 1055*cdf0e10cSrcweir return false; 1056*cdf0e10cSrcweir 1057*cdf0e10cSrcweir return m_bActiveControl; 1058*cdf0e10cSrcweir } 1059*cdf0e10cSrcweir 1060*cdf0e10cSrcweir //------------------------------------------------------------------------ 1061*cdf0e10cSrcweir void FmTextControlShell::dispose() 1062*cdf0e10cSrcweir { 1063*cdf0e10cSrcweir if ( IsActiveControl() ) 1064*cdf0e10cSrcweir controlDeactivated(); 1065*cdf0e10cSrcweir if ( isControllerListening() ) 1066*cdf0e10cSrcweir stopControllerListening(); 1067*cdf0e10cSrcweir } 1068*cdf0e10cSrcweir 1069*cdf0e10cSrcweir //------------------------------------------------------------------------ 1070*cdf0e10cSrcweir void FmTextControlShell::designModeChanged( bool /*_bNewDesignMode*/ ) 1071*cdf0e10cSrcweir { 1072*cdf0e10cSrcweir m_rBindings.Invalidate( pTextControlSlots ); 1073*cdf0e10cSrcweir } 1074*cdf0e10cSrcweir 1075*cdf0e10cSrcweir //------------------------------------------------------------------------ 1076*cdf0e10cSrcweir void FmTextControlShell::formActivated( const Reference< XFormController >& _rxController ) 1077*cdf0e10cSrcweir { 1078*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1079*cdf0e10cSrcweir ::rtl::OString sTrace( "FmTextControlShell::formActivated: 0x" ); 1080*cdf0e10cSrcweir sTrace += ::rtl::OString::valueOf( (sal_IntPtr)_rxController.get(), 16 ); 1081*cdf0e10cSrcweir DBG_TRACE( sTrace ); 1082*cdf0e10cSrcweir #endif 1083*cdf0e10cSrcweir 1084*cdf0e10cSrcweir DBG_ASSERT( _rxController.is(), "FmTextControlShell::formActivated: invalid controller!" ); 1085*cdf0e10cSrcweir if ( !_rxController.is() ) 1086*cdf0e10cSrcweir return; 1087*cdf0e10cSrcweir 1088*cdf0e10cSrcweir // sometimes, a form controller notifies activations, even if it's already activated 1089*cdf0e10cSrcweir if ( m_xActiveController == _rxController ) 1090*cdf0e10cSrcweir return; 1091*cdf0e10cSrcweir 1092*cdf0e10cSrcweir try 1093*cdf0e10cSrcweir { 1094*cdf0e10cSrcweir startControllerListening( _rxController ); 1095*cdf0e10cSrcweir controlActivated( _rxController->getCurrentControl() ); 1096*cdf0e10cSrcweir } 1097*cdf0e10cSrcweir catch( const Exception& ) 1098*cdf0e10cSrcweir { 1099*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 1100*cdf0e10cSrcweir } 1101*cdf0e10cSrcweir } 1102*cdf0e10cSrcweir 1103*cdf0e10cSrcweir //------------------------------------------------------------------------ 1104*cdf0e10cSrcweir void FmTextControlShell::formDeactivated( const Reference< XFormController >& _rxController ) 1105*cdf0e10cSrcweir { 1106*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1107*cdf0e10cSrcweir ::rtl::OString sTrace( "FmTextControlShell::formDeactivated: 0x" ); 1108*cdf0e10cSrcweir sTrace += ::rtl::OString::valueOf( (sal_IntPtr)_rxController.get(), 16 ); 1109*cdf0e10cSrcweir DBG_TRACE( sTrace ); 1110*cdf0e10cSrcweir #endif 1111*cdf0e10cSrcweir (void)_rxController; 1112*cdf0e10cSrcweir 1113*cdf0e10cSrcweir if ( IsActiveControl() ) 1114*cdf0e10cSrcweir controlDeactivated(); 1115*cdf0e10cSrcweir if ( isControllerListening() ) 1116*cdf0e10cSrcweir stopControllerListening(); 1117*cdf0e10cSrcweir } 1118*cdf0e10cSrcweir 1119*cdf0e10cSrcweir //------------------------------------------------------------------------ 1120*cdf0e10cSrcweir void FmTextControlShell::startControllerListening( const Reference< XFormController >& _rxController ) 1121*cdf0e10cSrcweir { 1122*cdf0e10cSrcweir OSL_PRECOND( _rxController.is(), "FmTextControlShell::startControllerListening: invalid controller!" ); 1123*cdf0e10cSrcweir if ( !_rxController.is() ) 1124*cdf0e10cSrcweir return; 1125*cdf0e10cSrcweir 1126*cdf0e10cSrcweir OSL_PRECOND( !isControllerListening(), "FmTextControlShell::startControllerListening: already listening!" ); 1127*cdf0e10cSrcweir if ( isControllerListening() ) 1128*cdf0e10cSrcweir stopControllerListening( ); 1129*cdf0e10cSrcweir DBG_ASSERT( !isControllerListening(), "FmTextControlShell::startControllerListening: inconsistence!" ); 1130*cdf0e10cSrcweir 1131*cdf0e10cSrcweir try 1132*cdf0e10cSrcweir { 1133*cdf0e10cSrcweir Sequence< Reference< XControl > > aControls( _rxController->getControls() ); 1134*cdf0e10cSrcweir m_aControlObservers.resize( 0 ); 1135*cdf0e10cSrcweir m_aControlObservers.reserve( aControls.getLength() ); 1136*cdf0e10cSrcweir 1137*cdf0e10cSrcweir const Reference< XControl >* pControls = aControls.getConstArray(); 1138*cdf0e10cSrcweir const Reference< XControl >* pControlsEnd = pControls + aControls.getLength(); 1139*cdf0e10cSrcweir for ( ; pControls != pControlsEnd; ++pControls ) 1140*cdf0e10cSrcweir { 1141*cdf0e10cSrcweir m_aControlObservers.push_back( FocusListenerAdapter( new FmFocusListenerAdapter( *pControls, this ) ) ); 1142*cdf0e10cSrcweir } 1143*cdf0e10cSrcweir } 1144*cdf0e10cSrcweir catch( const Exception& ) 1145*cdf0e10cSrcweir { 1146*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 1147*cdf0e10cSrcweir } 1148*cdf0e10cSrcweir 1149*cdf0e10cSrcweir m_xActiveController = _rxController; 1150*cdf0e10cSrcweir } 1151*cdf0e10cSrcweir 1152*cdf0e10cSrcweir //------------------------------------------------------------------------ 1153*cdf0e10cSrcweir void FmTextControlShell::stopControllerListening( ) 1154*cdf0e10cSrcweir { 1155*cdf0e10cSrcweir OSL_PRECOND( isControllerListening(), "FmTextControlShell::stopControllerListening: inconsistence!" ); 1156*cdf0e10cSrcweir 1157*cdf0e10cSrcweir // dispose all listeners associated with the controls of the active controller 1158*cdf0e10cSrcweir for ( FocusListenerAdapters::iterator aLoop = m_aControlObservers.begin(); 1159*cdf0e10cSrcweir aLoop != m_aControlObservers.end(); 1160*cdf0e10cSrcweir ++aLoop 1161*cdf0e10cSrcweir ) 1162*cdf0e10cSrcweir { 1163*cdf0e10cSrcweir (*aLoop)->dispose(); 1164*cdf0e10cSrcweir } 1165*cdf0e10cSrcweir 1166*cdf0e10cSrcweir FocusListenerAdapters aEmpty; 1167*cdf0e10cSrcweir m_aControlObservers.swap( aEmpty ); 1168*cdf0e10cSrcweir 1169*cdf0e10cSrcweir m_xActiveController.clear(); 1170*cdf0e10cSrcweir } 1171*cdf0e10cSrcweir 1172*cdf0e10cSrcweir //------------------------------------------------------------------------ 1173*cdf0e10cSrcweir void FmTextControlShell::implClearActiveControlRef() 1174*cdf0e10cSrcweir { 1175*cdf0e10cSrcweir // no more features for this control 1176*cdf0e10cSrcweir for ( ControlFeatures::iterator aLoop = m_aControlFeatures.begin(); 1177*cdf0e10cSrcweir aLoop != m_aControlFeatures.end(); 1178*cdf0e10cSrcweir ++aLoop 1179*cdf0e10cSrcweir ) 1180*cdf0e10cSrcweir { 1181*cdf0e10cSrcweir aLoop->second->dispose(); 1182*cdf0e10cSrcweir } 1183*cdf0e10cSrcweir 1184*cdf0e10cSrcweir ControlFeatures aEmpty; 1185*cdf0e10cSrcweir m_aControlFeatures.swap( aEmpty ); 1186*cdf0e10cSrcweir 1187*cdf0e10cSrcweir if ( m_aContextMenuObserver.get() ) 1188*cdf0e10cSrcweir { 1189*cdf0e10cSrcweir m_aContextMenuObserver->dispose(); 1190*cdf0e10cSrcweir m_aContextMenuObserver = MouseListenerAdapter(); 1191*cdf0e10cSrcweir } 1192*cdf0e10cSrcweir 1193*cdf0e10cSrcweir if ( m_xActiveTextComponent.is() ) 1194*cdf0e10cSrcweir { 1195*cdf0e10cSrcweir DBG_TRACE( "FmTextControlShell::ClipBoard: stopping timer for clipboard invalidation" ); 1196*cdf0e10cSrcweir m_aClipboardInvalidation.Stop(); 1197*cdf0e10cSrcweir } 1198*cdf0e10cSrcweir // no more active control 1199*cdf0e10cSrcweir m_xActiveControl.clear(); 1200*cdf0e10cSrcweir m_xActiveTextComponent.clear(); 1201*cdf0e10cSrcweir m_bActiveControlIsReadOnly = true; 1202*cdf0e10cSrcweir m_bActiveControlIsRichText = false; 1203*cdf0e10cSrcweir m_bActiveControl = false; 1204*cdf0e10cSrcweir } 1205*cdf0e10cSrcweir 1206*cdf0e10cSrcweir //------------------------------------------------------------------------ 1207*cdf0e10cSrcweir void FmTextControlShell::controlDeactivated( ) 1208*cdf0e10cSrcweir { 1209*cdf0e10cSrcweir DBG_ASSERT( IsActiveControl(), "FmTextControlShell::controlDeactivated: no active control!" ); 1210*cdf0e10cSrcweir 1211*cdf0e10cSrcweir m_bActiveControl = false; 1212*cdf0e10cSrcweir 1213*cdf0e10cSrcweir m_rBindings.Invalidate( pTextControlSlots ); 1214*cdf0e10cSrcweir } 1215*cdf0e10cSrcweir 1216*cdf0e10cSrcweir //------------------------------------------------------------------------ 1217*cdf0e10cSrcweir void FmTextControlShell::controlActivated( const Reference< XControl >& _rxControl ) 1218*cdf0e10cSrcweir { 1219*cdf0e10cSrcweir // ensure that all knittings with the previously active control are lost 1220*cdf0e10cSrcweir if ( m_xActiveControl.is() ) 1221*cdf0e10cSrcweir implClearActiveControlRef(); 1222*cdf0e10cSrcweir DBG_ASSERT( m_aControlFeatures.empty(), "FmTextControlShell::controlActivated: should have no dispatchers when I'm here!" ); 1223*cdf0e10cSrcweir 1224*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1225*cdf0e10cSrcweir { 1226*cdf0e10cSrcweir Sequence< Reference< XControl > > aActiveControls; 1227*cdf0e10cSrcweir if ( m_xActiveController.is() ) 1228*cdf0e10cSrcweir aActiveControls = m_xActiveController->getControls(); 1229*cdf0e10cSrcweir 1230*cdf0e10cSrcweir bool bFoundThisControl = false; 1231*cdf0e10cSrcweir 1232*cdf0e10cSrcweir const Reference< XControl >* pControls = aActiveControls.getConstArray(); 1233*cdf0e10cSrcweir const Reference< XControl >* pControlsEnd = pControls + aActiveControls.getLength(); 1234*cdf0e10cSrcweir for ( ; ( pControls != pControlsEnd ) && !bFoundThisControl; ++pControls ) 1235*cdf0e10cSrcweir { 1236*cdf0e10cSrcweir if ( *pControls == _rxControl ) 1237*cdf0e10cSrcweir bFoundThisControl = true; 1238*cdf0e10cSrcweir } 1239*cdf0e10cSrcweir DBG_ASSERT( bFoundThisControl, "FmTextControlShell::controlActivated: only controls which belong to the active controller can be activated!" ); 1240*cdf0e10cSrcweir } 1241*cdf0e10cSrcweir #endif 1242*cdf0e10cSrcweir // ask the control for dispatchers for our text-related slots 1243*cdf0e10cSrcweir fillFeatureDispatchers( _rxControl, pTextControlSlots, m_aControlFeatures ); 1244*cdf0e10cSrcweir 1245*cdf0e10cSrcweir // remember this control 1246*cdf0e10cSrcweir m_xActiveControl = _rxControl; 1247*cdf0e10cSrcweir m_xActiveTextComponent = m_xActiveTextComponent.query( _rxControl ); 1248*cdf0e10cSrcweir m_bActiveControlIsReadOnly = lcl_determineReadOnly( m_xActiveControl ); 1249*cdf0e10cSrcweir m_bActiveControlIsRichText = lcl_isRichText( m_xActiveControl ); 1250*cdf0e10cSrcweir 1251*cdf0e10cSrcweir // if we found a rich text control, we need context menu support 1252*cdf0e10cSrcweir if ( m_bActiveControlIsRichText ) 1253*cdf0e10cSrcweir { 1254*cdf0e10cSrcweir DBG_ASSERT( NULL == m_aContextMenuObserver.get(), "FmTextControlShell::controlActivated: already have an observer!" ); 1255*cdf0e10cSrcweir m_aContextMenuObserver = MouseListenerAdapter( new FmMouseListenerAdapter( _rxControl, this ) ); 1256*cdf0e10cSrcweir } 1257*cdf0e10cSrcweir 1258*cdf0e10cSrcweir if ( m_xActiveTextComponent.is() ) 1259*cdf0e10cSrcweir { 1260*cdf0e10cSrcweir DBG_TRACE( "FmTextControlShell::ClipBoard: starting timer for clipboard invalidation" ); 1261*cdf0e10cSrcweir m_aClipboardInvalidation.Start(); 1262*cdf0e10cSrcweir } 1263*cdf0e10cSrcweir 1264*cdf0e10cSrcweir m_bActiveControl = true; 1265*cdf0e10cSrcweir 1266*cdf0e10cSrcweir m_rBindings.Invalidate( pTextControlSlots ); 1267*cdf0e10cSrcweir 1268*cdf0e10cSrcweir if ( m_pViewFrame ) 1269*cdf0e10cSrcweir m_pViewFrame->UIFeatureChanged(); 1270*cdf0e10cSrcweir 1271*cdf0e10cSrcweir // don't call the activation handler if we don't have any slots we can serve 1272*cdf0e10cSrcweir // The activation handler is used to put the shell on the top of the dispatcher stack, 1273*cdf0e10cSrcweir // so it's preferred when slots are distributed. 1274*cdf0e10cSrcweir // Note that this is a slight hack, to prevent that we grab slots from the SfxDispatcher 1275*cdf0e10cSrcweir // which should be served by other shells (e.g. Cut/Copy/Paste). 1276*cdf0e10cSrcweir // A real solution would be a forwarding-mechanism for slots: We should be on the top 1277*cdf0e10cSrcweir // if we're active, but if we cannot handle the slot, then we need to tell the dispatcher 1278*cdf0e10cSrcweir // to skip our shell, and pass the slot to the next one. However, this mechanism is not 1279*cdf0e10cSrcweir // not in place in SFX. 1280*cdf0e10cSrcweir // Another possibility would be to have dedicated shells for the slots which we might 1281*cdf0e10cSrcweir // or might not be able to serve. However, this could probably increase the number of 1282*cdf0e10cSrcweir // shells too much (In theory, nearly every slot could have an own shell then). 1283*cdf0e10cSrcweir // 1284*cdf0e10cSrcweir // #i51621# / 2005-08-19 / frank.schoenheit@sun.com 1285*cdf0e10cSrcweir bool bHaveAnyServeableSlots = m_xActiveTextComponent.is() || !m_aControlFeatures.empty(); 1286*cdf0e10cSrcweir if ( m_aControlActivationHandler.IsSet() && bHaveAnyServeableSlots ) 1287*cdf0e10cSrcweir m_aControlActivationHandler.Call( NULL ); 1288*cdf0e10cSrcweir 1289*cdf0e10cSrcweir m_bNeedClipboardInvalidation = true; 1290*cdf0e10cSrcweir } 1291*cdf0e10cSrcweir 1292*cdf0e10cSrcweir //------------------------------------------------------------------------ 1293*cdf0e10cSrcweir void FmTextControlShell::fillFeatureDispatchers( const Reference< XControl > _rxControl, SfxSlotId* _pZeroTerminatedSlots, 1294*cdf0e10cSrcweir ControlFeatures& _rDispatchers ) 1295*cdf0e10cSrcweir { 1296*cdf0e10cSrcweir Reference< XDispatchProvider > xProvider( _rxControl, UNO_QUERY ); 1297*cdf0e10cSrcweir SfxApplication* pApplication = SFX_APP(); 1298*cdf0e10cSrcweir DBG_ASSERT( pApplication, "FmTextControlShell::fillFeatureDispatchers: no SfxApplication!" ); 1299*cdf0e10cSrcweir if ( xProvider.is() && pApplication ) 1300*cdf0e10cSrcweir { 1301*cdf0e10cSrcweir SfxSlotId* pSlots = _pZeroTerminatedSlots; 1302*cdf0e10cSrcweir while ( *pSlots ) 1303*cdf0e10cSrcweir { 1304*cdf0e10cSrcweir FmTextControlFeature* pDispatcher = implGetFeatureDispatcher( xProvider, pApplication, *pSlots ); 1305*cdf0e10cSrcweir if ( pDispatcher ) 1306*cdf0e10cSrcweir _rDispatchers.insert( ControlFeatures::value_type( *pSlots, ControlFeature( pDispatcher ) ) ); 1307*cdf0e10cSrcweir 1308*cdf0e10cSrcweir ++pSlots; 1309*cdf0e10cSrcweir } 1310*cdf0e10cSrcweir } 1311*cdf0e10cSrcweir } 1312*cdf0e10cSrcweir 1313*cdf0e10cSrcweir //------------------------------------------------------------------------ 1314*cdf0e10cSrcweir void FmTextControlShell::impl_parseURL_nothrow( URL& _rURL ) 1315*cdf0e10cSrcweir { 1316*cdf0e10cSrcweir try 1317*cdf0e10cSrcweir { 1318*cdf0e10cSrcweir if ( !m_xURLTransformer.is() ) 1319*cdf0e10cSrcweir { 1320*cdf0e10cSrcweir ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); 1321*cdf0e10cSrcweir aContext.createComponent( "com.sun.star.util.URLTransformer", m_xURLTransformer ); 1322*cdf0e10cSrcweir } 1323*cdf0e10cSrcweir if ( m_xURLTransformer.is() ) 1324*cdf0e10cSrcweir m_xURLTransformer->parseStrict( _rURL ); 1325*cdf0e10cSrcweir } 1326*cdf0e10cSrcweir catch( const Exception& ) 1327*cdf0e10cSrcweir { 1328*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 1329*cdf0e10cSrcweir } 1330*cdf0e10cSrcweir } 1331*cdf0e10cSrcweir 1332*cdf0e10cSrcweir //------------------------------------------------------------------------ 1333*cdf0e10cSrcweir FmTextControlFeature* FmTextControlShell::implGetFeatureDispatcher( const Reference< XDispatchProvider >& _rxProvider, SfxApplication* _pApplication, SfxSlotId _nSlot ) 1334*cdf0e10cSrcweir { 1335*cdf0e10cSrcweir OSL_PRECOND( _rxProvider.is() && _pApplication, "FmTextControlShell::implGetFeatureDispatcher: invalid arg(s)!" ); 1336*cdf0e10cSrcweir URL aFeatureURL; 1337*cdf0e10cSrcweir aFeatureURL.Complete = lcl_getUnoSlotName( *_pApplication, _nSlot ); 1338*cdf0e10cSrcweir impl_parseURL_nothrow( aFeatureURL ); 1339*cdf0e10cSrcweir Reference< XDispatch > xDispatcher = _rxProvider->queryDispatch( aFeatureURL, ::rtl::OUString(), 0xFF ); 1340*cdf0e10cSrcweir if ( xDispatcher.is() ) 1341*cdf0e10cSrcweir return new FmTextControlFeature( xDispatcher, aFeatureURL, _nSlot, this ); 1342*cdf0e10cSrcweir return NULL; 1343*cdf0e10cSrcweir } 1344*cdf0e10cSrcweir 1345*cdf0e10cSrcweir //------------------------------------------------------------------------ 1346*cdf0e10cSrcweir void FmTextControlShell::Invalidate( SfxSlotId _nSlot ) 1347*cdf0e10cSrcweir { 1348*cdf0e10cSrcweir m_rBindings.Invalidate( _nSlot ); 1349*cdf0e10cSrcweir // despite this method being called "Invalidate", we also update here - this gives more immediate 1350*cdf0e10cSrcweir // feedback in the UI 1351*cdf0e10cSrcweir m_rBindings.Update( _nSlot ); 1352*cdf0e10cSrcweir } 1353*cdf0e10cSrcweir 1354*cdf0e10cSrcweir //------------------------------------------------------------------------ 1355*cdf0e10cSrcweir void FmTextControlShell::focusGained( const ::com::sun::star::awt::FocusEvent& _rEvent ) 1356*cdf0e10cSrcweir { 1357*cdf0e10cSrcweir Reference< XControl > xControl( _rEvent.Source, UNO_QUERY ); 1358*cdf0e10cSrcweir 1359*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1360*cdf0e10cSrcweir ::rtl::OString sTrace( "FmTextControlShell::focusGained: 0x" ); 1361*cdf0e10cSrcweir sTrace += ::rtl::OString::valueOf( (sal_IntPtr)xControl.get(), 16 ); 1362*cdf0e10cSrcweir DBG_TRACE( sTrace ); 1363*cdf0e10cSrcweir #endif 1364*cdf0e10cSrcweir 1365*cdf0e10cSrcweir DBG_ASSERT( xControl.is(), "FmTextControlShell::focusGained: suspicious focus event!" ); 1366*cdf0e10cSrcweir if ( xControl.is() ) 1367*cdf0e10cSrcweir controlActivated( xControl ); 1368*cdf0e10cSrcweir } 1369*cdf0e10cSrcweir 1370*cdf0e10cSrcweir //------------------------------------------------------------------------ 1371*cdf0e10cSrcweir void FmTextControlShell::focusLost( const ::com::sun::star::awt::FocusEvent& _rEvent ) 1372*cdf0e10cSrcweir { 1373*cdf0e10cSrcweir Reference< XControl > xControl( _rEvent.Source, UNO_QUERY ); 1374*cdf0e10cSrcweir 1375*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1376*cdf0e10cSrcweir ::rtl::OString sTrace( "FmTextControlShell::focusLost: 0x" ); 1377*cdf0e10cSrcweir sTrace += ::rtl::OString::valueOf( (sal_IntPtr)xControl.get(), 16 ); 1378*cdf0e10cSrcweir DBG_TRACE( sTrace ); 1379*cdf0e10cSrcweir #endif 1380*cdf0e10cSrcweir 1381*cdf0e10cSrcweir m_bActiveControl = false; 1382*cdf0e10cSrcweir } 1383*cdf0e10cSrcweir 1384*cdf0e10cSrcweir //------------------------------------------------------------------------ 1385*cdf0e10cSrcweir void FmTextControlShell::ForgetActiveControl() 1386*cdf0e10cSrcweir { 1387*cdf0e10cSrcweir implClearActiveControlRef(); 1388*cdf0e10cSrcweir } 1389*cdf0e10cSrcweir 1390*cdf0e10cSrcweir //------------------------------------------------------------------------ 1391*cdf0e10cSrcweir void FmTextControlShell::contextMenuRequested( const awt::MouseEvent& /*_rEvent*/ ) 1392*cdf0e10cSrcweir { 1393*cdf0e10cSrcweir m_rBindings.GetDispatcher()->ExecutePopup( SVX_RES( RID_FM_TEXTATTRIBUTE_MENU ) ); 1394*cdf0e10cSrcweir } 1395*cdf0e10cSrcweir 1396*cdf0e10cSrcweir //........................................................................ 1397*cdf0e10cSrcweir } // namespace svx 1398*cdf0e10cSrcweir //........................................................................ 1399