1cdf0e10cSrcweir /************************************************************************* 2cdf0e10cSrcweir * 3cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4cdf0e10cSrcweir * 5cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6cdf0e10cSrcweir * 7cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8cdf0e10cSrcweir * 9cdf0e10cSrcweir * This file is part of OpenOffice.org. 10cdf0e10cSrcweir * 11cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14cdf0e10cSrcweir * 15cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20cdf0e10cSrcweir * 21cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25cdf0e10cSrcweir * 26cdf0e10cSrcweir ************************************************************************/ 27cdf0e10cSrcweir 28cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29cdf0e10cSrcweir #include "precompiled_svx.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir // include --------------------------------------------------------------- 32cdf0e10cSrcweir 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include <string> // HACK: prevent conflict between STLPORT and Workshop headers 35cdf0e10cSrcweir #include <tools/shl.hxx> 36cdf0e10cSrcweir #include <svl/poolitem.hxx> 37cdf0e10cSrcweir #include <svl/eitem.hxx> 38cdf0e10cSrcweir #include <vcl/toolbox.hxx> 39cdf0e10cSrcweir #include <vcl/bmpacc.hxx> 40cdf0e10cSrcweir #include <svtools/valueset.hxx> 41cdf0e10cSrcweir #include <svtools/ctrlbox.hxx> 42cdf0e10cSrcweir #include <svl/style.hxx> 43cdf0e10cSrcweir #include <svtools/ctrltool.hxx> 44cdf0e10cSrcweir #include <svl/stritem.hxx> 45cdf0e10cSrcweir #include <unotools/pathoptions.hxx> 46cdf0e10cSrcweir #include <sfx2/tplpitem.hxx> 47cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 48cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 49cdf0e10cSrcweir #include <sfx2/objsh.hxx> 50cdf0e10cSrcweir #include <sfx2/docfac.hxx> 51cdf0e10cSrcweir #include <sfx2/templdlg.hxx> 52cdf0e10cSrcweir #include <svl/isethint.hxx> 53cdf0e10cSrcweir #include <sfx2/querystatus.hxx> 54cdf0e10cSrcweir #include <sfx2/sfxstatuslistener.hxx> 55cdf0e10cSrcweir #include <tools/urlobj.hxx> 56cdf0e10cSrcweir #include <sfx2/childwin.hxx> 57cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 58cdf0e10cSrcweir #include <unotools/fontoptions.hxx> 59cdf0e10cSrcweir #include <vcl/mnemonic.hxx> 60cdf0e10cSrcweir 61cdf0e10cSrcweir #include <vcl/svapp.hxx> 62cdf0e10cSrcweir #include <svl/smplhint.hxx> 63cdf0e10cSrcweir 64cdf0e10cSrcweir #define _SVX_TBCONTRL_CXX 65cdf0e10cSrcweir #include <svtools/colorcfg.hxx> 66cdf0e10cSrcweir #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> 67cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 68cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 69cdf0e10cSrcweir #include <com/sun/star/frame/status/ItemStatus.hpp> 70cdf0e10cSrcweir #include <com/sun/star/frame/status/FontHeight.hpp> 71cdf0e10cSrcweir 72cdf0e10cSrcweir #include <svx/dialogs.hrc> 73cdf0e10cSrcweir #include <svx/svxitems.hrc> 74cdf0e10cSrcweir #include "helpid.hrc" 75cdf0e10cSrcweir #include "svx/htmlmode.hxx" 76cdf0e10cSrcweir #include <svx/xtable.hxx> 77cdf0e10cSrcweir #include "editeng/fontitem.hxx" 78cdf0e10cSrcweir #include <editeng/fhgtitem.hxx> 79cdf0e10cSrcweir #include <editeng/brshitem.hxx> 80cdf0e10cSrcweir #include <editeng/boxitem.hxx> 81cdf0e10cSrcweir #include <editeng/colritem.hxx> 82cdf0e10cSrcweir #include "editeng/flstitem.hxx" 83cdf0e10cSrcweir #include "editeng/bolnitem.hxx" 84cdf0e10cSrcweir #include "svx/drawitem.hxx" 85cdf0e10cSrcweir #include <svx/tbcontrl.hxx> 86cdf0e10cSrcweir #include "svx/dlgutil.hxx" 87cdf0e10cSrcweir #include <svx/dialmgr.hxx> 88cdf0e10cSrcweir #include "colorwindow.hxx" 89cdf0e10cSrcweir #include <memory> 90cdf0e10cSrcweir 91cdf0e10cSrcweir #include <svx/tbxcolorupdate.hxx> 92cdf0e10cSrcweir #include <editeng/eerdll.hxx> 93cdf0e10cSrcweir #include <editeng/editrids.hrc> 94cdf0e10cSrcweir 95cdf0e10cSrcweir // ------------------------------------------------------------------------ 96cdf0e10cSrcweir 97cdf0e10cSrcweir #define MAX_MRU_FONTNAME_ENTRIES 5 98cdf0e10cSrcweir #define LOGICAL_EDIT_HEIGHT 12 99cdf0e10cSrcweir 100cdf0e10cSrcweir // STATIC DATA ----------------------------------------------------------- 101cdf0e10cSrcweir 102cdf0e10cSrcweir #ifndef DELETEZ 103cdf0e10cSrcweir #define DELETEZ(p) (delete (p), (p)=NULL) 104cdf0e10cSrcweir #endif 105cdf0e10cSrcweir // don't make more than 15 entries visible at once 106cdf0e10cSrcweir #define MAX_STYLES_ENTRIES static_cast< sal_uInt16 >( 15 ) 107cdf0e10cSrcweir 108cdf0e10cSrcweir void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet ); 109cdf0e10cSrcweir void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize ); 110cdf0e10cSrcweir sal_Bool lcl_FontChangedHint( const SfxHint &rHint ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir // namespaces 113cdf0e10cSrcweir using ::rtl::OUString; 114cdf0e10cSrcweir using namespace ::com::sun::star; 115cdf0e10cSrcweir using namespace ::com::sun::star::uno; 116cdf0e10cSrcweir using namespace ::com::sun::star::frame; 117cdf0e10cSrcweir using namespace ::com::sun::star::util; 118cdf0e10cSrcweir using namespace ::com::sun::star::beans; 119cdf0e10cSrcweir using namespace ::com::sun::star::lang; 120cdf0e10cSrcweir 121cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxStyleToolBoxControl, SfxTemplateItem ); 122cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFontNameToolBoxControl, SvxFontItem ); 123cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFontColorToolBoxControl, SvxColorItem ); 124cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFontColorExtToolBoxControl, SvxColorItem ); 125cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxColorToolBoxControl, SvxColorItem ); 126cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFrameToolBoxControl, SvxBoxItem ); 127cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFrameLineStyleToolBoxControl, SvxLineItem ); 128cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFrameLineColorToolBoxControl, SvxColorItem ); 129cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxReloadControllerItem, SfxBoolItem ); 130cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxSimpleUndoRedoController, SfxStringItem ); 131cdf0e10cSrcweir 132cdf0e10cSrcweir //======================================================================== 133cdf0e10cSrcweir // class SvxStyleBox_Impl ----------------------------------------------------- 134cdf0e10cSrcweir //======================================================================== 135cdf0e10cSrcweir 136cdf0e10cSrcweir 137cdf0e10cSrcweir class SvxStyleBox_Impl : public ComboBox 138cdf0e10cSrcweir { 139cdf0e10cSrcweir using Window::IsVisible; 140cdf0e10cSrcweir public: 141cdf0e10cSrcweir SvxStyleBox_Impl( Window* pParent, sal_uInt16 nSlot, const OUString& rCommand, SfxStyleFamily eFamily, const Reference< XDispatchProvider >& rDispatchProvider, 142cdf0e10cSrcweir const Reference< XFrame >& _xFrame,const String& rClearFormatKey, const String& rMoreKey, sal_Bool bInSpecialMode ); 143cdf0e10cSrcweir ~SvxStyleBox_Impl(); 144cdf0e10cSrcweir 145cdf0e10cSrcweir void SetFamily( SfxStyleFamily eNewFamily ); 146cdf0e10cSrcweir inline sal_Bool IsVisible() { return bVisible; } 147cdf0e10cSrcweir 148cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 149cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 150cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 151cdf0e10cSrcweir virtual void StateChanged( StateChangedType nStateChange ); 152cdf0e10cSrcweir 153cdf0e10cSrcweir inline void SetVisibilityListener( const Link& aVisListener ) { aVisibilityListener = aVisListener; } 154cdf0e10cSrcweir inline void RemoveVisibilityListener() { aVisibilityListener = Link(); } 155cdf0e10cSrcweir 156cdf0e10cSrcweir void SetDefaultStyle( const ::rtl::OUString& rDefault ) { sDefaultStyle = rDefault; } 157cdf0e10cSrcweir DECL_STATIC_LINK( SvxStyleBox_Impl, FocusHdl_Impl, Control* ); 158cdf0e10cSrcweir 159cdf0e10cSrcweir protected: 160cdf0e10cSrcweir virtual void Select(); 161cdf0e10cSrcweir 162cdf0e10cSrcweir private: 163cdf0e10cSrcweir sal_uInt16 nSlotId; 164cdf0e10cSrcweir SfxStyleFamily eStyleFamily; 165cdf0e10cSrcweir sal_uInt16 nCurSel; 166cdf0e10cSrcweir sal_Bool bRelease; 167cdf0e10cSrcweir Size aLogicalSize; 168cdf0e10cSrcweir Link aVisibilityListener; 169cdf0e10cSrcweir sal_Bool bVisible; 170cdf0e10cSrcweir Reference< XDispatchProvider > m_xDispatchProvider; 171cdf0e10cSrcweir Reference< XFrame > m_xFrame; 172cdf0e10cSrcweir OUString m_aCommand; 173cdf0e10cSrcweir String aClearFormatKey; 174cdf0e10cSrcweir String aMoreKey; 175cdf0e10cSrcweir String sDefaultStyle; 176cdf0e10cSrcweir sal_Bool bInSpecialMode; 177cdf0e10cSrcweir 178cdf0e10cSrcweir void ReleaseFocus(); 179cdf0e10cSrcweir }; 180cdf0e10cSrcweir 181cdf0e10cSrcweir //======================================================================== 182cdf0e10cSrcweir // class SvxFontNameBox -------------------------------------------------- 183cdf0e10cSrcweir //======================================================================== 184cdf0e10cSrcweir 185cdf0e10cSrcweir class SvxFontNameBox_Impl : public FontNameBox 186cdf0e10cSrcweir { 187cdf0e10cSrcweir using Window::Update; 188cdf0e10cSrcweir private: 189cdf0e10cSrcweir const FontList* pFontList; 190cdf0e10cSrcweir ::std::auto_ptr<FontList> m_aOwnFontList; 191cdf0e10cSrcweir Font aCurFont; 192cdf0e10cSrcweir Size aLogicalSize; 193cdf0e10cSrcweir String aCurText; 194cdf0e10cSrcweir sal_uInt16 nFtCount; 195cdf0e10cSrcweir sal_Bool bRelease; 196cdf0e10cSrcweir Reference< XDispatchProvider > m_xDispatchProvider; 197cdf0e10cSrcweir Reference< XFrame > m_xFrame; 198cdf0e10cSrcweir 199cdf0e10cSrcweir void ReleaseFocus_Impl(); 200cdf0e10cSrcweir void EnableControls_Impl(); 201cdf0e10cSrcweir 202cdf0e10cSrcweir protected: 203cdf0e10cSrcweir virtual void Select(); 204cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 205cdf0e10cSrcweir 206cdf0e10cSrcweir public: 207cdf0e10cSrcweir SvxFontNameBox_Impl( Window* pParent, const Reference< XDispatchProvider >& rDispatchProvider,const Reference< XFrame >& _xFrame 208cdf0e10cSrcweir , WinBits nStyle = WB_SORT 209cdf0e10cSrcweir ); 210cdf0e10cSrcweir 211cdf0e10cSrcweir void FillList(); 212cdf0e10cSrcweir void Update( const SvxFontItem* pFontItem ); 213cdf0e10cSrcweir sal_uInt16 GetListCount() { return nFtCount; } 214cdf0e10cSrcweir void Clear() { FontNameBox::Clear(); nFtCount = 0; } 215cdf0e10cSrcweir void Fill( const FontList* pList ) 216cdf0e10cSrcweir { FontNameBox::Fill( pList ); 217cdf0e10cSrcweir nFtCount = pList->GetFontNameCount(); } 218cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 219cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 220cdf0e10cSrcweir virtual Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); 221cdf0e10cSrcweir inline void SetOwnFontList(::std::auto_ptr<FontList> _aOwnFontList) { m_aOwnFontList = _aOwnFontList; } 222cdf0e10cSrcweir }; 223cdf0e10cSrcweir 224cdf0e10cSrcweir //======================================================================== 225cdf0e10cSrcweir // class SvxFrameWindow_Impl -------------------------------------------------- 226cdf0e10cSrcweir //======================================================================== 227cdf0e10cSrcweir 228cdf0e10cSrcweir // fuer den SelectHdl werden die Modifier gebraucht, also 229cdf0e10cSrcweir // muss man sie im MouseButtonUp besorgen 230cdf0e10cSrcweir 231cdf0e10cSrcweir class SvxFrmValueSet_Impl : public ValueSet 232cdf0e10cSrcweir { 233cdf0e10cSrcweir sal_uInt16 nModifier; 234cdf0e10cSrcweir virtual void MouseButtonUp( const MouseEvent& rMEvt ); 235cdf0e10cSrcweir public: 236cdf0e10cSrcweir SvxFrmValueSet_Impl(Window* pParent, WinBits nWinStyle) 237cdf0e10cSrcweir : ValueSet(pParent, nWinStyle), nModifier(0) {} 238cdf0e10cSrcweir sal_uInt16 GetModifier() const {return nModifier;} 239cdf0e10cSrcweir 240cdf0e10cSrcweir }; 241cdf0e10cSrcweir 242cdf0e10cSrcweir void SvxFrmValueSet_Impl::MouseButtonUp( const MouseEvent& rMEvt ) 243cdf0e10cSrcweir { 244cdf0e10cSrcweir nModifier = rMEvt.GetModifier(); 245cdf0e10cSrcweir ValueSet::MouseButtonUp(rMEvt); 246cdf0e10cSrcweir } 247cdf0e10cSrcweir 248cdf0e10cSrcweir class SvxFrameWindow_Impl : public SfxPopupWindow 249cdf0e10cSrcweir { 250cdf0e10cSrcweir using FloatingWindow::StateChanged; 251cdf0e10cSrcweir 252cdf0e10cSrcweir private: 253cdf0e10cSrcweir SvxFrmValueSet_Impl aFrameSet; 254cdf0e10cSrcweir ImageList aImgList; 255cdf0e10cSrcweir sal_Bool bParagraphMode; 256cdf0e10cSrcweir 257cdf0e10cSrcweir #if _SOLAR__PRIVATE 258cdf0e10cSrcweir DECL_LINK( SelectHdl, void * ); 259cdf0e10cSrcweir #endif 260cdf0e10cSrcweir 261cdf0e10cSrcweir protected: 262cdf0e10cSrcweir virtual void Resize(); 263cdf0e10cSrcweir virtual sal_Bool Close(); 264cdf0e10cSrcweir virtual Window* GetPreferredKeyInputWindow(); 265cdf0e10cSrcweir virtual void GetFocus(); 266cdf0e10cSrcweir 267cdf0e10cSrcweir public: 268cdf0e10cSrcweir SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow ); 269cdf0e10cSrcweir ~SvxFrameWindow_Impl(); 270cdf0e10cSrcweir void StartSelection(); 271cdf0e10cSrcweir 272cdf0e10cSrcweir virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, 273cdf0e10cSrcweir const SfxPoolItem* pState ); 274cdf0e10cSrcweir virtual SfxPopupWindow* Clone() const; 275cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 276cdf0e10cSrcweir 277cdf0e10cSrcweir inline sal_Bool IsHighContrast( void ) const; 278cdf0e10cSrcweir }; 279cdf0e10cSrcweir 280cdf0e10cSrcweir inline sal_Bool SvxFrameWindow_Impl::IsHighContrast( void ) const 281cdf0e10cSrcweir { 282cdf0e10cSrcweir return GetSettings().GetStyleSettings().GetHighContrastMode(); 283cdf0e10cSrcweir } 284cdf0e10cSrcweir 285cdf0e10cSrcweir //======================================================================== 286cdf0e10cSrcweir // class SvxLineWindow_Impl --------------------------------------------------- 287cdf0e10cSrcweir //======================================================================== 288cdf0e10cSrcweir class SvxLineWindow_Impl : public SfxPopupWindow 289cdf0e10cSrcweir { 290cdf0e10cSrcweir private: 291cdf0e10cSrcweir ValueSet aLineSet; 292cdf0e10cSrcweir bool m_bIsWriter; 293cdf0e10cSrcweir 294cdf0e10cSrcweir #if _SOLAR__PRIVATE 295cdf0e10cSrcweir void MakeLineBitmap( sal_uInt16 nNo, Bitmap& rBmp, const Size& rSize, String& rStr, 296cdf0e10cSrcweir const ::Color& rLine, const ::Color& rBack ); 297cdf0e10cSrcweir DECL_LINK( SelectHdl, void * ); 298cdf0e10cSrcweir #endif 299cdf0e10cSrcweir 300cdf0e10cSrcweir protected: 301cdf0e10cSrcweir virtual void Resize(); 302cdf0e10cSrcweir virtual sal_Bool Close(); 303cdf0e10cSrcweir virtual Window* GetPreferredKeyInputWindow(); 304cdf0e10cSrcweir virtual void GetFocus(); 305cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 306cdf0e10cSrcweir void CreateBitmaps( void ); 307cdf0e10cSrcweir public: 308cdf0e10cSrcweir SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow ); 309cdf0e10cSrcweir 310cdf0e10cSrcweir void StartSelection(); 311cdf0e10cSrcweir virtual SfxPopupWindow* Clone() const; 312cdf0e10cSrcweir }; 313cdf0e10cSrcweir 314cdf0e10cSrcweir //######################################################################## 315cdf0e10cSrcweir // Hilfsklassen: 316cdf0e10cSrcweir //======================================================================== 317cdf0e10cSrcweir // class SfxStyleControllerItem ------------------------------------------ 318cdf0e10cSrcweir //======================================================================== 319cdf0e10cSrcweir class SvxStyleToolBoxControl; 320cdf0e10cSrcweir 321cdf0e10cSrcweir class SfxStyleControllerItem_Impl : public SfxStatusListener 322cdf0e10cSrcweir { 323cdf0e10cSrcweir public: 324cdf0e10cSrcweir SfxStyleControllerItem_Impl( const Reference< XDispatchProvider >& rDispatchProvider, 325cdf0e10cSrcweir sal_uInt16 nSlotId, 326cdf0e10cSrcweir const rtl::OUString& rCommand, 327cdf0e10cSrcweir SvxStyleToolBoxControl& rTbxCtl ); 328cdf0e10cSrcweir 329cdf0e10cSrcweir protected: 330cdf0e10cSrcweir virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); 331cdf0e10cSrcweir 332cdf0e10cSrcweir private: 333cdf0e10cSrcweir SvxStyleToolBoxControl& rControl; 334cdf0e10cSrcweir }; 335cdf0e10cSrcweir 336cdf0e10cSrcweir //======================================================================== 337cdf0e10cSrcweir // class SvxStyleBox_Impl ----------------------------------------------------- 338cdf0e10cSrcweir //======================================================================== 339cdf0e10cSrcweir 340cdf0e10cSrcweir SvxStyleBox_Impl::SvxStyleBox_Impl( 341cdf0e10cSrcweir Window* pParent, 342cdf0e10cSrcweir sal_uInt16 nSlot, 343cdf0e10cSrcweir const rtl::OUString& rCommand, 344cdf0e10cSrcweir SfxStyleFamily eFamily, 345cdf0e10cSrcweir const Reference< XDispatchProvider >& rDispatchProvider, 346cdf0e10cSrcweir const Reference< XFrame >& _xFrame, 347cdf0e10cSrcweir const String& rClearFormatKey, 348cdf0e10cSrcweir const String& rMoreKey, 349cdf0e10cSrcweir sal_Bool bInSpec) : 350cdf0e10cSrcweir 351cdf0e10cSrcweir ComboBox( pParent, SVX_RES( RID_SVXTBX_STYLE ) ), 352cdf0e10cSrcweir 353cdf0e10cSrcweir nSlotId ( nSlot ), 354cdf0e10cSrcweir eStyleFamily( eFamily ), 355cdf0e10cSrcweir bRelease ( sal_True ), 356cdf0e10cSrcweir bVisible(sal_False), 357cdf0e10cSrcweir m_xDispatchProvider( rDispatchProvider ), 358cdf0e10cSrcweir m_xFrame(_xFrame), 359cdf0e10cSrcweir m_aCommand ( rCommand ), 360cdf0e10cSrcweir aClearFormatKey ( rClearFormatKey ), 361cdf0e10cSrcweir aMoreKey ( rMoreKey ), 362cdf0e10cSrcweir bInSpecialMode ( bInSpec ) 363cdf0e10cSrcweir { 364cdf0e10cSrcweir aLogicalSize = PixelToLogic( GetSizePixel(), MAP_APPFONT ); 365cdf0e10cSrcweir EnableAutocomplete( sal_True ); 366cdf0e10cSrcweir } 367cdf0e10cSrcweir 368cdf0e10cSrcweir SvxStyleBox_Impl::~SvxStyleBox_Impl() 369cdf0e10cSrcweir { 370cdf0e10cSrcweir } 371cdf0e10cSrcweir 372cdf0e10cSrcweir // ----------------------------------------------------------------------- 373cdf0e10cSrcweir 374cdf0e10cSrcweir void SvxStyleBox_Impl::ReleaseFocus() 375cdf0e10cSrcweir { 376cdf0e10cSrcweir if ( !bRelease ) 377cdf0e10cSrcweir { 378cdf0e10cSrcweir bRelease = sal_True; 379cdf0e10cSrcweir return; 380cdf0e10cSrcweir } 381cdf0e10cSrcweir if ( m_xFrame.is() && m_xFrame->getContainerWindow().is() ) 382cdf0e10cSrcweir m_xFrame->getContainerWindow()->setFocus(); 383cdf0e10cSrcweir } 384cdf0e10cSrcweir 385cdf0e10cSrcweir // ----------------------------------------------------------------------- 386cdf0e10cSrcweir 387cdf0e10cSrcweir void SvxStyleBox_Impl::Select() 388cdf0e10cSrcweir { 389cdf0e10cSrcweir // Tell base class about selection so that AT get informed about it. 390cdf0e10cSrcweir ComboBox::Select(); 391cdf0e10cSrcweir 392cdf0e10cSrcweir if ( !IsTravelSelect() ) 393cdf0e10cSrcweir { 394cdf0e10cSrcweir String aSelEntry( GetText() ); 395cdf0e10cSrcweir bool bDoIt = true, bClear = false; 396cdf0e10cSrcweir if( bInSpecialMode ) 397cdf0e10cSrcweir { 398cdf0e10cSrcweir if( aSelEntry == aClearFormatKey && GetSelectEntryPos() == 0 ) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir aSelEntry = sDefaultStyle; 401cdf0e10cSrcweir bClear = true; 402cdf0e10cSrcweir //not only apply default style but also call 'ClearFormatting' 403cdf0e10cSrcweir Sequence< PropertyValue > aEmptyVals; 404cdf0e10cSrcweir SfxToolBoxControl::Dispatch( m_xDispatchProvider, String::CreateFromAscii(".uno:ResetAttributes"), 405cdf0e10cSrcweir aEmptyVals); 406cdf0e10cSrcweir } 407cdf0e10cSrcweir else if( aSelEntry == aMoreKey && GetSelectEntryPos() == ( GetEntryCount() - 1 ) ) 408cdf0e10cSrcweir { 409cdf0e10cSrcweir SfxViewFrame* pViewFrm = SfxViewFrame::Current(); 410cdf0e10cSrcweir DBG_ASSERT( pViewFrm, "SvxStyleBox_Impl::Select(): no viewframe" ); 411cdf0e10cSrcweir pViewFrm->ShowChildWindow( SID_STYLE_DESIGNER ); 412cdf0e10cSrcweir SfxChildWindow* pChildWin = pViewFrm->GetChildWindow( SID_STYLE_DESIGNER ); 413cdf0e10cSrcweir if ( pChildWin && pChildWin->GetWindow() ) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir static_cast< SfxTemplateDialogWrapper* >( pChildWin )->SetParagraphFamily(); 416cdf0e10cSrcweir static_cast< SfxDockingWindow* >( pChildWin->GetWindow() )->AutoShow( sal_True ); 417cdf0e10cSrcweir Application::PostUserEvent( 418cdf0e10cSrcweir STATIC_LINK( 0, SvxStyleBox_Impl, FocusHdl_Impl ), pChildWin->GetWindow() ); 419cdf0e10cSrcweir } 420cdf0e10cSrcweir bDoIt = false; 421cdf0e10cSrcweir } 422cdf0e10cSrcweir } 423cdf0e10cSrcweir 424cdf0e10cSrcweir // #i36723# after ReleaseFocus() the new entry is included into the List 425cdf0e10cSrcweir sal_Bool bCreateNew = GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND; 426cdf0e10cSrcweir 427cdf0e10cSrcweir /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. 428cdf0e10cSrcweir This instance may be deleted in the meantime (i.e. when a dialog is opened 429cdf0e10cSrcweir while in Dispatch()), accessing members will crash in this case. */ 430cdf0e10cSrcweir ReleaseFocus(); 431cdf0e10cSrcweir 432cdf0e10cSrcweir if( bDoIt ) 433cdf0e10cSrcweir { 434cdf0e10cSrcweir if ( bClear ) 435cdf0e10cSrcweir SetText( aSelEntry ); 436cdf0e10cSrcweir SaveValue(); 437cdf0e10cSrcweir 438cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 2 ); 439cdf0e10cSrcweir aArgs[0].Value = makeAny( OUString( aSelEntry ) ); 440cdf0e10cSrcweir aArgs[1].Name = OUString::createFromAscii( "Family" ); 441cdf0e10cSrcweir aArgs[1].Value = makeAny( sal_Int16( eStyleFamily )); 442cdf0e10cSrcweir if( bCreateNew ) 443cdf0e10cSrcweir { 444cdf0e10cSrcweir aArgs[0].Name = OUString::createFromAscii( "Param" ); 445cdf0e10cSrcweir SfxToolBoxControl::Dispatch( m_xDispatchProvider, String::CreateFromAscii(".uno:StyleNewByExample"), aArgs); 446cdf0e10cSrcweir } 447cdf0e10cSrcweir else 448cdf0e10cSrcweir { 449cdf0e10cSrcweir aArgs[0].Name = OUString::createFromAscii( "Template" ); 450cdf0e10cSrcweir SfxToolBoxControl::Dispatch( m_xDispatchProvider, m_aCommand, aArgs ); 451cdf0e10cSrcweir } 452cdf0e10cSrcweir } 453cdf0e10cSrcweir } 454cdf0e10cSrcweir } 455cdf0e10cSrcweir // ----------------------------------------------------------------------- 456cdf0e10cSrcweir 457cdf0e10cSrcweir void SvxStyleBox_Impl::SetFamily( SfxStyleFamily eNewFamily ) 458cdf0e10cSrcweir { 459cdf0e10cSrcweir eStyleFamily = eNewFamily; 460cdf0e10cSrcweir } 461cdf0e10cSrcweir 462cdf0e10cSrcweir // ----------------------------------------------------------------------- 463cdf0e10cSrcweir 464cdf0e10cSrcweir long SvxStyleBox_Impl::PreNotify( NotifyEvent& rNEvt ) 465cdf0e10cSrcweir { 466cdf0e10cSrcweir sal_uInt16 nType = rNEvt.GetType(); 467cdf0e10cSrcweir 468cdf0e10cSrcweir if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType ) 469cdf0e10cSrcweir nCurSel = GetSelectEntryPos(); 470cdf0e10cSrcweir else if ( EVENT_LOSEFOCUS == nType ) 471cdf0e10cSrcweir { 472cdf0e10cSrcweir // don't handle before our Select() is called 473cdf0e10cSrcweir if ( !HasFocus() && !HasChildPathFocus() ) 474cdf0e10cSrcweir SetText( GetSavedValue() ); 475cdf0e10cSrcweir } 476cdf0e10cSrcweir return ComboBox::PreNotify( rNEvt ); 477cdf0e10cSrcweir } 478cdf0e10cSrcweir 479cdf0e10cSrcweir // ----------------------------------------------------------------------- 480cdf0e10cSrcweir 481cdf0e10cSrcweir long SvxStyleBox_Impl::Notify( NotifyEvent& rNEvt ) 482cdf0e10cSrcweir { 483cdf0e10cSrcweir long nHandled = 0; 484cdf0e10cSrcweir 485cdf0e10cSrcweir if ( rNEvt.GetType() == EVENT_KEYINPUT ) 486cdf0e10cSrcweir { 487cdf0e10cSrcweir sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); 488cdf0e10cSrcweir 489cdf0e10cSrcweir switch ( nCode ) 490cdf0e10cSrcweir { 491cdf0e10cSrcweir case KEY_RETURN: 492cdf0e10cSrcweir case KEY_TAB: 493cdf0e10cSrcweir { 494cdf0e10cSrcweir if ( KEY_TAB == nCode ) 495cdf0e10cSrcweir bRelease = sal_False; 496cdf0e10cSrcweir else 497cdf0e10cSrcweir nHandled = 1; 498cdf0e10cSrcweir Select(); 499cdf0e10cSrcweir break; 500cdf0e10cSrcweir } 501cdf0e10cSrcweir 502cdf0e10cSrcweir case KEY_ESCAPE: 503cdf0e10cSrcweir SelectEntryPos( nCurSel ); 504cdf0e10cSrcweir ReleaseFocus(); 505cdf0e10cSrcweir nHandled = 1; 506cdf0e10cSrcweir break; 507cdf0e10cSrcweir } 508cdf0e10cSrcweir } 509cdf0e10cSrcweir return nHandled ? nHandled : ComboBox::Notify( rNEvt ); 510cdf0e10cSrcweir } 511cdf0e10cSrcweir /* -----------------------------08.03.2002 13:03------------------------------ 512cdf0e10cSrcweir 513cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 514cdf0e10cSrcweir void SvxStyleBox_Impl::DataChanged( const DataChangedEvent& rDCEvt ) 515cdf0e10cSrcweir { 516cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 517cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 518cdf0e10cSrcweir { 519cdf0e10cSrcweir SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT)); 520cdf0e10cSrcweir Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT); 521cdf0e10cSrcweir SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT)); 522cdf0e10cSrcweir } 523cdf0e10cSrcweir 524cdf0e10cSrcweir ComboBox::DataChanged( rDCEvt ); 525cdf0e10cSrcweir } 526cdf0e10cSrcweir 527cdf0e10cSrcweir void SvxStyleBox_Impl::StateChanged( StateChangedType nStateChange ) 528cdf0e10cSrcweir { 529cdf0e10cSrcweir ComboBox::StateChanged( nStateChange ); 530cdf0e10cSrcweir 531cdf0e10cSrcweir if ( nStateChange == STATE_CHANGE_VISIBLE ) 532cdf0e10cSrcweir { 533cdf0e10cSrcweir bVisible = IsReallyVisible(); 534cdf0e10cSrcweir if ( aVisibilityListener.IsSet() ) 535cdf0e10cSrcweir aVisibilityListener.Call( this ); 536cdf0e10cSrcweir } 537cdf0e10cSrcweir else if ( nStateChange == STATE_CHANGE_INITSHOW ) 538cdf0e10cSrcweir { 539cdf0e10cSrcweir bVisible = sal_True; 540cdf0e10cSrcweir if ( aVisibilityListener.IsSet() ) 541cdf0e10cSrcweir aVisibilityListener.Call( this ); 542cdf0e10cSrcweir } 543cdf0e10cSrcweir } 544cdf0e10cSrcweir 545cdf0e10cSrcweir //-------------------------------------------------------------------- 546cdf0e10cSrcweir 547cdf0e10cSrcweir IMPL_STATIC_LINK( SvxStyleBox_Impl, FocusHdl_Impl, Control*, _pCtrl ) 548cdf0e10cSrcweir { 549cdf0e10cSrcweir (void)pThis; 550cdf0e10cSrcweir if ( _pCtrl ) 551cdf0e10cSrcweir _pCtrl->GrabFocus(); 552cdf0e10cSrcweir return 0; 553cdf0e10cSrcweir } 554cdf0e10cSrcweir 555cdf0e10cSrcweir // ----------------------------------------------------------------------- 556cdf0e10cSrcweir 557cdf0e10cSrcweir sal_Bool GetDocFontList_Impl( const FontList** ppFontList, SvxFontNameBox_Impl* pBox ) 558cdf0e10cSrcweir { 559cdf0e10cSrcweir sal_Bool bChanged = sal_False; 560cdf0e10cSrcweir const SfxObjectShell* pDocSh = SfxObjectShell::Current(); 561cdf0e10cSrcweir SvxFontListItem* pFontListItem = NULL; 562cdf0e10cSrcweir 563cdf0e10cSrcweir if ( pDocSh ) 564cdf0e10cSrcweir pFontListItem = 565cdf0e10cSrcweir (SvxFontListItem*)pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); 566cdf0e10cSrcweir else 567cdf0e10cSrcweir { 568cdf0e10cSrcweir ::std::auto_ptr<FontList> aFontList(new FontList( pBox )); 569cdf0e10cSrcweir *ppFontList = aFontList.get(); 570cdf0e10cSrcweir pBox->SetOwnFontList(aFontList); 571cdf0e10cSrcweir bChanged = sal_True; 572cdf0e10cSrcweir } 573cdf0e10cSrcweir 574cdf0e10cSrcweir if ( pFontListItem ) 575cdf0e10cSrcweir { 576cdf0e10cSrcweir const FontList* pNewFontList = pFontListItem->GetFontList(); 577cdf0e10cSrcweir DBG_ASSERT( pNewFontList, "Doc-FontList not available!" ); 578cdf0e10cSrcweir 579cdf0e10cSrcweir // keine alte Liste, aber neue Liste 580cdf0e10cSrcweir if ( !*ppFontList && pNewFontList ) 581cdf0e10cSrcweir { 582cdf0e10cSrcweir // => "ubernehmen 583cdf0e10cSrcweir *ppFontList = pNewFontList; 584cdf0e10cSrcweir bChanged = sal_True; 585cdf0e10cSrcweir } 586cdf0e10cSrcweir else 587cdf0e10cSrcweir { 588cdf0e10cSrcweir // Vergleich der Fontlisten ist nicht vollkommen 589cdf0e10cSrcweir // wird die Fontliste am Doc geaendert, kann man hier 590cdf0e10cSrcweir // nur ueber die Listbox Aenderungen feststellen, weil 591cdf0e10cSrcweir // ppFontList dabei schon upgedatet wurde 592cdf0e10cSrcweir bChanged = 593cdf0e10cSrcweir ( ( *ppFontList != pNewFontList ) || 594cdf0e10cSrcweir pBox->GetListCount() != pNewFontList->GetFontNameCount() ); 595cdf0e10cSrcweir HACK(vergleich ist unvollstaendig) 596cdf0e10cSrcweir 597cdf0e10cSrcweir if ( bChanged ) 598cdf0e10cSrcweir *ppFontList = pNewFontList; 599cdf0e10cSrcweir } 600cdf0e10cSrcweir 601cdf0e10cSrcweir if ( pBox ) 602cdf0e10cSrcweir pBox->Enable(); 603cdf0e10cSrcweir } 604cdf0e10cSrcweir else if ( pBox && ( pDocSh || ( !pDocSh && !ppFontList ))) 605cdf0e10cSrcweir { 606cdf0e10cSrcweir // Disable box only when we have a SfxObjectShell and didn't get a font list OR 607cdf0e10cSrcweir // we don't have a SfxObjectShell and no current font list. 608cdf0e10cSrcweir // It's possible that we currently have no SfxObjectShell, but a current font list. 609cdf0e10cSrcweir // See #i58471: When a user set the focus into the font name combo box and opens 610cdf0e10cSrcweir // the help window with F1. After closing the help window, we disable the font name 611cdf0e10cSrcweir // combo box. The SfxObjectShell::Current() method returns in that case zero. But the 612cdf0e10cSrcweir // font list hasn't changed and therefore the combo box shouldn't be disabled! 613cdf0e10cSrcweir pBox->Disable(); 614cdf0e10cSrcweir } 615cdf0e10cSrcweir 616cdf0e10cSrcweir // in die FontBox ggf. auch die neue Liste f"ullen 617cdf0e10cSrcweir if ( pBox && bChanged ) 618cdf0e10cSrcweir { 619cdf0e10cSrcweir if ( *ppFontList ) 620cdf0e10cSrcweir pBox->Fill( *ppFontList ); 621cdf0e10cSrcweir else 622cdf0e10cSrcweir pBox->Clear(); 623cdf0e10cSrcweir } 624cdf0e10cSrcweir return bChanged; 625cdf0e10cSrcweir } 626cdf0e10cSrcweir 627cdf0e10cSrcweir //======================================================================== 628cdf0e10cSrcweir // class SvxFontNameBox_Impl -------------------------------------------------- 629cdf0e10cSrcweir //======================================================================== 630cdf0e10cSrcweir 631cdf0e10cSrcweir SvxFontNameBox_Impl::SvxFontNameBox_Impl( Window* pParent, const Reference< XDispatchProvider >& rDispatchProvider,const Reference< XFrame >& _xFrame, WinBits nStyle ) : 632cdf0e10cSrcweir 633cdf0e10cSrcweir FontNameBox ( pParent, nStyle | WinBits( WB_DROPDOWN | WB_AUTOHSCROLL ) ), 634cdf0e10cSrcweir pFontList ( NULL ), 635cdf0e10cSrcweir aLogicalSize ( 75,160 ), 636cdf0e10cSrcweir nFtCount ( 0 ), 637cdf0e10cSrcweir bRelease ( sal_True ), 638cdf0e10cSrcweir m_xDispatchProvider( rDispatchProvider ), 639cdf0e10cSrcweir m_xFrame (_xFrame) 640cdf0e10cSrcweir { 641cdf0e10cSrcweir SetSizePixel(LogicToPixel( aLogicalSize, MAP_APPFONT )); 642cdf0e10cSrcweir EnableControls_Impl(); 643cdf0e10cSrcweir } 644cdf0e10cSrcweir // ----------------------------------------------------------------------- 645cdf0e10cSrcweir 646cdf0e10cSrcweir void SvxFontNameBox_Impl::FillList() 647cdf0e10cSrcweir { 648cdf0e10cSrcweir // alte Selektion merken, und am Ende wieder setzen 649cdf0e10cSrcweir Selection aOldSel = GetSelection(); 650cdf0e10cSrcweir // hat sich Doc-Fontlist geaendert? 651cdf0e10cSrcweir GetDocFontList_Impl( &pFontList, this ); 652cdf0e10cSrcweir aCurText = GetText(); 653cdf0e10cSrcweir SetSelection( aOldSel ); 654cdf0e10cSrcweir } 655cdf0e10cSrcweir 656cdf0e10cSrcweir // ----------------------------------------------------------------------- 657cdf0e10cSrcweir 658cdf0e10cSrcweir void SvxFontNameBox_Impl::Update( const SvxFontItem* pFontItem ) 659cdf0e10cSrcweir { 660cdf0e10cSrcweir if ( pFontItem ) 661cdf0e10cSrcweir { 662cdf0e10cSrcweir aCurFont.SetName ( pFontItem->GetFamilyName() ); 663cdf0e10cSrcweir aCurFont.SetFamily ( pFontItem->GetFamily() ); 664cdf0e10cSrcweir aCurFont.SetStyleName ( pFontItem->GetStyleName() ); 665cdf0e10cSrcweir aCurFont.SetPitch ( pFontItem->GetPitch() ); 666cdf0e10cSrcweir aCurFont.SetCharSet ( pFontItem->GetCharSet() ); 667cdf0e10cSrcweir } 668cdf0e10cSrcweir String aCurName = aCurFont.GetName(); 669cdf0e10cSrcweir if ( GetText() != aCurName ) 670cdf0e10cSrcweir SetText( aCurName ); 671cdf0e10cSrcweir } 672cdf0e10cSrcweir 673cdf0e10cSrcweir // ----------------------------------------------------------------------- 674cdf0e10cSrcweir 675cdf0e10cSrcweir long SvxFontNameBox_Impl::PreNotify( NotifyEvent& rNEvt ) 676cdf0e10cSrcweir { 677cdf0e10cSrcweir sal_uInt16 nType = rNEvt.GetType(); 678cdf0e10cSrcweir 679cdf0e10cSrcweir if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType ) 680cdf0e10cSrcweir { 681cdf0e10cSrcweir EnableControls_Impl(); 682cdf0e10cSrcweir FillList(); 683cdf0e10cSrcweir } 684cdf0e10cSrcweir return FontNameBox::PreNotify( rNEvt ); 685cdf0e10cSrcweir } 686cdf0e10cSrcweir 687cdf0e10cSrcweir // ----------------------------------------------------------------------- 688cdf0e10cSrcweir 689cdf0e10cSrcweir long SvxFontNameBox_Impl::Notify( NotifyEvent& rNEvt ) 690cdf0e10cSrcweir { 691cdf0e10cSrcweir long nHandled = 0; 692cdf0e10cSrcweir 693cdf0e10cSrcweir if ( rNEvt.GetType() == EVENT_KEYINPUT ) 694cdf0e10cSrcweir { 695cdf0e10cSrcweir sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); 696cdf0e10cSrcweir 697cdf0e10cSrcweir switch ( nCode ) 698cdf0e10cSrcweir { 699cdf0e10cSrcweir case KEY_RETURN: 700cdf0e10cSrcweir case KEY_TAB: 701cdf0e10cSrcweir { 702cdf0e10cSrcweir if ( KEY_TAB == nCode ) 703cdf0e10cSrcweir bRelease = sal_False; 704cdf0e10cSrcweir else 705cdf0e10cSrcweir nHandled = 1; 706cdf0e10cSrcweir Select(); 707cdf0e10cSrcweir break; 708cdf0e10cSrcweir } 709cdf0e10cSrcweir 710cdf0e10cSrcweir case KEY_ESCAPE: 711cdf0e10cSrcweir SetText( aCurText ); 712cdf0e10cSrcweir ReleaseFocus_Impl(); 713cdf0e10cSrcweir break; 714cdf0e10cSrcweir } 715cdf0e10cSrcweir } 716cdf0e10cSrcweir else if ( EVENT_LOSEFOCUS == rNEvt.GetType() ) 717cdf0e10cSrcweir { 718cdf0e10cSrcweir Window* pFocusWin = Application::GetFocusWindow(); 719cdf0e10cSrcweir if ( !HasFocus() && GetSubEdit() != pFocusWin ) 720cdf0e10cSrcweir SetText( GetSavedValue() ); 721cdf0e10cSrcweir } 722cdf0e10cSrcweir 723cdf0e10cSrcweir return nHandled ? nHandled : FontNameBox::Notify( rNEvt ); 724cdf0e10cSrcweir } 725cdf0e10cSrcweir 726cdf0e10cSrcweir // --------------------------------------------------------------------------- 727cdf0e10cSrcweir void SvxFontNameBox_Impl::DataChanged( const DataChangedEvent& rDCEvt ) 728cdf0e10cSrcweir { 729cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 730cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 731cdf0e10cSrcweir { 732cdf0e10cSrcweir SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT)); 733cdf0e10cSrcweir Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT); 734cdf0e10cSrcweir SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT)); 735cdf0e10cSrcweir } 736cdf0e10cSrcweir 737cdf0e10cSrcweir FontNameBox::DataChanged( rDCEvt ); 738cdf0e10cSrcweir } 739cdf0e10cSrcweir 740cdf0e10cSrcweir // ----------------------------------------------------------------------- 741cdf0e10cSrcweir 742cdf0e10cSrcweir void SvxFontNameBox_Impl::ReleaseFocus_Impl() 743cdf0e10cSrcweir { 744cdf0e10cSrcweir if ( !bRelease ) 745cdf0e10cSrcweir { 746cdf0e10cSrcweir bRelease = sal_True; 747cdf0e10cSrcweir return; 748cdf0e10cSrcweir } 749cdf0e10cSrcweir if ( m_xFrame.is() && m_xFrame->getContainerWindow().is() ) 750cdf0e10cSrcweir m_xFrame->getContainerWindow()->setFocus(); 751cdf0e10cSrcweir } 752cdf0e10cSrcweir 753cdf0e10cSrcweir // ----------------------------------------------------------------------- 754cdf0e10cSrcweir 755cdf0e10cSrcweir void SvxFontNameBox_Impl::EnableControls_Impl() 756cdf0e10cSrcweir { 757cdf0e10cSrcweir SvtFontOptions aFontOpt; 758cdf0e10cSrcweir sal_Bool bEnable = aFontOpt.IsFontHistoryEnabled(); 759cdf0e10cSrcweir sal_uInt16 nEntries = bEnable ? MAX_MRU_FONTNAME_ENTRIES : 0; 760cdf0e10cSrcweir if ( GetMaxMRUCount() != nEntries ) 761cdf0e10cSrcweir { 762cdf0e10cSrcweir // refill in the next GetFocus-Handler 763cdf0e10cSrcweir pFontList = NULL; 764cdf0e10cSrcweir Clear(); 765cdf0e10cSrcweir SetMaxMRUCount( nEntries ); 766cdf0e10cSrcweir } 767cdf0e10cSrcweir 768cdf0e10cSrcweir bEnable = aFontOpt.IsFontWYSIWYGEnabled(); 769cdf0e10cSrcweir EnableWYSIWYG( bEnable ); 770cdf0e10cSrcweir EnableSymbols( bEnable ); 771cdf0e10cSrcweir } 772cdf0e10cSrcweir 773cdf0e10cSrcweir // ----------------------------------------------------------------------- 774cdf0e10cSrcweir 775cdf0e10cSrcweir void SvxFontNameBox_Impl::Select() 776cdf0e10cSrcweir { 777cdf0e10cSrcweir FontNameBox::Select(); 778cdf0e10cSrcweir 779cdf0e10cSrcweir if ( !IsTravelSelect() ) 780cdf0e10cSrcweir { 781cdf0e10cSrcweir if ( pFontList ) 782cdf0e10cSrcweir { 783cdf0e10cSrcweir FontInfo aInfo( pFontList->Get( GetText(), 784cdf0e10cSrcweir aCurFont.GetWeight(), 785cdf0e10cSrcweir aCurFont.GetItalic() ) ); 786cdf0e10cSrcweir aCurFont = aInfo; 787cdf0e10cSrcweir 788cdf0e10cSrcweir SvxFontItem aFontItem( aInfo.GetFamily(), 789cdf0e10cSrcweir aInfo.GetName(), 790cdf0e10cSrcweir aInfo.GetStyleName(), 791cdf0e10cSrcweir aInfo.GetPitch(), 792cdf0e10cSrcweir aInfo.GetCharSet(), 793cdf0e10cSrcweir SID_ATTR_CHAR_FONT ); 794cdf0e10cSrcweir 795cdf0e10cSrcweir Any a; 796cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 ); 797cdf0e10cSrcweir aArgs[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" )); 798cdf0e10cSrcweir aFontItem.QueryValue( a ); 799cdf0e10cSrcweir aArgs[0].Value = a; 800cdf0e10cSrcweir 801cdf0e10cSrcweir // #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. 802cdf0e10cSrcweir // This instance may be deleted in the meantime (i.e. when a dialog is opened 803cdf0e10cSrcweir // while in Dispatch()), accessing members will crash in this case. 804cdf0e10cSrcweir ReleaseFocus_Impl(); 805cdf0e10cSrcweir 806cdf0e10cSrcweir SfxToolBoxControl::Dispatch( m_xDispatchProvider, 807cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharFontName" )), 808cdf0e10cSrcweir aArgs ); 809cdf0e10cSrcweir } 810cdf0e10cSrcweir else 811cdf0e10cSrcweir ReleaseFocus_Impl(); 812cdf0e10cSrcweir } 813cdf0e10cSrcweir } 814cdf0e10cSrcweir 815cdf0e10cSrcweir //======================================================================== 816cdf0e10cSrcweir // class SvxColorWindow_Impl -------------------------------------------------- 817cdf0e10cSrcweir //======================================================================== 818cdf0e10cSrcweir #ifndef WB_NO_DIRECTSELECT 819cdf0e10cSrcweir #define WB_NO_DIRECTSELECT ((WinBits)0x04000000) 820cdf0e10cSrcweir #endif 821cdf0e10cSrcweir 822cdf0e10cSrcweir #define PALETTE_X 10 823cdf0e10cSrcweir #define PALETTE_Y 11 824cdf0e10cSrcweir #define PALETTE_SIZE (PALETTE_X * PALETTE_Y) 825cdf0e10cSrcweir 826cdf0e10cSrcweir SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, 827cdf0e10cSrcweir sal_uInt16 nSlotId, 828cdf0e10cSrcweir const Reference< XFrame >& rFrame, 829cdf0e10cSrcweir const String& rWndTitle, 830cdf0e10cSrcweir Window* pParentWindow ) : 831cdf0e10cSrcweir 832cdf0e10cSrcweir SfxPopupWindow( nSlotId, rFrame, pParentWindow, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK|WB_DIALOGCONTROL ) ), 833cdf0e10cSrcweir 834cdf0e10cSrcweir theSlotId( nSlotId ), 835cdf0e10cSrcweir aColorSet( this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) ), 836cdf0e10cSrcweir maCommand( rCommand ) 837cdf0e10cSrcweir 838cdf0e10cSrcweir { 839cdf0e10cSrcweir SfxObjectShell* pDocSh = SfxObjectShell::Current(); 840cdf0e10cSrcweir const SfxPoolItem* pItem = NULL; 841cdf0e10cSrcweir XColorTable* pColorTable = NULL; 842cdf0e10cSrcweir sal_Bool bKillTable = sal_False; 843cdf0e10cSrcweir const Size aSize12( 13, 13 ); 844cdf0e10cSrcweir 845cdf0e10cSrcweir if ( pDocSh ) 846cdf0e10cSrcweir if ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) 847cdf0e10cSrcweir pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); 848cdf0e10cSrcweir 849cdf0e10cSrcweir if ( !pColorTable ) 850cdf0e10cSrcweir { 851cdf0e10cSrcweir pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); 852cdf0e10cSrcweir bKillTable = sal_True; 853cdf0e10cSrcweir } 854cdf0e10cSrcweir 855cdf0e10cSrcweir if ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId ) 856cdf0e10cSrcweir { 857cdf0e10cSrcweir aColorSet.SetStyle( aColorSet.GetStyle() | WB_NONEFIELD ); 858cdf0e10cSrcweir aColorSet.SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) ); 859cdf0e10cSrcweir aColorSet.SetAccessibleName( SVX_RESSTR( RID_SVXSTR_BACKGROUND ) ); 860cdf0e10cSrcweir } 861cdf0e10cSrcweir else if ( SID_ATTR_CHAR_COLOR == theSlotId || SID_ATTR_CHAR_COLOR2 == theSlotId || SID_EXTRUSION_3D_COLOR == theSlotId ) 862cdf0e10cSrcweir { 863cdf0e10cSrcweir SfxPoolItem* pDummy; 864cdf0e10cSrcweir 865cdf0e10cSrcweir Reference< XDispatchProvider > aDisp( GetFrame()->getController(), UNO_QUERY ); 866cdf0e10cSrcweir SfxQueryStatus aQueryStatus( aDisp, 867cdf0e10cSrcweir SID_ATTR_AUTO_COLOR_INVALID, 868cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoColorInvalid" ))); 869cdf0e10cSrcweir SfxItemState eState = aQueryStatus.QueryState( pDummy ); 870cdf0e10cSrcweir if( (SFX_ITEM_DEFAULT > eState) || ( SID_EXTRUSION_3D_COLOR == theSlotId ) ) 871cdf0e10cSrcweir { 872cdf0e10cSrcweir aColorSet.SetStyle( aColorSet.GetStyle() | WB_NONEFIELD ); 873cdf0e10cSrcweir aColorSet.SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) ); 874cdf0e10cSrcweir aColorSet.SetAccessibleName( SVX_RESSTR( RID_SVXSTR_TEXTCOLOR ) ); 875cdf0e10cSrcweir } 876cdf0e10cSrcweir } 877cdf0e10cSrcweir else 878cdf0e10cSrcweir { 879cdf0e10cSrcweir aColorSet.SetAccessibleName( SVX_RESSTR( RID_SVXSTR_FRAME_COLOR ) ); 880cdf0e10cSrcweir } 881cdf0e10cSrcweir 882cdf0e10cSrcweir if ( pColorTable ) 883cdf0e10cSrcweir { 884cdf0e10cSrcweir short i = 0; 885cdf0e10cSrcweir long nCount = pColorTable->Count(); 886cdf0e10cSrcweir XColorEntry* pEntry = NULL; 887cdf0e10cSrcweir ::Color aColWhite( COL_WHITE ); 888cdf0e10cSrcweir String aStrWhite( EditResId(RID_SVXITEMS_COLOR_WHITE) ); 889cdf0e10cSrcweir 890cdf0e10cSrcweir if ( nCount > PALETTE_SIZE ) 891cdf0e10cSrcweir // Show scrollbar if more than PALLETTE_SIZE colors are available 892cdf0e10cSrcweir aColorSet.SetStyle( aColorSet.GetStyle() | WB_VSCROLL ); 893cdf0e10cSrcweir 894cdf0e10cSrcweir for ( i = 0; i < nCount; i++ ) 895cdf0e10cSrcweir { 896cdf0e10cSrcweir pEntry = pColorTable->GetColor(i); 897cdf0e10cSrcweir aColorSet.InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() ); 898cdf0e10cSrcweir } 899cdf0e10cSrcweir 900cdf0e10cSrcweir while ( i < PALETTE_SIZE ) 901cdf0e10cSrcweir { 902cdf0e10cSrcweir // fill empty elements if less then PALLETTE_SIZE colors are available 903cdf0e10cSrcweir aColorSet.InsertItem( i+1, aColWhite, aStrWhite ); 904cdf0e10cSrcweir i++; 905cdf0e10cSrcweir } 906cdf0e10cSrcweir } 907cdf0e10cSrcweir 908cdf0e10cSrcweir aColorSet.SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectHdl ) ); 909cdf0e10cSrcweir aColorSet.SetColCount( PALETTE_X ); 910cdf0e10cSrcweir aColorSet.SetLineCount( PALETTE_Y ); 911cdf0e10cSrcweir 912cdf0e10cSrcweir lcl_CalcSizeValueSet( *this, aColorSet, aSize12 ); 913cdf0e10cSrcweir 914cdf0e10cSrcweir SetHelpId( HID_POPUP_COLOR ); 915cdf0e10cSrcweir aColorSet.SetHelpId( HID_POPUP_COLOR_CTRL ); 916cdf0e10cSrcweir 917cdf0e10cSrcweir SetText( rWndTitle ); 918cdf0e10cSrcweir aColorSet.Show(); 919cdf0e10cSrcweir 920cdf0e10cSrcweir AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColorTableState" ))); 921cdf0e10cSrcweir if ( bKillTable ) 922cdf0e10cSrcweir delete pColorTable; 923cdf0e10cSrcweir } 924cdf0e10cSrcweir 925cdf0e10cSrcweir SvxColorWindow_Impl::~SvxColorWindow_Impl() 926cdf0e10cSrcweir { 927cdf0e10cSrcweir } 928cdf0e10cSrcweir 929cdf0e10cSrcweir void SvxColorWindow_Impl::KeyInput( const KeyEvent& rKEvt ) 930cdf0e10cSrcweir { 931cdf0e10cSrcweir aColorSet.KeyInput(rKEvt); 932cdf0e10cSrcweir } 933cdf0e10cSrcweir 934cdf0e10cSrcweir SfxPopupWindow* SvxColorWindow_Impl::Clone() const 935cdf0e10cSrcweir { 936cdf0e10cSrcweir return new SvxColorWindow_Impl( maCommand, theSlotId, GetFrame(), GetText(), GetParent() ); 937cdf0e10cSrcweir } 938cdf0e10cSrcweir 939cdf0e10cSrcweir // ----------------------------------------------------------------------- 940cdf0e10cSrcweir 941cdf0e10cSrcweir IMPL_LINK( SvxColorWindow_Impl, SelectHdl, void *, EMPTYARG ) 942cdf0e10cSrcweir { 943cdf0e10cSrcweir sal_uInt16 nItemId = aColorSet.GetSelectItemId(); 944cdf0e10cSrcweir SvxColorItem aColorItem( aColorSet.GetItemColor( nItemId ), theSlotId ); 945cdf0e10cSrcweir 946cdf0e10cSrcweir /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() calls. 947cdf0e10cSrcweir This instance may be deleted in the meantime (i.e. when a dialog is opened 948cdf0e10cSrcweir while in Dispatch()), accessing members will crash in this case. */ 949cdf0e10cSrcweir aColorSet.SetNoSelection(); 950cdf0e10cSrcweir 951cdf0e10cSrcweir if ( IsInPopupMode() ) 952cdf0e10cSrcweir EndPopupMode(); 953cdf0e10cSrcweir 954cdf0e10cSrcweir if ( !nItemId && ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId ) ) 955cdf0e10cSrcweir { 956cdf0e10cSrcweir Sequence< PropertyValue > aArgs; 957cdf0e10cSrcweir SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ), 958cdf0e10cSrcweir maCommand, 959cdf0e10cSrcweir aArgs ); 960cdf0e10cSrcweir } 961cdf0e10cSrcweir else if ( !nItemId && (SID_ATTR_CHAR_COLOR == theSlotId || SID_ATTR_CHAR_COLOR2 == theSlotId || SID_EXTRUSION_3D_COLOR == theSlotId) ) 962cdf0e10cSrcweir { 963cdf0e10cSrcweir SvxColorItem _aColorItem( COL_AUTO, theSlotId ); 964cdf0e10cSrcweir INetURLObject aObj( maCommand ); 965cdf0e10cSrcweir 966cdf0e10cSrcweir Any a; 967cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 ); 968cdf0e10cSrcweir aArgs[0].Name = aObj.GetURLPath(); 969cdf0e10cSrcweir _aColorItem.QueryValue( a ); 970cdf0e10cSrcweir aArgs[0].Value = a; 971cdf0e10cSrcweir SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ), 972cdf0e10cSrcweir maCommand, 973cdf0e10cSrcweir aArgs ); 974cdf0e10cSrcweir } 975cdf0e10cSrcweir else 976cdf0e10cSrcweir { 977cdf0e10cSrcweir INetURLObject aObj( maCommand ); 978cdf0e10cSrcweir 979cdf0e10cSrcweir Any a; 980cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 ); 981cdf0e10cSrcweir aArgs[0].Name = aObj.GetURLPath(); 982cdf0e10cSrcweir aColorItem.QueryValue( a ); 983cdf0e10cSrcweir aArgs[0].Value = a; 984cdf0e10cSrcweir SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ), 985cdf0e10cSrcweir maCommand, 986cdf0e10cSrcweir aArgs ); 987cdf0e10cSrcweir } 988cdf0e10cSrcweir 989cdf0e10cSrcweir return 0; 990cdf0e10cSrcweir } 991cdf0e10cSrcweir 992cdf0e10cSrcweir // ----------------------------------------------------------------------- 993cdf0e10cSrcweir 994cdf0e10cSrcweir void SvxColorWindow_Impl::Resize() 995cdf0e10cSrcweir { 996cdf0e10cSrcweir lcl_ResizeValueSet( *this, aColorSet); 997cdf0e10cSrcweir } 998cdf0e10cSrcweir 999cdf0e10cSrcweir // ----------------------------------------------------------------------- 1000cdf0e10cSrcweir 1001cdf0e10cSrcweir void SvxColorWindow_Impl::StartSelection() 1002cdf0e10cSrcweir { 1003cdf0e10cSrcweir aColorSet.StartSelection(); 1004cdf0e10cSrcweir } 1005cdf0e10cSrcweir 1006cdf0e10cSrcweir // ----------------------------------------------------------------------- 1007cdf0e10cSrcweir 1008cdf0e10cSrcweir sal_Bool SvxColorWindow_Impl::Close() 1009cdf0e10cSrcweir { 1010cdf0e10cSrcweir return SfxPopupWindow::Close(); 1011cdf0e10cSrcweir } 1012cdf0e10cSrcweir 1013cdf0e10cSrcweir // ----------------------------------------------------------------------- 1014cdf0e10cSrcweir 1015cdf0e10cSrcweir void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1016cdf0e10cSrcweir { 1017cdf0e10cSrcweir if (( SFX_ITEM_DISABLED != eState ) && pState ) 1018cdf0e10cSrcweir { 1019cdf0e10cSrcweir if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorTableItem ))) 1020cdf0e10cSrcweir { 1021cdf0e10cSrcweir XColorTable* pColorTable = pState ? ((SvxColorTableItem *)pState)->GetColorTable() : NULL; 1022cdf0e10cSrcweir 1023cdf0e10cSrcweir if ( pColorTable ) 1024cdf0e10cSrcweir { 1025cdf0e10cSrcweir // Die Liste der Farben (ColorTable) hat sich ge"andert: 1026cdf0e10cSrcweir short i = 0; 1027cdf0e10cSrcweir long nCount = pColorTable->Count(); 1028cdf0e10cSrcweir XColorEntry* pEntry = NULL; 1029cdf0e10cSrcweir ::Color aColWhite( COL_WHITE ); 1030cdf0e10cSrcweir String aStrWhite( SVX_RES( RID_SVXITEMS_COLOR_WHITE ) ); 1031cdf0e10cSrcweir 1032cdf0e10cSrcweir // ScrollBar an oder aus 1033cdf0e10cSrcweir WinBits nBits = aColorSet.GetStyle(); 1034cdf0e10cSrcweir if ( nCount > PALETTE_SIZE ) 1035cdf0e10cSrcweir nBits &= ~WB_VSCROLL; 1036cdf0e10cSrcweir else 1037cdf0e10cSrcweir nBits |= WB_VSCROLL; 1038cdf0e10cSrcweir aColorSet.SetStyle( nBits ); 1039cdf0e10cSrcweir 1040cdf0e10cSrcweir for ( i = 0; i < nCount; ++i ) 1041cdf0e10cSrcweir { 1042cdf0e10cSrcweir pEntry = pColorTable->GetColor(i); 1043cdf0e10cSrcweir aColorSet.SetItemColor( i + 1, pEntry->GetColor() ); 1044cdf0e10cSrcweir aColorSet.SetItemText ( i + 1, pEntry->GetName() ); 1045cdf0e10cSrcweir } 1046cdf0e10cSrcweir 1047cdf0e10cSrcweir while ( i < PALETTE_SIZE ) 1048cdf0e10cSrcweir { 1049cdf0e10cSrcweir aColorSet.SetItemColor( i + 1, aColWhite ); 1050cdf0e10cSrcweir aColorSet.SetItemText ( i + 1, aStrWhite ); 1051cdf0e10cSrcweir i++; 1052cdf0e10cSrcweir } 1053cdf0e10cSrcweir } 1054cdf0e10cSrcweir } 1055cdf0e10cSrcweir } 1056cdf0e10cSrcweir } 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir //======================================================================== 1059cdf0e10cSrcweir // class SvxFrameWindow_Impl -------------------------------------------------- 1060cdf0e10cSrcweir //======================================================================== 1061cdf0e10cSrcweir 1062cdf0e10cSrcweir SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow ) : 1063cdf0e10cSrcweir 1064cdf0e10cSrcweir SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK | WB_DIALOGCONTROL ) ), 1065cdf0e10cSrcweir aFrameSet ( this, WinBits( WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ), 1066cdf0e10cSrcweir bParagraphMode(sal_False) 1067cdf0e10cSrcweir 1068cdf0e10cSrcweir { 1069cdf0e10cSrcweir BindListener(); 1070cdf0e10cSrcweir String sCommand(String::CreateFromAscii( ".uno:BorderReducedMode" )); 1071cdf0e10cSrcweir AddStatusListener( sCommand ); 1072cdf0e10cSrcweir aImgList = ImageList( SVX_RES( IsHighContrast()? RID_SVXIL_FRAME_HC : RID_SVXIL_FRAME ) ); 1073cdf0e10cSrcweir 1074cdf0e10cSrcweir /* 1075cdf0e10cSrcweir * 1 2 3 4 1076cdf0e10cSrcweir * ------------------------------------- 1077cdf0e10cSrcweir * NONE LEFT RIGHT LEFTRIGHT 1078cdf0e10cSrcweir * TOP BOTTOM TOPBOTTOM OUTER 1079cdf0e10cSrcweir * ------------------------------------- 1080cdf0e10cSrcweir * HOR HORINNER VERINNER ALL <- kann ueber bParagraphMode 1081cdf0e10cSrcweir * abgeschaltet werden 1082cdf0e10cSrcweir */ 1083cdf0e10cSrcweir 1084cdf0e10cSrcweir sal_uInt16 i = 0; 1085cdf0e10cSrcweir 1086cdf0e10cSrcweir for ( i=1; i<9; i++ ) 1087cdf0e10cSrcweir aFrameSet.InsertItem( i, aImgList.GetImage(i) ); 1088cdf0e10cSrcweir 1089cdf0e10cSrcweir //bParagraphMode should have been set in StateChanged 1090cdf0e10cSrcweir if ( !bParagraphMode ) 1091cdf0e10cSrcweir for ( i = 9; i < 13; i++ ) 1092cdf0e10cSrcweir aFrameSet.InsertItem( i, aImgList.GetImage(i) ); 1093cdf0e10cSrcweir 1094cdf0e10cSrcweir aFrameSet.SetColCount( 4 ); 1095cdf0e10cSrcweir aFrameSet.SetSelectHdl( LINK( this, SvxFrameWindow_Impl, SelectHdl ) ); 1096cdf0e10cSrcweir 1097cdf0e10cSrcweir lcl_CalcSizeValueSet( *this, aFrameSet,Size( 20, 20 )); 1098cdf0e10cSrcweir 1099cdf0e10cSrcweir SetHelpId( HID_POPUP_FRAME ); 1100cdf0e10cSrcweir SetText( SVX_RESSTR(RID_SVXSTR_FRAME) ); 1101cdf0e10cSrcweir aFrameSet.SetAccessibleName( SVX_RESSTR(RID_SVXSTR_FRAME) ); 1102cdf0e10cSrcweir aFrameSet.Show(); 1103cdf0e10cSrcweir } 1104cdf0e10cSrcweir /*-- 22.09.2004 12:27:50--------------------------------------------------- 1105cdf0e10cSrcweir 1106cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1107cdf0e10cSrcweir SvxFrameWindow_Impl::~SvxFrameWindow_Impl() 1108cdf0e10cSrcweir { 1109cdf0e10cSrcweir UnbindListener(); 1110cdf0e10cSrcweir } 1111cdf0e10cSrcweir 1112cdf0e10cSrcweir SfxPopupWindow* SvxFrameWindow_Impl::Clone() const 1113cdf0e10cSrcweir { 1114cdf0e10cSrcweir //! HACK: wie bekomme ich den Paragraph-Mode ?? 1115cdf0e10cSrcweir return new SvxFrameWindow_Impl( GetId(), GetFrame(), GetParent() ); 1116cdf0e10cSrcweir } 1117cdf0e10cSrcweir 1118cdf0e10cSrcweir Window* SvxFrameWindow_Impl::GetPreferredKeyInputWindow() 1119cdf0e10cSrcweir { 1120cdf0e10cSrcweir return &aFrameSet; 1121cdf0e10cSrcweir } 1122cdf0e10cSrcweir 1123cdf0e10cSrcweir void SvxFrameWindow_Impl::GetFocus() 1124cdf0e10cSrcweir { 1125cdf0e10cSrcweir aFrameSet.GrabFocus(); 1126cdf0e10cSrcweir } 1127cdf0e10cSrcweir 1128cdf0e10cSrcweir void SvxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) 1129cdf0e10cSrcweir { 1130cdf0e10cSrcweir SfxPopupWindow::DataChanged( rDCEvt ); 1131cdf0e10cSrcweir 1132cdf0e10cSrcweir if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) 1133cdf0e10cSrcweir { 1134cdf0e10cSrcweir aImgList = ImageList( SVX_RES( IsHighContrast()? RID_SVXIL_FRAME_HC : RID_SVXIL_FRAME ) ); 1135cdf0e10cSrcweir 1136cdf0e10cSrcweir sal_uInt16 nNumOfItems = aFrameSet.GetItemCount(); 1137cdf0e10cSrcweir 1138cdf0e10cSrcweir for( sal_uInt16 i = 1 ; i <= nNumOfItems ; ++i ) 1139cdf0e10cSrcweir aFrameSet.SetItemImage( i, aImgList.GetImage( i ) ); 1140cdf0e10cSrcweir } 1141cdf0e10cSrcweir } 1142cdf0e10cSrcweir // ----------------------------------------------------------------------- 1143cdf0e10cSrcweir 1144cdf0e10cSrcweir #define FRM_VALID_LEFT 0x01 1145cdf0e10cSrcweir #define FRM_VALID_RIGHT 0x02 1146cdf0e10cSrcweir #define FRM_VALID_TOP 0x04 1147cdf0e10cSrcweir #define FRM_VALID_BOTTOM 0x08 1148cdf0e10cSrcweir #define FRM_VALID_HINNER 0x10 1149cdf0e10cSrcweir #define FRM_VALID_VINNER 0x20 1150cdf0e10cSrcweir #define FRM_VALID_OUTER 0x0f 1151cdf0e10cSrcweir #define FRM_VALID_ALL 0xff 1152cdf0e10cSrcweir 1153cdf0e10cSrcweir // 1154cdf0e10cSrcweir // Per default bleiben ungesetzte Linien unveraendert 1155cdf0e10cSrcweir // Mit Shift werden ungesetzte Linien zurueckgsetzt 1156cdf0e10cSrcweir // 1157cdf0e10cSrcweir IMPL_LINK( SvxFrameWindow_Impl, SelectHdl, void *, EMPTYARG ) 1158cdf0e10cSrcweir { 1159cdf0e10cSrcweir ::Color aColBlack( COL_BLACK ); 1160cdf0e10cSrcweir SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER ); 1161cdf0e10cSrcweir SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER ); 1162cdf0e10cSrcweir SvxBorderLine theDefLine; 1163cdf0e10cSrcweir SvxBorderLine *pLeft = 0, 1164cdf0e10cSrcweir *pRight = 0, 1165cdf0e10cSrcweir *pTop = 0, 1166cdf0e10cSrcweir *pBottom = 0; 1167cdf0e10cSrcweir sal_uInt16 nSel = aFrameSet.GetSelectItemId(); 1168cdf0e10cSrcweir sal_uInt16 nModifier = aFrameSet.GetModifier(); 1169cdf0e10cSrcweir sal_uInt8 nValidFlags = 0; 1170cdf0e10cSrcweir 1171cdf0e10cSrcweir theDefLine.SetOutWidth( DEF_LINE_WIDTH_0 ); 1172cdf0e10cSrcweir switch ( nSel ) 1173cdf0e10cSrcweir { 1174cdf0e10cSrcweir case 1: nValidFlags |= FRM_VALID_ALL; 1175cdf0e10cSrcweir break; // NONE 1176cdf0e10cSrcweir case 2: pLeft = &theDefLine; 1177cdf0e10cSrcweir nValidFlags |= FRM_VALID_LEFT; 1178cdf0e10cSrcweir break; // LEFT 1179cdf0e10cSrcweir case 3: pRight = &theDefLine; 1180cdf0e10cSrcweir nValidFlags |= FRM_VALID_RIGHT; 1181cdf0e10cSrcweir break; // RIGHT 1182cdf0e10cSrcweir case 4: pLeft = pRight = &theDefLine; 1183cdf0e10cSrcweir nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT; 1184cdf0e10cSrcweir break; // LEFTRIGHT 1185cdf0e10cSrcweir case 5: pTop = &theDefLine; 1186cdf0e10cSrcweir nValidFlags |= FRM_VALID_TOP; 1187cdf0e10cSrcweir break; // TOP 1188cdf0e10cSrcweir case 6: pBottom = &theDefLine; 1189cdf0e10cSrcweir nValidFlags |= FRM_VALID_BOTTOM; 1190cdf0e10cSrcweir break; // BOTTOM 1191cdf0e10cSrcweir case 7: pTop = pBottom = &theDefLine; 1192cdf0e10cSrcweir nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP; 1193cdf0e10cSrcweir break; // TOPBOTTOM 1194cdf0e10cSrcweir case 8: pLeft = pRight = pTop = pBottom = &theDefLine; 1195cdf0e10cSrcweir nValidFlags |= FRM_VALID_OUTER; 1196cdf0e10cSrcweir break; // OUTER 1197cdf0e10cSrcweir 1198cdf0e10cSrcweir // Tabelle innen: 1199cdf0e10cSrcweir case 9: // HOR 1200cdf0e10cSrcweir pTop = pBottom = &theDefLine; 1201cdf0e10cSrcweir aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI ); 1202cdf0e10cSrcweir aBorderInner.SetLine( NULL, BOXINFO_LINE_VERT ); 1203cdf0e10cSrcweir nValidFlags |= FRM_VALID_HINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM; 1204cdf0e10cSrcweir break; 1205cdf0e10cSrcweir 1206cdf0e10cSrcweir case 10: // HORINNER 1207cdf0e10cSrcweir pLeft = pRight = pTop = pBottom = &theDefLine; 1208cdf0e10cSrcweir aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI ); 1209cdf0e10cSrcweir aBorderInner.SetLine( NULL, BOXINFO_LINE_VERT ); 1210cdf0e10cSrcweir nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT|FRM_VALID_HINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM; 1211cdf0e10cSrcweir break; 1212cdf0e10cSrcweir 1213cdf0e10cSrcweir case 11: // VERINNER 1214cdf0e10cSrcweir pLeft = pRight = pTop = pBottom = &theDefLine; 1215cdf0e10cSrcweir aBorderInner.SetLine( NULL, BOXINFO_LINE_HORI ); 1216cdf0e10cSrcweir aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT ); 1217cdf0e10cSrcweir nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT|FRM_VALID_VINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM; 1218cdf0e10cSrcweir break; 1219cdf0e10cSrcweir 1220cdf0e10cSrcweir case 12: // ALL 1221cdf0e10cSrcweir pLeft = pRight = pTop = pBottom = &theDefLine; 1222cdf0e10cSrcweir aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI ); 1223cdf0e10cSrcweir aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT ); 1224cdf0e10cSrcweir nValidFlags |= FRM_VALID_ALL; 1225cdf0e10cSrcweir break; 1226cdf0e10cSrcweir 1227cdf0e10cSrcweir default: 1228cdf0e10cSrcweir break; 1229cdf0e10cSrcweir } 1230cdf0e10cSrcweir aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT ); 1231cdf0e10cSrcweir aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT ); 1232cdf0e10cSrcweir aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); 1233cdf0e10cSrcweir aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); 1234cdf0e10cSrcweir 1235cdf0e10cSrcweir if(nModifier == KEY_SHIFT) 1236cdf0e10cSrcweir nValidFlags |= FRM_VALID_ALL; 1237cdf0e10cSrcweir aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); 1238cdf0e10cSrcweir aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); 1239cdf0e10cSrcweir aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT)); 1240cdf0e10cSrcweir aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); 1241cdf0e10cSrcweir aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); 1242cdf0e10cSrcweir aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); 1243cdf0e10cSrcweir aBorderInner.SetValid( VALID_DISTANCE, sal_True ); 1244cdf0e10cSrcweir aBorderInner.SetValid( VALID_DISABLE, sal_False ); 1245cdf0e10cSrcweir 1246cdf0e10cSrcweir if ( IsInPopupMode() ) 1247cdf0e10cSrcweir EndPopupMode(); 1248cdf0e10cSrcweir 1249cdf0e10cSrcweir Any a; 1250cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 2 ); 1251cdf0e10cSrcweir aArgs[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OuterBorder" )); 1252cdf0e10cSrcweir aBorderOuter.QueryValue( a ); 1253cdf0e10cSrcweir aArgs[0].Value = a; 1254cdf0e10cSrcweir aArgs[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "InnerBorder" )); 1255cdf0e10cSrcweir aBorderInner.QueryValue( a ); 1256cdf0e10cSrcweir aArgs[1].Value = a; 1257cdf0e10cSrcweir 1258cdf0e10cSrcweir /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. 1259cdf0e10cSrcweir This instance may be deleted in the meantime (i.e. when a dialog is opened 1260cdf0e10cSrcweir while in Dispatch()), accessing members will crash in this case. */ 1261cdf0e10cSrcweir aFrameSet.SetNoSelection(); 1262cdf0e10cSrcweir 1263cdf0e10cSrcweir SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ), 1264cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SetBorderStyle" )), 1265cdf0e10cSrcweir aArgs ); 1266cdf0e10cSrcweir return 0; 1267cdf0e10cSrcweir } 1268cdf0e10cSrcweir 1269cdf0e10cSrcweir // ----------------------------------------------------------------------- 1270cdf0e10cSrcweir 1271cdf0e10cSrcweir void SvxFrameWindow_Impl::Resize() 1272cdf0e10cSrcweir { 1273cdf0e10cSrcweir lcl_ResizeValueSet( *this, aFrameSet); 1274cdf0e10cSrcweir } 1275cdf0e10cSrcweir 1276cdf0e10cSrcweir // ----------------------------------------------------------------------- 1277cdf0e10cSrcweir 1278cdf0e10cSrcweir void SvxFrameWindow_Impl::StateChanged( 1279cdf0e10cSrcweir 1280cdf0e10cSrcweir sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1281cdf0e10cSrcweir 1282cdf0e10cSrcweir { 1283cdf0e10cSrcweir if ( pState && nSID == SID_BORDER_REDUCED_MODE) 1284cdf0e10cSrcweir { 1285cdf0e10cSrcweir const SfxBoolItem* pItem = PTR_CAST( SfxBoolItem, pState ); 1286cdf0e10cSrcweir 1287cdf0e10cSrcweir if ( pItem ) 1288cdf0e10cSrcweir { 1289cdf0e10cSrcweir bParagraphMode = (sal_Bool)pItem->GetValue(); 1290cdf0e10cSrcweir //initial calls mustn't insert or remove elements 1291cdf0e10cSrcweir if(aFrameSet.GetItemCount()) 1292cdf0e10cSrcweir { 1293cdf0e10cSrcweir sal_Bool bTableMode = ( aFrameSet.GetItemCount() == 12 ); 1294cdf0e10cSrcweir sal_Bool bResize = sal_False; 1295cdf0e10cSrcweir 1296cdf0e10cSrcweir if ( bTableMode && bParagraphMode ) 1297cdf0e10cSrcweir { 1298cdf0e10cSrcweir for ( sal_uInt16 i = 9; i < 13; i++ ) 1299cdf0e10cSrcweir aFrameSet.RemoveItem(i); 1300cdf0e10cSrcweir bResize = sal_True; 1301cdf0e10cSrcweir } 1302cdf0e10cSrcweir else if ( !bTableMode && !bParagraphMode ) 1303cdf0e10cSrcweir { 1304cdf0e10cSrcweir for ( sal_uInt16 i = 9; i < 13; i++ ) 1305cdf0e10cSrcweir aFrameSet.InsertItem( i, aImgList.GetImage(i) ); 1306cdf0e10cSrcweir bResize = sal_True; 1307cdf0e10cSrcweir } 1308cdf0e10cSrcweir 1309cdf0e10cSrcweir if ( bResize ) 1310cdf0e10cSrcweir { 1311cdf0e10cSrcweir lcl_CalcSizeValueSet( *this, aFrameSet,Size( 20, 20 )); 1312cdf0e10cSrcweir } 1313cdf0e10cSrcweir } 1314cdf0e10cSrcweir } 1315cdf0e10cSrcweir } 1316cdf0e10cSrcweir SfxPopupWindow::StateChanged( nSID, eState, pState ); 1317cdf0e10cSrcweir } 1318cdf0e10cSrcweir 1319cdf0e10cSrcweir // ----------------------------------------------------------------------- 1320cdf0e10cSrcweir 1321cdf0e10cSrcweir void SvxFrameWindow_Impl::StartSelection() 1322cdf0e10cSrcweir { 1323cdf0e10cSrcweir aFrameSet.StartSelection(); 1324cdf0e10cSrcweir } 1325cdf0e10cSrcweir 1326cdf0e10cSrcweir // ----------------------------------------------------------------------- 1327cdf0e10cSrcweir 1328cdf0e10cSrcweir sal_Bool SvxFrameWindow_Impl::Close() 1329cdf0e10cSrcweir { 1330cdf0e10cSrcweir return SfxPopupWindow::Close(); 1331cdf0e10cSrcweir } 1332cdf0e10cSrcweir 1333cdf0e10cSrcweir //======================================================================== 1334cdf0e10cSrcweir // class SvxLineWindow_Impl -------------------------------------------------- 1335cdf0e10cSrcweir //======================================================================== 1336cdf0e10cSrcweir 1337cdf0e10cSrcweir SvxLineWindow_Impl::SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow ) : 1338cdf0e10cSrcweir 1339cdf0e10cSrcweir SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK | WB_DIALOGCONTROL ) ), 1340cdf0e10cSrcweir 1341cdf0e10cSrcweir aLineSet( this, WinBits( WB_3DLOOK | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD | WB_NONEFIELD | WB_NO_DIRECTSELECT ) ) 1342cdf0e10cSrcweir { 1343cdf0e10cSrcweir try 1344cdf0e10cSrcweir { 1345cdf0e10cSrcweir Reference< lang::XServiceInfo > xServices( rFrame->getController()->getModel(), UNO_QUERY_THROW ); 1346cdf0e10cSrcweir m_bIsWriter = xServices->supportsService(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument"))); 1347cdf0e10cSrcweir } 1348cdf0e10cSrcweir catch(const uno::Exception& ) 1349cdf0e10cSrcweir { 1350cdf0e10cSrcweir } 1351cdf0e10cSrcweir Size aBmpSize( 55, 12 ); 1352cdf0e10cSrcweir CreateBitmaps(); 1353cdf0e10cSrcweir 1354cdf0e10cSrcweir aLineSet.SetColCount( 2 ); 1355cdf0e10cSrcweir aLineSet.SetSelectHdl( LINK( this, SvxLineWindow_Impl, SelectHdl ) ); 1356*d205bed2SMathias Bauer aLineSet.SetText( SVX_RESSTR(RID_SVXSTR_NONE) ); 1357cdf0e10cSrcweir 1358cdf0e10cSrcweir aLineSet.SetAccessibleName( SVX_RESSTR(RID_SVXSTR_FRAME_STYLE) ); 1359cdf0e10cSrcweir lcl_CalcSizeValueSet( *this, aLineSet, aBmpSize ); 1360cdf0e10cSrcweir 1361cdf0e10cSrcweir SetHelpId( HID_POPUP_LINE ); 1362cdf0e10cSrcweir SetText( SVX_RESSTR(RID_SVXSTR_FRAME_STYLE) ); 1363cdf0e10cSrcweir aLineSet.Show(); 1364cdf0e10cSrcweir } 1365cdf0e10cSrcweir 1366cdf0e10cSrcweir SfxPopupWindow* SvxLineWindow_Impl::Clone() const 1367cdf0e10cSrcweir { 1368cdf0e10cSrcweir return new SvxLineWindow_Impl( GetId(), GetFrame(), GetParent() ); 1369cdf0e10cSrcweir } 1370cdf0e10cSrcweir 1371cdf0e10cSrcweir // ----------------------------------------------------------------------- 1372cdf0e10cSrcweir 1373cdf0e10cSrcweir void SvxLineWindow_Impl::MakeLineBitmap( sal_uInt16 nNo, Bitmap& rBmp, const Size& rSize, String& rStr, 1374cdf0e10cSrcweir const ::Color& rLineCol, const ::Color& rBackCol ) 1375cdf0e10cSrcweir { 1376cdf0e10cSrcweir VirtualDevice aVirDev( *this ); 1377cdf0e10cSrcweir Rectangle aRect( Point(2,0), Size(rSize.Width()-4,0) ); 1378cdf0e10cSrcweir 1379cdf0e10cSrcweir // grau einfaerben und Bitmap sichern: 1380cdf0e10cSrcweir aVirDev.SetOutputSizePixel( rSize ); 1381cdf0e10cSrcweir aVirDev.SetLineColor(); 1382cdf0e10cSrcweir aVirDev.SetFillColor( rBackCol ); 1383cdf0e10cSrcweir aVirDev.DrawRect( Rectangle( Point(0,0), rSize ) ); 1384cdf0e10cSrcweir aVirDev.SetFillColor( rLineCol ); 1385cdf0e10cSrcweir 1386cdf0e10cSrcweir sal_uInt16 nLineWidth = 0; 1387cdf0e10cSrcweir switch ( nNo ) 1388cdf0e10cSrcweir { 1389cdf0e10cSrcweir case 1: // DEF_LINE_WIDTH_0 1390cdf0e10cSrcweir aRect.Top() = 6; 1391cdf0e10cSrcweir aRect.Bottom() = 6; 1392cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1393cdf0e10cSrcweir break; 1394cdf0e10cSrcweir 1395cdf0e10cSrcweir case 2: // DEF_LINE_WIDTH_1 1396cdf0e10cSrcweir aRect.Top() = 5; 1397cdf0e10cSrcweir aRect.Bottom() = 6; 1398cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1399cdf0e10cSrcweir nLineWidth = (sal_uInt16) DEF_LINE_WIDTH_1/20; 1400cdf0e10cSrcweir break; 1401cdf0e10cSrcweir 1402cdf0e10cSrcweir case 3: // DEF_LINE_WIDTH_2 1403cdf0e10cSrcweir aRect.Top() = 5; 1404cdf0e10cSrcweir aRect.Bottom() = 7; 1405cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1406cdf0e10cSrcweir nLineWidth = (sal_uInt16) DEF_LINE_WIDTH_2/20; 1407cdf0e10cSrcweir break; 1408cdf0e10cSrcweir 1409cdf0e10cSrcweir case 4: // DEF_LINE_WIDTH_3 1410cdf0e10cSrcweir aRect.Top() = 4; 1411cdf0e10cSrcweir aRect.Bottom() = 7; 1412cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1413cdf0e10cSrcweir aVirDev.DrawRect( Rectangle( Point(2,4), Point(37,7) ) ); 1414cdf0e10cSrcweir nLineWidth = (sal_uInt16) DEF_LINE_WIDTH_3/20; 1415cdf0e10cSrcweir break; 1416cdf0e10cSrcweir 1417cdf0e10cSrcweir case 5: // DEF_LINE_WIDTH_4 1418cdf0e10cSrcweir aRect.Top() = 4; 1419cdf0e10cSrcweir aRect.Bottom() = 8; 1420cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1421cdf0e10cSrcweir nLineWidth = (sal_uInt16) DEF_LINE_WIDTH_4/20; 1422cdf0e10cSrcweir break; 1423cdf0e10cSrcweir 1424cdf0e10cSrcweir case 6: // DEF_DOUBLE_LINE0 1425cdf0e10cSrcweir aRect.Top() = 5; 1426cdf0e10cSrcweir aRect.Bottom() = 5; 1427cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1428cdf0e10cSrcweir aRect.Top() = 7; 1429cdf0e10cSrcweir aRect.Bottom() = 7; 1430cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1431cdf0e10cSrcweir nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE0_OUT+DEF_DOUBLE_LINE0_IN+DEF_DOUBLE_LINE0_DIST)/20; 1432cdf0e10cSrcweir break; 1433cdf0e10cSrcweir 1434cdf0e10cSrcweir case 7: // DEF_DOUBLE_LINE7 1435cdf0e10cSrcweir aRect.Top() = 4; 1436cdf0e10cSrcweir aRect.Bottom() = 4; 1437cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1438cdf0e10cSrcweir aRect.Top() = 7; 1439cdf0e10cSrcweir aRect.Bottom() = 7; 1440cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1441cdf0e10cSrcweir nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE7_OUT+DEF_DOUBLE_LINE7_IN+DEF_DOUBLE_LINE7_DIST)/20; 1442cdf0e10cSrcweir break; 1443cdf0e10cSrcweir 1444cdf0e10cSrcweir case 8: // DEF_DOUBLE_LINE1 1445cdf0e10cSrcweir aRect.Top() = 4; 1446cdf0e10cSrcweir aRect.Bottom() = 5; 1447cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1448cdf0e10cSrcweir aRect.Top() = 7; 1449cdf0e10cSrcweir aRect.Bottom() = 8; 1450cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1451cdf0e10cSrcweir nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE1_OUT+DEF_DOUBLE_LINE1_IN+DEF_DOUBLE_LINE1_DIST)/20; 1452cdf0e10cSrcweir break; 1453cdf0e10cSrcweir 1454cdf0e10cSrcweir case 9: // DEF_DOUBLE_LINE2 1455cdf0e10cSrcweir aRect.Top() = 3; 1456cdf0e10cSrcweir aRect.Bottom() = 5; 1457cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1458cdf0e10cSrcweir aRect.Top() = 8; 1459cdf0e10cSrcweir aRect.Bottom() = 10; 1460cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1461cdf0e10cSrcweir nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE2_OUT+DEF_DOUBLE_LINE2_IN+DEF_DOUBLE_LINE2_DIST)/20; 1462cdf0e10cSrcweir break; 1463cdf0e10cSrcweir 1464cdf0e10cSrcweir case 10: // DEF_DOUBLE_LINE8 1465cdf0e10cSrcweir aRect.Top() = 3; 1466cdf0e10cSrcweir aRect.Bottom() = 4; 1467cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1468cdf0e10cSrcweir aRect.Top() = 7; 1469cdf0e10cSrcweir aRect.Bottom() = 7; 1470cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1471cdf0e10cSrcweir nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE8_OUT+DEF_DOUBLE_LINE8_IN+DEF_DOUBLE_LINE8_DIST)/20; 1472cdf0e10cSrcweir break; 1473cdf0e10cSrcweir 1474cdf0e10cSrcweir case 11: // DEF_DOUBLE_LINE9 1475cdf0e10cSrcweir aRect.Top() = 3; 1476cdf0e10cSrcweir aRect.Bottom() = 5; 1477cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1478cdf0e10cSrcweir aRect.Top() = 8; 1479cdf0e10cSrcweir aRect.Bottom() = 8; 1480cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1481cdf0e10cSrcweir nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE9_OUT+DEF_DOUBLE_LINE9_IN+DEF_DOUBLE_LINE9_DIST)/20; 1482cdf0e10cSrcweir break; 1483cdf0e10cSrcweir 1484cdf0e10cSrcweir case 12: // DEF_DOUBLE_LINE10 1485cdf0e10cSrcweir aRect.Top() = 2; 1486cdf0e10cSrcweir aRect.Bottom() = 5; 1487cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1488cdf0e10cSrcweir aRect.Top() = 8; 1489cdf0e10cSrcweir aRect.Bottom() = 8; 1490cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1491cdf0e10cSrcweir nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE10_OUT+DEF_DOUBLE_LINE10_IN+DEF_DOUBLE_LINE10_DIST)/20; 1492cdf0e10cSrcweir break; 1493cdf0e10cSrcweir 1494cdf0e10cSrcweir case 13: // DEF_DOUBLE_LINE3 1495cdf0e10cSrcweir aRect.Top() = 4; 1496cdf0e10cSrcweir aRect.Bottom() = 5; 1497cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1498cdf0e10cSrcweir aRect.Top() = 7; 1499cdf0e10cSrcweir aRect.Bottom() = 7; 1500cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1501cdf0e10cSrcweir nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE3_OUT+DEF_DOUBLE_LINE3_IN+DEF_DOUBLE_LINE3_DIST)/20; 1502cdf0e10cSrcweir break; 1503cdf0e10cSrcweir 1504cdf0e10cSrcweir case 14: // DEF_DOUBLE_LINE4 1505cdf0e10cSrcweir aRect.Top() = 4; 1506cdf0e10cSrcweir aRect.Bottom() = 4; 1507cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1508cdf0e10cSrcweir aRect.Top() = 6; 1509cdf0e10cSrcweir aRect.Bottom() = 7; 1510cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1511cdf0e10cSrcweir nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE4_OUT+DEF_DOUBLE_LINE4_IN+DEF_DOUBLE_LINE4_DIST)/20; 1512cdf0e10cSrcweir break; 1513cdf0e10cSrcweir 1514cdf0e10cSrcweir case 15: // DEF_DOUBLE_LINE5 1515cdf0e10cSrcweir aRect.Top() = 3; 1516cdf0e10cSrcweir aRect.Bottom() = 5; 1517cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1518cdf0e10cSrcweir aRect.Top() = 8; 1519cdf0e10cSrcweir aRect.Bottom() = 9; 1520cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1521cdf0e10cSrcweir nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE5_OUT+DEF_DOUBLE_LINE5_IN+DEF_DOUBLE_LINE5_DIST)/20; 1522cdf0e10cSrcweir break; 1523cdf0e10cSrcweir 1524cdf0e10cSrcweir case 16: // DEF_DOUBLE_LINE6 1525cdf0e10cSrcweir aRect.Top() = 3; 1526cdf0e10cSrcweir aRect.Bottom() = 4; 1527cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1528cdf0e10cSrcweir aRect.Top() = 7; 1529cdf0e10cSrcweir aRect.Bottom() = 9; 1530cdf0e10cSrcweir aVirDev.DrawRect( aRect ); 1531cdf0e10cSrcweir nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE6_OUT+DEF_DOUBLE_LINE6_IN+DEF_DOUBLE_LINE6_DIST)/20; 1532cdf0e10cSrcweir break; 1533cdf0e10cSrcweir 1534cdf0e10cSrcweir default: 1535cdf0e10cSrcweir break; 1536cdf0e10cSrcweir } 1537cdf0e10cSrcweir if ( nLineWidth ) 1538cdf0e10cSrcweir { 1539cdf0e10cSrcweir rStr = String::CreateFromInt32( nLineWidth ); 1540cdf0e10cSrcweir rStr.AppendAscii(" pt"); 1541cdf0e10cSrcweir } 1542cdf0e10cSrcweir rBmp = aVirDev.GetBitmap( Point(0,0), rSize ); 1543cdf0e10cSrcweir } 1544cdf0e10cSrcweir 1545cdf0e10cSrcweir // ----------------------------------------------------------------------- 1546cdf0e10cSrcweir 1547cdf0e10cSrcweir IMPL_LINK( SvxLineWindow_Impl, SelectHdl, void *, EMPTYARG ) 1548cdf0e10cSrcweir { 1549cdf0e10cSrcweir SvxLineItem aLineItem( SID_FRAME_LINESTYLE ); 1550cdf0e10cSrcweir sal_uInt16 n1 = 0, 1551cdf0e10cSrcweir n2 = 0, 1552cdf0e10cSrcweir n3 = 0; 1553cdf0e10cSrcweir sal_Bool bSetLine = sal_True; 1554cdf0e10cSrcweir 1555cdf0e10cSrcweir switch ( aLineSet.GetSelectItemId() ) 1556cdf0e10cSrcweir { 1557cdf0e10cSrcweir case 1: n1 = DEF_LINE_WIDTH_0; break; 1558cdf0e10cSrcweir case 2: n1 = DEF_LINE_WIDTH_1; break; 1559cdf0e10cSrcweir case 3: n1 = DEF_LINE_WIDTH_2; break; 1560cdf0e10cSrcweir case 4: n1 = DEF_LINE_WIDTH_3; break; 1561cdf0e10cSrcweir case 5: n1 = DEF_LINE_WIDTH_4; break; 1562cdf0e10cSrcweir 1563cdf0e10cSrcweir case 6: n1 = DEF_DOUBLE_LINE0_OUT; 1564cdf0e10cSrcweir n2 = DEF_DOUBLE_LINE0_IN; 1565cdf0e10cSrcweir n3 = DEF_DOUBLE_LINE0_DIST; break; 1566cdf0e10cSrcweir case 7: n1 = DEF_DOUBLE_LINE7_OUT; 1567cdf0e10cSrcweir n2 = DEF_DOUBLE_LINE7_IN; 1568cdf0e10cSrcweir n3 = DEF_DOUBLE_LINE7_DIST; break; 1569cdf0e10cSrcweir case 8: n1 = DEF_DOUBLE_LINE1_OUT; 1570cdf0e10cSrcweir n2 = DEF_DOUBLE_LINE1_IN; 1571cdf0e10cSrcweir n3 = DEF_DOUBLE_LINE1_DIST; break; 1572cdf0e10cSrcweir case 9: n1 = DEF_DOUBLE_LINE2_OUT; 1573cdf0e10cSrcweir n2 = DEF_DOUBLE_LINE2_IN; 1574cdf0e10cSrcweir n3 = DEF_DOUBLE_LINE2_DIST; break; 1575cdf0e10cSrcweir case 10: n1 = DEF_DOUBLE_LINE8_OUT; 1576cdf0e10cSrcweir n2 = DEF_DOUBLE_LINE8_IN; 1577cdf0e10cSrcweir n3 = DEF_DOUBLE_LINE8_DIST; break; 1578cdf0e10cSrcweir case 11: n1 = DEF_DOUBLE_LINE9_OUT; 1579cdf0e10cSrcweir n2 = DEF_DOUBLE_LINE9_IN; 1580cdf0e10cSrcweir n3 = DEF_DOUBLE_LINE9_DIST; break; 1581cdf0e10cSrcweir case 12: n1 = DEF_DOUBLE_LINE10_OUT; 1582cdf0e10cSrcweir n2 = DEF_DOUBLE_LINE10_IN; 1583cdf0e10cSrcweir n3 = DEF_DOUBLE_LINE10_DIST; break; 1584cdf0e10cSrcweir case 13: n1 = DEF_DOUBLE_LINE3_OUT; 1585cdf0e10cSrcweir n2 = DEF_DOUBLE_LINE3_IN; 1586cdf0e10cSrcweir n3 = DEF_DOUBLE_LINE3_DIST; break; 1587cdf0e10cSrcweir case 14: n1 = DEF_DOUBLE_LINE4_OUT; 1588cdf0e10cSrcweir n2 = DEF_DOUBLE_LINE4_IN; 1589cdf0e10cSrcweir n3 = DEF_DOUBLE_LINE4_DIST; break; 1590cdf0e10cSrcweir case 15: n1 = DEF_DOUBLE_LINE5_OUT; 1591cdf0e10cSrcweir n2 = DEF_DOUBLE_LINE5_IN; 1592cdf0e10cSrcweir n3 = DEF_DOUBLE_LINE5_DIST; break; 1593cdf0e10cSrcweir case 16: n1 = DEF_DOUBLE_LINE6_OUT; 1594cdf0e10cSrcweir n2 = DEF_DOUBLE_LINE6_IN; 1595cdf0e10cSrcweir n3 = DEF_DOUBLE_LINE6_DIST; break; 1596cdf0e10cSrcweir case 0: 1597cdf0e10cSrcweir default: 1598cdf0e10cSrcweir bSetLine = sal_False; 1599cdf0e10cSrcweir break; 1600cdf0e10cSrcweir } 1601cdf0e10cSrcweir if ( bSetLine ) 1602cdf0e10cSrcweir { 1603cdf0e10cSrcweir SvxBorderLine aTmp( NULL, n1, n2, n3 ); 1604cdf0e10cSrcweir aLineItem.SetLine( &aTmp ); 1605cdf0e10cSrcweir } 1606cdf0e10cSrcweir else 1607cdf0e10cSrcweir aLineItem.SetLine( 0 ); 1608cdf0e10cSrcweir 1609cdf0e10cSrcweir if ( IsInPopupMode() ) 1610cdf0e10cSrcweir EndPopupMode(); 1611cdf0e10cSrcweir 1612cdf0e10cSrcweir Any a; 1613cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 ); 1614cdf0e10cSrcweir aArgs[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "LineStyle" )); 1615cdf0e10cSrcweir aLineItem.QueryValue( a, m_bIsWriter ? CONVERT_TWIPS : 0 ); 1616cdf0e10cSrcweir aArgs[0].Value = a; 1617cdf0e10cSrcweir 1618cdf0e10cSrcweir /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. 1619cdf0e10cSrcweir This instance may be deleted in the meantime (i.e. when a dialog is opened 1620cdf0e10cSrcweir while in Dispatch()), accessing members will crash in this case. */ 1621cdf0e10cSrcweir aLineSet.SetNoSelection(); 1622cdf0e10cSrcweir 1623cdf0e10cSrcweir SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ), 1624cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LineStyle" )), 1625cdf0e10cSrcweir aArgs ); 1626cdf0e10cSrcweir return 0; 1627cdf0e10cSrcweir } 1628cdf0e10cSrcweir 1629cdf0e10cSrcweir // ----------------------------------------------------------------------- 1630cdf0e10cSrcweir 1631cdf0e10cSrcweir void SvxLineWindow_Impl::Resize() 1632cdf0e10cSrcweir { 1633cdf0e10cSrcweir lcl_ResizeValueSet( *this, aLineSet); 1634cdf0e10cSrcweir } 1635cdf0e10cSrcweir 1636cdf0e10cSrcweir // ----------------------------------------------------------------------- 1637cdf0e10cSrcweir 1638cdf0e10cSrcweir void SvxLineWindow_Impl::StartSelection() 1639cdf0e10cSrcweir { 1640cdf0e10cSrcweir aLineSet.StartSelection(); 1641cdf0e10cSrcweir } 1642cdf0e10cSrcweir 1643cdf0e10cSrcweir // ----------------------------------------------------------------------- 1644cdf0e10cSrcweir 1645cdf0e10cSrcweir sal_Bool SvxLineWindow_Impl::Close() 1646cdf0e10cSrcweir { 1647cdf0e10cSrcweir return SfxPopupWindow::Close(); 1648cdf0e10cSrcweir } 1649cdf0e10cSrcweir 1650cdf0e10cSrcweir // ----------------------------------------------------------------------- 1651cdf0e10cSrcweir 1652cdf0e10cSrcweir Window* SvxLineWindow_Impl::GetPreferredKeyInputWindow() 1653cdf0e10cSrcweir { 1654cdf0e10cSrcweir return &aLineSet; 1655cdf0e10cSrcweir } 1656cdf0e10cSrcweir 1657cdf0e10cSrcweir // ----------------------------------------------------------------------- 1658cdf0e10cSrcweir 1659cdf0e10cSrcweir void SvxLineWindow_Impl::GetFocus() 1660cdf0e10cSrcweir { 1661cdf0e10cSrcweir aLineSet.GrabFocus(); 1662cdf0e10cSrcweir } 1663cdf0e10cSrcweir 1664cdf0e10cSrcweir void SvxLineWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) 1665cdf0e10cSrcweir { 1666cdf0e10cSrcweir SfxPopupWindow::DataChanged( rDCEvt ); 1667cdf0e10cSrcweir 1668cdf0e10cSrcweir if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) 1669cdf0e10cSrcweir { 1670cdf0e10cSrcweir CreateBitmaps(); 1671cdf0e10cSrcweir Invalidate(); 1672cdf0e10cSrcweir } 1673cdf0e10cSrcweir } 1674cdf0e10cSrcweir 1675cdf0e10cSrcweir void SvxLineWindow_Impl::CreateBitmaps( void ) 1676cdf0e10cSrcweir { 1677cdf0e10cSrcweir Size aBmpSize( 55, 12 ); 1678cdf0e10cSrcweir Bitmap aBmp; 1679cdf0e10cSrcweir String aStr; 1680cdf0e10cSrcweir 1681cdf0e10cSrcweir const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); 1682cdf0e10cSrcweir svtools::ColorConfig aColorConfig; 1683cdf0e10cSrcweir ::Color aLineCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); 1684cdf0e10cSrcweir ::Color aBackCol( rStyleSettings.GetWindowColor() ); 1685cdf0e10cSrcweir aLineSet.Clear(); 1686cdf0e10cSrcweir 1687cdf0e10cSrcweir for( sal_uInt16 i = 1 ; i < 17 ; ++i ) 1688cdf0e10cSrcweir { 1689cdf0e10cSrcweir MakeLineBitmap( i, aBmp, aBmpSize, aStr, aLineCol, aBackCol ); 1690cdf0e10cSrcweir aLineSet.InsertItem( i, aBmp, aStr ); 1691cdf0e10cSrcweir } 1692cdf0e10cSrcweir } 1693cdf0e10cSrcweir 1694cdf0e10cSrcweir // ----------------------------------------------------------------------- 1695cdf0e10cSrcweir 1696cdf0e10cSrcweir //######################################################################## 1697cdf0e10cSrcweir // Hilfsklassen 1698cdf0e10cSrcweir 1699cdf0e10cSrcweir //======================================================================== 1700cdf0e10cSrcweir // class SfxStyleControllerItem_Impl ------------------------------------------ 1701cdf0e10cSrcweir //======================================================================== 1702cdf0e10cSrcweir 1703cdf0e10cSrcweir SfxStyleControllerItem_Impl::SfxStyleControllerItem_Impl( 1704cdf0e10cSrcweir const Reference< XDispatchProvider >& rDispatchProvider, 1705cdf0e10cSrcweir sal_uInt16 nSlotId, // Family-ID 1706cdf0e10cSrcweir const rtl::OUString& rCommand, // .uno: command bound to this item 1707cdf0e10cSrcweir SvxStyleToolBoxControl& rTbxCtl ) // Controller-Instanz, dem dieses Item zugeordnet ist. 1708cdf0e10cSrcweir : SfxStatusListener( rDispatchProvider, nSlotId, rCommand ), 1709cdf0e10cSrcweir rControl( rTbxCtl ) 1710cdf0e10cSrcweir { 1711cdf0e10cSrcweir } 1712cdf0e10cSrcweir 1713cdf0e10cSrcweir // ----------------------------------------------------------------------- 1714cdf0e10cSrcweir 1715cdf0e10cSrcweir void SfxStyleControllerItem_Impl::StateChanged( 1716cdf0e10cSrcweir sal_uInt16, SfxItemState eState, const SfxPoolItem* pState ) 1717cdf0e10cSrcweir { 1718cdf0e10cSrcweir switch ( GetId() ) 1719cdf0e10cSrcweir { 1720cdf0e10cSrcweir case SID_STYLE_FAMILY1: 1721cdf0e10cSrcweir case SID_STYLE_FAMILY2: 1722cdf0e10cSrcweir case SID_STYLE_FAMILY3: 1723cdf0e10cSrcweir case SID_STYLE_FAMILY4: 1724cdf0e10cSrcweir case SID_STYLE_FAMILY5: 1725cdf0e10cSrcweir { 1726cdf0e10cSrcweir const sal_uInt16 nIdx = GetId() - SID_STYLE_FAMILY_START; 1727cdf0e10cSrcweir 1728cdf0e10cSrcweir if ( SFX_ITEM_AVAILABLE == eState ) 1729cdf0e10cSrcweir { 1730cdf0e10cSrcweir const SfxTemplateItem* pStateItem = 1731cdf0e10cSrcweir PTR_CAST( SfxTemplateItem, pState ); 1732cdf0e10cSrcweir DBG_ASSERT( pStateItem != NULL, "SfxTemplateItem expected" ); 1733cdf0e10cSrcweir rControl.SetFamilyState( nIdx, pStateItem ); 1734cdf0e10cSrcweir } 1735cdf0e10cSrcweir else 1736cdf0e10cSrcweir rControl.SetFamilyState( nIdx, NULL ); 1737cdf0e10cSrcweir break; 1738cdf0e10cSrcweir } 1739cdf0e10cSrcweir } 1740cdf0e10cSrcweir } 1741cdf0e10cSrcweir 1742cdf0e10cSrcweir //######################################################################## 1743cdf0e10cSrcweir 1744cdf0e10cSrcweir //======================================================================== 1745cdf0e10cSrcweir // class SvxStyleToolBoxControl ------------------------------------------ 1746cdf0e10cSrcweir //======================================================================== 1747cdf0e10cSrcweir 1748cdf0e10cSrcweir struct SvxStyleToolBoxControl::Impl 1749cdf0e10cSrcweir { 1750cdf0e10cSrcweir String aClearForm; 1751cdf0e10cSrcweir String aMore; 1752cdf0e10cSrcweir ::std::vector< ::rtl::OUString > aDefaultStyles; 1753cdf0e10cSrcweir sal_Bool bListening; 1754cdf0e10cSrcweir sal_Bool bSpecModeWriter; 1755cdf0e10cSrcweir sal_Bool bSpecModeCalc; 1756cdf0e10cSrcweir 1757cdf0e10cSrcweir inline Impl( void ) 1758cdf0e10cSrcweir :aClearForm ( SVX_RESSTR( RID_SVXSTR_CLEARFORM ) ) 1759cdf0e10cSrcweir ,aMore ( SVX_RESSTR( RID_SVXSTR_MORE ) ) 1760cdf0e10cSrcweir ,bListening ( sal_False ) 1761cdf0e10cSrcweir ,bSpecModeWriter ( sal_False ) 1762cdf0e10cSrcweir ,bSpecModeCalc ( sal_False ) 1763cdf0e10cSrcweir { 1764cdf0e10cSrcweir 1765cdf0e10cSrcweir 1766cdf0e10cSrcweir } 1767cdf0e10cSrcweir void InitializeStyles(Reference < frame::XModel > xModel) 1768cdf0e10cSrcweir { 1769cdf0e10cSrcweir //now convert the default style names to the localized names 1770cdf0e10cSrcweir try 1771cdf0e10cSrcweir { 1772cdf0e10cSrcweir Reference< style::XStyleFamiliesSupplier > xStylesSupplier( xModel, UNO_QUERY_THROW ); 1773cdf0e10cSrcweir Reference< lang::XServiceInfo > xServices( xModel, UNO_QUERY_THROW ); 1774cdf0e10cSrcweir bSpecModeWriter = xServices->supportsService(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument"))); 1775cdf0e10cSrcweir if(bSpecModeWriter) 1776cdf0e10cSrcweir { 1777cdf0e10cSrcweir Reference<container::XNameAccess> xParaStyles; 1778cdf0e10cSrcweir xStylesSupplier->getStyleFamilies()->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles"))) >>= 1779cdf0e10cSrcweir xParaStyles; 1780cdf0e10cSrcweir static const sal_Char* aWriterStyles[] = 1781cdf0e10cSrcweir { 1782cdf0e10cSrcweir "Standard", 1783cdf0e10cSrcweir "Heading 1", 1784cdf0e10cSrcweir "Heading 2", 1785cdf0e10cSrcweir "Heading 3", 1786cdf0e10cSrcweir "Text body" 1787cdf0e10cSrcweir }; 1788cdf0e10cSrcweir for( sal_uInt32 nStyle = 0; nStyle < sizeof( aWriterStyles ) / sizeof( sal_Char*); ++nStyle ) 1789cdf0e10cSrcweir { 1790cdf0e10cSrcweir try 1791cdf0e10cSrcweir { 1792cdf0e10cSrcweir Reference< beans::XPropertySet > xStyle; 1793cdf0e10cSrcweir xParaStyles->getByName( rtl::OUString::createFromAscii( aWriterStyles[nStyle] )) >>= xStyle; 1794cdf0e10cSrcweir ::rtl::OUString sName; 1795cdf0e10cSrcweir xStyle->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DisplayName"))) >>= sName; 1796cdf0e10cSrcweir if( sName.getLength() ) 1797cdf0e10cSrcweir aDefaultStyles.push_back(sName); 1798cdf0e10cSrcweir } 1799cdf0e10cSrcweir catch( const uno::Exception& ) 1800cdf0e10cSrcweir {} 1801cdf0e10cSrcweir } 1802cdf0e10cSrcweir 1803cdf0e10cSrcweir } 1804cdf0e10cSrcweir else if( 0 != ( 1805cdf0e10cSrcweir bSpecModeCalc = xServices->supportsService(::rtl::OUString( 1806cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument"))))) 1807cdf0e10cSrcweir { 1808cdf0e10cSrcweir static const sal_Char* aCalcStyles[] = 1809cdf0e10cSrcweir { 1810cdf0e10cSrcweir "Default", 1811cdf0e10cSrcweir "Heading1", 1812cdf0e10cSrcweir "Result", 1813cdf0e10cSrcweir "Result2" 1814cdf0e10cSrcweir }; 1815cdf0e10cSrcweir Reference<container::XNameAccess> xCellStyles; 1816cdf0e10cSrcweir xStylesSupplier->getStyleFamilies()->getByName( 1817cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CellStyles"))) >>= 1818cdf0e10cSrcweir xCellStyles; 1819cdf0e10cSrcweir for( sal_uInt32 nStyle = 0; nStyle < sizeof( aCalcStyles ) / sizeof( sal_Char*); ++nStyle ) 1820cdf0e10cSrcweir { 1821cdf0e10cSrcweir try 1822cdf0e10cSrcweir { 1823cdf0e10cSrcweir const rtl::OUString sStyleName( rtl::OUString::createFromAscii( aCalcStyles[nStyle] ) ); 1824cdf0e10cSrcweir if( xCellStyles->hasByName( sStyleName ) ) 1825cdf0e10cSrcweir { 1826cdf0e10cSrcweir Reference< beans::XPropertySet > xStyle( xCellStyles->getByName( sStyleName), UNO_QUERY_THROW ); 1827cdf0e10cSrcweir ::rtl::OUString sName; 1828cdf0e10cSrcweir xStyle->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DisplayName"))) >>= sName; 1829cdf0e10cSrcweir if( sName.getLength() ) 1830cdf0e10cSrcweir aDefaultStyles.push_back(sName); 1831cdf0e10cSrcweir } 1832cdf0e10cSrcweir } 1833cdf0e10cSrcweir catch( const uno::Exception& ) 1834cdf0e10cSrcweir {} 1835cdf0e10cSrcweir } 1836cdf0e10cSrcweir } 1837cdf0e10cSrcweir } 1838cdf0e10cSrcweir catch(const uno::Exception& ) 1839cdf0e10cSrcweir { 1840cdf0e10cSrcweir DBG_ERROR("error while initializing style names"); 1841cdf0e10cSrcweir } 1842cdf0e10cSrcweir } 1843cdf0e10cSrcweir }; 1844cdf0e10cSrcweir 1845cdf0e10cSrcweir 1846cdf0e10cSrcweir // mapping table from bound items. BE CAREFUL this table must be in the 1847cdf0e10cSrcweir // same order as the uno commands bound to the slots SID_STYLE_FAMILY1..n 1848cdf0e10cSrcweir // MAX_FAMILIES must also be correctly set! 1849cdf0e10cSrcweir static const char* StyleSlotToStyleCommand[MAX_FAMILIES] = 1850cdf0e10cSrcweir { 1851cdf0e10cSrcweir ".uno:CharStyle", 1852cdf0e10cSrcweir ".uno:ParaStyle", 1853cdf0e10cSrcweir ".uno:FrameStyle", 1854cdf0e10cSrcweir ".uno:PageStyle", 1855cdf0e10cSrcweir ".uno:TemplateFamily5" 1856cdf0e10cSrcweir }; 1857cdf0e10cSrcweir 1858cdf0e10cSrcweir SvxStyleToolBoxControl::SvxStyleToolBoxControl( 1859cdf0e10cSrcweir sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) 1860cdf0e10cSrcweir : SfxToolBoxControl ( nSlotId, nId, rTbx ), 1861cdf0e10cSrcweir pStyleSheetPool ( NULL ), 1862cdf0e10cSrcweir nActFamily ( 0xffff ), 1863cdf0e10cSrcweir bListening ( sal_False ), 1864cdf0e10cSrcweir pImpl ( new Impl ) 1865cdf0e10cSrcweir { 1866cdf0e10cSrcweir for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ ) 1867cdf0e10cSrcweir { 1868cdf0e10cSrcweir pBoundItems[i] = 0; 1869cdf0e10cSrcweir m_xBoundItems[i] = Reference< XComponent >(); 1870cdf0e10cSrcweir pFamilyState[i] = NULL; 1871cdf0e10cSrcweir } 1872cdf0e10cSrcweir } 1873cdf0e10cSrcweir 1874cdf0e10cSrcweir // ----------------------------------------------------------------------- 1875cdf0e10cSrcweir SvxStyleToolBoxControl::~SvxStyleToolBoxControl() 1876cdf0e10cSrcweir { 1877cdf0e10cSrcweir } 1878cdf0e10cSrcweir 1879cdf0e10cSrcweir // ----------------------------------------------------------------------- 1880cdf0e10cSrcweir void SAL_CALL SvxStyleToolBoxControl::initialize( const Sequence< Any >& aArguments ) 1881cdf0e10cSrcweir throw ( Exception, RuntimeException) 1882cdf0e10cSrcweir { 1883cdf0e10cSrcweir SfxToolBoxControl::initialize( aArguments ); 1884cdf0e10cSrcweir 1885cdf0e10cSrcweir // After initialize we should have a valid frame member where we can retrieve our 1886cdf0e10cSrcweir // dispatch provider. 1887cdf0e10cSrcweir if ( m_xFrame.is() ) 1888cdf0e10cSrcweir { 1889cdf0e10cSrcweir pImpl->InitializeStyles(m_xFrame->getController()->getModel()); 1890cdf0e10cSrcweir Reference< XDispatchProvider > xDispatchProvider( m_xFrame->getController(), UNO_QUERY ); 1891cdf0e10cSrcweir for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ ) 1892cdf0e10cSrcweir { 1893cdf0e10cSrcweir pBoundItems[i] = new SfxStyleControllerItem_Impl( xDispatchProvider, 1894cdf0e10cSrcweir SID_STYLE_FAMILY_START + i, 1895cdf0e10cSrcweir OUString::createFromAscii( StyleSlotToStyleCommand[i] ), 1896cdf0e10cSrcweir *this ); 1897cdf0e10cSrcweir m_xBoundItems[i] = Reference< XComponent >( static_cast< OWeakObject* >( pBoundItems[i] ), UNO_QUERY ); 1898cdf0e10cSrcweir pFamilyState[i] = NULL; 1899cdf0e10cSrcweir } 1900cdf0e10cSrcweir } 1901cdf0e10cSrcweir } 1902cdf0e10cSrcweir 1903cdf0e10cSrcweir // XComponent 1904cdf0e10cSrcweir void SAL_CALL SvxStyleToolBoxControl::dispose() 1905cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 1906cdf0e10cSrcweir { 1907cdf0e10cSrcweir SfxToolBoxControl::dispose(); 1908cdf0e10cSrcweir 1909cdf0e10cSrcweir for( sal_uInt16 i=0; i<MAX_FAMILIES; i++ ) 1910cdf0e10cSrcweir { 1911cdf0e10cSrcweir if ( m_xBoundItems[i].is() ) 1912cdf0e10cSrcweir { 1913cdf0e10cSrcweir try 1914cdf0e10cSrcweir { 1915cdf0e10cSrcweir m_xBoundItems[i]->dispose(); 1916cdf0e10cSrcweir } 1917cdf0e10cSrcweir catch ( Exception& ) 1918cdf0e10cSrcweir { 1919cdf0e10cSrcweir } 1920cdf0e10cSrcweir 1921cdf0e10cSrcweir m_xBoundItems[i].clear(); 1922cdf0e10cSrcweir pBoundItems[i] = 0; 1923cdf0e10cSrcweir } 1924cdf0e10cSrcweir DELETEZ( pFamilyState[i] ); 1925cdf0e10cSrcweir } 1926cdf0e10cSrcweir pStyleSheetPool = NULL; 1927cdf0e10cSrcweir DELETEZ( pImpl ); 1928cdf0e10cSrcweir } 1929cdf0e10cSrcweir 1930cdf0e10cSrcweir // ----------------------------------------------------------------------- 1931cdf0e10cSrcweir void SAL_CALL SvxStyleToolBoxControl::update() throw (RuntimeException) 1932cdf0e10cSrcweir { 1933cdf0e10cSrcweir // Do nothing, we will start binding our listener when we are visible. 1934cdf0e10cSrcweir // See link SvxStyleToolBoxControl::VisibilityNotification. 1935cdf0e10cSrcweir SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)GetToolBox().GetItemWindow( GetId() ); 1936cdf0e10cSrcweir if ( pBox->IsVisible() ) 1937cdf0e10cSrcweir { 1938cdf0e10cSrcweir for ( int i=0; i<MAX_FAMILIES; i++ ) 1939cdf0e10cSrcweir pBoundItems [i]->ReBind(); 1940cdf0e10cSrcweir 1941cdf0e10cSrcweir bindListener(); 1942cdf0e10cSrcweir } 1943cdf0e10cSrcweir } 1944cdf0e10cSrcweir 1945cdf0e10cSrcweir // ----------------------------------------------------------------------- 1946cdf0e10cSrcweir 1947cdf0e10cSrcweir SfxStyleFamily SvxStyleToolBoxControl::GetActFamily() 1948cdf0e10cSrcweir { 1949cdf0e10cSrcweir switch ( nActFamily-1 + SID_STYLE_FAMILY_START ) 1950cdf0e10cSrcweir { 1951cdf0e10cSrcweir case SID_STYLE_FAMILY1: return SFX_STYLE_FAMILY_CHAR; 1952cdf0e10cSrcweir case SID_STYLE_FAMILY2: return SFX_STYLE_FAMILY_PARA; 1953cdf0e10cSrcweir case SID_STYLE_FAMILY3: return SFX_STYLE_FAMILY_FRAME; 1954cdf0e10cSrcweir case SID_STYLE_FAMILY4: return SFX_STYLE_FAMILY_PAGE; 1955cdf0e10cSrcweir case SID_STYLE_FAMILY5: return SFX_STYLE_FAMILY_PSEUDO; 1956cdf0e10cSrcweir default: 1957cdf0e10cSrcweir DBG_ERROR( "unknown style family" ); 1958cdf0e10cSrcweir break; 1959cdf0e10cSrcweir } 1960cdf0e10cSrcweir return SFX_STYLE_FAMILY_PARA; 1961cdf0e10cSrcweir } 1962cdf0e10cSrcweir 1963cdf0e10cSrcweir // ----------------------------------------------------------------------- 1964cdf0e10cSrcweir 1965cdf0e10cSrcweir void SvxStyleToolBoxControl::FillStyleBox() 1966cdf0e10cSrcweir { 1967cdf0e10cSrcweir SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)GetToolBox().GetItemWindow( GetId() ); 1968cdf0e10cSrcweir 1969cdf0e10cSrcweir DBG_ASSERT( pStyleSheetPool, "StyleSheetPool not found!" ); 1970cdf0e10cSrcweir DBG_ASSERT( pBox, "Control not found!" ); 1971cdf0e10cSrcweir 1972cdf0e10cSrcweir if ( pStyleSheetPool && pBox && nActFamily!=0xffff ) 1973cdf0e10cSrcweir { 1974cdf0e10cSrcweir const SfxStyleFamily eFamily = GetActFamily(); 1975cdf0e10cSrcweir sal_uInt16 nCount = pStyleSheetPool->Count(); 1976cdf0e10cSrcweir sal_uInt16 i = 0; 1977cdf0e10cSrcweir SfxStyleSheetBase* pStyle = NULL; 1978cdf0e10cSrcweir sal_Bool bDoFill = sal_False; 1979cdf0e10cSrcweir 1980cdf0e10cSrcweir pStyleSheetPool->SetSearchMask( eFamily, SFXSTYLEBIT_USED ); 1981cdf0e10cSrcweir 1982cdf0e10cSrcweir //------------------------------ 1983cdf0e10cSrcweir // Ueberpruefen, ob Fill noetig: 1984cdf0e10cSrcweir //------------------------------ 1985cdf0e10cSrcweir 1986cdf0e10cSrcweir pStyle = pStyleSheetPool->First(); 1987cdf0e10cSrcweir //!!! TODO: This condition isn't right any longer, because we always show some default entries 1988cdf0e10cSrcweir //!!! so the list doesn't show the count 1989cdf0e10cSrcweir if ( nCount != pBox->GetEntryCount() ) 1990cdf0e10cSrcweir { 1991cdf0e10cSrcweir bDoFill = sal_True; 1992cdf0e10cSrcweir } 1993cdf0e10cSrcweir else 1994cdf0e10cSrcweir { 1995cdf0e10cSrcweir while ( pStyle && !bDoFill ) 1996cdf0e10cSrcweir { 1997cdf0e10cSrcweir bDoFill = ( pBox->GetEntry(i) != pStyle->GetName() ); 1998cdf0e10cSrcweir pStyle = pStyleSheetPool->Next(); 1999cdf0e10cSrcweir i++; 2000cdf0e10cSrcweir } 2001cdf0e10cSrcweir } 2002cdf0e10cSrcweir 2003cdf0e10cSrcweir if ( bDoFill ) 2004cdf0e10cSrcweir { 2005cdf0e10cSrcweir pBox->SetUpdateMode( sal_False ); 2006cdf0e10cSrcweir pBox->Clear(); 2007cdf0e10cSrcweir 2008cdf0e10cSrcweir { 2009cdf0e10cSrcweir sal_uInt16 _i; 2010cdf0e10cSrcweir sal_uInt32 nCnt = pImpl->aDefaultStyles.size(); 2011cdf0e10cSrcweir bool bInsert; 2012cdf0e10cSrcweir 2013cdf0e10cSrcweir pStyle = pStyleSheetPool->First(); 2014cdf0e10cSrcweir 2015cdf0e10cSrcweir if( pImpl->bSpecModeWriter || pImpl->bSpecModeCalc ) 2016cdf0e10cSrcweir { 2017cdf0e10cSrcweir while ( pStyle ) 2018cdf0e10cSrcweir { 2019cdf0e10cSrcweir // sort out default styles 2020cdf0e10cSrcweir bInsert = true; 2021cdf0e10cSrcweir ::rtl::OUString aName( pStyle->GetName() ); 2022cdf0e10cSrcweir for( _i = 0 ; _i < nCnt ; ++_i ) 2023cdf0e10cSrcweir { 2024cdf0e10cSrcweir if( pImpl->aDefaultStyles[_i] == aName ) 2025cdf0e10cSrcweir { 2026cdf0e10cSrcweir bInsert = false; 2027cdf0e10cSrcweir break; 2028cdf0e10cSrcweir } 2029cdf0e10cSrcweir } 2030cdf0e10cSrcweir 2031cdf0e10cSrcweir if( bInsert ) 2032cdf0e10cSrcweir pBox->InsertEntry( aName ); 2033cdf0e10cSrcweir pStyle = pStyleSheetPool->Next(); 2034cdf0e10cSrcweir } 2035cdf0e10cSrcweir } 2036cdf0e10cSrcweir else 2037cdf0e10cSrcweir { 2038cdf0e10cSrcweir while ( pStyle ) 2039cdf0e10cSrcweir { 2040cdf0e10cSrcweir pBox->InsertEntry( pStyle->GetName() ); 2041cdf0e10cSrcweir pStyle = pStyleSheetPool->Next(); 2042cdf0e10cSrcweir } 2043cdf0e10cSrcweir } 2044cdf0e10cSrcweir } 2045cdf0e10cSrcweir 2046cdf0e10cSrcweir if( pImpl->bSpecModeWriter || pImpl->bSpecModeCalc ) 2047cdf0e10cSrcweir { 2048cdf0e10cSrcweir // insert default styles 2049cdf0e10cSrcweir sal_uInt16 _i; 2050cdf0e10cSrcweir sal_uInt32 nCnt = pImpl->aDefaultStyles.size(); 2051cdf0e10cSrcweir sal_uInt16 nPos = 1; 2052cdf0e10cSrcweir for( _i = 0 ; _i < nCnt ; ++_i ) 2053cdf0e10cSrcweir { 2054cdf0e10cSrcweir pBox->InsertEntry( pImpl->aDefaultStyles[_i], nPos ); 2055cdf0e10cSrcweir ++nPos; 2056cdf0e10cSrcweir } 2057cdf0e10cSrcweir 2058cdf0e10cSrcweir // disable sort to preserve special order 2059cdf0e10cSrcweir WinBits nWinBits = pBox->GetStyle(); 2060cdf0e10cSrcweir nWinBits &= ~WB_SORT; 2061cdf0e10cSrcweir pBox->SetStyle( nWinBits ); 2062cdf0e10cSrcweir 2063cdf0e10cSrcweir pBox->InsertEntry( pImpl->aClearForm, 0 ); 2064cdf0e10cSrcweir pBox->SetSeparatorPos( 0 ); 2065cdf0e10cSrcweir 2066cdf0e10cSrcweir pBox->InsertEntry( pImpl->aMore ); 2067cdf0e10cSrcweir 2068cdf0e10cSrcweir // enable sort again 2069cdf0e10cSrcweir nWinBits |= WB_SORT; 2070cdf0e10cSrcweir pBox->SetStyle( nWinBits ); 2071cdf0e10cSrcweir } 2072cdf0e10cSrcweir 2073cdf0e10cSrcweir pBox->SetUpdateMode( sal_True ); 2074cdf0e10cSrcweir pBox->SetFamily( eFamily ); 2075cdf0e10cSrcweir 2076cdf0e10cSrcweir sal_uInt16 nLines = Min( pBox->GetEntryCount(), MAX_STYLES_ENTRIES ); 2077cdf0e10cSrcweir pBox->SetDropDownLineCount( nLines ); 2078cdf0e10cSrcweir } 2079cdf0e10cSrcweir } 2080cdf0e10cSrcweir } 2081cdf0e10cSrcweir 2082cdf0e10cSrcweir // ----------------------------------------------------------------------- 2083cdf0e10cSrcweir 2084cdf0e10cSrcweir void SvxStyleToolBoxControl::SelectStyle( const String& rStyleName ) 2085cdf0e10cSrcweir { 2086cdf0e10cSrcweir SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)GetToolBox().GetItemWindow( GetId() ); 2087cdf0e10cSrcweir DBG_ASSERT( pBox, "Control not found!" ); 2088cdf0e10cSrcweir 2089cdf0e10cSrcweir if ( pBox ) 2090cdf0e10cSrcweir { 2091cdf0e10cSrcweir // String aStrSel( pBox->GetSelectEntry() ); 2092cdf0e10cSrcweir String aStrSel( pBox->GetText() ); 2093cdf0e10cSrcweir 2094cdf0e10cSrcweir if ( rStyleName.Len() > 0 ) 2095cdf0e10cSrcweir { 2096cdf0e10cSrcweir if ( rStyleName != aStrSel ) 2097cdf0e10cSrcweir // pBox->SelectEntry( rStyleName ); 2098cdf0e10cSrcweir pBox->SetText( rStyleName ); 2099cdf0e10cSrcweir } 2100cdf0e10cSrcweir else 2101cdf0e10cSrcweir pBox->SetNoSelection(); 2102cdf0e10cSrcweir pBox->SaveValue(); 2103cdf0e10cSrcweir } 2104cdf0e10cSrcweir } 2105cdf0e10cSrcweir 2106cdf0e10cSrcweir // ----------------------------------------------------------------------- 2107cdf0e10cSrcweir 2108cdf0e10cSrcweir void SvxStyleToolBoxControl::Update() 2109cdf0e10cSrcweir { 2110cdf0e10cSrcweir SfxStyleSheetBasePool* pPool = NULL; 2111cdf0e10cSrcweir SfxObjectShell* pDocShell = SfxObjectShell::Current(); 2112cdf0e10cSrcweir 2113cdf0e10cSrcweir if ( pDocShell ) 2114cdf0e10cSrcweir pPool = pDocShell->GetStyleSheetPool(); 2115cdf0e10cSrcweir 2116cdf0e10cSrcweir sal_uInt16 i; 2117cdf0e10cSrcweir for ( i=0; i<MAX_FAMILIES; i++ ) 2118cdf0e10cSrcweir if( pFamilyState[i] ) 2119cdf0e10cSrcweir break; 2120cdf0e10cSrcweir 2121cdf0e10cSrcweir if ( i==MAX_FAMILIES || !pPool ) 2122cdf0e10cSrcweir { 2123cdf0e10cSrcweir pStyleSheetPool = pPool; 2124cdf0e10cSrcweir return; 2125cdf0e10cSrcweir } 2126cdf0e10cSrcweir 2127cdf0e10cSrcweir //-------------------------------------------------------------------- 2128cdf0e10cSrcweir const SfxTemplateItem* pItem = NULL; 2129cdf0e10cSrcweir 2130cdf0e10cSrcweir if ( nActFamily == 0xffff || 0 == (pItem = pFamilyState[nActFamily-1]) ) 2131cdf0e10cSrcweir // aktueller Bereich nicht innerhalb der erlaubten Bereiche 2132cdf0e10cSrcweir // oder Default 2133cdf0e10cSrcweir { 2134cdf0e10cSrcweir pStyleSheetPool = pPool; 2135cdf0e10cSrcweir nActFamily = 2; 2136cdf0e10cSrcweir 2137cdf0e10cSrcweir pItem = pFamilyState[nActFamily-1]; 2138cdf0e10cSrcweir if ( !pItem ) 2139cdf0e10cSrcweir { 2140cdf0e10cSrcweir nActFamily++; 2141cdf0e10cSrcweir pItem = pFamilyState[nActFamily-1]; 2142cdf0e10cSrcweir } 2143cdf0e10cSrcweir 2144cdf0e10cSrcweir if ( !pItem ) 2145cdf0e10cSrcweir { 2146cdf0e10cSrcweir DBG_WARNING( "Unknown Family" ); // can happen 2147cdf0e10cSrcweir } 2148cdf0e10cSrcweir } 2149cdf0e10cSrcweir else if ( pPool != pStyleSheetPool ) 2150cdf0e10cSrcweir pStyleSheetPool = pPool; 2151cdf0e10cSrcweir 2152cdf0e10cSrcweir FillStyleBox(); // entscheidet selbst, ob gefuellt werden muss 2153cdf0e10cSrcweir 2154cdf0e10cSrcweir if ( pItem ) 2155cdf0e10cSrcweir SelectStyle( pItem->GetStyleName() ); 2156cdf0e10cSrcweir } 2157cdf0e10cSrcweir 2158cdf0e10cSrcweir // ----------------------------------------------------------------------- 2159cdf0e10cSrcweir 2160cdf0e10cSrcweir void SvxStyleToolBoxControl::SetFamilyState( sal_uInt16 nIdx, 2161cdf0e10cSrcweir const SfxTemplateItem* pItem ) 2162cdf0e10cSrcweir { 2163cdf0e10cSrcweir DELETEZ( pFamilyState[nIdx] ); 2164cdf0e10cSrcweir 2165cdf0e10cSrcweir if ( pItem ) 2166cdf0e10cSrcweir pFamilyState[nIdx] = new SfxTemplateItem( *pItem ); 2167cdf0e10cSrcweir 2168cdf0e10cSrcweir Update(); 2169cdf0e10cSrcweir } 2170cdf0e10cSrcweir 2171cdf0e10cSrcweir // ----------------------------------------------------------------------- 2172cdf0e10cSrcweir 2173cdf0e10cSrcweir IMPL_LINK( SvxStyleToolBoxControl, VisibilityNotification, void*, EMPTYARG ) 2174cdf0e10cSrcweir { 2175cdf0e10cSrcweir 2176cdf0e10cSrcweir sal_uInt16 i; 2177cdf0e10cSrcweir 2178cdf0e10cSrcweir // Call ReBind() && UnBind() according to visibility 2179cdf0e10cSrcweir SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)( GetToolBox().GetItemWindow( GetId() )); 2180cdf0e10cSrcweir if ( pBox->IsVisible() && !isBound() ) 2181cdf0e10cSrcweir { 2182cdf0e10cSrcweir for ( i=0; i<MAX_FAMILIES; i++ ) 2183cdf0e10cSrcweir pBoundItems [i]->ReBind(); 2184cdf0e10cSrcweir 2185cdf0e10cSrcweir bindListener(); 2186cdf0e10cSrcweir } 2187cdf0e10cSrcweir else if ( !pBox->IsVisible() && isBound() ) 2188cdf0e10cSrcweir { 2189cdf0e10cSrcweir for ( i=0; i<MAX_FAMILIES; i++ ) 2190cdf0e10cSrcweir pBoundItems[i]->UnBind(); 2191cdf0e10cSrcweir unbindListener(); 2192cdf0e10cSrcweir } 2193cdf0e10cSrcweir 2194cdf0e10cSrcweir return 0; 2195cdf0e10cSrcweir } 2196cdf0e10cSrcweir 2197cdf0e10cSrcweir // ----------------------------------------------------------------------- 2198cdf0e10cSrcweir 2199cdf0e10cSrcweir void SvxStyleToolBoxControl::StateChanged( 2200cdf0e10cSrcweir 2201cdf0e10cSrcweir sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState ) 2202cdf0e10cSrcweir 2203cdf0e10cSrcweir { 2204cdf0e10cSrcweir sal_uInt16 nId = GetId(); 2205cdf0e10cSrcweir ToolBox& rTbx = GetToolBox(); 2206cdf0e10cSrcweir SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)(rTbx.GetItemWindow( nId )); 2207cdf0e10cSrcweir TriState eTri = STATE_NOCHECK; 2208cdf0e10cSrcweir 2209cdf0e10cSrcweir DBG_ASSERT( pBox, "Control not found!" ); 2210cdf0e10cSrcweir 2211cdf0e10cSrcweir if ( SFX_ITEM_DISABLED == eState ) 2212cdf0e10cSrcweir pBox->Disable(); 2213cdf0e10cSrcweir else 2214cdf0e10cSrcweir pBox->Enable(); 2215cdf0e10cSrcweir 2216cdf0e10cSrcweir rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); 2217cdf0e10cSrcweir 2218cdf0e10cSrcweir switch ( eState ) 2219cdf0e10cSrcweir { 2220cdf0e10cSrcweir case SFX_ITEM_AVAILABLE: 2221cdf0e10cSrcweir eTri = ((const SfxBoolItem*)pState)->GetValue() 2222cdf0e10cSrcweir ? STATE_CHECK 2223cdf0e10cSrcweir : STATE_NOCHECK; 2224cdf0e10cSrcweir break; 2225cdf0e10cSrcweir 2226cdf0e10cSrcweir case SFX_ITEM_DONTCARE: 2227cdf0e10cSrcweir eTri = STATE_DONTKNOW; 2228cdf0e10cSrcweir break; 2229cdf0e10cSrcweir } 2230cdf0e10cSrcweir 2231cdf0e10cSrcweir rTbx.SetItemState( nId, eTri ); 2232cdf0e10cSrcweir 2233cdf0e10cSrcweir if ( SFX_ITEM_DISABLED != eState ) 2234cdf0e10cSrcweir Update(); 2235cdf0e10cSrcweir } 2236cdf0e10cSrcweir 2237cdf0e10cSrcweir // ----------------------------------------------------------------------- 2238cdf0e10cSrcweir 2239cdf0e10cSrcweir Window* SvxStyleToolBoxControl::CreateItemWindow( Window *pParent ) 2240cdf0e10cSrcweir { 2241cdf0e10cSrcweir SvxStyleBox_Impl* pBox = new SvxStyleBox_Impl( pParent, 2242cdf0e10cSrcweir SID_STYLE_APPLY, 2243cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StyleApply" )), 2244cdf0e10cSrcweir SFX_STYLE_FAMILY_PARA, 2245cdf0e10cSrcweir Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), 2246cdf0e10cSrcweir m_xFrame, 2247cdf0e10cSrcweir pImpl->aClearForm, 2248cdf0e10cSrcweir pImpl->aMore, 2249cdf0e10cSrcweir pImpl->bSpecModeWriter || pImpl->bSpecModeCalc ); 2250cdf0e10cSrcweir if( !pImpl->aDefaultStyles.empty()) 2251cdf0e10cSrcweir pBox->SetDefaultStyle( pImpl->aDefaultStyles[0] ); 2252cdf0e10cSrcweir // Set visibility listener to bind/unbind controller 2253cdf0e10cSrcweir pBox->SetVisibilityListener( LINK( this, SvxStyleToolBoxControl, VisibilityNotification )); 2254cdf0e10cSrcweir 2255cdf0e10cSrcweir return pBox; 2256cdf0e10cSrcweir } 2257cdf0e10cSrcweir 2258cdf0e10cSrcweir //======================================================================== 2259cdf0e10cSrcweir // class SvxFontNameToolBoxControl --------------------------------------- 2260cdf0e10cSrcweir //======================================================================== 2261cdf0e10cSrcweir 2262cdf0e10cSrcweir SvxFontNameToolBoxControl::SvxFontNameToolBoxControl( 2263cdf0e10cSrcweir sal_uInt16 nSlotId, 2264cdf0e10cSrcweir sal_uInt16 nId, 2265cdf0e10cSrcweir ToolBox& rTbx ) 2266cdf0e10cSrcweir 2267cdf0e10cSrcweir : SfxToolBoxControl( nSlotId, nId, rTbx ) 2268cdf0e10cSrcweir { 2269cdf0e10cSrcweir } 2270cdf0e10cSrcweir 2271cdf0e10cSrcweir // ----------------------------------------------------------------------- 2272cdf0e10cSrcweir 2273cdf0e10cSrcweir void SvxFontNameToolBoxControl::StateChanged( 2274cdf0e10cSrcweir 2275cdf0e10cSrcweir sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState ) 2276cdf0e10cSrcweir 2277cdf0e10cSrcweir { 2278cdf0e10cSrcweir sal_uInt16 nId = GetId(); 2279cdf0e10cSrcweir ToolBox& rTbx = GetToolBox(); 2280cdf0e10cSrcweir SvxFontNameBox_Impl* pBox = (SvxFontNameBox_Impl*)(rTbx.GetItemWindow( nId )); 2281cdf0e10cSrcweir 2282cdf0e10cSrcweir DBG_ASSERT( pBox, "Control not found!" ); 2283cdf0e10cSrcweir 2284cdf0e10cSrcweir if ( SFX_ITEM_DISABLED == eState ) 2285cdf0e10cSrcweir { 2286cdf0e10cSrcweir pBox->Disable(); 2287cdf0e10cSrcweir pBox->Update( (const SvxFontItem*)NULL ); 2288cdf0e10cSrcweir } 2289cdf0e10cSrcweir else 2290cdf0e10cSrcweir { 2291cdf0e10cSrcweir pBox->Enable(); 2292cdf0e10cSrcweir 2293cdf0e10cSrcweir if ( SFX_ITEM_AVAILABLE == eState ) 2294cdf0e10cSrcweir { 2295cdf0e10cSrcweir const SvxFontItem* pFontItem = dynamic_cast< const SvxFontItem* >( pState ); 2296cdf0e10cSrcweir 2297cdf0e10cSrcweir DBG_ASSERT( pFontItem, "svx::SvxFontNameToolBoxControl::StateChanged(), wrong item type!" ); 2298cdf0e10cSrcweir if( pFontItem ) 2299cdf0e10cSrcweir pBox->Update( pFontItem ); 2300cdf0e10cSrcweir } 2301cdf0e10cSrcweir else 2302cdf0e10cSrcweir pBox->SetText( String() ); 2303cdf0e10cSrcweir pBox->SaveValue(); 2304cdf0e10cSrcweir } 2305cdf0e10cSrcweir 2306cdf0e10cSrcweir rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); 2307cdf0e10cSrcweir } 2308cdf0e10cSrcweir 2309cdf0e10cSrcweir // ----------------------------------------------------------------------- 2310cdf0e10cSrcweir 2311cdf0e10cSrcweir Window* SvxFontNameToolBoxControl::CreateItemWindow( Window *pParent ) 2312cdf0e10cSrcweir { 2313cdf0e10cSrcweir SvxFontNameBox_Impl* pBox = new SvxFontNameBox_Impl( pParent, 2314cdf0e10cSrcweir Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), 2315cdf0e10cSrcweir m_xFrame,0); 2316cdf0e10cSrcweir return pBox; 2317cdf0e10cSrcweir } 2318cdf0e10cSrcweir 2319cdf0e10cSrcweir //======================================================================== 2320cdf0e10cSrcweir // class SvxFontColorToolBoxControl -------------------------------------- 2321cdf0e10cSrcweir //======================================================================== 2322cdf0e10cSrcweir 2323cdf0e10cSrcweir SvxFontColorToolBoxControl::SvxFontColorToolBoxControl( 2324cdf0e10cSrcweir sal_uInt16 nSlotId, 2325cdf0e10cSrcweir sal_uInt16 nId, 2326cdf0e10cSrcweir ToolBox& rTbx ) 2327cdf0e10cSrcweir 2328cdf0e10cSrcweir : SfxToolBoxControl( nSlotId, nId, rTbx ), 2329cdf0e10cSrcweir pBtnUpdater( new ::svx::ToolboxButtonColorUpdater( 2330cdf0e10cSrcweir nSlotId, nId, &GetToolBox(), TBX_UPDATER_MODE_CHAR_COLOR_NEW )) 2331cdf0e10cSrcweir { 2332cdf0e10cSrcweir rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) ); 2333cdf0e10cSrcweir } 2334cdf0e10cSrcweir 2335cdf0e10cSrcweir // ----------------------------------------------------------------------- 2336cdf0e10cSrcweir 2337cdf0e10cSrcweir SvxFontColorToolBoxControl::~SvxFontColorToolBoxControl() 2338cdf0e10cSrcweir { 2339cdf0e10cSrcweir delete pBtnUpdater; 2340cdf0e10cSrcweir } 2341cdf0e10cSrcweir 2342cdf0e10cSrcweir // ----------------------------------------------------------------------- 2343cdf0e10cSrcweir 2344cdf0e10cSrcweir SfxPopupWindowType SvxFontColorToolBoxControl::GetPopupWindowType() const 2345cdf0e10cSrcweir { 2346cdf0e10cSrcweir return SFX_POPUPWINDOW_ONCLICK; 2347cdf0e10cSrcweir } 2348cdf0e10cSrcweir 2349cdf0e10cSrcweir // ----------------------------------------------------------------------- 2350cdf0e10cSrcweir 2351cdf0e10cSrcweir SfxPopupWindow* SvxFontColorToolBoxControl::CreatePopupWindow() 2352cdf0e10cSrcweir { 2353cdf0e10cSrcweir SvxColorWindow_Impl* pColorWin = 2354cdf0e10cSrcweir new SvxColorWindow_Impl( 2355cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Color" )), 2356cdf0e10cSrcweir SID_ATTR_CHAR_COLOR, 2357cdf0e10cSrcweir m_xFrame, 2358cdf0e10cSrcweir SVX_RESSTR( RID_SVXITEMS_EXTRAS_CHARCOLOR ), 2359cdf0e10cSrcweir &GetToolBox() ); 2360cdf0e10cSrcweir 2361cdf0e10cSrcweir pColorWin->StartPopupMode( &GetToolBox(), 2362cdf0e10cSrcweir FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF ); 2363cdf0e10cSrcweir pColorWin->StartSelection(); 2364cdf0e10cSrcweir SetPopupWindow( pColorWin ); 2365cdf0e10cSrcweir return pColorWin; 2366cdf0e10cSrcweir } 2367cdf0e10cSrcweir 2368cdf0e10cSrcweir // ----------------------------------------------------------------------- 2369cdf0e10cSrcweir 2370cdf0e10cSrcweir void SvxFontColorToolBoxControl::StateChanged( 2371cdf0e10cSrcweir 2372cdf0e10cSrcweir sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState ) 2373cdf0e10cSrcweir 2374cdf0e10cSrcweir { 2375cdf0e10cSrcweir sal_uInt16 nId = GetId(); 2376cdf0e10cSrcweir ToolBox& rTbx = GetToolBox(); 2377cdf0e10cSrcweir const SvxColorItem* pItem = 0; 2378cdf0e10cSrcweir 2379cdf0e10cSrcweir if ( SFX_ITEM_DONTCARE != eState ) 2380cdf0e10cSrcweir pItem = PTR_CAST( SvxColorItem, pState ); 2381cdf0e10cSrcweir 2382cdf0e10cSrcweir if ( pItem ) 2383cdf0e10cSrcweir pBtnUpdater->Update( pItem->GetValue()); 2384cdf0e10cSrcweir 2385cdf0e10cSrcweir rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); 2386cdf0e10cSrcweir rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); 2387cdf0e10cSrcweir } 2388cdf0e10cSrcweir 2389cdf0e10cSrcweir //======================================================================== 2390cdf0e10cSrcweir // class SvxColorToolBoxControl -------------------------------- 2391cdf0e10cSrcweir //======================================================================== 2392cdf0e10cSrcweir 2393cdf0e10cSrcweir SvxColorToolBoxControl::SvxColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : 2394cdf0e10cSrcweir 2395cdf0e10cSrcweir SfxToolBoxControl( nSlotId, nId, rTbx ) 2396cdf0e10cSrcweir { 2397cdf0e10cSrcweir if ( nSlotId == SID_BACKGROUND_COLOR ) 2398cdf0e10cSrcweir rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); 2399cdf0e10cSrcweir else 2400cdf0e10cSrcweir rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) ); 2401cdf0e10cSrcweir rTbx.Invalidate(); 2402cdf0e10cSrcweir pBtnUpdater = new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() ); 2403cdf0e10cSrcweir } 2404cdf0e10cSrcweir 2405cdf0e10cSrcweir // ----------------------------------------------------------------------- 2406cdf0e10cSrcweir 2407cdf0e10cSrcweir SvxColorToolBoxControl::~SvxColorToolBoxControl() 2408cdf0e10cSrcweir { 2409cdf0e10cSrcweir delete pBtnUpdater; 2410cdf0e10cSrcweir } 2411cdf0e10cSrcweir 2412cdf0e10cSrcweir // ----------------------------------------------------------------------- 2413cdf0e10cSrcweir 2414cdf0e10cSrcweir SfxPopupWindowType SvxColorToolBoxControl::GetPopupWindowType() const 2415cdf0e10cSrcweir { 2416cdf0e10cSrcweir return SFX_POPUPWINDOW_ONCLICK; 2417cdf0e10cSrcweir } 2418cdf0e10cSrcweir 2419cdf0e10cSrcweir // ----------------------------------------------------------------------- 2420cdf0e10cSrcweir 2421cdf0e10cSrcweir SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow() 2422cdf0e10cSrcweir { 2423cdf0e10cSrcweir sal_uInt16 nResId = GetSlotId() == SID_BACKGROUND_COLOR ? 2424cdf0e10cSrcweir RID_SVXSTR_BACKGROUND : RID_SVXSTR_COLOR; 2425cdf0e10cSrcweir SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl( 2426cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:BackgroundColor" )), 2427cdf0e10cSrcweir SID_BACKGROUND_COLOR, 2428cdf0e10cSrcweir m_xFrame, 2429cdf0e10cSrcweir SVX_RESSTR(nResId), 2430cdf0e10cSrcweir &GetToolBox() ); 2431cdf0e10cSrcweir 2432cdf0e10cSrcweir pColorWin->StartPopupMode( &GetToolBox(), 2433cdf0e10cSrcweir FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF ); 2434cdf0e10cSrcweir pColorWin->StartSelection(); 2435cdf0e10cSrcweir SetPopupWindow( pColorWin ); 2436cdf0e10cSrcweir return pColorWin; 2437cdf0e10cSrcweir } 2438cdf0e10cSrcweir 2439cdf0e10cSrcweir // ----------------------------------------------------------------------- 2440cdf0e10cSrcweir 2441cdf0e10cSrcweir void SvxColorToolBoxControl::StateChanged( 2442cdf0e10cSrcweir 2443cdf0e10cSrcweir sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState ) 2444cdf0e10cSrcweir 2445cdf0e10cSrcweir { 2446cdf0e10cSrcweir const SvxColorItem* pItem = 0; 2447cdf0e10cSrcweir if ( SFX_ITEM_DONTCARE != eState ) 2448cdf0e10cSrcweir pItem = PTR_CAST( SvxColorItem, pState ); 2449cdf0e10cSrcweir 2450cdf0e10cSrcweir if ( pItem ) 2451cdf0e10cSrcweir pBtnUpdater->Update( pItem->GetValue() ); 2452cdf0e10cSrcweir 2453cdf0e10cSrcweir sal_uInt16 nId = GetId(); 2454cdf0e10cSrcweir ToolBox& rTbx = GetToolBox(); 2455cdf0e10cSrcweir rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); 2456cdf0e10cSrcweir rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); 2457cdf0e10cSrcweir } 2458cdf0e10cSrcweir 2459cdf0e10cSrcweir //======================================================================== 2460cdf0e10cSrcweir // class SvxFontColorExtToolBoxControl -------------------------------------- 2461cdf0e10cSrcweir //======================================================================== 2462cdf0e10cSrcweir 2463cdf0e10cSrcweir SvxFontColorExtToolBoxControl::SvxFontColorExtToolBoxControl( 2464cdf0e10cSrcweir sal_uInt16 nSlotId, 2465cdf0e10cSrcweir sal_uInt16 nId, 2466cdf0e10cSrcweir ToolBox& rTbx ) : 2467cdf0e10cSrcweir 2468cdf0e10cSrcweir SfxToolBoxControl( nSlotId, nId, rTbx ), 2469cdf0e10cSrcweir pBtnUpdater(0) 2470cdf0e10cSrcweir { 2471cdf0e10cSrcweir rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) ); 2472cdf0e10cSrcweir // The following commands are available at the writer module. 2473cdf0e10cSrcweir if ( SID_ATTR_CHAR_COLOR2 == nSlotId ) 2474cdf0e10cSrcweir addStatusListener( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharColorExt" ))); 2475cdf0e10cSrcweir else 2476cdf0e10cSrcweir addStatusListener( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharBackgroundExt" ))); 2477cdf0e10cSrcweir 2478cdf0e10cSrcweir sal_uInt16 nMode = SID_ATTR_CHAR_COLOR2 == nSlotId 2479cdf0e10cSrcweir ? TBX_UPDATER_MODE_CHAR_COLOR_NEW : TBX_UPDATER_MODE_CHAR_COLOR_NEW; 2480cdf0e10cSrcweir pBtnUpdater = new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox(), nMode ); 2481cdf0e10cSrcweir } 2482cdf0e10cSrcweir 2483cdf0e10cSrcweir // ----------------------------------------------------------------------- 2484cdf0e10cSrcweir 2485cdf0e10cSrcweir SvxFontColorExtToolBoxControl::~SvxFontColorExtToolBoxControl() 2486cdf0e10cSrcweir { 2487cdf0e10cSrcweir delete pBtnUpdater; 2488cdf0e10cSrcweir } 2489cdf0e10cSrcweir 2490cdf0e10cSrcweir // ----------------------------------------------------------------------- 2491cdf0e10cSrcweir 2492cdf0e10cSrcweir SfxPopupWindowType SvxFontColorExtToolBoxControl::GetPopupWindowType() const 2493cdf0e10cSrcweir { 2494cdf0e10cSrcweir return SFX_POPUPWINDOW_ONTIMEOUT; 2495cdf0e10cSrcweir } 2496cdf0e10cSrcweir 2497cdf0e10cSrcweir // ----------------------------------------------------------------------- 2498cdf0e10cSrcweir 2499cdf0e10cSrcweir SfxPopupWindow* SvxFontColorExtToolBoxControl::CreatePopupWindow() 2500cdf0e10cSrcweir { 2501cdf0e10cSrcweir SvxColorWindow_Impl* pColorWin = 2502cdf0e10cSrcweir new SvxColorWindow_Impl( 2503cdf0e10cSrcweir m_aCommandURL, 2504cdf0e10cSrcweir GetSlotId(), 2505cdf0e10cSrcweir m_xFrame, 2506cdf0e10cSrcweir SVX_RESSTR( RID_SVXITEMS_EXTRAS_CHARCOLOR ), 2507cdf0e10cSrcweir &GetToolBox() ); 2508cdf0e10cSrcweir 2509cdf0e10cSrcweir if ( GetSlotId() == SID_ATTR_CHAR_COLOR_BACKGROUND ) 2510cdf0e10cSrcweir pColorWin->SetText( SVX_RESSTR( RID_SVXSTR_EXTRAS_CHARBACKGROUND ) ); 2511cdf0e10cSrcweir 2512cdf0e10cSrcweir pColorWin->StartPopupMode( &GetToolBox(), 2513cdf0e10cSrcweir FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF ); 2514cdf0e10cSrcweir pColorWin->StartSelection(); 2515cdf0e10cSrcweir SetPopupWindow( pColorWin ); 2516cdf0e10cSrcweir return pColorWin; 2517cdf0e10cSrcweir } 2518cdf0e10cSrcweir 2519cdf0e10cSrcweir // ----------------------------------------------------------------------- 2520cdf0e10cSrcweir 2521cdf0e10cSrcweir void SvxFontColorExtToolBoxControl::StateChanged( 2522cdf0e10cSrcweir 2523cdf0e10cSrcweir sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 2524cdf0e10cSrcweir 2525cdf0e10cSrcweir { 2526cdf0e10cSrcweir sal_uInt16 nId = GetId(); 2527cdf0e10cSrcweir ToolBox& rTbx = GetToolBox(); 2528cdf0e10cSrcweir const SvxColorItem* pItem = 0; 2529cdf0e10cSrcweir 2530cdf0e10cSrcweir if ( nSID == SID_ATTR_CHAR_COLOR_EXT || 2531cdf0e10cSrcweir nSID == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT ) 2532cdf0e10cSrcweir { 2533cdf0e10cSrcweir if ( SFX_ITEM_DONTCARE != eState ) 2534cdf0e10cSrcweir { 2535cdf0e10cSrcweir const SfxBoolItem* pBool = PTR_CAST( SfxBoolItem, pState ); 2536cdf0e10cSrcweir rTbx.CheckItem( nId, pBool && pBool->GetValue()); 2537cdf0e10cSrcweir } 2538cdf0e10cSrcweir rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); 2539cdf0e10cSrcweir } 2540cdf0e10cSrcweir else 2541cdf0e10cSrcweir { 2542cdf0e10cSrcweir if ( SFX_ITEM_DONTCARE != eState ) 2543cdf0e10cSrcweir pItem = PTR_CAST( SvxColorItem, pState ); 2544cdf0e10cSrcweir 2545cdf0e10cSrcweir if ( pItem ) 2546cdf0e10cSrcweir pBtnUpdater->Update( pItem->GetValue() ); 2547cdf0e10cSrcweir } 2548cdf0e10cSrcweir } 2549cdf0e10cSrcweir 2550cdf0e10cSrcweir // ----------------------------------------------------------------------- 2551cdf0e10cSrcweir 2552cdf0e10cSrcweir void SvxFontColorExtToolBoxControl::Select( sal_Bool ) 2553cdf0e10cSrcweir { 2554cdf0e10cSrcweir OUString aCommand; 2555cdf0e10cSrcweir OUString aParamName; 2556cdf0e10cSrcweir if ( SID_ATTR_CHAR_COLOR2 == GetSlotId() ) 2557cdf0e10cSrcweir { 2558cdf0e10cSrcweir aCommand = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharColorExt" )); 2559cdf0e10cSrcweir aParamName = OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColorExt" )); 2560cdf0e10cSrcweir } 2561cdf0e10cSrcweir else 2562cdf0e10cSrcweir { 2563cdf0e10cSrcweir aCommand = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharBackgroundExt" )); 2564cdf0e10cSrcweir aParamName = OUString( RTL_CONSTASCII_USTRINGPARAM( "CharBackgroundExt" )); 2565cdf0e10cSrcweir } 2566cdf0e10cSrcweir 2567cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 ); 2568cdf0e10cSrcweir aArgs[0].Name = aParamName; 2569cdf0e10cSrcweir aArgs[0].Value = makeAny( GetToolBox().IsItemChecked( GetId() )); 2570cdf0e10cSrcweir Dispatch( aCommand, aArgs ); 2571cdf0e10cSrcweir } 2572cdf0e10cSrcweir 2573cdf0e10cSrcweir //======================================================================== 2574cdf0e10cSrcweir // class SvxFrameToolBoxControl ------------------------------------------ 2575cdf0e10cSrcweir //======================================================================== 2576cdf0e10cSrcweir 2577cdf0e10cSrcweir SvxFrameToolBoxControl::SvxFrameToolBoxControl( 2578cdf0e10cSrcweir sal_uInt16 nSlotId, 2579cdf0e10cSrcweir sal_uInt16 nId, 2580cdf0e10cSrcweir ToolBox& rTbx ) 2581cdf0e10cSrcweir 2582cdf0e10cSrcweir : SfxToolBoxControl( nSlotId, nId, rTbx ) 2583cdf0e10cSrcweir { 2584cdf0e10cSrcweir rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); 2585cdf0e10cSrcweir } 2586cdf0e10cSrcweir 2587cdf0e10cSrcweir // ----------------------------------------------------------------------- 2588cdf0e10cSrcweir 2589cdf0e10cSrcweir SfxPopupWindowType SvxFrameToolBoxControl::GetPopupWindowType() const 2590cdf0e10cSrcweir { 2591cdf0e10cSrcweir return SFX_POPUPWINDOW_ONCLICK; 2592cdf0e10cSrcweir } 2593cdf0e10cSrcweir 2594cdf0e10cSrcweir // ----------------------------------------------------------------------- 2595cdf0e10cSrcweir 2596cdf0e10cSrcweir SfxPopupWindow* SvxFrameToolBoxControl::CreatePopupWindow() 2597cdf0e10cSrcweir { 2598cdf0e10cSrcweir SvxFrameWindow_Impl* pFrameWin = new SvxFrameWindow_Impl( 2599cdf0e10cSrcweir GetSlotId(), m_xFrame, &GetToolBox() ); 2600cdf0e10cSrcweir 2601cdf0e10cSrcweir pFrameWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS | FLOATWIN_POPUPMODE_ALLOWTEAROFF ); 2602cdf0e10cSrcweir pFrameWin->StartSelection(); 2603cdf0e10cSrcweir SetPopupWindow( pFrameWin ); 2604cdf0e10cSrcweir 2605cdf0e10cSrcweir return pFrameWin; 2606cdf0e10cSrcweir } 2607cdf0e10cSrcweir 2608cdf0e10cSrcweir // ----------------------------------------------------------------------- 2609cdf0e10cSrcweir 2610cdf0e10cSrcweir void SvxFrameToolBoxControl::StateChanged( 2611cdf0e10cSrcweir 2612cdf0e10cSrcweir sal_uInt16, SfxItemState eState, const SfxPoolItem* ) 2613cdf0e10cSrcweir 2614cdf0e10cSrcweir { 2615cdf0e10cSrcweir sal_uInt16 nId = GetId(); 2616cdf0e10cSrcweir ToolBox& rTbx = GetToolBox(); 2617cdf0e10cSrcweir 2618cdf0e10cSrcweir rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); 2619cdf0e10cSrcweir rTbx.SetItemState( nId, (SFX_ITEM_DONTCARE == eState) 2620cdf0e10cSrcweir ? STATE_DONTKNOW 2621cdf0e10cSrcweir : STATE_NOCHECK ); 2622cdf0e10cSrcweir } 2623cdf0e10cSrcweir 2624cdf0e10cSrcweir //======================================================================== 2625cdf0e10cSrcweir // class SvxFrameLineStyleToolBoxControl --------------------------------- 2626cdf0e10cSrcweir //======================================================================== 2627cdf0e10cSrcweir 2628cdf0e10cSrcweir SvxFrameLineStyleToolBoxControl::SvxFrameLineStyleToolBoxControl( 2629cdf0e10cSrcweir sal_uInt16 nSlotId, 2630cdf0e10cSrcweir sal_uInt16 nId, 2631cdf0e10cSrcweir ToolBox& rTbx ) 2632cdf0e10cSrcweir 2633cdf0e10cSrcweir : SfxToolBoxControl( nSlotId, nId, rTbx ) 2634cdf0e10cSrcweir { 2635cdf0e10cSrcweir rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); 2636cdf0e10cSrcweir } 2637cdf0e10cSrcweir 2638cdf0e10cSrcweir // ----------------------------------------------------------------------- 2639cdf0e10cSrcweir 2640cdf0e10cSrcweir SfxPopupWindowType SvxFrameLineStyleToolBoxControl::GetPopupWindowType() const 2641cdf0e10cSrcweir { 2642cdf0e10cSrcweir return SFX_POPUPWINDOW_ONCLICK; 2643cdf0e10cSrcweir } 2644cdf0e10cSrcweir 2645cdf0e10cSrcweir // ----------------------------------------------------------------------- 2646cdf0e10cSrcweir 2647cdf0e10cSrcweir SfxPopupWindow* SvxFrameLineStyleToolBoxControl::CreatePopupWindow() 2648cdf0e10cSrcweir { 2649cdf0e10cSrcweir SvxLineWindow_Impl* pLineWin = new SvxLineWindow_Impl( GetSlotId(), m_xFrame, &GetToolBox() ); 2650cdf0e10cSrcweir pLineWin->StartPopupMode( &GetToolBox(), sal_True ); 2651cdf0e10cSrcweir pLineWin->StartSelection(); 2652cdf0e10cSrcweir SetPopupWindow( pLineWin ); 2653cdf0e10cSrcweir 2654cdf0e10cSrcweir return pLineWin; 2655cdf0e10cSrcweir } 2656cdf0e10cSrcweir 2657cdf0e10cSrcweir // ----------------------------------------------------------------------- 2658cdf0e10cSrcweir 2659cdf0e10cSrcweir void SvxFrameLineStyleToolBoxControl::StateChanged( 2660cdf0e10cSrcweir 2661cdf0e10cSrcweir sal_uInt16 , SfxItemState eState, const SfxPoolItem* ) 2662cdf0e10cSrcweir { 2663cdf0e10cSrcweir sal_uInt16 nId = GetId(); 2664cdf0e10cSrcweir ToolBox& rTbx = GetToolBox(); 2665cdf0e10cSrcweir 2666cdf0e10cSrcweir rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); 2667cdf0e10cSrcweir rTbx.SetItemState( nId, (SFX_ITEM_DONTCARE == eState) 2668cdf0e10cSrcweir ? STATE_DONTKNOW 2669cdf0e10cSrcweir : STATE_NOCHECK ); 2670cdf0e10cSrcweir } 2671cdf0e10cSrcweir 2672cdf0e10cSrcweir //======================================================================== 2673cdf0e10cSrcweir // class SvxFrameLineColorToolBoxControl --------------------------------- 2674cdf0e10cSrcweir //======================================================================== 2675cdf0e10cSrcweir 2676cdf0e10cSrcweir SvxFrameLineColorToolBoxControl::SvxFrameLineColorToolBoxControl( 2677cdf0e10cSrcweir sal_uInt16 nSlotId, 2678cdf0e10cSrcweir sal_uInt16 nId, 2679cdf0e10cSrcweir ToolBox& rTbx ) : 2680cdf0e10cSrcweir 2681cdf0e10cSrcweir SfxToolBoxControl( nSlotId, nId, rTbx ), 2682cdf0e10cSrcweir pBtnUpdater(new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() )) 2683cdf0e10cSrcweir { 2684cdf0e10cSrcweir rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); 2685cdf0e10cSrcweir } 2686cdf0e10cSrcweir 2687cdf0e10cSrcweir // ----------------------------------------------------------------------- 2688cdf0e10cSrcweir 2689cdf0e10cSrcweir SvxFrameLineColorToolBoxControl::~SvxFrameLineColorToolBoxControl() 2690cdf0e10cSrcweir { 2691cdf0e10cSrcweir 2692cdf0e10cSrcweir delete pBtnUpdater; 2693cdf0e10cSrcweir } 2694cdf0e10cSrcweir 2695cdf0e10cSrcweir // ----------------------------------------------------------------------- 2696cdf0e10cSrcweir 2697cdf0e10cSrcweir SfxPopupWindowType SvxFrameLineColorToolBoxControl::GetPopupWindowType() const 2698cdf0e10cSrcweir { 2699cdf0e10cSrcweir return SFX_POPUPWINDOW_ONCLICK; 2700cdf0e10cSrcweir } 2701cdf0e10cSrcweir 2702cdf0e10cSrcweir // ----------------------------------------------------------------------- 2703cdf0e10cSrcweir 2704cdf0e10cSrcweir SfxPopupWindow* SvxFrameLineColorToolBoxControl::CreatePopupWindow() 2705cdf0e10cSrcweir { 2706cdf0e10cSrcweir SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl( 2707cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FrameLineColor" )), 2708cdf0e10cSrcweir SID_FRAME_LINECOLOR, 2709cdf0e10cSrcweir m_xFrame, 2710cdf0e10cSrcweir SVX_RESSTR(RID_SVXSTR_FRAME_COLOR), 2711cdf0e10cSrcweir &GetToolBox() ); 2712cdf0e10cSrcweir 2713cdf0e10cSrcweir pColorWin->StartPopupMode( &GetToolBox(), 2714cdf0e10cSrcweir FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF ); 2715cdf0e10cSrcweir pColorWin->StartSelection(); 2716cdf0e10cSrcweir SetPopupWindow( pColorWin ); 2717cdf0e10cSrcweir return pColorWin; 2718cdf0e10cSrcweir } 2719cdf0e10cSrcweir 2720cdf0e10cSrcweir // ----------------------------------------------------------------------- 2721cdf0e10cSrcweir 2722cdf0e10cSrcweir void SvxFrameLineColorToolBoxControl::StateChanged( 2723cdf0e10cSrcweir 2724cdf0e10cSrcweir sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState ) 2725cdf0e10cSrcweir 2726cdf0e10cSrcweir { 2727cdf0e10cSrcweir sal_uInt16 nId = GetId(); 2728cdf0e10cSrcweir ToolBox& rTbx = GetToolBox(); 2729cdf0e10cSrcweir rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); 2730cdf0e10cSrcweir rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); 2731cdf0e10cSrcweir 2732cdf0e10cSrcweir const SvxColorItem* pItem = 0; 2733cdf0e10cSrcweir if ( SFX_ITEM_DONTCARE != eState ) 2734cdf0e10cSrcweir { 2735cdf0e10cSrcweir pItem = PTR_CAST( SvxColorItem, pState ); 2736cdf0e10cSrcweir if ( pItem ) 2737cdf0e10cSrcweir pBtnUpdater->Update( pItem->GetValue()); 2738cdf0e10cSrcweir } 2739cdf0e10cSrcweir } 2740cdf0e10cSrcweir 2741cdf0e10cSrcweir // class SvxReloadControllerItem_Impl ------------------------------------ 2742cdf0e10cSrcweir 2743cdf0e10cSrcweir class SvxReloadControllerItem_Impl 2744cdf0e10cSrcweir { 2745cdf0e10cSrcweir public: 2746cdf0e10cSrcweir Image* pNormalImage; 2747cdf0e10cSrcweir Image* pSpecialImage; 2748cdf0e10cSrcweir 2749cdf0e10cSrcweir SvxReloadControllerItem_Impl() : 2750cdf0e10cSrcweir pNormalImage( new Image( SVX_RES( RID_SVX_RELOAD_NORMAL ) ) ), pSpecialImage( 0 ) {} 2751cdf0e10cSrcweir ~SvxReloadControllerItem_Impl() { delete pNormalImage; delete pSpecialImage; } 2752cdf0e10cSrcweir 2753cdf0e10cSrcweir Image& GetNormalImage() { return *pNormalImage; } 2754cdf0e10cSrcweir Image& GetSpecialImage() 2755cdf0e10cSrcweir { 2756cdf0e10cSrcweir if ( !pSpecialImage ) 2757cdf0e10cSrcweir pSpecialImage = new Image( SVX_RES( RID_SVX_RELOAD_SPECIAL ) ); 2758cdf0e10cSrcweir return *pSpecialImage; 2759cdf0e10cSrcweir } 2760cdf0e10cSrcweir }; 2761cdf0e10cSrcweir 2762cdf0e10cSrcweir // ----------------------------------------------------------------------- 2763cdf0e10cSrcweir 2764cdf0e10cSrcweir SvxReloadControllerItem::SvxReloadControllerItem( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) 2765cdf0e10cSrcweir : SfxToolBoxControl( nSlotId, nId, rTbx ) 2766cdf0e10cSrcweir , pImpl( new SvxReloadControllerItem_Impl ) 2767cdf0e10cSrcweir { 2768cdf0e10cSrcweir rTbx.SetItemImage( nId, pImpl->GetNormalImage() ); 2769cdf0e10cSrcweir } 2770cdf0e10cSrcweir 2771cdf0e10cSrcweir // ----------------------------------------------------------------------- 2772cdf0e10cSrcweir 2773cdf0e10cSrcweir SvxReloadControllerItem::~SvxReloadControllerItem() 2774cdf0e10cSrcweir { 2775cdf0e10cSrcweir delete pImpl; 2776cdf0e10cSrcweir } 2777cdf0e10cSrcweir 2778cdf0e10cSrcweir // ----------------------------------------------------------------------- 2779cdf0e10cSrcweir 2780cdf0e10cSrcweir void SvxReloadControllerItem::StateChanged( 2781cdf0e10cSrcweir sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState ) 2782cdf0e10cSrcweir { 2783cdf0e10cSrcweir SfxBoolItem* pItem = PTR_CAST( SfxBoolItem, pState ); 2784cdf0e10cSrcweir ToolBox& rBox = GetToolBox(); 2785cdf0e10cSrcweir if( pItem ) 2786cdf0e10cSrcweir { 2787cdf0e10cSrcweir rBox.SetItemImage( GetId(), 2788cdf0e10cSrcweir pItem->GetValue() ? pImpl->GetSpecialImage() : 2789cdf0e10cSrcweir pImpl->GetNormalImage() ); 2790cdf0e10cSrcweir } 2791cdf0e10cSrcweir rBox.EnableItem( GetId(), eState != SFX_ITEM_DISABLED ); 2792cdf0e10cSrcweir } 2793cdf0e10cSrcweir 2794cdf0e10cSrcweir //======================================================================== 2795cdf0e10cSrcweir // class SvxSimpleUndoRedoController ------------------------------------- 2796cdf0e10cSrcweir //======================================================================== 2797cdf0e10cSrcweir 2798cdf0e10cSrcweir SvxSimpleUndoRedoController::SvxSimpleUndoRedoController( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) 2799cdf0e10cSrcweir :SfxToolBoxControl( nSlotId, nId, rTbx ) 2800cdf0e10cSrcweir { 2801cdf0e10cSrcweir aDefaultText = rTbx.GetItemText( nId ); 2802cdf0e10cSrcweir } 2803cdf0e10cSrcweir 2804cdf0e10cSrcweir // ----------------------------------------------------------------------- 2805cdf0e10cSrcweir 2806cdf0e10cSrcweir SvxSimpleUndoRedoController::~SvxSimpleUndoRedoController() 2807cdf0e10cSrcweir { 2808cdf0e10cSrcweir } 2809cdf0e10cSrcweir 2810cdf0e10cSrcweir // ----------------------------------------------------------------------- 2811cdf0e10cSrcweir 2812cdf0e10cSrcweir void SvxSimpleUndoRedoController::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState ) 2813cdf0e10cSrcweir { 2814cdf0e10cSrcweir SfxStringItem* pItem = PTR_CAST( SfxStringItem, pState ); 2815cdf0e10cSrcweir ToolBox& rBox = GetToolBox(); 2816cdf0e10cSrcweir if ( pItem && eState != SFX_ITEM_DISABLED ) 2817cdf0e10cSrcweir { 2818cdf0e10cSrcweir ::rtl::OUString aNewText( MnemonicGenerator::EraseAllMnemonicChars( pItem->GetValue() ) ); 2819cdf0e10cSrcweir rBox.SetQuickHelpText( GetId(), aNewText ); 2820cdf0e10cSrcweir } 2821cdf0e10cSrcweir if ( eState == SFX_ITEM_DISABLED ) 2822cdf0e10cSrcweir rBox.SetQuickHelpText( GetId(), aDefaultText ); 2823cdf0e10cSrcweir rBox.EnableItem( GetId(), eState != SFX_ITEM_DISABLED ); 2824cdf0e10cSrcweir } 2825cdf0e10cSrcweir 2826cdf0e10cSrcweir //======================================================================== 2827cdf0e10cSrcweir 2828cdf0e10cSrcweir void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet ) 2829cdf0e10cSrcweir { 2830cdf0e10cSrcweir Size aSize = rWin.GetOutputSizePixel(); 2831cdf0e10cSrcweir aSize.Width() -= 4; 2832cdf0e10cSrcweir aSize.Height() -= 4; 2833cdf0e10cSrcweir rValueSet.SetPosSizePixel( Point(2,2), aSize ); 2834cdf0e10cSrcweir } 2835cdf0e10cSrcweir 2836cdf0e10cSrcweir // ----------------------------------------------------------------------- 2837cdf0e10cSrcweir 2838cdf0e10cSrcweir void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize ) 2839cdf0e10cSrcweir { 2840cdf0e10cSrcweir Size aSize = rValueSet.CalcWindowSizePixel( aItemSize ); 2841cdf0e10cSrcweir aSize.Width() += 4; 2842cdf0e10cSrcweir aSize.Height() += 4; 2843cdf0e10cSrcweir rWin.SetOutputSizePixel( aSize ); 2844cdf0e10cSrcweir } 2845cdf0e10cSrcweir 2846cdf0e10cSrcweir // ----------------------------------------------------------------------- 2847cdf0e10cSrcweir 2848cdf0e10cSrcweir sal_Bool lcl_FontChangedHint( const SfxHint &rHint ) 2849cdf0e10cSrcweir { 2850cdf0e10cSrcweir SfxPoolItemHint *pItemHint = PTR_CAST(SfxPoolItemHint, &rHint); 2851cdf0e10cSrcweir if ( pItemHint ) 2852cdf0e10cSrcweir { 2853cdf0e10cSrcweir SfxPoolItem *pItem = pItemHint->GetObject(); 2854cdf0e10cSrcweir return ( pItem->Which() == SID_ATTR_CHAR_FONTLIST ); 2855cdf0e10cSrcweir } 2856cdf0e10cSrcweir else 2857cdf0e10cSrcweir { 2858cdf0e10cSrcweir SfxSimpleHint* pSimpleHint = PTR_CAST(SfxSimpleHint, &rHint); 2859cdf0e10cSrcweir return pSimpleHint && ( SFX_HINT_DATACHANGED == 2860cdf0e10cSrcweir ( pSimpleHint->GetId() & SFX_HINT_DATACHANGED ) ); 2861cdf0e10cSrcweir } 2862cdf0e10cSrcweir } 2863cdf0e10cSrcweir // ----------------------------------------------------------------------------- 2864cdf0e10cSrcweir Reference< ::com::sun::star::accessibility::XAccessible > SvxFontNameBox_Impl::CreateAccessible() 2865cdf0e10cSrcweir { 2866cdf0e10cSrcweir FillList(); 2867cdf0e10cSrcweir return FontNameBox::CreateAccessible(); 2868cdf0e10cSrcweir } 2869