This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push: new 843af51 Cleaned up resource files, removed whitespace 843af51 is described below commit 843af519c84fff6efdefda5eb59775a5f5d4c0e5 Author: mseidel <msei...@apache.org> AuthorDate: Sun Mar 13 23:38:28 2022 +0100 Cleaned up resource files, removed whitespace --- main/svx/source/tbxctrls/colrctrl.src | 24 +- main/svx/source/tbxctrls/fontworkgallery.src | 4 +- main/svx/source/tbxctrls/grafctrl.src | 143 ++-- main/svx/source/tbxctrls/lboxctrl.src | 34 +- main/svx/source/tbxctrls/tbcontrl.src | 16 - .../svx/source/tbxctrls/tbunosearchcontrollers.cxx | 930 +++++++++++---------- .../svx/source/tbxctrls/tbunosearchcontrollers.src | 10 +- 7 files changed, 561 insertions(+), 600 deletions(-) diff --git a/main/svx/source/tbxctrls/colrctrl.src b/main/svx/source/tbxctrls/colrctrl.src index 7174d21..e69dc33 100644 --- a/main/svx/source/tbxctrls/colrctrl.src +++ b/main/svx/source/tbxctrls/colrctrl.src @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,26 +7,27 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - // include --------------------------------------------------------------- - //#include "colrctrl.hrc" + +// include --------------------------------------------------------------- +//#include "colrctrl.hrc" #include <svx/dialogs.hrc> #include "helpid.hrc" - // pragma ---------------------------------------------------------------- +// pragma ---------------------------------------------------------------- - // RID_SVXCTRL_COLOR ----------------------------------------------------- +// RID_SVXCTRL_COLOR ----------------------------------------------------- DockingWindow RID_SVXCTRL_COLOR { HelpID = HID_CTRL_COLOR ; @@ -39,13 +40,13 @@ DockingWindow RID_SVXCTRL_COLOR Zoomable = TRUE ; Dockable = TRUE ; EnableResizing = TRUE ; - Size = MAP_APPFONT ( 150 , 22 ) ; + Size = MAP_APPFONT ( 150, 22 ) ; Text [ en-US ] = "Colors" ; Control 1 { HelpId = HID_COLOR_CTL_COLORS ; - Pos = MAP_APPFONT ( 2 , 2 ) ; - Size = MAP_APPFONT ( 146 , 18 ) ; + Pos = MAP_APPFONT ( 2, 2 ) ; + Size = MAP_APPFONT ( 146, 18 ) ; Border = FALSE ; }; }; @@ -55,3 +56,4 @@ String STR_COLORTABLE Text [ en-US ] = "Color Palette" ; }; +// ********************************************************************** EOF diff --git a/main/svx/source/tbxctrls/fontworkgallery.src b/main/svx/source/tbxctrls/fontworkgallery.src index 6606e92..55986a0 100644 --- a/main/svx/source/tbxctrls/fontworkgallery.src +++ b/main/svx/source/tbxctrls/fontworkgallery.src @@ -187,11 +187,11 @@ DockingWindow RID_SVXFLOAT_FONTWORK_ALIGNMENT }; Image IMG_FONTWORK_ALIGN_STRETCH_26 { - ImageBitmap = Bitmap {File = "fontworkalignstretch_26.png"; } ; + ImageBitmap = Bitmap {File = "fontworkalignstretch_26.png" ;} ; }; Image IMG_FONTWORK_ALIGN_STRETCH_26_H { - ImageBitmap = Bitmap {File = "fontworkalignstretch_26_h.png"; } ; + ImageBitmap = Bitmap {File = "fontworkalignstretch_26_h.png" ;} ; }; }; diff --git a/main/svx/source/tbxctrls/grafctrl.src b/main/svx/source/tbxctrls/grafctrl.src index 914dc4b..a9bc5c6 100644 --- a/main/svx/source/tbxctrls/grafctrl.src +++ b/main/svx/source/tbxctrls/grafctrl.src @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -28,44 +28,44 @@ FloatingWindow RID_SVXTBX_GRFFILTER { - HelpId = HID_GRFFILTER; - Moveable = TRUE ; - Closeable = TRUE ; - Hide = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "Filters" ; - ToolBox TBX_GRFFILTER - { - SVLook = TRUE ; - MenuStrings = TRUE ; - Align = BOXALIGN_TOP; - LineCount = 3; - ItemList = - { - ToolBoxItem - { - Identifier = SID_GRFFILTER_INVERT ; - HelpID = HID_GRFFILTER_INVERT ; - }; - ToolBoxItem - { - Identifier = SID_GRFFILTER_SMOOTH ; - HelpID = HID_GRFFILTER_SMOOTH ; + HelpId = HID_GRFFILTER ; + Moveable = TRUE ; + Closeable = TRUE ; + Hide = TRUE ; + SVLook = TRUE ; + Text [ en-US ] = "Filters" ; + ToolBox TBX_GRFFILTER + { + SVLook = TRUE ; + MenuStrings = TRUE ; + Align = BOXALIGN_TOP ; + LineCount = 3 ; + ItemList = + { + ToolBoxItem + { + Identifier = SID_GRFFILTER_INVERT ; + HelpID = HID_GRFFILTER_INVERT ; }; - ToolBoxItem - { - Identifier = SID_GRFFILTER_SHARPEN ; - HelpID = HID_GRFFILTER_SHARPEN ; + ToolBoxItem + { + Identifier = SID_GRFFILTER_SMOOTH ; + HelpID = HID_GRFFILTER_SMOOTH ; }; - ToolBoxItem - { - Identifier = SID_GRFFILTER_REMOVENOISE ; - HelpID = HID_GRFFILTER_REMOVENOISE ; + ToolBoxItem + { + Identifier = SID_GRFFILTER_SHARPEN ; + HelpID = HID_GRFFILTER_SHARPEN ; + }; + ToolBoxItem + { + Identifier = SID_GRFFILTER_REMOVENOISE ; + HelpID = HID_GRFFILTER_REMOVENOISE ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_BREAK ; }; - ToolBoxItem - { - Type = TOOLBOXITEM_BREAK ; - }; ToolBoxItem { Identifier = SID_GRFFILTER_SOLARIZE ; @@ -86,10 +86,10 @@ FloatingWindow RID_SVXTBX_GRFFILTER Identifier = SID_GRFFILTER_POPART ; HelpId = HID_GRFFILTER_POPART ; }; - ToolBoxItem - { - Type = TOOLBOXITEM_BREAK ; - }; + ToolBoxItem + { + Type = TOOLBOXITEM_BREAK ; + }; ToolBoxItem { Identifier = SID_GRFFILTER_SOBEL ; @@ -105,8 +105,8 @@ FloatingWindow RID_SVXTBX_GRFFILTER Identifier = SID_GRFFILTER_MOSAIC ; HelpId = HID_GRFFILTER_MOSAIC ; }; - }; - }; + }; + }; }; // ----------- @@ -115,74 +115,39 @@ FloatingWindow RID_SVXTBX_GRFFILTER String RID_SVXSTR_UNDO_GRAFMODE { - Text [ en-US ] = "Graphics Mode"; + Text [ en-US ] = "Graphics Mode" ; }; String RID_SVXSTR_UNDO_GRAFRED { - Text [ en-US ] = "Red"; + Text [ en-US ] = "Red" ; }; String RID_SVXSTR_UNDO_GRAFGREEN { - Text [ en-US ] = "Green"; + Text [ en-US ] = "Green" ; }; String RID_SVXSTR_UNDO_GRAFBLUE { - Text [ en-US ] = "Blue"; + Text [ en-US ] = "Blue" ; }; String RID_SVXSTR_UNDO_GRAFLUMINANCE { - Text [ en-US ] = "Brightness"; + Text [ en-US ] = "Brightness" ; }; String RID_SVXSTR_UNDO_GRAFCONTRAST { - Text [ en-US ] = "Contrast"; + Text [ en-US ] = "Contrast" ; }; String RID_SVXSTR_UNDO_GRAFGAMMA { - Text [ en-US ] = "Gamma"; + Text [ en-US ] = "Gamma" ; }; String RID_SVXSTR_UNDO_GRAFTRANSPARENCY { - Text [ en-US ] = "Transparency"; + Text [ en-US ] = "Transparency" ; }; String RID_SVXSTR_GRAFCROP { - Text [ en-US ] = "Crop"; + Text [ en-US ] = "Crop" ; }; // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/main/svx/source/tbxctrls/lboxctrl.src b/main/svx/source/tbxctrls/lboxctrl.src index 2bb08c3..71341a4 100644 --- a/main/svx/source/tbxctrls/lboxctrl.src +++ b/main/svx/source/tbxctrls/lboxctrl.src @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -27,10 +27,10 @@ FloatingWindow RID_SVXTBX_UNDO_REDO_CTRL { - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 150 , 74 ) ; + Pos = MAP_APPFONT ( 0, 0 ) ; + Size = MAP_APPFONT ( 150, 74 ) ; HelpID = HID_SVXTBX_UNDO_REDO_CTRL ; - SysWin = TRUE; + SysWin = TRUE ; Border = TRUE ; Hide = TRUE ; SVLook = TRUE ; @@ -38,36 +38,38 @@ FloatingWindow RID_SVXTBX_UNDO_REDO_CTRL ListBox LB_SVXTBX_UNDO_REDO_CTRL { - HelpID = "svx:ListBox:RID_SVXTBX_UNDO_REDO_CTRL:LB_SVXTBX_UNDO_REDO_CTRL"; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 150 , 60 ) ; + HelpID = "svx:ListBox:RID_SVXTBX_UNDO_REDO_CTRL:LB_SVXTBX_UNDO_REDO_CTRL" ; + Pos = MAP_APPFONT ( 0, 0 ) ; + Size = MAP_APPFONT ( 150, 60 ) ; Border = TRUE ; DropDown = FALSE ; OutputSize = TRUE ; }; FixedText FT_NUM_OPERATIONS { - Pos = MAP_APPFONT ( 6 , 64 ) ; - Size = MAP_APPFONT ( 138 , 10 ) ; + Pos = MAP_APPFONT ( 6, 64 ) ; + Size = MAP_APPFONT ( 138, 10 ) ; }; }; String RID_SVXSTR_NUM_UNDO_ACTIONS { - Text[ en-US ] = "Actions to undo: $(ARG1)"; + Text [ en-US ] = "Actions to undo: $(ARG1)" ; }; String RID_SVXSTR_NUM_UNDO_ACTION { - Text[ en-US ] = "Actions to undo: $(ARG1)" ; + Text [ en-US ] = "Actions to undo: $(ARG1)" ; }; String RID_SVXSTR_NUM_REDO_ACTIONS { - Text[ en-US ] = "Actions to redo: $(ARG1)"; + Text [ en-US ] = "Actions to redo: $(ARG1)" ; }; String RID_SVXSTR_NUM_REDO_ACTION { - Text[ en-US ] = "Actions to redo: $(ARG1)"; + Text [ en-US ] = "Actions to redo: $(ARG1)" ; }; + +// ********************************************************************** EOF diff --git a/main/svx/source/tbxctrls/tbcontrl.src b/main/svx/source/tbxctrls/tbcontrl.src index 7f82056..df45aa1 100644 --- a/main/svx/source/tbxctrls/tbcontrl.src +++ b/main/svx/source/tbxctrls/tbcontrl.src @@ -35,12 +35,10 @@ Image RID_SVX_RELOAD_NORMAL { ImageBitmap = Bitmap { File = "reload.png" ; }; - MASKCOLOR }; Image RID_SVX_RELOAD_SPECIAL { ImageBitmap = Bitmap { File = "reloads.png" ; }; - MASKCOLOR }; ImageList RID_SVXIL_FRAME { @@ -106,72 +104,58 @@ String RID_SVXSTR_PAGES Image RID_SVXIMG_GRAF_RED { ImageBitmap = Bitmap { File = "sc10865.png" ; }; - MASKCOLOR }; Image RID_SVXIMG_GRAF_GREEN { ImageBitmap = Bitmap { File = "sc10866.png" ; }; - MASKCOLOR }; Image RID_SVXIMG_GRAF_BLUE { ImageBitmap = Bitmap { File = "sc10867.png" ; }; - MASKCOLOR }; Image RID_SVXIMG_GRAF_LUMINANCE { ImageBitmap = Bitmap { File = "sc10863.png" ; }; - MASKCOLOR }; Image RID_SVXIMG_GRAF_CONTRAST { ImageBitmap = Bitmap { File = "sc10864.png" ; }; - MASKCOLOR }; Image RID_SVXIMG_GRAF_GAMMA { ImageBitmap = Bitmap { File = "sc10868.png" ; }; - MASKCOLOR }; Image RID_SVXIMG_GRAF_TRANSPARENCE { ImageBitmap = Bitmap { File = "sc10869.png" ; }; - MASKCOLOR }; Image RID_SVXIMG_GRAF_RED_H { ImageBitmap = Bitmap { File = "sch10865.png" ; }; - MASKCOLOR }; Image RID_SVXIMG_GRAF_GREEN_H { ImageBitmap = Bitmap { File = "sch10866.png" ; }; - MASKCOLOR }; Image RID_SVXIMG_GRAF_BLUE_H { ImageBitmap = Bitmap { File = "sch10867.png" ; }; - MASKCOLOR }; Image RID_SVXIMG_GRAF_LUMINANCE_H { ImageBitmap = Bitmap { File = "sch10863.png" ; }; - MASKCOLOR }; Image RID_SVXIMG_GRAF_CONTRAST_H { ImageBitmap = Bitmap { File = "sch10864.png" ; }; - MASKCOLOR }; Image RID_SVXIMG_GRAF_GAMMA_H { ImageBitmap = Bitmap { File = "sch10868.png" ; }; - MASKCOLOR }; Image RID_SVXIMG_GRAF_TRANSPARENCE_H { ImageBitmap = Bitmap { File = "sch10869.png" ; }; - MASKCOLOR }; String RID_SVXSTR_CLEARFORM { diff --git a/main/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/main/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 0b318d5..7008162 100644 --- a/main/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/main/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -45,9 +45,9 @@ static const ::rtl::OUString SEARCHITEM_SEARCHSTRING = ::rtl::OUString::create static const ::rtl::OUString SEARCHITEM_SEARCHBACKWARD = ::rtl::OUString::createFromAscii("SearchItem.Backward"); static const ::rtl::OUString COMMAND_EXECUTESEARCH = ::rtl::OUString::createFromAscii(".uno:ExecuteSearch"); -static const ::rtl::OUString COMMAND_FINDTEXT = ::rtl::OUString::createFromAscii(".uno:FindText") ; +static const ::rtl::OUString COMMAND_FINDTEXT = ::rtl::OUString::createFromAscii(".uno:FindText"); static const ::rtl::OUString COMMAND_DOWNSEARCH = ::rtl::OUString::createFromAscii(".uno:DownSearch"); -static const ::rtl::OUString COMMAND_UPSEARCH = ::rtl::OUString::createFromAscii(".uno:UpSearch") ; +static const ::rtl::OUString COMMAND_UPSEARCH = ::rtl::OUString::createFromAscii(".uno:UpSearch"); static const ::rtl::OUString COMMAND_APPENDSEARCHHISTORY = ::rtl::OUString::createFromAscii("AppendSearchHistory"); static const ::rtl::OUString SERVICENAME_URLTRANSFORMER = ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer"); @@ -55,32 +55,32 @@ static const sal_Int32 REMEMBER_SIZE = 10; void impl_executeSearch( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr, const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Sequence< css::beans::PropertyValue >& lArgs ) { - css::uno::Reference< css::util::XURLTransformer > xURLTransformer( rSMgr->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY ); - if ( xURLTransformer.is() ) - { - css::util::URL aURL; - aURL.Complete = COMMAND_EXECUTESEARCH; - xURLTransformer->parseStrict(aURL); + css::uno::Reference< css::util::XURLTransformer > xURLTransformer( rSMgr->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY ); + if ( xURLTransformer.is() ) + { + css::util::URL aURL; + aURL.Complete = COMMAND_EXECUTESEARCH; + xURLTransformer->parseStrict(aURL); - css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY); - if ( xDispatchProvider.is() ) - { - css::uno::Reference< css::frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 ); - if ( xDispatch.is() && aURL.Complete.getLength() > 0 ) - xDispatch->dispatch( aURL, lArgs ); - } - } + css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY); + if ( xDispatchProvider.is() ) + { + css::uno::Reference< css::frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 ); + if ( xDispatch.is() && aURL.Complete.getLength() > 0 ) + xDispatch->dispatch( aURL, lArgs ); + } + } } -FindTextFieldControl::FindTextFieldControl( Window* pParent, WinBits nStyle, - css::uno::Reference< css::frame::XFrame >& xFrame, - css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager) : - ComboBox( pParent, nStyle ), - m_xFrame(xFrame), - m_xServiceManager(xServiceManager), - m_bToClearTextField(sal_True) +FindTextFieldControl::FindTextFieldControl( Window* pParent, WinBits nStyle, + css::uno::Reference< css::frame::XFrame >& xFrame, + css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager) : + ComboBox( pParent, nStyle ), + m_xFrame(xFrame), + m_xServiceManager(xServiceManager), + m_bToClearTextField(sal_True) { - InitControls_Impl(); + InitControls_Impl(); } FindTextFieldControl::~FindTextFieldControl() @@ -89,97 +89,97 @@ FindTextFieldControl::~FindTextFieldControl() void FindTextFieldControl::InitControls_Impl() { - SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_FIND ) ); - SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor()); + SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_FIND ) ); + SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor()); - EnableAutocomplete(sal_True, sal_True); + EnableAutocomplete(sal_True, sal_True); } void FindTextFieldControl::Remember_Impl(const String& rStr) { - sal_uInt16 nCount = GetEntryCount(); + sal_uInt16 nCount = GetEntryCount(); - for (sal_uInt16 i=0; i<nCount; ++i) - { - if ( rStr == GetEntry(i)) - return; - } + for (sal_uInt16 i=0; i<nCount; ++i) + { + if ( rStr == GetEntry(i)) + return; + } - if (nCount == REMEMBER_SIZE) - RemoveEntry(REMEMBER_SIZE-1); + if (nCount == REMEMBER_SIZE) + RemoveEntry(REMEMBER_SIZE-1); - InsertEntry(rStr, 0); + InsertEntry(rStr, 0); } void FindTextFieldControl::Modify() { - ComboBox::Modify(); + ComboBox::Modify(); - SetControlForeground( GetSettings().GetStyleSettings().GetWindowTextColor() ); + SetControlForeground( GetSettings().GetStyleSettings().GetWindowTextColor() ); } long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt ) { - long nRet= ComboBox::PreNotify( rNEvt ); - - switch ( rNEvt.GetType() ) - { - case EVENT_KEYINPUT: - { - const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); - sal_Bool bCtrl = pKeyEvent->GetKeyCode().IsMod1(); - sal_Bool bAlt = pKeyEvent->GetKeyCode().IsMod2(); - sal_Bool bShift = pKeyEvent->GetKeyCode().IsShift(); - sal_uInt16 nCode = pKeyEvent->GetKeyCode().GetCode(); - - if ( (bCtrl && bAlt && KEY_F == nCode) || KEY_ESCAPE == nCode ) - { - nRet = 1; - GrabFocusToDocument(); - } - - if ( KEY_RETURN == nCode ) - { - Remember_Impl(GetText()); - - ::rtl::OUString sFindText = GetText(); - css::uno::Sequence< css::beans::PropertyValue > lArgs(2); - - lArgs[0].Name = SEARCHITEM_SEARCHSTRING; - lArgs[0].Value <<= sFindText; - - lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; - if (bShift) - lArgs[1].Value <<= sal_True; - else - lArgs[1].Value <<= sal_False; - - impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); - nRet = 1; - } - break; - } - - case EVENT_GETFOCUS: - if ( m_bToClearTextField ) - { - SetText( String() ); - m_bToClearTextField = sal_False; - } - SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) ); - break; - - case EVENT_LOSEFOCUS: - if ( GetText().Len() == 0 ) - { - SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_FIND ) ); - SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor()); - m_bToClearTextField = sal_True; - } - break; - } - - return nRet; + long nRet= ComboBox::PreNotify( rNEvt ); + + switch ( rNEvt.GetType() ) + { + case EVENT_KEYINPUT: + { + const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); + sal_Bool bCtrl = pKeyEvent->GetKeyCode().IsMod1(); + sal_Bool bAlt = pKeyEvent->GetKeyCode().IsMod2(); + sal_Bool bShift = pKeyEvent->GetKeyCode().IsShift(); + sal_uInt16 nCode = pKeyEvent->GetKeyCode().GetCode(); + + if ( (bCtrl && bAlt && KEY_F == nCode) || KEY_ESCAPE == nCode ) + { + nRet = 1; + GrabFocusToDocument(); + } + + if ( KEY_RETURN == nCode ) + { + Remember_Impl(GetText()); + + ::rtl::OUString sFindText = GetText(); + css::uno::Sequence< css::beans::PropertyValue > lArgs(2); + + lArgs[0].Name = SEARCHITEM_SEARCHSTRING; + lArgs[0].Value <<= sFindText; + + lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + if (bShift) + lArgs[1].Value <<= sal_True; + else + lArgs[1].Value <<= sal_False; + + impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); + nRet = 1; + } + break; + } + + case EVENT_GETFOCUS: + if ( m_bToClearTextField ) + { + SetText( String() ); + m_bToClearTextField = sal_False; + } + SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) ); + break; + + case EVENT_LOSEFOCUS: + if ( GetText().Len() == 0 ) + { + SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_FIND ) ); + SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor()); + m_bToClearTextField = sal_True; + } + break; + } + + return nRet; } @@ -198,83 +198,83 @@ SearchToolbarControllersManager::~SearchToolbarControllersManager() SearchToolbarControllersManager* SearchToolbarControllersManager::createControllersManager() { - if (!m_pInstance) - m_pInstance = new SearchToolbarControllersManager(); + if (!m_pInstance) + m_pInstance = new SearchToolbarControllersManager(); - return m_pInstance; + return m_pInstance; } void SearchToolbarControllersManager::registryController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL ) { - SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); - if (pIt == aSearchToolbarControllersMap.end()) - { - SearchToolbarControllersVec lControllers(1); - lControllers[0].Name = sCommandURL; - lControllers[0].Value <<= xStatusListener; - aSearchToolbarControllersMap.insert(SearchToolbarControllersMap::value_type(xFrame, lControllers)); - } - else - { - sal_Int32 nSize = pIt->second.size(); - for (sal_Int32 i=0; i<nSize; ++i) - { - if (pIt->second[i].Name.equals(sCommandURL)) - return; - } - - pIt->second.resize(nSize+1); - pIt->second[nSize].Name = sCommandURL; - pIt->second[nSize].Value <<= xStatusListener; - } + SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); + if (pIt == aSearchToolbarControllersMap.end()) + { + SearchToolbarControllersVec lControllers(1); + lControllers[0].Name = sCommandURL; + lControllers[0].Value <<= xStatusListener; + aSearchToolbarControllersMap.insert(SearchToolbarControllersMap::value_type(xFrame, lControllers)); + } + else + { + sal_Int32 nSize = pIt->second.size(); + for (sal_Int32 i=0; i<nSize; ++i) + { + if (pIt->second[i].Name.equals(sCommandURL)) + return; + } + + pIt->second.resize(nSize+1); + pIt->second[nSize].Name = sCommandURL; + pIt->second[nSize].Value <<= xStatusListener; + } } void SearchToolbarControllersManager::freeController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& /*xStatusListener*/, const ::rtl::OUString& sCommandURL ) { - SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); - if (pIt != aSearchToolbarControllersMap.end()) - { - for (SearchToolbarControllersVec::iterator pItCtrl=pIt->second.begin(); pItCtrl!=pIt->second.end(); ++pItCtrl) - { - if (pItCtrl->Name.equals(sCommandURL)) - { - pIt->second.erase(pItCtrl); - break; - } - } + SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); + if (pIt != aSearchToolbarControllersMap.end()) + { + for (SearchToolbarControllersVec::iterator pItCtrl=pIt->second.begin(); pItCtrl!=pIt->second.end(); ++pItCtrl) + { + if (pItCtrl->Name.equals(sCommandURL)) + { + pIt->second.erase(pItCtrl); + break; + } + } - if (pIt->second.empty()) - aSearchToolbarControllersMap.erase(pIt); - } + if (pIt->second.empty()) + aSearchToolbarControllersMap.erase(pIt); + } } css::uno::Reference< css::frame::XStatusListener > SearchToolbarControllersManager::findController( const css::uno::Reference< css::frame::XFrame >& xFrame, const ::rtl::OUString& sCommandURL ) { - css::uno::Reference< css::frame::XStatusListener > xStatusListener; + css::uno::Reference< css::frame::XStatusListener > xStatusListener; - SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); - if (pIt != aSearchToolbarControllersMap.end()) - { - for (SearchToolbarControllersVec::iterator pItCtrl =pIt->second.begin(); pItCtrl != pIt->second.end(); ++pItCtrl) - { - if (pItCtrl->Name.equals(sCommandURL)) - { - pItCtrl->Value >>= xStatusListener; - break; - } - } - } + SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); + if (pIt != aSearchToolbarControllersMap.end()) + { + for (SearchToolbarControllersVec::iterator pItCtrl =pIt->second.begin(); pItCtrl != pIt->second.end(); ++pItCtrl) + { + if (pItCtrl->Name.equals(sCommandURL)) + { + pItCtrl->Value >>= xStatusListener; + break; + } + } + } - return xStatusListener; + return xStatusListener; } //----------------------------------------------------------------------------------------------------------- // FindTextToolbarController FindTextToolbarController::FindTextToolbarController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ) - :svt::ToolboxController( rServiceManager, - css::uno::Reference< css::frame::XFrame >(), - COMMAND_FINDTEXT ) + :svt::ToolboxController( rServiceManager, + css::uno::Reference< css::frame::XFrame >(), + COMMAND_FINDTEXT ) { } @@ -285,86 +285,92 @@ FindTextToolbarController::~FindTextToolbarController() // XInterface css::uno::Any SAL_CALL FindTextToolbarController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ) { - css::uno::Any a = ToolboxController::queryInterface( aType ); - if ( a.hasValue() ) - return a; + css::uno::Any a = ToolboxController::queryInterface( aType ); + if ( a.hasValue() ) + return a; - return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); + return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); } void SAL_CALL FindTextToolbarController::acquire() throw () { - ToolboxController::acquire(); + ToolboxController::acquire(); } void SAL_CALL FindTextToolbarController::release() throw () { - ToolboxController::release(); + ToolboxController::release(); } // XServiceInfo ::rtl::OUString SAL_CALL FindTextToolbarController::getImplementationName() throw( css::uno::RuntimeException ) { - return getImplementationName_Static(); + return getImplementationName_Static(); } sal_Bool SAL_CALL FindTextToolbarController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) -{ - const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); - const ::rtl::OUString * pArray = aSNL.getConstArray(); +{ + const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; - return false; + return false; } css::uno::Sequence< ::rtl::OUString > SAL_CALL FindTextToolbarController::getSupportedServiceNames() throw( css::uno::RuntimeException ) { - return getSupportedServiceNames_Static(); + return getSupportedServiceNames_Static(); } -css::uno::Sequence< ::rtl::OUString > FindTextToolbarController::getSupportedServiceNames_Static() throw() +css::uno::Sequence< ::rtl::OUString > FindTextToolbarController::getSupportedServiceNames_Static() throw() { - css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) ); - return aSNS; + css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) ); + return aSNS; } // XComponent void SAL_CALL FindTextToolbarController::dispose() throw ( css::uno::RuntimeException ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); - SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); - - svt::ToolboxController::dispose(); - delete m_pFindTextFieldControl; - m_pFindTextFieldControl = 0; + svt::ToolboxController::dispose(); + delete m_pFindTextFieldControl; + m_pFindTextFieldControl = 0; } // XInitialization void SAL_CALL FindTextToolbarController::initialize( const css::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException) { - svt::ToolboxController::initialize(aArguments); - - Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); - ToolBox* pToolBox = (ToolBox*)pWindow; - if ( pToolBox ) - { - sal_uInt16 nItemCount = pToolBox->GetItemCount(); - for ( sal_uInt16 i=0; i<nItemCount; ++i ) - { - ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); - if ( sItemCommand.equals( COMMAND_DOWNSEARCH ) ) - m_nDownSearchId = i; - else if (sItemCommand.equals( COMMAND_UPSEARCH )) - m_nUpSearchId = i; - } - } - - SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + svt::ToolboxController::initialize(aArguments); + + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + sal_uInt16 nItemCount = pToolBox->GetItemCount(); + for ( sal_uInt16 i=0; i<nItemCount; ++i ) + { + ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); + if ( sItemCommand.equals( COMMAND_DOWNSEARCH ) ) + { + pToolBox->EnableItem(i, sal_False); + m_nDownSearchId = i; + } + else if (sItemCommand.equals( COMMAND_UPSEARCH )) + { + pToolBox->EnableItem(i, sal_False); + m_nUpSearchId = i; + } + } + } + + SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); } // XToolbarController @@ -374,71 +380,71 @@ void SAL_CALL FindTextToolbarController::execute( sal_Int16 /*KeyModifier*/ ) th css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException ) { - css::uno::Reference< css::awt::XWindow > xItemWindow; + css::uno::Reference< css::awt::XWindow > xItemWindow; - css::uno::Reference< css::awt::XWindow > xParent( Parent ); - Window* pParent = VCLUnoHelper::GetWindow( xParent ); - if ( pParent ) - { - ToolBox* pToolbar = ( ToolBox* )pParent; - m_pFindTextFieldControl = new FindTextFieldControl( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xServiceManager ); + css::uno::Reference< css::awt::XWindow > xParent( Parent ); + Window* pParent = VCLUnoHelper::GetWindow( xParent ); + if ( pParent ) + { + ToolBox* pToolbar = ( ToolBox* )pParent; + m_pFindTextFieldControl = new FindTextFieldControl( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xServiceManager ); - Size aSize(100, m_pFindTextFieldControl->GetTextHeight() + 200); - m_pFindTextFieldControl->SetSizePixel( aSize ); - m_pFindTextFieldControl->SetModifyHdl(LINK(this, FindTextToolbarController, EditModifyHdl)); - } - xItemWindow = VCLUnoHelper::GetInterface( m_pFindTextFieldControl ); + Size aSize(100, m_pFindTextFieldControl->GetTextHeight() + 200); + m_pFindTextFieldControl->SetSizePixel( aSize ); + m_pFindTextFieldControl->SetModifyHdl(LINK(this, FindTextToolbarController, EditModifyHdl)); + } + xItemWindow = VCLUnoHelper::GetInterface( m_pFindTextFieldControl ); - return xItemWindow; + return xItemWindow; } // XStatusListener void SAL_CALL FindTextToolbarController::statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - if ( m_bDisposed ) - return; + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + if ( m_bDisposed ) + return; - ::rtl::OUString aFeatureURL = rEvent.FeatureURL.Complete; - if (aFeatureURL.equalsAscii("AppendSearchHistory")) - { - m_pFindTextFieldControl->Remember_Impl(m_pFindTextFieldControl->GetText()); - } + ::rtl::OUString aFeatureURL = rEvent.FeatureURL.Complete; + if (aFeatureURL.equalsAscii("AppendSearchHistory")) + { + m_pFindTextFieldControl->Remember_Impl(m_pFindTextFieldControl->GetText()); + } } IMPL_LINK( FindTextToolbarController, EditModifyHdl, void *, EMPTYARG ) { - // enable or disable item DownSearch/UpSearch of findbar - Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); - ToolBox* pToolBox = (ToolBox*)pWindow; - if ( pToolBox && m_pFindTextFieldControl ) - { - if (m_pFindTextFieldControl->GetText().Len()>0) - { - if ( !pToolBox->IsItemEnabled(m_nDownSearchId) ) - pToolBox->EnableItem(m_nDownSearchId, sal_True); - if ( !pToolBox->IsItemEnabled(m_nUpSearchId) ) - pToolBox->EnableItem(m_nUpSearchId, sal_True); - } - else - { - if ( pToolBox->IsItemEnabled(m_nDownSearchId) ) - pToolBox->EnableItem(m_nDownSearchId, sal_False); - if ( pToolBox->IsItemEnabled(m_nUpSearchId) ) - pToolBox->EnableItem(m_nUpSearchId, sal_False); - } - } - - return 0; + // enable or disable item DownSearch/UpSearch of findbar + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox && m_pFindTextFieldControl ) + { + if (m_pFindTextFieldControl->GetText().Len()>0) + { + if ( !pToolBox->IsItemEnabled(m_nDownSearchId) ) + pToolBox->EnableItem(m_nDownSearchId, sal_True); + if ( !pToolBox->IsItemEnabled(m_nUpSearchId) ) + pToolBox->EnableItem(m_nUpSearchId, sal_True); + } + else + { + if ( pToolBox->IsItemEnabled(m_nDownSearchId) ) + pToolBox->EnableItem(m_nDownSearchId, sal_False); + if ( pToolBox->IsItemEnabled(m_nUpSearchId) ) + pToolBox->EnableItem(m_nUpSearchId, sal_False); + } + } + + return 0; } //----------------------------------------------------------------------------------------------------------- // class DownSearchToolboxController DownSearchToolboxController::DownSearchToolboxController(const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ) - : svt::ToolboxController( rServiceManager, - css::uno::Reference< css::frame::XFrame >(), - COMMAND_DOWNSEARCH ) + : svt::ToolboxController( rServiceManager, + css::uno::Reference< css::frame::XFrame >(), + COMMAND_DOWNSEARCH ) { } @@ -449,125 +455,125 @@ DownSearchToolboxController::~DownSearchToolboxController() // XInterface css::uno::Any SAL_CALL DownSearchToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ) { - css::uno::Any a = ToolboxController::queryInterface( aType ); - if ( a.hasValue() ) - return a; + css::uno::Any a = ToolboxController::queryInterface( aType ); + if ( a.hasValue() ) + return a; - return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); + return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); } void SAL_CALL DownSearchToolboxController::acquire() throw () { - ToolboxController::acquire(); + ToolboxController::acquire(); } void SAL_CALL DownSearchToolboxController::release() throw () { - ToolboxController::release(); + ToolboxController::release(); } // XServiceInfo ::rtl::OUString SAL_CALL DownSearchToolboxController::getImplementationName() throw( css::uno::RuntimeException ) { - return getImplementationName_Static(); + return getImplementationName_Static(); } sal_Bool SAL_CALL DownSearchToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) -{ - const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); - const ::rtl::OUString * pArray = aSNL.getConstArray(); +{ + const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; - return false; + return false; } css::uno::Sequence< ::rtl::OUString > SAL_CALL DownSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException ) { - return getSupportedServiceNames_Static(); + return getSupportedServiceNames_Static(); } -css::uno::Sequence< ::rtl::OUString > DownSearchToolboxController::getSupportedServiceNames_Static() throw() +css::uno::Sequence< ::rtl::OUString > DownSearchToolboxController::getSupportedServiceNames_Static() throw() { - css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); - return aSNS; + css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } // XComponent void SAL_CALL DownSearchToolboxController::dispose() throw ( css::uno::RuntimeException ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); - svt::ToolboxController::dispose(); + svt::ToolboxController::dispose(); } // XInitialization void SAL_CALL DownSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) { - svt::ToolboxController::initialize( aArguments ); - SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + svt::ToolboxController::initialize( aArguments ); + SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); } // XToolbarController void SAL_CALL DownSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException) { - if ( m_bDisposed ) - throw css::lang::DisposedException(); - - ::rtl::OUString sFindText; - Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); - ToolBox* pToolBox = (ToolBox*)pWindow; - if ( pToolBox ) - { - sal_uInt16 nItemCount = pToolBox->GetItemCount(); - for ( sal_uInt16 i=0; i<nItemCount; ++i ) - { - ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); - if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) - { - Window* pItemWin = pToolBox->GetItemWindow(i); - if (pItemWin) - sFindText = pItemWin->GetText(); - break; - } - } - } - - css::uno::Sequence< css::beans::PropertyValue > lArgs(2); - lArgs[0].Name = SEARCHITEM_SEARCHSTRING; - lArgs[0].Value <<= sFindText; - lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; - lArgs[1].Value <<= sal_False; - - impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); - - css::frame::FeatureStateEvent aEvent; - aEvent.FeatureURL.Complete = COMMAND_APPENDSEARCHHISTORY; - css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); - if (xStatusListener.is()) - xStatusListener->statusChanged( aEvent ); + if ( m_bDisposed ) + throw css::lang::DisposedException(); + + ::rtl::OUString sFindText; + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + sal_uInt16 nItemCount = pToolBox->GetItemCount(); + for ( sal_uInt16 i=0; i<nItemCount; ++i ) + { + ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); + if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) + { + Window* pItemWin = pToolBox->GetItemWindow(i); + if (pItemWin) + sFindText = pItemWin->GetText(); + break; + } + } + } + + css::uno::Sequence< css::beans::PropertyValue > lArgs(2); + lArgs[0].Name = SEARCHITEM_SEARCHSTRING; + lArgs[0].Value <<= sFindText; + lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + lArgs[1].Value <<= sal_False; + + impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); + + css::frame::FeatureStateEvent aEvent; + aEvent.FeatureURL.Complete = COMMAND_APPENDSEARCHHISTORY; + css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); + if (xStatusListener.is()) + xStatusListener->statusChanged( aEvent ); } // XStatusListener void SAL_CALL DownSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - if ( m_bDisposed ) - return; + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + if ( m_bDisposed ) + return; } //----------------------------------------------------------------------------------------------------------- // class UpSearchToolboxController UpSearchToolboxController::UpSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager ) - :svt::ToolboxController( rServiceManager, - css::uno::Reference< css::frame::XFrame >(), - COMMAND_UPSEARCH ) + :svt::ToolboxController( rServiceManager, + css::uno::Reference< css::frame::XFrame >(), + COMMAND_UPSEARCH ) { } @@ -578,256 +584,256 @@ UpSearchToolboxController::~UpSearchToolboxController() // XInterface css::uno::Any SAL_CALL UpSearchToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ) { - css::uno::Any a = ToolboxController::queryInterface( aType ); - if ( a.hasValue() ) - return a; + css::uno::Any a = ToolboxController::queryInterface( aType ); + if ( a.hasValue() ) + return a; - return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); + return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); } void SAL_CALL UpSearchToolboxController::acquire() throw () { - ToolboxController::acquire(); + ToolboxController::acquire(); } void SAL_CALL UpSearchToolboxController::release() throw () { - ToolboxController::release(); + ToolboxController::release(); } // XServiceInfo ::rtl::OUString SAL_CALL UpSearchToolboxController::getImplementationName() throw( css::uno::RuntimeException ) { - return getImplementationName_Static(); + return getImplementationName_Static(); } sal_Bool SAL_CALL UpSearchToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) -{ - const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); - const ::rtl::OUString * pArray = aSNL.getConstArray(); +{ + const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; - return false; + return false; } css::uno::Sequence< ::rtl::OUString > SAL_CALL UpSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException ) { - return getSupportedServiceNames_Static(); + return getSupportedServiceNames_Static(); } -css::uno::Sequence< ::rtl::OUString > UpSearchToolboxController::getSupportedServiceNames_Static() throw() +css::uno::Sequence< ::rtl::OUString > UpSearchToolboxController::getSupportedServiceNames_Static() throw() { - css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) ); - return aSNS; + css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) ); + return aSNS; } // XComponent void SAL_CALL UpSearchToolboxController::dispose() throw ( css::uno::RuntimeException ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); - svt::ToolboxController::dispose(); + svt::ToolboxController::dispose(); } // XInitialization void SAL_CALL UpSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) { - svt::ToolboxController::initialize( aArguments ); - SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + svt::ToolboxController::initialize( aArguments ); + SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); } // XToolbarController void SAL_CALL UpSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException ) { - if ( m_bDisposed ) - throw css::lang::DisposedException(); - - ::rtl::OUString sFindText; - Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); - ToolBox* pToolBox = (ToolBox*)pWindow; - if ( pToolBox ) - { - sal_uInt16 nItemCount = pToolBox->GetItemCount(); - for ( sal_uInt16 i=0; i<nItemCount; ++i ) - { - ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); - if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) - { - Window* pItemWin = pToolBox->GetItemWindow(i); - if (pItemWin) - sFindText = pItemWin->GetText(); - break; - } - } - } - - css::uno::Sequence< css::beans::PropertyValue > lArgs(2); - lArgs[0].Name = SEARCHITEM_SEARCHSTRING; - lArgs[0].Value <<= sFindText; - lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; - lArgs[1].Value <<= sal_True; - - impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); - - css::frame::FeatureStateEvent aEvent; - aEvent.FeatureURL.Complete = COMMAND_APPENDSEARCHHISTORY; - css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); - if (xStatusListener.is()) - xStatusListener->statusChanged( aEvent ); + if ( m_bDisposed ) + throw css::lang::DisposedException(); + + ::rtl::OUString sFindText; + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + sal_uInt16 nItemCount = pToolBox->GetItemCount(); + for ( sal_uInt16 i=0; i<nItemCount; ++i ) + { + ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); + if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) + { + Window* pItemWin = pToolBox->GetItemWindow(i); + if (pItemWin) + sFindText = pItemWin->GetText(); + break; + } + } + } + + css::uno::Sequence< css::beans::PropertyValue > lArgs(2); + lArgs[0].Name = SEARCHITEM_SEARCHSTRING; + lArgs[0].Value <<= sFindText; + lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + lArgs[1].Value <<= sal_True; + + impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); + + css::frame::FeatureStateEvent aEvent; + aEvent.FeatureURL.Complete = COMMAND_APPENDSEARCHHISTORY; + css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); + if (xStatusListener.is()) + xStatusListener->statusChanged( aEvent ); } // XStatusListener void SAL_CALL UpSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - if ( m_bDisposed ) - return; + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + if ( m_bDisposed ) + return; } //----------------------------------------------------------------------------------------------------------- // class FindbarDispatcher FindbarDispatcher::FindbarDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory) - : m_xFactory( xFactory ) + : m_xFactory( xFactory ) { } FindbarDispatcher::~FindbarDispatcher() { - m_xFactory = NULL; - m_xFrame = NULL; + m_xFactory = NULL; + m_xFrame = NULL; } // XInterface css::uno::Any SAL_CALL FindbarDispatcher::queryInterface( const css::uno::Type& aType ) throw( css::uno::RuntimeException ) { - css::uno::Any aReturn( ::cppu::queryInterface( aType, - static_cast< css::lang::XServiceInfo* >(this), - static_cast< css::lang::XInitialization* >(this), - static_cast< css::frame::XDispatchProvider* >(this), - static_cast< css::frame::XDispatch* >(this)) ); + css::uno::Any aReturn( ::cppu::queryInterface( aType, + static_cast< css::lang::XServiceInfo* >(this), + static_cast< css::lang::XInitialization* >(this), + static_cast< css::frame::XDispatchProvider* >(this), + static_cast< css::frame::XDispatch* >(this)) ); - if ( aReturn.hasValue() ) - return aReturn; + if ( aReturn.hasValue() ) + return aReturn; - return OWeakObject::queryInterface( aType ); + return OWeakObject::queryInterface( aType ); } void SAL_CALL FindbarDispatcher::acquire() throw() { - OWeakObject::acquire(); + OWeakObject::acquire(); } void SAL_CALL FindbarDispatcher::release() throw() { - OWeakObject::release(); + OWeakObject::release(); } // XServiceInfo ::rtl::OUString SAL_CALL FindbarDispatcher::getImplementationName() throw( css::uno::RuntimeException ) { - return getImplementationName_Static(); + return getImplementationName_Static(); } sal_Bool SAL_CALL FindbarDispatcher::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) -{ - return ( - ServiceName.equalsAscii("com.sun.star.comp.svx.FindbarDispatcher") || - ServiceName.equalsAscii("com.sun.star.frame.ProtocolHandler") - ); +{ + return ( + ServiceName.equalsAscii("com.sun.star.comp.svx.FindbarDispatcher") || + ServiceName.equalsAscii("com.sun.star.frame.ProtocolHandler") + ); } css::uno::Sequence< ::rtl::OUString > SAL_CALL FindbarDispatcher::getSupportedServiceNames() throw( css::uno::RuntimeException ) { - return getSupportedServiceNames_Static(); + return getSupportedServiceNames_Static(); } -css::uno::Sequence< ::rtl::OUString > FindbarDispatcher::getSupportedServiceNames_Static() throw() +css::uno::Sequence< ::rtl::OUString > FindbarDispatcher::getSupportedServiceNames_Static() throw() { - css::uno::Sequence< ::rtl::OUString > aSNS( 2 ); - aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FindbarDispatcher" )); - aSNS.getArray()[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ProtocolHandler" )); - return aSNS; + css::uno::Sequence< ::rtl::OUString > aSNS( 2 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FindbarDispatcher" )); + aSNS.getArray()[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ProtocolHandler" )); + return aSNS; } // XInitialization void SAL_CALL FindbarDispatcher::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) { - if ( aArguments.getLength() ) - aArguments[0] >>= m_xFrame; + if ( aArguments.getLength() ) + aArguments[0] >>= m_xFrame; } // XDispatchProvider css::uno::Reference< css::frame::XDispatch > SAL_CALL FindbarDispatcher::queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& /*sTargetFrameName*/, sal_Int32 /*nSearchFlags*/ ) throw( css::uno::RuntimeException ) { - css::uno::Reference< css::frame::XDispatch > xDispatch; + css::uno::Reference< css::frame::XDispatch > xDispatch; - if ( aURL.Protocol.equalsAscii("vnd.sun.star.findbar:") ) - xDispatch = this; + if ( aURL.Protocol.equalsAscii("vnd.sun.star.findbar:") ) + xDispatch = this; - return xDispatch; + return xDispatch; } css::uno::Sequence < css::uno::Reference< css::frame::XDispatch > > SAL_CALL FindbarDispatcher::queryDispatches( const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescripts ) throw( css::uno::RuntimeException ) { - sal_Int32 nCount = seqDescripts.getLength(); - css::uno::Sequence < css::uno::Reference < XDispatch > > lDispatcher( nCount ); + sal_Int32 nCount = seqDescripts.getLength(); + css::uno::Sequence < css::uno::Reference < XDispatch > > lDispatcher( nCount ); - for( sal_Int32 i=0; i<nCount; ++i ) - lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL, seqDescripts[i].FrameName, seqDescripts[i].SearchFlags ); + for( sal_Int32 i=0; i<nCount; ++i ) + lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL, seqDescripts[i].FrameName, seqDescripts[i].SearchFlags ); - return lDispatcher; + return lDispatcher; } // XDispatch void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css::uno::Sequence < css::beans::PropertyValue >& /*lArgs*/ ) throw( css::uno::RuntimeException ) { - //vnd.sun.star.findbar:FocusToFindbar - set cursor to the FindTextFieldControl of the findbar - if ( aURL.Path.equalsAscii("FocusToFindbar") ) - { - css::uno::Reference< css::beans::XPropertySet > xPropSet(m_xFrame, css::uno::UNO_QUERY); - if(!xPropSet.is()) - return; - - css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; - css::uno::Any aValue = xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii("LayoutManager") ); - aValue >>= xLayoutManager; - if (!xLayoutManager.is()) - return; - - const ::rtl::OUString sResourceURL = ::rtl::OUString::createFromAscii("private:resource/toolbar/findbar"); - css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL); - if (!xUIElement.is()) - return; - - css::uno::Reference< css::awt::XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - ToolBox* pToolBox = (ToolBox*)pWindow; - if ( pToolBox ) - { - sal_uInt16 nItemCount = pToolBox->GetItemCount(); - for ( sal_uInt16 i=0; i<nItemCount; ++i ) - { - ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); - if ( sItemCommand.equalsAscii(".uno:FindText") ) - { - Window* pItemWin = pToolBox->GetItemWindow( i ); - if ( pItemWin ) - { - pItemWin->GrabFocus(); - return; - } - } - } - } - - } + //vnd.sun.star.findbar:FocusToFindbar - set cursor to the FindTextFieldControl of the findbar + if ( aURL.Path.equalsAscii("FocusToFindbar") ) + { + css::uno::Reference< css::beans::XPropertySet > xPropSet(m_xFrame, css::uno::UNO_QUERY); + if(!xPropSet.is()) + return; + + css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; + css::uno::Any aValue = xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii("LayoutManager") ); + aValue >>= xLayoutManager; + if (!xLayoutManager.is()) + return; + + const ::rtl::OUString sResourceURL = ::rtl::OUString::createFromAscii("private:resource/toolbar/findbar"); + css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL); + if (!xUIElement.is()) + return; + + css::uno::Reference< css::awt::XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY); + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + sal_uInt16 nItemCount = pToolBox->GetItemCount(); + for ( sal_uInt16 i=0; i<nItemCount; ++i ) + { + ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); + if ( sItemCommand.equalsAscii(".uno:FindText") ) + { + Window* pItemWin = pToolBox->GetItemWindow( i ); + if ( pItemWin ) + { + pItemWin->GrabFocus(); + return; + } + } + } + } + + } } void SAL_CALL FindbarDispatcher::addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*xControl*/, const css::util::URL& /*aURL*/ ) throw ( css::uno::RuntimeException ) @@ -839,30 +845,30 @@ void SAL_CALL FindbarDispatcher::removeStatusListener( const css::uno::Reference } //----------------------------------------------------------------------------------------------------------- -// create Instance +// create Instance -css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance( - const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) { - return *new FindTextToolbarController( rSMgr ); + return *new FindTextToolbarController( rSMgr ); } -css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance( - const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) { - return *new DownSearchToolboxController( rSMgr ); + return *new DownSearchToolboxController( rSMgr ); } -css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance( - const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) { - return *new UpSearchToolboxController( rSMgr ); + return *new UpSearchToolboxController( rSMgr ); } -css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance( - const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) { - return *new FindbarDispatcher( rSMgr ); + return *new FindbarDispatcher( rSMgr ); } //----------------------------------------------------------------------------------------------------------- diff --git a/main/svx/source/tbxctrls/tbunosearchcontrollers.src b/main/svx/source/tbxctrls/tbunosearchcontrollers.src index f56fafe..c38fc30 100644 --- a/main/svx/source/tbxctrls/tbunosearchcontrollers.src +++ b/main/svx/source/tbxctrls/tbunosearchcontrollers.src @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -27,3 +27,5 @@ String RID_SVXSTR_FINDBAR_FIND { Text [ en-US ] = "Find" ; }; + +// ********************************************************************** EOF