tbxcustomshapes.cxx (f6e50924) | tbxcustomshapes.cxx (201d50ff) |
---|---|
1/************************************************************** | 1/************************************************************** |
2 * | 2 * |
3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at | 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at |
10 * | 10 * |
11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
12 * | 12 * |
13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. | 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. |
19 * | 19 * |
20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_svx.hxx" 26 27#include <string> // HACK: prevent conflict between STLPORT and Workshop headers --- 12 unchanged lines hidden (view full) --- 40#include <sfx2/imagemgr.hxx> 41#include <vcl/svapp.hxx> 42#include "svx/tbxcustomshapes.hxx" 43 44SFX_IMPL_TOOLBOX_CONTROL(SvxTbxCtlCustomShapes, SfxBoolItem); 45 46/************************************************************************* 47|* | 20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_svx.hxx" 26 27#include <string> // HACK: prevent conflict between STLPORT and Workshop headers --- 12 unchanged lines hidden (view full) --- 40#include <sfx2/imagemgr.hxx> 41#include <vcl/svapp.hxx> 42#include "svx/tbxcustomshapes.hxx" 43 44SFX_IMPL_TOOLBOX_CONTROL(SvxTbxCtlCustomShapes, SfxBoolItem); 45 46/************************************************************************* 47|* |
48|* 49|* | |
50\************************************************************************/ 51 52SvxTbxCtlCustomShapes::SvxTbxCtlCustomShapes( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : 53 SfxToolBoxControl( nSlotId, nId, rTbx ), 54 m_aSubTbxResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/" ) ) 55{ 56 switch( nSlotId ) 57 { 58 default : 59 { 60 DBG_ASSERT( false, "SvxTbxCtlCustomShapes: unknown slot executed. ?" ); 61 } 62 case SID_DRAWTBX_CS_BASIC : 63 { | 48\************************************************************************/ 49 50SvxTbxCtlCustomShapes::SvxTbxCtlCustomShapes( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : 51 SfxToolBoxControl( nSlotId, nId, rTbx ), 52 m_aSubTbxResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/" ) ) 53{ 54 switch( nSlotId ) 55 { 56 default : 57 { 58 DBG_ASSERT( false, "SvxTbxCtlCustomShapes: unknown slot executed. ?" ); 59 } 60 case SID_DRAWTBX_CS_BASIC : 61 { |
64 m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:BasicShapes.diamond" ) ); 65 m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "basicshapes" ) ); | 62 m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:BasicShapes.diamond" ) ); 63 m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "basicshapes" ) ); |
66 } 67 break; 68 69 case SID_DRAWTBX_CS_SYMBOL : 70 { | 64 } 65 break; 66 67 case SID_DRAWTBX_CS_SYMBOL : 68 { |
71 m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SymbolShapes.smiley" ) ); | 69 m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SymbolShapes.smiley" ) ); |
72 m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "symbolshapes" ) ); 73 } 74 break; 75 76 case SID_DRAWTBX_CS_ARROW : 77 { | 70 m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "symbolshapes" ) ); 71 } 72 break; 73 74 case SID_DRAWTBX_CS_ARROW : 75 { |
78 m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ArrowShapes.left-right-arrow" ) ); | 76 m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ArrowShapes.left-right-arrow" ) ); |
79 m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "arrowshapes" ) ); 80 } 81 break; 82 case SID_DRAWTBX_CS_FLOWCHART : 83 { 84 m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FlowChartShapes.flowchart-internal-storage" ) ); 85 m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "flowchartshapes" ) ); 86 } --- 6 unchanged lines hidden (view full) --- 93 break; 94 case SID_DRAWTBX_CS_STAR : 95 { 96 m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StarShapes.star5" ) ); 97 m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "starshapes" ) ); 98 } 99 break; 100 } | 77 m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "arrowshapes" ) ); 78 } 79 break; 80 case SID_DRAWTBX_CS_FLOWCHART : 81 { 82 m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FlowChartShapes.flowchart-internal-storage" ) ); 83 m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "flowchartshapes" ) ); 84 } --- 6 unchanged lines hidden (view full) --- 91 break; 92 case SID_DRAWTBX_CS_STAR : 93 { 94 m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StarShapes.star5" ) ); 95 m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "starshapes" ) ); 96 } 97 break; 98 } |
101 m_aSubTbxResName += m_aSubTbName; | 99 m_aSubTbxResName += m_aSubTbName; |
102 rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) ); 103 rTbx.Invalidate(); 104} 105 106/************************************************************************* | 100 rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) ); 101 rTbx.Invalidate(); 102} 103 104/************************************************************************* |
107|* | |
108|* Benachrichtigung, wenn sich der Applikationsstatus geaendert hat | 105|* Benachrichtigung, wenn sich der Applikationsstatus geaendert hat |
109|* | |
110\************************************************************************/ 111 112void SvxTbxCtlCustomShapes::StateChanged( sal_uInt16 nSID, SfxItemState eState, | 106\************************************************************************/ 107 108void SvxTbxCtlCustomShapes::StateChanged( sal_uInt16 nSID, SfxItemState eState, |
113 const SfxPoolItem* pState ) | 109 const SfxPoolItem* pState ) |
114{ | 110{ |
115 SfxToolBoxControl::StateChanged( nSID, eState, pState ); | 111 SfxToolBoxControl::StateChanged( nSID, eState, pState ); |
116} 117 118/************************************************************************* | 112} 113 114/************************************************************************* |
119|* | |
120|* Wenn man ein PopupWindow erzeugen will | 115|* Wenn man ein PopupWindow erzeugen will |
121|* | |
122\************************************************************************/ 123 124SfxPopupWindowType SvxTbxCtlCustomShapes::GetPopupWindowType() const 125{ 126 return( m_aCommand.getLength() == 0 ? SFX_POPUPWINDOW_ONCLICK : SFX_POPUPWINDOW_ONTIMEOUT); 127} 128 129/************************************************************************* | 116\************************************************************************/ 117 118SfxPopupWindowType SvxTbxCtlCustomShapes::GetPopupWindowType() const 119{ 120 return( m_aCommand.getLength() == 0 ? SFX_POPUPWINDOW_ONCLICK : SFX_POPUPWINDOW_ONTIMEOUT); 121} 122 123/************************************************************************* |
130|* | |
131|* Hier wird das Fenster erzeugt 132|* Lage der Toolbox mit GetToolBox() abfragbar 133|* rItemRect sind die Screen-Koordinaten | 124|* Hier wird das Fenster erzeugt 125|* Lage der Toolbox mit GetToolBox() abfragbar 126|* rItemRect sind die Screen-Koordinaten |
134|* | |
135\************************************************************************/ 136 137SfxPopupWindow* SvxTbxCtlCustomShapes::CreatePopupWindow() 138{ | 127\************************************************************************/ 128 129SfxPopupWindow* SvxTbxCtlCustomShapes::CreatePopupWindow() 130{ |
139 createAndPositionSubToolBar( m_aSubTbxResName ); | 131 createAndPositionSubToolBar( m_aSubTbxResName ); |
140 return NULL; 141} 142 143// ----------------------------------------------------------------------- 144 145void SvxTbxCtlCustomShapes::Select( sal_Bool /*bMod1*/ ) 146{ 147 if ( m_aCommand.getLength() > 0 ) 148 { | 132 return NULL; 133} 134 135// ----------------------------------------------------------------------- 136 137void SvxTbxCtlCustomShapes::Select( sal_Bool /*bMod1*/ ) 138{ 139 if ( m_aCommand.getLength() > 0 ) 140 { |
149 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aParamSeq( 0 ); | 141 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aParamSeq( 0 ); |
150 Dispatch( m_aCommand, aParamSeq ); 151 } 152} 153 154 155::sal_Bool SAL_CALL SvxTbxCtlCustomShapes::opensSubToolbar() throw (::com::sun::star::uno::RuntimeException) 156{ | 142 Dispatch( m_aCommand, aParamSeq ); 143 } 144} 145 146 147::sal_Bool SAL_CALL SvxTbxCtlCustomShapes::opensSubToolbar() throw (::com::sun::star::uno::RuntimeException) 148{ |
157 // We control a sub-toolbar therefor, we have to return true. 158 return sal_True; | 149 // We control a sub-toolbar therefor, we have to return true. 150 return sal_True; |
159} 160 161::rtl::OUString SAL_CALL SvxTbxCtlCustomShapes::getSubToolbarName() throw (::com::sun::star::uno::RuntimeException) 162{ | 151} 152 153::rtl::OUString SAL_CALL SvxTbxCtlCustomShapes::getSubToolbarName() throw (::com::sun::star::uno::RuntimeException) 154{ |
163 // Provide the controlled sub-toolbar name, so we are notified whenever 164 // this toolbar executes a function. 165 return m_aSubTbName; | 155 // Provide the controlled sub-toolbar name, so we are notified whenever 156 // this toolbar executes a function. 157 return m_aSubTbName; |
166} 167 168void SAL_CALL SvxTbxCtlCustomShapes::functionSelected( const ::rtl::OUString& rCommand ) throw (::com::sun::star::uno::RuntimeException) 169{ | 158} 159 160void SAL_CALL SvxTbxCtlCustomShapes::functionSelected( const ::rtl::OUString& rCommand ) throw (::com::sun::star::uno::RuntimeException) 161{ |
170 // remind the new command 171 m_aCommand = rCommand; 172 // Our sub-toolbar wants to execute a function. 173 // We have to change the image of our toolbar button to reflect the new function. 174 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 175 if ( !m_bDisposed ) 176 { 177 if ( m_aCommand.getLength() > 0 ) 178 { 179 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface()); 180 Image aImage = GetImage( xFrame, m_aCommand, hasBigImages(), isHighContrast() ); 181 if ( !!aImage ) 182 GetToolBox().SetItemImage( GetId(), aImage ); 183 } 184 } | 162 // remind the new command 163 m_aCommand = rCommand; 164 // Our sub-toolbar wants to execute a function. 165 // We have to change the image of our toolbar button to reflect the new function. 166 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 167 if ( !m_bDisposed ) 168 { 169 if ( m_aCommand.getLength() > 0 ) 170 { 171 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface()); 172 Image aImage = GetImage( xFrame, m_aCommand, hasBigImages(), isHighContrast() ); 173 if ( !!aImage ) 174 GetToolBox().SetItemImage( GetId(), aImage ); 175 } 176 } |
185} 186 187void SAL_CALL SvxTbxCtlCustomShapes::updateImage( ) throw (::com::sun::star::uno::RuntimeException) 188{ | 177} 178 179void SAL_CALL SvxTbxCtlCustomShapes::updateImage( ) throw (::com::sun::star::uno::RuntimeException) 180{ |
189 // We should update the button image of our parent (toolbar). 190 // Use the stored command to set the correct current image. 191 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 192 if ( m_aCommand.getLength() > 0 ) 193 { 194 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface()); 195 Image aImage = GetImage( xFrame, m_aCommand, hasBigImages(), isHighContrast() ); 196 if ( !!aImage ) 197 GetToolBox().SetItemImage( GetId(), aImage ); 198 } | 181 // We should update the button image of our parent (toolbar). 182 // Use the stored command to set the correct current image. 183 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 184 if ( m_aCommand.getLength() > 0 ) 185 { 186 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface()); 187 Image aImage = GetImage( xFrame, m_aCommand, hasBigImages(), isHighContrast() ); 188 if ( !!aImage ) 189 GetToolBox().SetItemImage( GetId(), aImage ); 190 } |
199} | 191} |
200 | |