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