xref: /trunk/main/reportdesign/source/ui/misc/toolboxcontroller.cxx (revision b63233d868a9af170b0457a7aa0c5809011cc2c1)
19e0e4191SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
39e0e4191SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
49e0e4191SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
59e0e4191SAndrew Rist  * distributed with this work for additional information
69e0e4191SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
79e0e4191SAndrew Rist  * to you under the Apache License, Version 2.0 (the
89e0e4191SAndrew Rist  * "License"); you may not use this file except in compliance
99e0e4191SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
119e0e4191SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
139e0e4191SAndrew Rist  * Unless required by applicable law or agreed to in writing,
149e0e4191SAndrew Rist  * software distributed under the License is distributed on an
159e0e4191SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169e0e4191SAndrew Rist  * KIND, either express or implied.  See the License for the
179e0e4191SAndrew Rist  * specific language governing permissions and limitations
189e0e4191SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
209e0e4191SAndrew Rist  *************************************************************/
219e0e4191SAndrew Rist 
229e0e4191SAndrew Rist 
23*b63233d8Sdamjan #include "precompiled_rptui.hxx"
24cdf0e10cSrcweir #include "toolboxcontroller.hxx"
25cdf0e10cSrcweir #include <com/sun/star/ui/ImageType.hpp>
26cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
27cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
28cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
29cdf0e10cSrcweir #include <vcl/menu.hxx>
30cdf0e10cSrcweir #include <com/sun/star/ui/XUIConfigurationManager.hpp>
31cdf0e10cSrcweir #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
32cdf0e10cSrcweir #include <com/sun/star/ui/XImageManager.hpp>
33cdf0e10cSrcweir #include <com/sun/star/ui/ImageType.hpp>
34cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphic.hpp>
35cdf0e10cSrcweir #include <com/sun/star/util/Color.hpp>
36cdf0e10cSrcweir #include <vcl/svapp.hxx>
37cdf0e10cSrcweir #include <vcl/toolbox.hxx>
38cdf0e10cSrcweir #include <svtools/miscopt.hxx>
39cdf0e10cSrcweir #include <unotools/moduleoptions.hxx>
40cdf0e10cSrcweir #include <svtools/menuoptions.hxx>
41cdf0e10cSrcweir #include <vos/mutex.hxx>
42cdf0e10cSrcweir #include <svx/svxids.hrc>
43cdf0e10cSrcweir #define ITEMID_COLOR        1
44cdf0e10cSrcweir #define ITEMID_BRUSH        2
45cdf0e10cSrcweir #define ITEMID_FONT         3
46cdf0e10cSrcweir #define ITEMID_FONTHEIGHT   4
47cdf0e10cSrcweir #include <editeng/fontitem.hxx>
48cdf0e10cSrcweir #include <editeng/fhgtitem.hxx>
49cdf0e10cSrcweir #include <svx/tbcontrl.hxx>
50cdf0e10cSrcweir #include <editeng/colritem.hxx>
51cdf0e10cSrcweir #include <svx/tbxcustomshapes.hxx>
52cdf0e10cSrcweir 
53cdf0e10cSrcweir #include <comphelper/sequence.hxx>
54cdf0e10cSrcweir 
55cdf0e10cSrcweir #include <memory>
56cdf0e10cSrcweir 
57cdf0e10cSrcweir namespace rptui
58cdf0e10cSrcweir {
59cdf0e10cSrcweir     using namespace svt;
60cdf0e10cSrcweir     using namespace com::sun::star;
61cdf0e10cSrcweir     using namespace com::sun::star::uno;
62cdf0e10cSrcweir     using namespace com::sun::star::beans;
63cdf0e10cSrcweir     using namespace com::sun::star::lang;
64cdf0e10cSrcweir     using namespace frame;
65cdf0e10cSrcweir     using namespace util;
66cdf0e10cSrcweir     using namespace ui;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir ::rtl::OUString SAL_CALL OToolboxController::getImplementationName() throw( RuntimeException )
69cdf0e10cSrcweir {
70cdf0e10cSrcweir     return getImplementationName_Static();
71cdf0e10cSrcweir }
72cdf0e10cSrcweir 
73cdf0e10cSrcweir //------------------------------------------------------------------------------
74cdf0e10cSrcweir ::rtl::OUString OToolboxController::getImplementationName_Static() throw( RuntimeException )
75cdf0e10cSrcweir {
76cdf0e10cSrcweir     return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.comp.ReportToolboxController"));
77cdf0e10cSrcweir }
78cdf0e10cSrcweir //------------------------------------------------------------------------------
79cdf0e10cSrcweir Sequence< ::rtl::OUString> OToolboxController::getSupportedServiceNames_Static(void) throw( RuntimeException )
80cdf0e10cSrcweir {
81cdf0e10cSrcweir     Sequence< ::rtl::OUString> aSupported(1);
82cdf0e10cSrcweir     aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.ReportToolboxController"));
83cdf0e10cSrcweir     return aSupported;
84cdf0e10cSrcweir }
85cdf0e10cSrcweir // -----------------------------------------------------------------------------
86cdf0e10cSrcweir ::sal_Bool SAL_CALL OToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw (uno::RuntimeException)
87cdf0e10cSrcweir {
88cdf0e10cSrcweir     return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static());
89cdf0e10cSrcweir }
90cdf0e10cSrcweir //-------------------------------------------------------------------------
91cdf0e10cSrcweir Sequence< ::rtl::OUString> SAL_CALL OToolboxController::getSupportedServiceNames() throw(RuntimeException)
92cdf0e10cSrcweir {
93cdf0e10cSrcweir     return getSupportedServiceNames_Static();
94cdf0e10cSrcweir }
95cdf0e10cSrcweir // -------------------------------------------------------------------------
96cdf0e10cSrcweir Reference< XInterface > OToolboxController::create(Reference< XComponentContext > const & xContext)
97cdf0e10cSrcweir {
98cdf0e10cSrcweir     return *(new OToolboxController(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY)));
99cdf0e10cSrcweir }
100cdf0e10cSrcweir // -----------------------------------------------------------------------------
101cdf0e10cSrcweir DBG_NAME(rpt_OToolboxController)
102cdf0e10cSrcweir OToolboxController::OToolboxController(const Reference< XMultiServiceFactory >& _rxORB)
103cdf0e10cSrcweir     : m_pToolbarController(NULL)
104cdf0e10cSrcweir     ,m_nToolBoxId(1)
105cdf0e10cSrcweir     ,m_nSlotId(0)
106cdf0e10cSrcweir {
107cdf0e10cSrcweir     DBG_CTOR(rpt_OToolboxController,NULL);
108cdf0e10cSrcweir     osl_incrementInterlockedCount(&m_refCount);
109cdf0e10cSrcweir     m_xServiceManager = _rxORB;
110cdf0e10cSrcweir     osl_decrementInterlockedCount(&m_refCount);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir }
113cdf0e10cSrcweir // -----------------------------------------------------------------------------
114cdf0e10cSrcweir OToolboxController::~OToolboxController()
115cdf0e10cSrcweir {
116cdf0e10cSrcweir     DBG_DTOR(rpt_OToolboxController,NULL);
117cdf0e10cSrcweir }
118cdf0e10cSrcweir // -----------------------------------------------------------------------------
119cdf0e10cSrcweir // XInterface
120cdf0e10cSrcweir Any SAL_CALL OToolboxController::queryInterface( const Type& _rType ) throw (RuntimeException)
121cdf0e10cSrcweir {
122cdf0e10cSrcweir     Any aReturn = ToolboxController::queryInterface(_rType);
123cdf0e10cSrcweir     if (!aReturn.hasValue())
124cdf0e10cSrcweir         aReturn = TToolboxController_BASE::queryInterface(_rType);
125cdf0e10cSrcweir     return aReturn;
126cdf0e10cSrcweir }
127cdf0e10cSrcweir // -----------------------------------------------------------------------------
128cdf0e10cSrcweir void SAL_CALL OToolboxController::acquire() throw ()
129cdf0e10cSrcweir {
130cdf0e10cSrcweir     ToolboxController::acquire();
131cdf0e10cSrcweir }
132cdf0e10cSrcweir // -----------------------------------------------------------------------------
133cdf0e10cSrcweir void SAL_CALL OToolboxController::release() throw ()
134cdf0e10cSrcweir {
135cdf0e10cSrcweir     ToolboxController::release();
136cdf0e10cSrcweir }
137cdf0e10cSrcweir // -----------------------------------------------------------------------------
138cdf0e10cSrcweir void SAL_CALL OToolboxController::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException)
139cdf0e10cSrcweir {
140cdf0e10cSrcweir     ToolboxController::initialize(_rArguments);
141cdf0e10cSrcweir     vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
142cdf0e10cSrcweir     ::osl::MutexGuard aGuard(m_aMutex);
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     ToolBox*    pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()));
145cdf0e10cSrcweir     if ( pToolBox )
146cdf0e10cSrcweir     {
147cdf0e10cSrcweir         const sal_uInt16 nCount = pToolBox->GetItemCount();
148cdf0e10cSrcweir         for (sal_uInt16 nPos = 0; nPos < nCount; ++nPos)
149cdf0e10cSrcweir         {
150cdf0e10cSrcweir             const sal_uInt16 nItemId = pToolBox->GetItemId(nPos);
151cdf0e10cSrcweir             if ( pToolBox->GetItemCommand(nItemId) == String(m_aCommandURL) )
152cdf0e10cSrcweir             {
153cdf0e10cSrcweir                 m_nToolBoxId = nItemId;
154cdf0e10cSrcweir                 break;
155cdf0e10cSrcweir             }
156cdf0e10cSrcweir         }
157cdf0e10cSrcweir         if ( m_aCommandURL.equalsAscii(".uno:BasicShapes") )
158cdf0e10cSrcweir         {
159cdf0e10cSrcweir             m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:BasicShapes")),sal_True));
160cdf0e10cSrcweir             m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_BASIC,m_nToolBoxId,*pToolBox));
161cdf0e10cSrcweir         }
162cdf0e10cSrcweir         else if ( m_aCommandURL.equalsAscii(".uno:SymbolShapes") )
163cdf0e10cSrcweir         {
164cdf0e10cSrcweir             m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:SymbolShapes")),sal_True));
165cdf0e10cSrcweir             m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_SYMBOL,m_nToolBoxId,*pToolBox));
166cdf0e10cSrcweir         }
167cdf0e10cSrcweir         else if ( m_aCommandURL.equalsAscii(".uno:ArrowShapes") )
168cdf0e10cSrcweir         {
169cdf0e10cSrcweir             m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:ArrowShapes")),sal_True));
170cdf0e10cSrcweir             m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_ARROW,m_nToolBoxId,*pToolBox));
171cdf0e10cSrcweir         }
172cdf0e10cSrcweir         else if ( m_aCommandURL.equalsAscii(".uno:FlowChartShapes") )
173cdf0e10cSrcweir         {
174cdf0e10cSrcweir             m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FlowChartShapes")),sal_True));
175cdf0e10cSrcweir             m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_FLOWCHART,m_nToolBoxId,*pToolBox));
176cdf0e10cSrcweir         }
177cdf0e10cSrcweir         else if ( m_aCommandURL.equalsAscii(".uno:CalloutShapes") )
178cdf0e10cSrcweir         {
179cdf0e10cSrcweir             m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:CalloutShapes")),sal_True));
180cdf0e10cSrcweir             m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_CALLOUT,m_nToolBoxId,*pToolBox));
181cdf0e10cSrcweir         }
182cdf0e10cSrcweir         else if ( m_aCommandURL.equalsAscii(".uno:StarShapes") )
183cdf0e10cSrcweir         {
184cdf0e10cSrcweir             m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:StarShapes")),sal_True));
185cdf0e10cSrcweir             m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_STAR,m_nToolBoxId,*pToolBox));
186cdf0e10cSrcweir         }
187cdf0e10cSrcweir         else if ( m_aCommandURL.equalsAscii(".uno:CharFontName") )
188cdf0e10cSrcweir         {
189cdf0e10cSrcweir             m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:CharFontName")),sal_True));
190cdf0e10cSrcweir             m_pToolbarController = TToolbarHelper::createFromQuery(new SvxFontNameToolBoxControl/*SvxStyleToolBoxControl*/(m_nSlotId = SID_ATTR_CHAR_FONT,m_nToolBoxId,*pToolBox));
191cdf0e10cSrcweir         }
192cdf0e10cSrcweir         else if ( m_aCommandURL.equalsAscii(".uno:FontColor") || m_aCommandURL.equalsAscii(".uno:Color") )
193cdf0e10cSrcweir         {
194cdf0e10cSrcweir             m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FontColor")),sal_True));
195cdf0e10cSrcweir             m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Color")),sal_True));
196cdf0e10cSrcweir             m_pToolbarController = TToolbarHelper::createFromQuery(new SvxFontColorExtToolBoxControl/*SvxFontColorToolBoxControl*/(m_nSlotId = SID_ATTR_CHAR_COLOR2,m_nToolBoxId,*pToolBox));
197cdf0e10cSrcweir         }
198cdf0e10cSrcweir         else
199cdf0e10cSrcweir         {
200cdf0e10cSrcweir             m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:BackgroundColor")),sal_True));
201cdf0e10cSrcweir             m_pToolbarController = TToolbarHelper::createFromQuery(new SvxColorToolBoxControl(m_nSlotId = SID_BACKGROUND_COLOR,m_nToolBoxId,*pToolBox));
202cdf0e10cSrcweir         }
203cdf0e10cSrcweir 
204cdf0e10cSrcweir         TCommandState::iterator aIter = m_aStates.begin();
205cdf0e10cSrcweir         for (; aIter != m_aStates.end(); ++aIter)
206cdf0e10cSrcweir             addStatusListener(aIter->first);
207cdf0e10cSrcweir 
208cdf0e10cSrcweir         if ( m_pToolbarController.is() )
209cdf0e10cSrcweir             m_pToolbarController->initialize(_rArguments);
210cdf0e10cSrcweir         // check if paste special is allowed, when not don't add DROPDOWN
211cdf0e10cSrcweir         pToolBox->SetItemBits(m_nToolBoxId,pToolBox->GetItemBits(m_nToolBoxId) | TIB_DROPDOWN);
212cdf0e10cSrcweir     }
213cdf0e10cSrcweir }
214cdf0e10cSrcweir // -----------------------------------------------------------------------------
215cdf0e10cSrcweir void SAL_CALL OToolboxController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException )
216cdf0e10cSrcweir {
217cdf0e10cSrcweir     ::osl::MutexGuard aGuard(m_aMutex);
218cdf0e10cSrcweir     TCommandState::iterator aFind = m_aStates.find( Event.FeatureURL.Complete );
219cdf0e10cSrcweir     if ( aFind != m_aStates.end() )
220cdf0e10cSrcweir     {
221cdf0e10cSrcweir         aFind->second = Event.IsEnabled;
222cdf0e10cSrcweir         if ( m_pToolbarController.is() )
223cdf0e10cSrcweir         {
224cdf0e10cSrcweir             // All other status events will be processed here
225cdf0e10cSrcweir             sal_Bool bSetCheckmark      = sal_False;
226cdf0e10cSrcweir             sal_Bool bCheckmark         = sal_False;
227cdf0e10cSrcweir             //m_pToolbarController->GetToolBox().Enable(Event.IsEnabled);
228cdf0e10cSrcweir             ToolBox& rTb = m_pToolbarController->GetToolBox();
229cdf0e10cSrcweir             for ( sal_uInt16 i = 0; i < rTb.GetItemCount(); i++ )
230cdf0e10cSrcweir             {
231cdf0e10cSrcweir                 sal_uInt16 nId = rTb.GetItemId( i );
232cdf0e10cSrcweir                 if ( nId == 0 )
233cdf0e10cSrcweir                     continue;
234cdf0e10cSrcweir 
235cdf0e10cSrcweir                 rtl::OUString aCmd = rTb.GetItemCommand( nId );
236cdf0e10cSrcweir                 if ( aCmd == Event.FeatureURL.Complete )
237cdf0e10cSrcweir                 {
238cdf0e10cSrcweir                     // Enable/disable item
239cdf0e10cSrcweir                     rTb.EnableItem( nId, Event.IsEnabled );
240cdf0e10cSrcweir 
241cdf0e10cSrcweir                     // Checkmark
242cdf0e10cSrcweir                     if ( Event.State >>= bCheckmark )
243cdf0e10cSrcweir                         bSetCheckmark = sal_True;
244cdf0e10cSrcweir 
245cdf0e10cSrcweir                     if ( bSetCheckmark )
246cdf0e10cSrcweir                         rTb.CheckItem( nId, bCheckmark );
247cdf0e10cSrcweir                     else
248cdf0e10cSrcweir                     {
249cdf0e10cSrcweir                         rtl::OUString aItemText;
250cdf0e10cSrcweir 
251cdf0e10cSrcweir                         if ( Event.State >>= aItemText )
252cdf0e10cSrcweir                             rTb.SetItemText( nId, aItemText );
253cdf0e10cSrcweir                     }
254cdf0e10cSrcweir                 }
255cdf0e10cSrcweir             }
256cdf0e10cSrcweir 
257cdf0e10cSrcweir             switch(m_nSlotId)
258cdf0e10cSrcweir             {
259cdf0e10cSrcweir                 case SID_ATTR_CHAR_COLOR2:
260cdf0e10cSrcweir                 case SID_BACKGROUND_COLOR:
261cdf0e10cSrcweir                     {
262cdf0e10cSrcweir                         util::Color nColor(COL_TRANSPARENT);
263cdf0e10cSrcweir                         Event.State >>= nColor;
264cdf0e10cSrcweir                         ::Color aGcc3WorkaroundTemporary( nColor);
265cdf0e10cSrcweir                         SvxColorItem aColorItem(aGcc3WorkaroundTemporary,1);
266cdf0e10cSrcweir                         if ( SID_ATTR_CHAR_COLOR2 == m_nSlotId )
267cdf0e10cSrcweir                             static_cast<SvxFontColorExtToolBoxControl*>(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SFX_ITEM_SET : SFX_ITEM_DISABLED,&aColorItem);
268cdf0e10cSrcweir                         else
269cdf0e10cSrcweir                             static_cast<SvxColorToolBoxControl*>(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SFX_ITEM_SET : SFX_ITEM_DISABLED,&aColorItem);
270cdf0e10cSrcweir                     }
271cdf0e10cSrcweir                     break;
272cdf0e10cSrcweir                 case SID_ATTR_CHAR_FONT:
273cdf0e10cSrcweir                     {
274cdf0e10cSrcweir                         SvxFontItem aItem(ITEMID_FONT);
275cdf0e10cSrcweir                         aItem.PutValue(Event.State);
276cdf0e10cSrcweir                         static_cast<SvxFontNameToolBoxControl*>(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SFX_ITEM_AVAILABLE : SFX_ITEM_DISABLED,&aItem);
277cdf0e10cSrcweir                     }
278cdf0e10cSrcweir                     break;
279cdf0e10cSrcweir             }
280cdf0e10cSrcweir         }
281cdf0e10cSrcweir     }
282cdf0e10cSrcweir }
283cdf0e10cSrcweir // -----------------------------------------------------------------------------
284cdf0e10cSrcweir Reference< awt::XWindow > SAL_CALL OToolboxController::createPopupWindow() throw (RuntimeException)
285cdf0e10cSrcweir {
286cdf0e10cSrcweir     // execute the menu
287cdf0e10cSrcweir     vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
288cdf0e10cSrcweir     ::osl::MutexGuard aGuard(m_aMutex);
289cdf0e10cSrcweir 
290cdf0e10cSrcweir     Reference< awt::XWindow > xRet;
291cdf0e10cSrcweir     if ( m_pToolbarController.is() )
292cdf0e10cSrcweir         xRet = m_pToolbarController.getRef()->createPopupWindow();
293cdf0e10cSrcweir 
294cdf0e10cSrcweir     return xRet;
295cdf0e10cSrcweir }
296cdf0e10cSrcweir // -----------------------------------------------------------------------------
297cdf0e10cSrcweir ::sal_Bool SAL_CALL OToolboxController::opensSubToolbar() throw (uno::RuntimeException)
298cdf0e10cSrcweir {
299cdf0e10cSrcweir     return m_nSlotId == SID_DRAWTBX_CS_BASIC;
300cdf0e10cSrcweir }
301cdf0e10cSrcweir // -----------------------------------------------------------------------------
302cdf0e10cSrcweir ::rtl::OUString SAL_CALL OToolboxController::getSubToolbarName() throw (uno::RuntimeException)
303cdf0e10cSrcweir {
304cdf0e10cSrcweir     vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
305cdf0e10cSrcweir     ::osl::MutexGuard aGuard(m_aMutex);
306cdf0e10cSrcweir     uno::Reference< frame::XSubToolbarController> xSub(m_pToolbarController.getRef(),uno::UNO_QUERY);
307cdf0e10cSrcweir     if ( xSub.is() )
308cdf0e10cSrcweir         return xSub->getSubToolbarName();
309cdf0e10cSrcweir     return ::rtl::OUString();
310cdf0e10cSrcweir }
311cdf0e10cSrcweir // -----------------------------------------------------------------------------
312cdf0e10cSrcweir void SAL_CALL OToolboxController::functionSelected( const ::rtl::OUString& rCommand ) throw (uno::RuntimeException)
313cdf0e10cSrcweir {
314cdf0e10cSrcweir     vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
315cdf0e10cSrcweir     ::osl::MutexGuard aGuard(m_aMutex);
316cdf0e10cSrcweir 
317cdf0e10cSrcweir     uno::Reference< frame::XSubToolbarController> xSub(m_pToolbarController.getRef(),uno::UNO_QUERY);
318cdf0e10cSrcweir     if ( xSub.is() )
319cdf0e10cSrcweir     {
320cdf0e10cSrcweir         xSub->functionSelected(m_aCommandURL = rCommand);
321cdf0e10cSrcweir     }
322cdf0e10cSrcweir }
323cdf0e10cSrcweir // -----------------------------------------------------------------------------
324cdf0e10cSrcweir void SAL_CALL OToolboxController::updateImage(  ) throw (uno::RuntimeException)
325cdf0e10cSrcweir {
326cdf0e10cSrcweir     vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
327cdf0e10cSrcweir     ::osl::MutexGuard aGuard(m_aMutex);
328cdf0e10cSrcweir 
329cdf0e10cSrcweir     uno::Reference< frame::XSubToolbarController> xSub(m_pToolbarController.getRef(),uno::UNO_QUERY);
330cdf0e10cSrcweir     if ( xSub.is() )
331cdf0e10cSrcweir         xSub->updateImage();
332cdf0e10cSrcweir }
333cdf0e10cSrcweir // -----------------------------------------------------------------------------
334cdf0e10cSrcweir uno::Reference< awt::XWindow > SAL_CALL OToolboxController::createItemWindow( const uno::Reference< awt::XWindow >& _xParent)
335cdf0e10cSrcweir throw (uno::RuntimeException)
336cdf0e10cSrcweir {
337cdf0e10cSrcweir     uno::Reference< awt::XWindow > xWindow;
338cdf0e10cSrcweir     if ( m_pToolbarController.is() )
339cdf0e10cSrcweir     {
340cdf0e10cSrcweir         switch(m_nSlotId)
341cdf0e10cSrcweir         {
342cdf0e10cSrcweir             case SID_ATTR_CHAR_FONT:
343cdf0e10cSrcweir                 xWindow = VCLUnoHelper::GetInterface(static_cast<SvxFontNameToolBoxControl*>(m_pToolbarController.get())->CreateItemWindow(VCLUnoHelper::GetWindow(_xParent)));
344cdf0e10cSrcweir                 break;
345cdf0e10cSrcweir             default:
346cdf0e10cSrcweir                 ;
347cdf0e10cSrcweir         }
348cdf0e10cSrcweir     }
349cdf0e10cSrcweir     return xWindow;
350cdf0e10cSrcweir }
351cdf0e10cSrcweir // -----------------------------------------------------------------------------
352cdf0e10cSrcweir //..........................................................................
353cdf0e10cSrcweir } // rptui
354cdf0e10cSrcweir //..........................................................................
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 
357