diff options
-rw-r--r-- | basctl/sdi/baside.sdi | 27 | ||||
-rw-r--r-- | basctl/source/basicide/basides1.cxx | 125 | ||||
-rw-r--r-- | basctl/source/basicide/iderdll.cxx | 6 | ||||
-rw-r--r-- | basctl/source/basicide/iderdll2.hxx | 5 | ||||
-rw-r--r-- | basctl/source/inc/basidesh.hxx | 32 | ||||
-rw-r--r-- | include/sfx2/sfxsids.hrc | 1 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu | 5 | ||||
-rw-r--r-- | sfx2/sdi/sfx.sdi | 18 |
8 files changed, 154 insertions, 65 deletions
diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi index 180cdf2caa6a..5c413f89e6c4 100644 --- a/basctl/sdi/baside.sdi +++ b/basctl/sdi/baside.sdi @@ -99,30 +99,45 @@ shell basctl_Shell StateMethod = GetState; ] - SID_SEARCH_OPTIONS + SID_GOTOLINE [ ExecMethod = ExecuteCurrent; StateMethod = GetState; ] - SID_SEARCH_ITEM + + // Search in IDE Basic + + SID_SEARCH_OPTIONS [ - ExecMethod = ExecuteCurrent; + ExecMethod = ExecuteSearch; StateMethod = GetState; ] - SID_GOTOLINE + SID_SEARCH_ITEM [ - ExecMethod = ExecuteCurrent; + ExecMethod = ExecuteSearch; StateMethod = GetState; ] FID_SEARCH_NOW [ - ExecMethod = ExecuteCurrent; + ExecMethod = ExecuteSearch; StateMethod = GetState; ] + SID_BASICIDE_REPEAT_SEARCH + [ + ExecMethod = ExecuteSearch; + StateMethod = GetState; + ] + + FID_SEARCH_ON // status() + [ + ExecMethod = ExecuteSearch; + Export = FALSE; + ] + FID_SEARCH_OFF [ ExecMethod = ExecuteCurrent; diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 95025f859bf9..da1c86f1872d 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -44,7 +44,6 @@ #include <svx/svxids.hrc> #include <svl/aeitem.hxx> #include <svl/intitem.hxx> -#include <svl/srchitem.hxx> #include <svl/visitem.hxx> #include <svl/whiter.hxx> #include <vcl/xtextedt.hxx> @@ -58,40 +57,56 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; -void Shell::ExecuteCurrent( SfxRequest& rReq ) +void Shell::ExecuteSearch( SfxRequest& rReq ) { if ( !pCurWin ) return; - switch ( rReq.GetSlot() ) + const SfxItemSet* pArgs = rReq.GetArgs(); + sal_uInt16 nSlot = rReq.GetSlot(); + + // if searching has not been done before this time + if (nSlot == SID_BASICIDE_REPEAT_SEARCH && !mpSearchItem) { - case SID_BASICIDE_HIDECURPAGE: - { - pCurWin->StoreData(); - RemoveWindow( pCurWin, false ); - } - break; - case SID_BASICIDE_RENAMECURRENT: - { - pTabBar->StartEditMode( pTabBar->GetCurPageId() ); - } - break; + rReq.SetReturnValue(SfxBoolItem(nSlot, false)); + nSlot = 0; + } + + switch ( nSlot ) + { + case SID_SEARCH_OPTIONS: + break; + case SID_SEARCH_ITEM: + mpSearchItem.reset( static_cast<SvxSearchItem*>( pArgs->Get(SID_SEARCH_ITEM).Clone() )); + break; + case FID_SEARCH_ON: + mbJustOpened = true; + GetViewFrame()->GetBindings().Invalidate(SID_SEARCH_ITEM); + break; + case SID_BASICIDE_REPEAT_SEARCH: case FID_SEARCH_NOW: { if (!pCurWin->HasActiveEditor()) break; - DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); - SfxItemSet const& rArgs = *rReq.GetArgs(); - // unfortunately I don't know the ID: - sal_uInt16 nWhich = rArgs.GetWhichByPos( 0 ); - DBG_ASSERT( nWhich, "Which for SearchItem?" ); - SfxPoolItem const& rItem = rArgs.Get(nWhich); - DBG_ASSERT(dynamic_cast<SvxSearchItem const*>(&rItem), "no searchitem!"); - SvxSearchItem const& rSearchItem = static_cast<SvxSearchItem const&>(rItem); - // memorize item because of the adjustments... - GetExtraData()->SetSearchItem(rSearchItem); + + // If it is a repeat searching + if ( nSlot == SID_BASICIDE_REPEAT_SEARCH ) + { + if( !mpSearchItem ) + mpSearchItem.reset( new SvxSearchItem( SID_SEARCH_ITEM )); + } + else + { + // Get SearchItem from request if it is the first searching + if ( pArgs ) + { + mpSearchItem.reset( static_cast<SvxSearchItem*>( pArgs->Get( SID_SEARCH_ITEM ).Clone() )); + } + } + sal_Int32 nFound = 0; - if (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL) + + if ( mpSearchItem->GetCommand() == SvxSearchCmd::REPLACE_ALL ) { sal_uInt16 nActModWindows = 0; for (auto const& window : aWindowTable) @@ -116,11 +131,11 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) for (auto const& window : aWindowTable) { BaseWindow* pWin = window.second; - nFound += pWin->StartSearchAndReplace(rSearchItem); + nFound += pWin->StartSearchAndReplace( *mpSearchItem ); } } else - nFound = pCurWin->StartSearchAndReplace(rSearchItem); + nFound = pCurWin->StartSearchAndReplace( *mpSearchItem ); OUString aReplStr(IDEResId(RID_STR_SEARCHREPLACES)); aReplStr = aReplStr.replaceAll("XX", OUString::number(nFound)); @@ -133,8 +148,8 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) else { bool bCanceled = false; - nFound = pCurWin->StartSearchAndReplace(rSearchItem); - if ( !nFound && !rSearchItem.GetSelection() ) + nFound = pCurWin->StartSearchAndReplace( *mpSearchItem ); + if ( !nFound && !mpSearchItem->GetSelection() ) { // search other modules... bool bChangeCurWindow = false; @@ -176,7 +191,7 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) { if ( pCurWin ) pWin->SetSizePixel( pCurWin->GetSizePixel() ); - nFound = pWin->StartSearchAndReplace(rSearchItem, true); + nFound = pWin->StartSearchAndReplace( *mpSearchItem, true ); } if ( nFound ) { @@ -194,7 +209,7 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) pWin = nullptr; } if ( !nFound && bSearchedFromStart ) - nFound = pCurWin->StartSearchAndReplace(rSearchItem, true); + nFound = pCurWin->StartSearchAndReplace( *mpSearchItem, true ); if ( bChangeCurWindow ) SetCurWindow( pWin, true ); } @@ -208,6 +223,29 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) } rReq.Done(); + break; + } + default: + pCurWin->ExecuteCommand( rReq ); + } +} + +void Shell::ExecuteCurrent( SfxRequest& rReq ) +{ + if ( !pCurWin ) + return; + + switch ( rReq.GetSlot() ) + { + case SID_BASICIDE_HIDECURPAGE: + { + pCurWin->StoreData(); + RemoveWindow( pCurWin, false ); + } + break; + case SID_BASICIDE_RENAMECURRENT: + { + pTabBar->StartEditMode( pTabBar->GetCurPageId() ); } break; case SID_UNDO: @@ -889,10 +927,27 @@ void Shell::GetState(SfxItemSet &rSet) break; case SID_SEARCH_ITEM: { - OUString aSelected = GetSelectionText(true); - SvxSearchItem& rItem = GetExtraData()->GetSearchItem(); - rItem.SetSearchString( aSelected ); - rSet.Put( rItem ); + if ( !mpSearchItem ) + { + mpSearchItem.reset( new SvxSearchItem( SID_SEARCH_ITEM )); + mpSearchItem->SetSearchString( GetSelectionText( true )); + } + + if ( mbJustOpened && HasSelection() ) + { + OUString aText = GetSelectionText( true ); + + if ( !aText.isEmpty() ) + { + mpSearchItem->SetSearchString( aText ); + mpSearchItem->SetSelection( false ); + } + else + mpSearchItem->SetSelection( true ); + } + + mbJustOpened = false; + rSet.Put( *mpSearchItem ); } break; case SID_BASICIDE_STAT_DATE: diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx index b80ce1f38970..7d7a6012355a 100644 --- a/basctl/source/basicide/iderdll.cxx +++ b/basctl/source/basicide/iderdll.cxx @@ -145,7 +145,6 @@ ExtraData* Dll::GetExtraData () ExtraData::ExtraData () : - pSearchItem(new SvxSearchItem(SID_SEARCH_ITEM)), bChoosingMacro(false), bShellInCriticalSection(false) { @@ -163,11 +162,6 @@ ExtraData::~ExtraData () // StarBASIC::setGlobalStarScriptListener( XEngineListenerRef() ); } -void ExtraData::SetSearchItem (const SvxSearchItem& rItem) -{ - pSearchItem.reset(static_cast<SvxSearchItem*>(rItem.Clone())); -} - IMPL_STATIC_LINK(ExtraData, GlobalBasicBreakHdl, StarBASIC *, pBasic, BasicDebugFlags) { BasicDebugFlags nRet = BasicDebugFlags::NONE; diff --git a/basctl/source/basicide/iderdll2.hxx b/basctl/source/basicide/iderdll2.hxx index 124e1d98adbc..0e1bff2be5e4 100644 --- a/basctl/source/basicide/iderdll2.hxx +++ b/basctl/source/basicide/iderdll2.hxx @@ -34,8 +34,6 @@ namespace basctl class ExtraData final { - std::unique_ptr<SvxSearchItem> pSearchItem; - LibInfo aLibInfo; EntryDescriptor m_aLastEntryDesc; @@ -60,9 +58,6 @@ public: bool& ChoosingMacro() { return bChoosingMacro; } bool& ShellInCriticalSection() { return bShellInCriticalSection; } - SvxSearchItem& GetSearchItem() const { return *pSearchItem; } - void SetSearchItem( const SvxSearchItem& rItem ); - const OUString& GetAddLibPath() const { return aAddLibPath; } void SetAddLibPath( const OUString& rPath ) { aAddLibPath = rPath; } diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx index 7d8398e4e0bc..b6e8909efa65 100644 --- a/basctl/source/inc/basidesh.hxx +++ b/basctl/source/inc/basidesh.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/container/XContainerListener.hpp> #include <sfx2/viewsh.hxx> #include <svx/ifaceids.hxx> +#include <svl/srchitem.hxx> #include <vcl/scrbar.hxx> #include <map> #include <memory> @@ -61,30 +62,34 @@ private: friend class LocalizationMgr; friend bool implImportDialog(weld::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& rLibName); // defined in baside3.cxx - WindowTable aWindowTable; + WindowTable aWindowTable; sal_uInt16 nCurKey; - VclPtr<BaseWindow> pCurWin; + VclPtr<BaseWindow> pCurWin; ScriptDocument m_aCurDocument; OUString m_aCurLibName; std::shared_ptr<LocalizationMgr> m_pCurLocalizationMgr; - VclPtr<ScrollBar> aHScrollBar; - VclPtr<ScrollBar> aVScrollBar; - VclPtr<ScrollBarBox> aScrollBarBox; - VclPtr<TabBar> pTabBar; // basctl::TabBar - bool bCreatingWindow; + VclPtr<ScrollBar> aHScrollBar; + VclPtr<ScrollBar> aVScrollBar; + VclPtr<ScrollBarBox> aScrollBarBox; + VclPtr<TabBar> pTabBar; // basctl::TabBar + bool bCreatingWindow; + // layout windows - VclPtr<ModulWindowLayout> pModulLayout; - VclPtr<DialogWindowLayout> pDialogLayout; - // the active layout window - VclPtr<Layout> pLayout; + VclPtr<ModulWindowLayout> pModulLayout; + VclPtr<DialogWindowLayout> pDialogLayout; + VclPtr<Layout> pLayout; // the active layout window // common object catalog window - VclPtr<ObjectCatalog> aObjectCatalog; + VclPtr<ObjectCatalog> aObjectCatalog; + + bool m_bAppBasicModified; + bool mbJustOpened = false; - bool m_bAppBasicModified; DocumentEventNotifier m_aNotifier; + friend class ContainerListenerImpl; css::uno::Reference< css::container::XContainerListener > m_xLibListener; + std::unique_ptr<SvxSearchItem> mpSearchItem; void Init(); void InitTabBar(); @@ -170,6 +175,7 @@ public: void GetState( SfxItemSet& ); void ExecuteGlobal( SfxRequest& rReq ); + void ExecuteSearch( SfxRequest& rReq ); void ExecuteCurrent( SfxRequest& rReq ); void ExecuteBasic( SfxRequest& rReq ); void ExecuteDialog( SfxRequest& rReq ); diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 739fdef24736..06f31d9c590c 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -554,6 +554,7 @@ class SfxDocumentInfoItem; #define FID_SVX_START (SID_LIB_START + 500) #define FID_SEARCH_NOW (FID_SVX_START + 2) +#define SID_BASICIDE_REPEAT_SEARCH (FID_SVX_START + 3) // SlotIds for Basic ------------------------------------------------------- #define SID_BASICIDE_TOGGLEBRKPNT ( SID_BASICIDE_START + 0 ) diff --git a/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu index 93e1f99fbf72..4cd6034331da 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu @@ -8,6 +8,11 @@ <value xml:lang="en-US">Go to Line...</value> </prop> </node> + <node oor:name=".uno:RepeatSearch" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Repeat Search</value> + </prop> + </node> <node oor:name=".uno:ShowLines" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Line Numbers</value> diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 74d780bd63bd..9031982badb5 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -1160,6 +1160,24 @@ SfxVoidItem ExecuteSearch FID_SEARCH_NOW ] +SfxVoidItem RepeatSearch SID_BASICIDE_REPEAT_SEARCH +(SvxSearchItem SearchItem SID_SEARCH_ITEM, SfxBoolItem Quiet SID_SEARCH_QUIET) +[ + AutoUpdate = FALSE, + FastCall = TRUE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Edit; +] + SfxBoolItem ExtendedHelp SID_EXTENDEDHELP |