LCOV - code coverage report
Current view: top level - extensions/source/bibliography - toolbar.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 341 0.0 %
Date: 2014-04-11 Functions: 0 51 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <comphelper/processfactory.hxx>
      21             : #include <com/sun/star/frame/XDispatch.hpp>
      22             : #include <com/sun/star/frame/XDispatchProvider.hpp>
      23             : #include <com/sun/star/util/URLTransformer.hpp>
      24             : #include <com/sun/star/util/XURLTransformer.hpp>
      25             : #include <com/sun/star/frame/FrameSearchFlag.hpp>
      26             : #include <datman.hxx>
      27             : #include <svx/svxids.hrc>
      28             : #include <svtools/miscopt.hxx>
      29             : #include <svtools/imgdef.hxx>
      30             : #include <vcl/svapp.hxx>
      31             : #include <vcl/settings.hxx>
      32             : #include <vcl/mnemonic.hxx>
      33             : #include "bibbeam.hxx"
      34             : #include "toolbar.hrc"
      35             : #include "bibresid.hxx"
      36             : 
      37             : #include "bibtools.hxx"
      38             : #include <osl/mutex.hxx>
      39             : 
      40             : using namespace ::rtl;
      41             : using namespace ::com::sun::star;
      42             : using namespace ::com::sun::star::uno;
      43             : using namespace ::com::sun::star::beans;
      44             : 
      45             : 
      46             : // Konstanten -------------------------------------------------------------
      47             : 
      48             : 
      49           0 : BibToolBarListener::BibToolBarListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId):
      50             :         nIndex(nId),
      51             :         aCommand(aStr),
      52           0 :         pToolBar(pTB)
      53             : {
      54           0 : }
      55             : 
      56           0 : BibToolBarListener::~BibToolBarListener()
      57             : {
      58           0 : }
      59             : 
      60           0 : void BibToolBarListener::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& rEvt)throw( ::com::sun::star::uno::RuntimeException, std::exception )
      61             : {
      62           0 :     if(rEvt.FeatureURL.Complete == aCommand)
      63             :     {
      64           0 :         SolarMutexGuard aGuard;
      65           0 :         pToolBar->EnableItem(nIndex,rEvt.IsEnabled);
      66             : 
      67           0 :         ::com::sun::star::uno::Any aState=rEvt.State;
      68           0 :         if(aState.getValueType()==::getBooleanCppuType())
      69             :         {
      70           0 :             sal_Bool bChecked= *(sal_Bool*)aState.getValue();
      71           0 :             pToolBar->CheckItem(nIndex, bChecked);
      72           0 :         }
      73             : 
      74             :     }
      75           0 : };
      76             : 
      77           0 : OUString   BibToolBarListener::GetCommand() const
      78             : {
      79           0 :     return aCommand;
      80             : }
      81             : 
      82           0 : BibTBListBoxListener::BibTBListBoxListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId):
      83           0 :     BibToolBarListener(pTB,aStr,nId)
      84             : {
      85           0 : }
      86             : 
      87           0 : BibTBListBoxListener::~BibTBListBoxListener()
      88             : {
      89           0 : }
      90             : 
      91           0 : void BibTBListBoxListener::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& rEvt)throw( ::com::sun::star::uno::RuntimeException, std::exception )
      92             : {
      93           0 :     if(rEvt.FeatureURL.Complete == GetCommand())
      94             :     {
      95           0 :         SolarMutexGuard aGuard;
      96           0 :         pToolBar->EnableSourceList(rEvt.IsEnabled);
      97             : 
      98           0 :         Any aState = rEvt.State;
      99           0 :         if(aState.getValueType() == ::getCppuType((Sequence<OUString>*)0))
     100             :         {
     101           0 :             pToolBar->UpdateSourceList(sal_False);
     102           0 :             pToolBar->ClearSourceList();
     103             : 
     104           0 :             Sequence<OUString>* pStringSeq = (Sequence<OUString>*)aState.getValue();
     105           0 :             const OUString* pStringArray = (const OUString*)pStringSeq->getConstArray();
     106             : 
     107           0 :             sal_uInt32 nCount = pStringSeq->getLength();
     108           0 :             OUString aEntry;
     109           0 :             for( sal_uInt32 i=0; i<nCount; i++ )
     110             :             {
     111           0 :                 aEntry = pStringArray[i];
     112           0 :                 pToolBar->InsertSourceEntry(aEntry);
     113             :             }
     114           0 :             pToolBar->UpdateSourceList(sal_True);
     115             :         }
     116             : 
     117           0 :         pToolBar->SelectSourceEntry(rEvt.FeatureDescriptor);
     118             :     }
     119           0 : };
     120             : 
     121           0 : BibTBQueryMenuListener::BibTBQueryMenuListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId):
     122           0 :     BibToolBarListener(pTB,aStr,nId)
     123             : {
     124           0 : }
     125             : 
     126           0 : BibTBQueryMenuListener::~BibTBQueryMenuListener()
     127             : {
     128           0 : }
     129             : 
     130           0 : void BibTBQueryMenuListener::statusChanged(const frame::FeatureStateEvent& rEvt)throw( uno::RuntimeException, std::exception )
     131             : {
     132           0 :     if(rEvt.FeatureURL.Complete == GetCommand())
     133             :     {
     134           0 :         SolarMutexGuard aGuard;
     135           0 :         pToolBar->EnableSourceList(rEvt.IsEnabled);
     136             : 
     137           0 :         uno::Any aState=rEvt.State;
     138           0 :         if(aState.getValueType()==::getCppuType((Sequence<OUString>*)0))
     139             :         {
     140           0 :             pToolBar->ClearFilterMenu();
     141             : 
     142           0 :             Sequence<OUString>* pStringSeq = (Sequence<OUString>*) aState.getValue();
     143           0 :             const OUString* pStringArray = (const OUString*)pStringSeq->getConstArray();
     144             : 
     145           0 :             sal_uInt32 nCount = pStringSeq->getLength();
     146           0 :             for( sal_uInt32 i=0; i<nCount; i++ )
     147             :             {
     148           0 :                 sal_uInt16 nID = pToolBar->InsertFilterItem(pStringArray[i]);
     149           0 :                 if(pStringArray[i]==rEvt.FeatureDescriptor)
     150             :                 {
     151           0 :                     pToolBar->SelectFilterItem(nID);
     152             :                 }
     153             :             }
     154           0 :         }
     155             :     }
     156           0 : };
     157             : 
     158           0 : BibTBEditListener::BibTBEditListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId):
     159           0 :     BibToolBarListener(pTB,aStr,nId)
     160             : {
     161           0 : }
     162             : 
     163           0 : BibTBEditListener::~BibTBEditListener()
     164             : {
     165           0 : }
     166             : 
     167           0 : void BibTBEditListener::statusChanged(const frame::FeatureStateEvent& rEvt)throw( uno::RuntimeException, std::exception )
     168             : {
     169           0 :     if(rEvt.FeatureURL.Complete == GetCommand())
     170             :     {
     171           0 :         SolarMutexGuard aGuard;
     172           0 :         pToolBar->EnableQuery(rEvt.IsEnabled);
     173             : 
     174           0 :         uno::Any aState=rEvt.State;
     175           0 :         if(aState.getValueType()==::getCppuType((const OUString*)0))
     176             :         {
     177           0 :             OUString aStr = *(OUString*) aState.getValue();
     178           0 :             pToolBar->SetQueryString(aStr);
     179           0 :         }
     180             :     }
     181           0 : }
     182             : 
     183           0 : BibToolBar::BibToolBar(Window* pParent, Link aLink, WinBits nStyle):
     184             :     ToolBox(pParent,BibResId(RID_BIB_TOOLBAR)),
     185             :     aImgLst(BibResId(  RID_TOOLBAR_IMGLIST     )),
     186             :     aBigImgLst(BibResId( RID_TOOLBAR_BIGIMGLIST )),
     187             :     aFtSource(this,WB_VCENTER),
     188             :     aLBSource(this,WB_DROPDOWN),
     189             :     aFtQuery(this,WB_VCENTER),
     190             :     aEdQuery(this),
     191             :     nMenuId(0),
     192             :     nSelMenuItem(0),
     193             :     aLayoutManager( aLink ),
     194             :     nSymbolsSize( SFX_SYMBOLS_SIZE_SMALL ),
     195           0 :     nOutStyle( 0 )
     196             : {
     197           0 :     SvtMiscOptions aSvtMiscOptions;
     198           0 :     nSymbolsSize = aSvtMiscOptions.GetCurrentSymbolsSize();
     199           0 :     nOutStyle  = aSvtMiscOptions.GetToolboxStyle();
     200             : 
     201           0 :     ApplyImageList();
     202           0 :     SetStyle(GetStyle()|nStyle);
     203           0 :     SetOutStyle(TOOLBOX_STYLE_FLAT);
     204           0 :     Size a2Size(GetOutputSizePixel());
     205           0 :     a2Size.Width()=100;
     206           0 :     aLBSource.SetSizePixel(a2Size);
     207           0 :     aLBSource.SetDropDownLineCount(9);
     208           0 :     aLBSource.Show();
     209           0 :     aLBSource.SetSelectHdl(LINK( this, BibToolBar, SelHdl));
     210             : 
     211           0 :     SvtMiscOptions().AddListenerLink( LINK( this, BibToolBar, OptionsChanged_Impl ) );
     212           0 :     Application::AddEventListener( LINK( this, BibToolBar, SettingsChanged_Impl ) );
     213             : 
     214           0 :     aTimer.SetTimeoutHdl(LINK( this, BibToolBar, SendSelHdl));
     215           0 :     aTimer.SetTimeout(400);
     216             : 
     217           0 :     SetDropdownClickHdl( LINK( this, BibToolBar, MenuHdl));
     218             : 
     219           0 :     aEdQuery.SetSizePixel(aLBSource.GetSizePixel());
     220           0 :     aEdQuery.Show();
     221             : 
     222           0 :     OUString aStr=GetItemText(TBC_FT_SOURCE);
     223           0 :     Rectangle aRect=GetItemRect(TBC_FT_SOURCE);
     224           0 :     aFtSource.SetText(aStr);
     225           0 :     aFtSource.SetSizePixel(aRect.GetSize());
     226           0 :     aFtSource.SetBackground(Wallpaper( COL_TRANSPARENT ));
     227             : 
     228           0 :     aStr=GetItemText(TBC_FT_QUERY);
     229           0 :     aRect=GetItemRect(TBC_FT_QUERY);
     230           0 :     aFtQuery.SetText(aStr);
     231           0 :     aFtQuery.SetSizePixel(aRect.GetSize());
     232           0 :     aFtQuery.SetBackground(Wallpaper( COL_TRANSPARENT ));
     233             : 
     234           0 :     SetItemWindow(TBC_FT_SOURCE,&aFtSource);
     235           0 :     SetItemWindow(TBC_LB_SOURCE,&aLBSource);
     236           0 :     SetItemWindow(TBC_FT_QUERY ,&aFtQuery);
     237           0 :     SetItemWindow(TBC_ED_QUERY ,&aEdQuery);
     238             : 
     239           0 :     ::bib::AddToTaskPaneList( this );
     240           0 : }
     241             : 
     242           0 : BibToolBar::~BibToolBar()
     243             : {
     244           0 :     SvtMiscOptions().RemoveListenerLink( LINK( this, BibToolBar, OptionsChanged_Impl ) );
     245           0 :     Application::RemoveEventListener( LINK( this, BibToolBar, SettingsChanged_Impl ) );
     246           0 :     ::bib::RemoveFromTaskPaneList( this );
     247           0 : }
     248             : 
     249           0 : void BibToolBar::InitListener()
     250             : {
     251           0 :     sal_uInt16  nCount=GetItemCount();
     252             : 
     253           0 :     uno::Reference< frame::XDispatch >  xDisp(xController,UNO_QUERY);
     254           0 :     uno::Reference< util::XURLTransformer > xTrans( util::URLTransformer::create(comphelper::getProcessComponentContext()) );
     255           0 :     if( xTrans.is() )
     256             :     {
     257           0 :         util::URL aQueryURL;
     258           0 :         aQueryURL.Complete = ".uno:Bib/MenuFilter";
     259           0 :         xTrans->parseStrict( aQueryURL);
     260           0 :         BibToolBarListener* pQuery=new BibTBQueryMenuListener(this,aQueryURL.Complete,TBC_BT_AUTOFILTER);
     261           0 :         xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pQuery),aQueryURL);
     262             : 
     263           0 :         for(sal_uInt16 nPos=0;nPos<nCount;nPos++)
     264             :         {
     265           0 :             sal_uInt16 nId=GetItemId(nPos);
     266           0 :             if(!nId || nId==TBC_FT_SOURCE || nId==TBC_FT_QUERY)
     267           0 :                 continue;
     268             : 
     269           0 :             util::URL aURL;
     270           0 :             aURL.Complete = GetItemCommand(nId);
     271           0 :             if(aURL.Complete.isEmpty())
     272           0 :                 continue;
     273             : 
     274           0 :             xTrans->parseStrict( aURL );
     275             : 
     276           0 :             BibToolBarListener* pListener=NULL;
     277           0 :             if(nId==TBC_LB_SOURCE)
     278             :             {
     279           0 :                 pListener=new BibTBListBoxListener(this,aURL.Complete,nId);
     280             :             }
     281           0 :             else if(nId==TBC_ED_QUERY)
     282             :             {
     283           0 :                 pListener=new BibTBEditListener(this,aURL.Complete,nId);
     284             :             }
     285             :             else
     286             :             {
     287           0 :                 pListener=new BibToolBarListener(this,aURL.Complete,nId);
     288             :             }
     289             : 
     290           0 :             BibToolBarListenerRef* pxInsert = new Reference<frame::XStatusListener>;
     291           0 :             (*pxInsert) = pListener;
     292           0 :             aListenerArr.push_back( pxInsert );
     293           0 :             xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pListener),aURL);
     294           0 :         }
     295           0 :     }
     296           0 : }
     297             : 
     298           0 : void BibToolBar::SetXController(const uno::Reference< frame::XController > & xCtr)
     299             : {
     300           0 :     xController=xCtr;
     301           0 :     InitListener();
     302             : 
     303           0 : }
     304             : 
     305           0 : void BibToolBar::Select()
     306             : {
     307           0 :     sal_uInt16  nId=GetCurItemId();
     308             : 
     309           0 :     if(nId!=TBC_BT_AUTOFILTER)
     310             :     {
     311           0 :         SendDispatch(nId,Sequence<PropertyValue>() );
     312             :     }
     313             :     else
     314             :     {
     315           0 :         Sequence<PropertyValue> aPropVal(2);
     316           0 :         PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray();
     317           0 :         pPropertyVal[0].Name="QueryText";
     318           0 :         OUString aSelection = aEdQuery.GetText();
     319           0 :         pPropertyVal[0].Value <<= aSelection;
     320             : 
     321           0 :         pPropertyVal[1].Name="QueryField";
     322           0 :         pPropertyVal[1].Value <<= aQueryField;
     323           0 :         SendDispatch(nId,aPropVal);
     324             :     }
     325           0 : }
     326             : 
     327           0 : void BibToolBar::SendDispatch(sal_uInt16 nId, const Sequence< PropertyValue >& rArgs)
     328             : {
     329           0 :     OUString aCommand = GetItemCommand(nId);
     330             : 
     331           0 :     uno::Reference< frame::XDispatchProvider >  xDSP( xController, UNO_QUERY );
     332             : 
     333           0 :     if( xDSP.is() && !aCommand.isEmpty())
     334             :     {
     335           0 :         uno::Reference< util::XURLTransformer >  xTrans( util::URLTransformer::create(comphelper::getProcessComponentContext()) );
     336           0 :         if( xTrans.is() )
     337             :         {
     338             :             // Datei laden
     339           0 :             util::URL aURL;
     340           0 :             aURL.Complete = aCommand;
     341             : 
     342           0 :             xTrans->parseStrict( aURL );
     343             : 
     344           0 :             uno::Reference< frame::XDispatch >  xDisp = xDSP->queryDispatch( aURL, OUString(), frame::FrameSearchFlag::SELF );
     345             : 
     346           0 :             if ( xDisp.is() )
     347           0 :                     xDisp->dispatch( aURL, rArgs);
     348           0 :         }
     349           0 :     }
     350             : 
     351           0 : }
     352             : 
     353           0 : void BibToolBar::Click()
     354             : {
     355           0 :     sal_uInt16  nId=GetCurItemId();
     356             : 
     357           0 :     if(nId == TBC_BT_COL_ASSIGN )
     358             :     {
     359           0 :         if(pDatMan)
     360           0 :             pDatMan->CreateMappingDialog(GetParent());
     361           0 :         CheckItem( nId, false );
     362             :     }
     363           0 :     else if(nId == TBC_BT_CHANGESOURCE)
     364             :     {
     365           0 :         if(pDatMan)
     366             :         {
     367           0 :             OUString sNew = pDatMan->CreateDBChangeDialog(GetParent());
     368           0 :             if(!sNew.isEmpty())
     369           0 :                 pDatMan->setActiveDataSource(sNew);
     370             :         }
     371           0 :         CheckItem( nId, false );
     372             :     }
     373           0 : }
     374             : 
     375           0 : void BibToolBar::ClearFilterMenu()
     376             : {
     377           0 :     aPopupMenu.Clear();
     378           0 :     nMenuId=0;
     379           0 : }
     380           0 : sal_uInt16 BibToolBar::InsertFilterItem(const OUString& aMenuEntry)
     381             : {
     382           0 :     nMenuId++;
     383           0 :     aPopupMenu.InsertItem(nMenuId,aMenuEntry);
     384             : 
     385           0 :     return nMenuId;
     386             : }
     387           0 : void BibToolBar::SelectFilterItem(sal_uInt16    nId)
     388             : {
     389           0 :     aPopupMenu.CheckItem(nId);
     390           0 :     nSelMenuItem=nId;
     391           0 :     aQueryField = MnemonicGenerator::EraseAllMnemonicChars( aPopupMenu.GetItemText(nId) );
     392           0 : }
     393             : 
     394           0 : void BibToolBar::EnableSourceList(sal_Bool bFlag)
     395             : {
     396           0 :     aFtSource.Enable(bFlag);
     397           0 :     aLBSource.Enable(bFlag);
     398           0 : }
     399             : 
     400           0 : void BibToolBar::ClearSourceList()
     401             : {
     402           0 :     aLBSource.Clear();
     403           0 : }
     404             : 
     405           0 : void BibToolBar::UpdateSourceList(sal_Bool bFlag)
     406             : {
     407           0 :     aLBSource.SetUpdateMode(bFlag);
     408           0 : }
     409             : 
     410           0 : void BibToolBar::InsertSourceEntry(const OUString& aEntry, sal_Int32 nPos)
     411             : {
     412           0 :     aLBSource.InsertEntry(aEntry, nPos);
     413           0 : }
     414             : 
     415           0 : void BibToolBar::SelectSourceEntry(const OUString& aStr)
     416             : {
     417           0 :     aLBSource.SelectEntry(aStr);
     418           0 : }
     419             : 
     420           0 : void BibToolBar::EnableQuery(sal_Bool bFlag)
     421             : {
     422           0 :     aFtQuery.Enable(bFlag);
     423           0 :     aEdQuery.Enable(bFlag);
     424           0 : }
     425             : 
     426           0 : void BibToolBar::SetQueryString(const OUString& aStr)
     427             : {
     428           0 :     aEdQuery.SetText(aStr);
     429           0 : }
     430             : 
     431             : 
     432           0 : bool BibToolBar::PreNotify( NotifyEvent& rNEvt )
     433             : {
     434           0 :     bool nResult = true;
     435             : 
     436           0 :     sal_uInt16 nSwitch=rNEvt.GetType();
     437           0 :     if(aEdQuery.HasFocus() && nSwitch==EVENT_KEYINPUT)
     438             :     {
     439           0 :         const KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode();
     440           0 :         sal_uInt16 nKey = aKeyCode.GetCode();
     441           0 :         if(nKey == KEY_RETURN)
     442             :         {
     443           0 :             Sequence<PropertyValue> aPropVal(2);
     444           0 :             PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray();
     445           0 :             pPropertyVal[0].Name = "QueryText";
     446           0 :             OUString aSelection = aEdQuery.GetText();
     447           0 :             pPropertyVal[0].Value <<= aSelection;
     448           0 :             pPropertyVal[1].Name="QueryField";
     449           0 :             pPropertyVal[1].Value <<= aQueryField;
     450           0 :             SendDispatch(TBC_BT_AUTOFILTER,aPropVal);
     451           0 :             return nResult;
     452             :         }
     453             : 
     454             :     }
     455             : 
     456           0 :     nResult=ToolBox::PreNotify(rNEvt);
     457             : 
     458           0 :     return nResult;
     459             : }
     460             : 
     461           0 : IMPL_LINK( BibToolBar, SelHdl, ListBox*, /*pLb*/ )
     462             : {
     463           0 :     aTimer.Start();
     464           0 :     return 0;
     465             : }
     466             : 
     467           0 : IMPL_LINK( BibToolBar, SendSelHdl, Timer*,/*pT*/)
     468             : {
     469           0 :     Sequence<PropertyValue> aPropVal(1);
     470           0 :     PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray();
     471           0 :     pPropertyVal[0].Name = "DataSourceName";
     472           0 :     OUString aEntry( MnemonicGenerator::EraseAllMnemonicChars( aLBSource.GetSelectEntry() ) );
     473           0 :     OUString aSelection = aEntry;
     474           0 :     pPropertyVal[0].Value <<= aSelection;
     475           0 :     SendDispatch(TBC_LB_SOURCE,aPropVal);
     476             : 
     477           0 :     return 0;
     478             : }
     479             : 
     480           0 : IMPL_LINK( BibToolBar, MenuHdl, ToolBox*, /*pToolbox*/)
     481             : {
     482           0 :     sal_uInt16  nId=GetCurItemId();
     483           0 :     if(nId==TBC_BT_AUTOFILTER)
     484             :     {
     485           0 :         EndSelection();     // vor SetDropMode (SetDropMode ruft SetItemImage)
     486             : 
     487           0 :         SetItemDown(TBC_BT_AUTOFILTER,true);
     488           0 :         nId = aPopupMenu.Execute(this, GetItemRect(TBC_BT_AUTOFILTER));
     489             : 
     490             : 
     491           0 :         if(nId>0)
     492             :         {
     493           0 :             aPopupMenu.CheckItem(nSelMenuItem,false);
     494           0 :             aPopupMenu.CheckItem(nId);
     495           0 :             nSelMenuItem=nId;
     496           0 :             aQueryField = MnemonicGenerator::EraseAllMnemonicChars( aPopupMenu.GetItemText(nId) );
     497           0 :             Sequence<PropertyValue> aPropVal(2);
     498           0 :             PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray();
     499           0 :             pPropertyVal[0].Name = "QueryText";
     500           0 :             OUString aSelection = aEdQuery.GetText();
     501           0 :             pPropertyVal[0].Value <<= aSelection;
     502           0 :             pPropertyVal[1].Name="QueryField";
     503           0 :             pPropertyVal[1].Value <<= aQueryField;
     504           0 :             SendDispatch(TBC_BT_AUTOFILTER,aPropVal);
     505             :         }
     506             : 
     507           0 :         Point aPoint;
     508           0 :         MouseEvent aLeave( aPoint, 0, MOUSE_LEAVEWINDOW | MOUSE_SYNTHETIC );
     509           0 :         MouseMove( aLeave );
     510           0 :         SetItemDown(TBC_BT_AUTOFILTER,false);
     511             : 
     512             : 
     513             :     }
     514           0 :     return 0;
     515             : }
     516             : 
     517           0 : void    BibToolBar::statusChanged(const frame::FeatureStateEvent& rEvent)
     518             :                                             throw( uno::RuntimeException )
     519             : {
     520           0 :     for(sal_uInt16 i = 0; i < aListenerArr.size(); i++)
     521             :     {
     522           0 :         BibToolBarListenerRef* pListener = &aListenerArr[i];
     523           0 :         (*pListener)->statusChanged(rEvent);
     524             :     }
     525           0 : }
     526             : 
     527           0 : void BibToolBar::DataChanged( const DataChangedEvent& rDCEvt )
     528             : {
     529           0 :     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
     530           0 :          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
     531           0 :             ApplyImageList();
     532           0 :     ToolBox::DataChanged( rDCEvt );
     533           0 : }
     534             : 
     535           0 : IMPL_LINK( BibToolBar, OptionsChanged_Impl, void*, /*pVoid*/ )
     536             : {
     537           0 :     sal_Bool bRebuildToolBar = sal_False;
     538           0 :     sal_Int16 eSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize();
     539           0 :     if ( nSymbolsSize != eSymbolsSize )
     540             :     {
     541           0 :         nSymbolsSize = eSymbolsSize;
     542           0 :         bRebuildToolBar = sal_True;
     543             :     }
     544           0 :     else if ( nOutStyle != SvtMiscOptions().GetToolboxStyle() )
     545             :     {
     546           0 :         nOutStyle = SvtMiscOptions().GetToolboxStyle();
     547           0 :         SetOutStyle( nOutStyle );
     548           0 :         bRebuildToolBar = sal_True;
     549             :     }
     550             : 
     551           0 :     if ( bRebuildToolBar )
     552           0 :         RebuildToolbar();
     553             : 
     554           0 :     return 0L;
     555             : }
     556             : 
     557             : 
     558             : 
     559           0 : IMPL_LINK( BibToolBar, SettingsChanged_Impl, void*, /*pVoid*/ )
     560             : {
     561             :     // Check if toolbar button size have changed and we have to use system settings
     562           0 :     sal_Int16 eSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize();
     563           0 :     if ( eSymbolsSize != nSymbolsSize )
     564             :     {
     565           0 :         nSymbolsSize = eSymbolsSize;
     566           0 :         RebuildToolbar();
     567             :     }
     568             : 
     569           0 :     return 0L;
     570             : }
     571             : 
     572             : 
     573           0 : void BibToolBar::RebuildToolbar()
     574             : {
     575           0 :     ApplyImageList();
     576             :     // We have to call parent asynchronously as SetSize works also asynchronously!
     577           0 :     Application::PostUserEvent( aLayoutManager, 0 );
     578           0 : }
     579             : 
     580             : 
     581             : 
     582           0 : void BibToolBar::ApplyImageList()
     583             : {
     584           0 :     ImageList& rList = ( nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ) ?
     585             :                        ( aImgLst ) :
     586           0 :                        ( aBigImgLst );
     587             : 
     588           0 :     SetItemImage(TBC_BT_AUTOFILTER  , rList.GetImage(SID_FM_AUTOFILTER));
     589           0 :     SetItemImage(TBC_BT_FILTERCRIT  , rList.GetImage(SID_FM_FILTERCRIT));
     590           0 :     SetItemImage(TBC_BT_REMOVEFILTER, rList.GetImage(SID_FM_REMOVE_FILTER_SORT ));
     591           0 :     AdjustToolBox();
     592           0 : }
     593             : 
     594           0 : void BibToolBar::AdjustToolBox()
     595             : {
     596           0 :     Size aOldSize = GetSizePixel();
     597           0 :     Size aSize = CalcWindowSizePixel();
     598           0 :     if ( !aSize.Width() )
     599           0 :         aSize.Width() = aOldSize.Width();
     600           0 :     else if ( !aSize.Height() )
     601           0 :         aSize.Height() = aOldSize.Height();
     602             : 
     603           0 :     Size aTbSize = GetSizePixel();
     604           0 :     if (
     605           0 :         (aSize.Width() && aSize.Width() != aTbSize.Width()) ||
     606           0 :         (aSize.Height() && aSize.Height() != aTbSize.Height())
     607             :        )
     608             :     {
     609           0 :         SetPosSizePixel( GetPosPixel(), aSize );
     610           0 :         Invalidate();
     611             :     }
     612           0 : }
     613             : 
     614             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10