diff options
author | Peter Burow <pb@openoffice.org> | 2001-08-16 13:06:24 +0000 |
---|---|---|
committer | Peter Burow <pb@openoffice.org> | 2001-08-16 13:06:24 +0000 |
commit | 342d1120d7c730b637c065aba6d3e4966b1643df (patch) | |
tree | 9e50b574690b3d9b449810b7d188849492563dc7 /sfx2/source | |
parent | 14ce2ea6f97508b757e855187fae160ab6ff45dd (diff) |
fix: #90922# 'Complete words only' box on search page added
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/appl/newhelp.cxx | 59 | ||||
-rw-r--r-- | sfx2/source/appl/newhelp.hrc | 11 | ||||
-rw-r--r-- | sfx2/source/appl/newhelp.hxx | 5 | ||||
-rw-r--r-- | sfx2/source/appl/newhelp.src | 17 |
4 files changed, 71 insertions, 21 deletions
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 7d3cdae4dc0f..4a32638d9ad6 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: newhelp.cxx,v $ * - * $Revision: 1.34 $ + * $Revision: 1.35 $ * - * last change: $Author: pb $ $Date: 2001-08-16 11:28:56 $ + * last change: $Author: pb $ $Date: 2001-08-16 14:06:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -787,6 +787,7 @@ SearchTabPage_Impl::SearchTabPage_Impl( Window* pParent ) : aSearchFT ( this, ResId( FT_SEARCH ) ), aSearchED ( this, ResId( ED_SEARCH ) ), aSearchBtn ( this, ResId( PB_SEARCH ) ), + aFullWordsCB( this, ResId( CB_FULLWORDS ) ), aScopeCB ( this, ResId( CB_SCOPE ) ), aResultsLB ( this, ResId( LB_RESULT ) ), aOpenBtn ( this, ResId( PB_OPEN_SEARCH ) ) @@ -806,9 +807,11 @@ SearchTabPage_Impl::SearchTabPage_Impl( Window* pParent ) : { String aUserData = aViewOpt.GetUserData(); BOOL bChecked = ( 1 == aUserData.GetToken(0).ToInt32() ) ? TRUE : FALSE; + aFullWordsCB.Check( bChecked ); + bChecked = ( 1 == aUserData.GetToken(1).ToInt32() ) ? TRUE : FALSE; aScopeCB.Check( bChecked ); - for ( USHORT i = 1; i < aUserData.GetTokenCount(); ++i ) + for ( USHORT i = 2; i < aUserData.GetTokenCount(); ++i ) { String aToken = aUserData.GetToken(i); aSearchED.InsertEntry( INetURLObject::decode( @@ -825,9 +828,12 @@ SearchTabPage_Impl::SearchTabPage_Impl( Window* pParent ) : SearchTabPage_Impl::~SearchTabPage_Impl() { SvtViewOptions aViewOpt( E_TABPAGE, CONFIGNAME_SEARCHPAGE ); - sal_Int32 nChecked = aScopeCB.IsChecked() ? 1 : 0; + sal_Int32 nChecked = aFullWordsCB.IsChecked() ? 1 : 0; String aUserData = String::CreateFromInt32( nChecked ); aUserData += ';'; + nChecked = aScopeCB.IsChecked() ? 1 : 0; + aUserData += String::CreateFromInt32( nChecked ); + aUserData += ';'; USHORT nCount = Min( aSearchED.GetEntryCount(), (USHORT)10 ); // save only 10 entries for ( USHORT i = 0; i < nCount; ++i ) @@ -875,12 +881,41 @@ IMPL_LINK( SearchTabPage_Impl, SearchHdl, PushButton*, EMPTYARG ) { EnterWait(); ClearSearchResults(); - String aSearchText = aSearchED.GetText(); + String aSearchText = TRIM( aSearchED.GetText() ); RememberSearchText( aSearchText ); String aSearchURL = HELP_URL; aSearchURL += aFactory; aSearchURL += String( HELP_SEARCH_TAG ); - aSearchURL += aSearchText; + if ( aFullWordsCB.IsChecked() ) + aSearchURL += aSearchText; + else if ( aSearchText.Len() > 0 ) + { + xub_StrLen nPos = aSearchText.Search( ' ' ); + if ( nPos != STRING_NOTFOUND ) + { + String aNewSearchText; + while ( nPos != STRING_NOTFOUND ) + { + aNewSearchText += aSearchText.Copy( 0, nPos ); + aNewSearchText += '*'; + aNewSearchText += ' '; + aSearchText.Erase( 0, nPos + 1 ); + aSearchText.EraseTrailingChars(); + nPos = aSearchText.Search( ' ' ); + if ( STRING_NOTFOUND == nPos ) + { + aNewSearchText += aSearchText; + aNewSearchText += '*'; + } + } + aSearchURL += aNewSearchText; + } + else + { + aSearchURL += aSearchText; + aSearchURL += '*'; + } + } AppendConfigToken_Impl( aSearchURL, sal_False ); if ( aScopeCB.IsChecked() ) aSearchURL += DEFINE_CONST_UNICODE("&Scope=Heading"); @@ -921,6 +956,7 @@ IMPL_LINK( SearchTabPage_Impl, OpenHdl, PushButton*, EMPTYARG ) void SearchTabPage_Impl::Resize() { + Size a6Size = LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); Size aSize = GetSizePixel(); if ( aSize.Width() < aMinSize.Width() ) aSize.Width() = aMinSize.Width(); @@ -930,20 +966,25 @@ void SearchTabPage_Impl::Resize() aSearchFT.SetSizePixel( aNewSize ); aNewSize.Height() = aResultsLB.GetSizePixel().Height(); aResultsLB.SetSizePixel( aNewSize ); - aNewSize.Height() = aScopeCB.GetSizePixel().Height(); + aNewSize.Height() = aFullWordsCB.GetSizePixel().Height(); + long nW = ( aNewSize.Width() - ( a6Size.Width() / 2 ) ) / 2; + aNewSize.Width() = nW; + aFullWordsCB.SetSizePixel( aNewSize ); + Point aNewPnt = aFullWordsCB.GetPosPixel(); + aNewPnt.X() += ( nW + ( a6Size.Width() / 2 ) ); + aScopeCB.SetPosPixel( aNewPnt ); aScopeCB.SetSizePixel( aNewSize ); aNewSize = aSearchED.GetSizePixel(); aNewSize.Width() = aSize.Width() - ( aPnt.X() * 2 ) - ( aSearchBtn.GetSizePixel().Width() + ( aPnt.X() / 2 ) ); aSearchED.SetSizePixel( aNewSize ); - Point aNewPnt = aSearchBtn.GetPosPixel(); + aNewPnt = aSearchBtn.GetPosPixel(); aNewPnt.X() = aPnt.X() + aNewSize.Width() + ( aPnt.X() / 2 ); aSearchBtn.SetPosPixel( aNewPnt ); if ( aSize.Height() > aMinSize.Height() ) { - Size a6Size = LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); long n3Height = a6Size.Height() / 2; Size aBtnSize = aOpenBtn.GetSizePixel(); long nExtraHeight = aBtnSize.Height() + n3Height; diff --git a/sfx2/source/appl/newhelp.hrc b/sfx2/source/appl/newhelp.hrc index 52bfa1cf34cd..cd671b679244 100644 --- a/sfx2/source/appl/newhelp.hrc +++ b/sfx2/source/appl/newhelp.hrc @@ -2,9 +2,9 @@ * * $RCSfile: newhelp.hrc,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: pb $ $Date: 2001-08-16 11:28:56 $ + * last change: $Author: pb $ $Date: 2001-08-16 14:06:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,9 +78,10 @@ #define ED_SEARCH 11 #define PB_SEARCH 12 #define FT_RESULT 13 -#define CB_SCOPE 14 -#define LB_RESULT 15 -#define PB_OPEN_SEARCH 16 +#define CB_FULLWORDS 14 +#define CB_SCOPE 15 +#define LB_RESULT 16 +#define PB_OPEN_SEARCH 17 // Bookmarks TabPage #define FT_BOOKMARKS 10 diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx index f500b5ed49d6..6eb6a9baef61 100644 --- a/sfx2/source/appl/newhelp.hxx +++ b/sfx2/source/appl/newhelp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: newhelp.hxx,v $ * - * $Revision: 1.22 $ + * $Revision: 1.23 $ * - * last change: $Author: pb $ $Date: 2001-08-16 11:28:56 $ + * last change: $Author: pb $ $Date: 2001-08-16 14:06:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -238,6 +238,7 @@ private: FixedText aSearchFT; SearchBox_Impl aSearchED; PushButton aSearchBtn; + CheckBox aFullWordsCB; CheckBox aScopeCB; SearchResultsBox_Impl aResultsLB; PushButton aOpenBtn; diff --git a/sfx2/source/appl/newhelp.src b/sfx2/source/appl/newhelp.src index 431a0feb13ce..8c5ac223f7b2 100644 --- a/sfx2/source/appl/newhelp.src +++ b/sfx2/source/appl/newhelp.src @@ -2,9 +2,9 @@ * * $RCSfile: newhelp.src,v $ * - * $Revision: 1.46 $ + * $Revision: 1.47 $ * - * last change: $Author: pb $ $Date: 2001-08-16 11:28:56 $ + * last change: $Author: pb $ $Date: 2001-08-16 14:06:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -327,11 +327,18 @@ TabPage TP_HELP_SEARCH Text[ catalan ] = "Buscar"; Text[ finnish ] = "~Etsi"; }; - CheckBox CB_SCOPE + CheckBox CB_FULLWORDS { Pos = MAP_APPFONT ( 6, 34 ) ; - Size = MAP_APPFONT ( 108 , 10 ) ; - Text = "~Nur in Titeln suchen" ; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text = "~Nur ganze Wörter" ; + Text [ english_us ] = "~Complete words only"; + }; + CheckBox CB_SCOPE + { + Pos = MAP_APPFONT ( 69, 34 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text = "N~ur in Titeln suchen" ; Text [ english_us ] = "Find in ~headings only"; Text[ portuguese ] = "~Procurar só em títulos"; Text[ russian ] = "~Èñêàòü òîëüêî â çàãîëîâêàõ"; |