tdf#48456 : when searching for a number, consider formatting

Change-Id: I4a1e3e269a269bb37e88aa8810a46d0f4ecfc518
Reviewed-on: https://gerrit.libreoffice.org/19420
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
This commit is contained in:
Dennis Francis
2015-10-17 23:14:35 +05:30
committed by Eike Rathke
parent b5a1a23ed0
commit 9a85743766
22 changed files with 262 additions and 16 deletions

View File

@@ -153,7 +153,7 @@ SFX_DECL_TYPE(13); // for SwAddPrinterItem, Sd...
SFX_DECL_TYPE(14); SFX_DECL_TYPE(14);
SFX_DECL_TYPE(16); // for SwDocDisplayItem SFX_DECL_TYPE(16); // for SwDocDisplayItem
SFX_DECL_TYPE(17); // for SvxAddressItem SFX_DECL_TYPE(17); // for SvxAddressItem
SFX_DECL_TYPE(21); // for SvxSearchItem SFX_DECL_TYPE(22); // for SvxSearchItem
// all SfxTypes must be in this header // all SfxTypes must be in this header
#undef SFX_DECL_TYPE #undef SFX_DECL_TYPE

View File

@@ -59,6 +59,7 @@
#define MID_SEARCH_COMMAND 19 #define MID_SEARCH_COMMAND 19
#define MID_SEARCH_STARTPOINTX 20 #define MID_SEARCH_STARTPOINTX 20
#define MID_SEARCH_STARTPOINTY 21 #define MID_SEARCH_STARTPOINTY 21
#define MID_SEARCH_SEARCHFORMATTED 22
#endif #endif

View File

@@ -75,6 +75,7 @@ class SVL_DLLPUBLIC SvxSearchItem :
bool m_bRowDirection; // search direction: row-wise/column-wise bool m_bRowDirection; // search direction: row-wise/column-wise
bool m_bAllTables; // search in all sheets bool m_bAllTables; // search in all sheets
bool m_bSearchFiltered; // search filtered cells. bool m_bSearchFiltered; // search filtered cells.
bool m_bSearchFormatted; // search formatted display strings
// Writer-specific // Writer-specific
bool m_bNotes; bool m_bNotes;
@@ -149,6 +150,9 @@ public:
bool IsSearchFiltered() const { return m_bSearchFiltered; } bool IsSearchFiltered() const { return m_bSearchFiltered; }
void SetSearchFiltered(bool b) { m_bSearchFiltered = b; } void SetSearchFiltered(bool b) { m_bSearchFiltered = b; }
bool IsSearchFormatted() const { return m_bSearchFormatted; }
void SetSearchFormatted(bool b) { m_bSearchFormatted = b; }
SvxSearchCellType GetCellType() const { return m_nCellType; } SvxSearchCellType GetCellType() const { return m_nCellType; }
void SetCellType(SvxSearchCellType nNewCellType) { m_nCellType = nNewCellType; } void SetCellType(SvxSearchCellType nNewCellType) { m_nCellType = nNewCellType; }

View File

@@ -942,6 +942,7 @@
#define RID_SVXSTR_TEXTCOLOR (RID_SVX_START + 1178) #define RID_SVXSTR_TEXTCOLOR (RID_SVX_START + 1178)
#define RID_SVXSTR_FINDBAR_SEARCHFORMATTED (RID_SVX_START + 1188)
#define RID_SVXSTR_FINDBAR_MATCHCASE (RID_SVX_START + 1189) #define RID_SVXSTR_FINDBAR_MATCHCASE (RID_SVX_START + 1189)
#define RID_SVXSTR_FINDBAR_FIND (RID_SVX_START + 1190) #define RID_SVXSTR_FINDBAR_FIND (RID_SVX_START + 1190)

View File

@@ -171,6 +171,7 @@ private:
VclPtr<PushButton> m_pSearchComponent2PB; VclPtr<PushButton> m_pSearchComponent2PB;
VclPtr<CheckBox> m_pMatchCaseCB; VclPtr<CheckBox> m_pMatchCaseCB;
VclPtr<CheckBox> m_pSearchFormattedCB;
VclPtr<CheckBox> m_pWordBtn; VclPtr<CheckBox> m_pWordBtn;
VclPtr<PushButton> m_pCloseBtn; VclPtr<PushButton> m_pCloseBtn;

View File

@@ -47,6 +47,7 @@ public:
bool IsSimilaritySearch() const; bool IsSimilaritySearch() const;
bool IsUseAsianOptions() const; bool IsUseAsianOptions() const;
bool IsMatchCase() const; // also Japanese search option bool IsMatchCase() const; // also Japanese search option
bool IsSearchFormatted() const;
bool IsNotes() const; bool IsNotes() const;
void SetWholeWordsOnly( bool bVal ); void SetWholeWordsOnly( bool bVal );
@@ -56,6 +57,7 @@ public:
void SetSimilaritySearch( bool bVal ); void SetSimilaritySearch( bool bVal );
void SetUseAsianOptions( bool bVal ); void SetUseAsianOptions( bool bVal );
void SetMatchCase( bool bVal ); // also Japanese search option void SetMatchCase( bool bVal ); // also Japanese search option
void SetSearchFormatted( bool bVal );
void SetNotes( bool bVal); void SetNotes( bool bVal);
// Japanese search options // Japanese search options

View File

@@ -793,6 +793,17 @@
<value>com.sun.star.svx.MatchCaseToolboxController</value> <value>com.sun.star.svx.MatchCaseToolboxController</value>
</prop> </prop>
</node> </node>
<node oor:name="com.sun.star.svx.SearchFormattedToolboxController" oor:op="replace">
<prop oor:name="Command">
<value>.uno:SearchFormattedDisplayString</value>
</prop>
<prop oor:name="Module">
<value/>
</prop>
<prop oor:name="Controller">
<value>com.sun.star.svx.SearchFormattedToolboxController</value>
</prop>
</node>
<node oor:name="com.sun.star.svx.FindAllToolboxController" oor:op="replace"> <node oor:name="com.sun.star.svx.FindAllToolboxController" oor:op="replace">
<prop oor:name="Command"> <prop oor:name="Command">
<value>.uno:FindAll</value> <value>.uno:FindAll</value>

View File

@@ -1534,6 +1534,11 @@
<value xml:lang="en-US">Match Case</value> <value xml:lang="en-US">Match Case</value>
</prop> </prop>
</node> </node>
<node oor:name=".uno:SearchFormattedDisplayString" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Search Formatted Display String</value>
</prop>
</node>
<node oor:name=".uno:FindAll" oor:op="replace"> <node oor:name=".uno:FindAll" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string"> <prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Find All</value> <value xml:lang="en-US">Find All</value>

View File

@@ -6020,6 +6020,13 @@
</info> </info>
<value>false</value> <value>false</value>
</prop> </prop>
<prop oor:name="IsSearchFormatted" oor:type="xs:boolean" oor:nillable="false">
<!-- UIHints: Edit / Find & Replace -->
<info>
<desc>Specifies if formatted display strings are searched instead of cell content (Calc).</desc>
</info>
<value>false</value>
</prop>
<group oor:name="Japanese"> <group oor:name="Japanese">
<info> <info>
<desc>Contains search options for the Japanese language.</desc> <desc>Contains search options for the Japanese language.</desc>

View File

@@ -376,6 +376,7 @@
#define SC_UNO_SRCHTYPE "SearchType" #define SC_UNO_SRCHTYPE "SearchType"
#define SC_UNO_SRCHWORDS "SearchWords" #define SC_UNO_SRCHWORDS "SearchWords"
#define SC_UNO_SRCHFILTERED "SearchFiltered" #define SC_UNO_SRCHFILTERED "SearchFiltered"
#define SC_UNO_SRCHFORMATTED "SearchFormatted"
// old (5.2) property names for page styles - for compatibility only! // old (5.2) property names for page styles - for compatibility only!
#define OLD_UNO_PAGE_BACKCOLOR "BackgroundColor" #define OLD_UNO_PAGE_BACKCOLOR "BackgroundColor"

View File

@@ -60,6 +60,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
bool bFound = false; bool bFound = false;
bool bDoSearch = true; bool bDoSearch = true;
bool bDoBack = rSearchItem.GetBackward(); bool bDoBack = rSearchItem.GetBackward();
bool bSearchFormatted = rSearchItem.IsSearchFormatted();
OUString aString; OUString aString;
ScRefCellValue aCell; ScRefCellValue aCell;
@@ -85,7 +86,10 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, pDocument, aString); bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, pDocument, aString);
else else
{ {
aCol[nCol].GetInputString( nRow, aString ); if( !bSearchFormatted )
aCol[nCol].GetInputString( nRow, aString );
else
aCol[nCol].GetString( nRow, aString );
} }
} }
break; break;
@@ -94,7 +98,10 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, pDocument, aString); bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, pDocument, aString);
else else
{ {
aCol[nCol].GetInputString( nRow, aString ); if( !bSearchFormatted )
aCol[nCol].GetInputString( nRow, aString );
else
aCol[nCol].GetString( nRow, aString );
} }
break; break;
case SvxSearchCellType::NOTE: case SvxSearchCellType::NOTE:

View File

@@ -155,6 +155,7 @@ void SAL_CALL ScCellSearchObj::setPropertyValue(
else if (aString == SC_UNO_SRCHSIMREM) pSearchItem->SetLEVShorter( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ); else if (aString == SC_UNO_SRCHSIMREM) pSearchItem->SetLEVShorter( ScUnoHelpFunctions::GetInt16FromAny( aValue ) );
else if (aString == SC_UNO_SRCHTYPE) pSearchItem->SetCellType( static_cast<SvxSearchCellType>(ScUnoHelpFunctions::GetInt16FromAny( aValue )) ); else if (aString == SC_UNO_SRCHTYPE) pSearchItem->SetCellType( static_cast<SvxSearchCellType>(ScUnoHelpFunctions::GetInt16FromAny( aValue )) );
else if (aString == SC_UNO_SRCHFILTERED) pSearchItem->SetSearchFiltered( ScUnoHelpFunctions::GetBoolFromAny(aValue) ); else if (aString == SC_UNO_SRCHFILTERED) pSearchItem->SetSearchFiltered( ScUnoHelpFunctions::GetBoolFromAny(aValue) );
else if (aString == SC_UNO_SRCHFORMATTED) pSearchItem->SetSearchFormatted( ScUnoHelpFunctions::GetBoolFromAny(aValue) );
} }
uno::Any SAL_CALL ScCellSearchObj::getPropertyValue( const OUString& aPropertyName ) uno::Any SAL_CALL ScCellSearchObj::getPropertyValue( const OUString& aPropertyName )
@@ -178,6 +179,7 @@ uno::Any SAL_CALL ScCellSearchObj::getPropertyValue( const OUString& aPropertyNa
else if (aString == SC_UNO_SRCHSIMREM) aRet <<= (sal_Int16) pSearchItem->GetLEVShorter(); else if (aString == SC_UNO_SRCHSIMREM) aRet <<= (sal_Int16) pSearchItem->GetLEVShorter();
else if (aString == SC_UNO_SRCHTYPE) aRet <<= (sal_Int16) pSearchItem->GetCellType(); else if (aString == SC_UNO_SRCHTYPE) aRet <<= (sal_Int16) pSearchItem->GetCellType();
else if (aString == SC_UNO_SRCHFILTERED) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsSearchFiltered() ); else if (aString == SC_UNO_SRCHFILTERED) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsSearchFiltered() );
else if (aString == SC_UNO_SRCHFORMATTED) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsSearchFormatted() );
return aRet; return aRet;
} }

View File

@@ -23,6 +23,7 @@
<toolbar:toolbaritem xlink:href=".uno:UpSearch"/> <toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
<toolbar:toolbaritem xlink:href=".uno:DownSearch"/> <toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
<toolbar:toolbaritem xlink:href=".uno:FindAll"/> <toolbar:toolbaritem xlink:href=".uno:FindAll"/>
<toolbar:toolbaritem xlink:href=".uno:SearchFormattedDisplayString"/>
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/> <toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbarseparator/> <toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/> <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>

View File

@@ -92,6 +92,7 @@
INT16 Command MID_SEARCH_COMMAND; INT16 Command MID_SEARCH_COMMAND;
INT32 SearchStartPointX MID_SEARCH_STARTPOINTX; INT32 SearchStartPointX MID_SEARCH_STARTPOINTX;
INT32 SearchStartPointY MID_SEARCH_STARTPOINTY; INT32 SearchStartPointY MID_SEARCH_STARTPOINTY;
BOOL SearchFormatted MID_SEARCH_SEARCHFORMATTED;
}; };
item SvxSearch SvxSearchItem; item SvxSearch SvxSearchItem;

View File

@@ -44,7 +44,7 @@ using namespace com::sun::star::util;
#define CFG_ROOT_NODE "Office.Common/SearchOptions" #define CFG_ROOT_NODE "Office.Common/SearchOptions"
#define SRCH_PARAMS 12 #define SRCH_PARAMS 13
#define SRCH_PARA_OPTIONS "Options" #define SRCH_PARA_OPTIONS "Options"
#define SRCH_PARA_FAMILY "Family" #define SRCH_PARA_FAMILY "Family"
#define SRCH_PARA_COMMAND "Command" #define SRCH_PARA_COMMAND "Command"
@@ -53,6 +53,7 @@ using namespace com::sun::star::util;
#define SRCH_PARA_ROWDIR "RowDirection" #define SRCH_PARA_ROWDIR "RowDirection"
#define SRCH_PARA_ALLTABLES "AllTables" #define SRCH_PARA_ALLTABLES "AllTables"
#define SRCH_PARA_SEARCHFILTERED "SearchFiltered" #define SRCH_PARA_SEARCHFILTERED "SearchFiltered"
#define SRCH_PARA_SEARCHFORMATTED "SearchFormatted"
#define SRCH_PARA_BACKWARD "Backward" #define SRCH_PARA_BACKWARD "Backward"
#define SRCH_PARA_PATTERN "Pattern" #define SRCH_PARA_PATTERN "Pattern"
#define SRCH_PARA_CONTENT "Content" #define SRCH_PARA_CONTENT "Content"
@@ -121,6 +122,7 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) :
m_bRowDirection ( true ), m_bRowDirection ( true ),
m_bAllTables ( false ), m_bAllTables ( false ),
m_bSearchFiltered ( false ), m_bSearchFiltered ( false ),
m_bSearchFormatted( false ),
m_bNotes ( false), m_bNotes ( false),
m_bBackward ( false ), m_bBackward ( false ),
m_bPattern ( false ), m_bPattern ( false ),
@@ -209,6 +211,7 @@ SvxSearchItem::SvxSearchItem( const SvxSearchItem& rItem ) :
m_bRowDirection ( rItem.m_bRowDirection ), m_bRowDirection ( rItem.m_bRowDirection ),
m_bAllTables ( rItem.m_bAllTables ), m_bAllTables ( rItem.m_bAllTables ),
m_bSearchFiltered ( rItem.m_bSearchFiltered ), m_bSearchFiltered ( rItem.m_bSearchFiltered ),
m_bSearchFormatted ( rItem.m_bSearchFormatted ),
m_bNotes ( rItem.m_bNotes), m_bNotes ( rItem.m_bNotes),
m_bBackward ( rItem.m_bBackward ), m_bBackward ( rItem.m_bBackward ),
m_bPattern ( rItem.m_bPattern ), m_bPattern ( rItem.m_bPattern ),
@@ -261,6 +264,7 @@ bool SvxSearchItem::operator==( const SfxPoolItem& rItem ) const
( m_bRowDirection == rSItem.m_bRowDirection ) && ( m_bRowDirection == rSItem.m_bRowDirection ) &&
( m_bAllTables == rSItem.m_bAllTables ) && ( m_bAllTables == rSItem.m_bAllTables ) &&
( m_bSearchFiltered == rSItem.m_bSearchFiltered ) && ( m_bSearchFiltered == rSItem.m_bSearchFiltered ) &&
( m_bSearchFormatted == rSItem.m_bSearchFormatted ) &&
( m_nCellType == rSItem.m_nCellType ) && ( m_nCellType == rSItem.m_nCellType ) &&
( m_nAppFlag == rSItem.m_nAppFlag ) && ( m_nAppFlag == rSItem.m_nAppFlag ) &&
( m_bAsianOptions == rSItem.m_bAsianOptions ) && ( m_bAsianOptions == rSItem.m_bAsianOptions ) &&
@@ -391,14 +395,16 @@ bool SvxSearchItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMembe
aSeq[6].Value <<= m_bAllTables; aSeq[6].Value <<= m_bAllTables;
aSeq[7].Name = SRCH_PARA_SEARCHFILTERED; aSeq[7].Name = SRCH_PARA_SEARCHFILTERED;
aSeq[7].Value <<= m_bSearchFiltered; aSeq[7].Value <<= m_bSearchFiltered;
aSeq[8].Name = SRCH_PARA_BACKWARD; aSeq[8].Name = SRCH_PARA_SEARCHFORMATTED;
aSeq[8].Value <<= m_bBackward; aSeq[8].Value <<= m_bSearchFormatted;
aSeq[9].Name = SRCH_PARA_PATTERN; aSeq[9].Name = SRCH_PARA_BACKWARD;
aSeq[9].Value <<= m_bPattern; aSeq[9].Value <<= m_bBackward;
aSeq[10].Name = SRCH_PARA_CONTENT; aSeq[10].Name = SRCH_PARA_PATTERN;
aSeq[10].Value <<= m_bContent; aSeq[10].Value <<= m_bPattern;
aSeq[11].Name = SRCH_PARA_ASIANOPT; aSeq[11].Name = SRCH_PARA_CONTENT;
aSeq[11].Value <<= m_bAsianOptions; aSeq[11].Value <<= m_bContent;
aSeq[12].Name = SRCH_PARA_ASIANOPT;
aSeq[12].Value <<= m_bAsianOptions;
rVal <<= aSeq; rVal <<= aSeq;
} }
break; break;
@@ -414,6 +420,8 @@ bool SvxSearchItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMembe
rVal <<= m_bAllTables; break; rVal <<= m_bAllTables; break;
case MID_SEARCH_SEARCHFILTERED: case MID_SEARCH_SEARCHFILTERED:
rVal <<= m_bSearchFiltered; break; rVal <<= m_bSearchFiltered; break;
case MID_SEARCH_SEARCHFORMATTED:
rVal <<= m_bSearchFormatted; break;
case MID_SEARCH_BACKWARD: case MID_SEARCH_BACKWARD:
rVal <<= m_bBackward; break; rVal <<= m_bBackward; break;
case MID_SEARCH_PATTERN: case MID_SEARCH_PATTERN:
@@ -530,6 +538,11 @@ bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nM
if ( aSeq[i].Value >>= m_bSearchFiltered ) if ( aSeq[i].Value >>= m_bSearchFiltered )
++nConvertedCount; ++nConvertedCount;
} }
else if ( aSeq[i].Name == SRCH_PARA_SEARCHFORMATTED )
{
if ( aSeq[i].Value >>= m_bSearchFormatted )
++nConvertedCount;
}
else if ( aSeq[i].Name == SRCH_PARA_BACKWARD ) else if ( aSeq[i].Name == SRCH_PARA_BACKWARD )
{ {
if ( aSeq[i].Value >>= m_bBackward ) if ( aSeq[i].Value >>= m_bBackward )
@@ -568,6 +581,8 @@ bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nM
bRet = (rVal >>= m_bAllTables); break; bRet = (rVal >>= m_bAllTables); break;
case MID_SEARCH_SEARCHFILTERED: case MID_SEARCH_SEARCHFILTERED:
bRet = (rVal >>= m_bSearchFiltered); break; bRet = (rVal >>= m_bSearchFiltered); break;
case MID_SEARCH_SEARCHFORMATTED:
bRet = (rVal >>= m_bSearchFormatted); break;
case MID_SEARCH_BACKWARD: case MID_SEARCH_BACKWARD:
bRet = (rVal >>= m_bBackward); break; bRet = (rVal >>= m_bBackward); break;
case MID_SEARCH_PATTERN: case MID_SEARCH_PATTERN:

View File

@@ -222,6 +222,39 @@ private:
VclPtr<CheckBox> m_pMatchCaseControl; VclPtr<CheckBox> m_pMatchCaseControl;
}; };
class SearchFormattedToolboxController : public svt::ToolboxController,
public css::lang::XServiceInfo
{
public:
SearchFormattedToolboxController( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
virtual ~SearchFormattedToolboxController();
// XInterface
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException, std::exception ) override;
virtual void SAL_CALL acquire() throw () override;
virtual void SAL_CALL release() throw () override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException, std::exception ) override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException, std::exception ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException, std::exception ) override;
// XComponent
virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException, std::exception ) override;
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException, std::exception) override;
// XToolbarController
virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException, std::exception ) override;
// XStatusListener
virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException, std::exception ) override;
private:
VclPtr<CheckBox> m_pSearchFormattedControl;
};
class FindAllToolboxController : public svt::ToolboxController, class FindAllToolboxController : public svt::ToolboxController,
public css::lang::XServiceInfo public css::lang::XServiceInfo
{ {

View File

@@ -300,6 +300,7 @@ SvxSearchDialog::SvxSearchDialog( vcl::Window* pParent, SfxChildWindow* pChildWi
get(m_pSearchComponent2PB, "component2"); get(m_pSearchComponent2PB, "component2");
get(m_pMatchCaseCB, "matchcase"); get(m_pMatchCaseCB, "matchcase");
get(m_pSearchFormattedCB, "searchformatted");
get(m_pWordBtn, "wholewords"); get(m_pWordBtn, "wholewords");
aCalcStr = get<FixedText>("entirecells")->GetText(); aCalcStr = get<FixedText>("entirecells")->GetText();
@@ -383,6 +384,7 @@ void SvxSearchDialog::dispose()
m_pSearchComponent1PB.clear(); m_pSearchComponent1PB.clear();
m_pSearchComponent2PB.clear(); m_pSearchComponent2PB.clear();
m_pMatchCaseCB.clear(); m_pMatchCaseCB.clear();
m_pSearchFormattedCB.clear();
m_pWordBtn.clear(); m_pWordBtn.clear();
m_pCloseBtn.clear(); m_pCloseBtn.clear();
m_pIgnoreDiacritics.clear(); m_pIgnoreDiacritics.clear();
@@ -740,6 +742,7 @@ void SvxSearchDialog::ShowOptionalControls_Impl()
m_pRowsBtn->Show(); m_pRowsBtn->Show();
m_pColumnsBtn->Show(); m_pColumnsBtn->Show();
m_pAllSheetsCB->Show(); m_pAllSheetsCB->Show();
m_pSearchFormattedCB->Show();
} }
} }
@@ -813,6 +816,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
m_pRowsBtn->SetClickHdl( aLink ); m_pRowsBtn->SetClickHdl( aLink );
m_pColumnsBtn->SetClickHdl( aLink ); m_pColumnsBtn->SetClickHdl( aLink );
m_pAllSheetsCB->SetClickHdl( aLink ); m_pAllSheetsCB->SetClickHdl( aLink );
m_pSearchFormattedCB->SetClickHdl( aLink );
sal_uIntPtr nModifyFlagCheck; sal_uIntPtr nModifyFlagCheck;
switch ( pSearchItem->GetCellType() ) switch ( pSearchItem->GetCellType() )
@@ -854,6 +858,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
} }
else else
{ {
m_pSearchFormattedCB->Hide();
m_pWordBtn->SetText( aCalcStr.getToken( 1, '#' ) ); m_pWordBtn->SetText( aCalcStr.getToken( 1, '#' ) );
if ( pSearchItem->GetAppFlag() == SvxSearchApp::DRAW ) if ( pSearchItem->GetAppFlag() == SvxSearchApp::DRAW )
@@ -1293,6 +1298,7 @@ IMPL_LINK_TYPED( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn, void )
pSearchItem->SetRowDirection( m_pRowsBtn->IsChecked() ); pSearchItem->SetRowDirection( m_pRowsBtn->IsChecked() );
pSearchItem->SetAllTables( m_pAllSheetsCB->IsChecked() ); pSearchItem->SetAllTables( m_pAllSheetsCB->IsChecked() );
pSearchItem->SetSearchFormatted( m_pSearchFormattedCB->IsChecked() );
} }
if (pBtn == m_pSearchBtn) if (pBtn == m_pSearchBtn)
@@ -2230,6 +2236,7 @@ void SvxSearchDialog::SaveToModule_Impl()
pSearchItem->SetRowDirection( m_pRowsBtn->IsChecked() ); pSearchItem->SetRowDirection( m_pRowsBtn->IsChecked() );
pSearchItem->SetAllTables( m_pAllSheetsCB->IsChecked() ); pSearchItem->SetAllTables( m_pAllSheetsCB->IsChecked() );
pSearchItem->SetSearchFormatted( m_pSearchFormattedCB->IsChecked() );
} }
pSearchItem->SetCommand( SvxSearchCmd::FIND ); pSearchItem->SetCommand( SvxSearchCmd::FIND );

View File

@@ -53,6 +53,7 @@ namespace {
static const char SEARCHITEM_COMMAND[] = "SearchItem.Command"; static const char SEARCHITEM_COMMAND[] = "SearchItem.Command";
static const char SEARCHITEM_SEARCHSTRING[] = "SearchItem.SearchString"; static const char SEARCHITEM_SEARCHSTRING[] = "SearchItem.SearchString";
static const char SEARCHITEM_SEARCHBACKWARD[] = "SearchItem.Backward"; static const char SEARCHITEM_SEARCHBACKWARD[] = "SearchItem.Backward";
static const char SEARCHITEM_SEARCHFORMATTED[] = "SearchItem.SearchFormatted";
static const char SEARCHITEM_SEARCHFLAGS[] = "SearchItem.SearchFlags"; static const char SEARCHITEM_SEARCHFLAGS[] = "SearchItem.SearchFlags";
static const char SEARCHITEM_TRANSLITERATEFLAGS[] = "SearchItem.TransliterateFlags"; static const char SEARCHITEM_TRANSLITERATEFLAGS[] = "SearchItem.TransliterateFlags";
static const char SEARCHITEM_ALGORITHMTYPE[] = "SearchItem.AlgorithmType"; static const char SEARCHITEM_ALGORITHMTYPE[] = "SearchItem.AlgorithmType";
@@ -63,6 +64,7 @@ static const char COMMAND_DOWNSEARCH[] = ".uno:DownSearch";
static const char COMMAND_UPSEARCH[] = ".uno:UpSearch"; static const char COMMAND_UPSEARCH[] = ".uno:UpSearch";
static const char COMMAND_EXITSEARCH[] = ".uno:ExitSearch"; static const char COMMAND_EXITSEARCH[] = ".uno:ExitSearch";
static const char COMMAND_MATCHCASE[] = ".uno:MatchCase"; static const char COMMAND_MATCHCASE[] = ".uno:MatchCase";
static const char COMMAND_SEARCHFORMATTED[] = ".uno:SearchFormattedDisplayString";
static const char COMMAND_APPENDSEARCHHISTORY[] = "AppendSearchHistory"; static const char COMMAND_APPENDSEARCHHISTORY[] = "AppendSearchHistory";
static const sal_Int32 REMEMBER_SIZE = 10; static const sal_Int32 REMEMBER_SIZE = 10;
@@ -80,6 +82,7 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
OUString sFindText; OUString sFindText;
bool aMatchCase = false; bool aMatchCase = false;
bool bSearchFormatted = false;
if ( pToolBox ) if ( pToolBox )
{ {
sal_uInt16 nItemCount = pToolBox->GetItemCount(); sal_uInt16 nItemCount = pToolBox->GetItemCount();
@@ -96,11 +99,16 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
CheckBox* pItemWin = static_cast<CheckBox*>( pToolBox->GetItemWindow(i) ); CheckBox* pItemWin = static_cast<CheckBox*>( pToolBox->GetItemWindow(i) );
if (pItemWin) if (pItemWin)
aMatchCase = pItemWin->IsChecked(); aMatchCase = pItemWin->IsChecked();
} else if ( sItemCommand == COMMAND_SEARCHFORMATTED )
{
CheckBox* pItemWin = static_cast<CheckBox*>( pToolBox->GetItemWindow(i) );
if (pItemWin)
bSearchFormatted = pItemWin->IsChecked();
} }
} }
} }
css::uno::Sequence< css::beans::PropertyValue > lArgs(6); css::uno::Sequence< css::beans::PropertyValue > lArgs(7);
lArgs[0].Name = SEARCHITEM_SEARCHSTRING; lArgs[0].Name = SEARCHITEM_SEARCHSTRING;
lArgs[0].Value <<= sFindText; lArgs[0].Value <<= sFindText;
lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD;
@@ -119,6 +127,8 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND ); SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND );
lArgs[5].Name = SEARCHITEM_ALGORITHMTYPE; lArgs[5].Name = SEARCHITEM_ALGORITHMTYPE;
lArgs[5].Value <<= (sal_Int16)0; // 0 == SearchAlgorithms_ABSOLUTE lArgs[5].Value <<= (sal_Int16)0; // 0 == SearchAlgorithms_ABSOLUTE
lArgs[6].Name = SEARCHITEM_SEARCHFORMATTED;
lArgs[6].Value <<= bSearchFormatted;
css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY); css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY);
if ( xDispatchProvider.is() ) if ( xDispatchProvider.is() )
@@ -699,6 +709,100 @@ void SAL_CALL MatchCaseToolboxController::statusChanged( const css::frame::Featu
{ {
} }
SearchFormattedToolboxController::SearchFormattedToolboxController( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
: svt::ToolboxController( rxContext,
css::uno::Reference< css::frame::XFrame >(),
OUString(COMMAND_SEARCHFORMATTED) )
, m_pSearchFormattedControl(NULL)
{
}
SearchFormattedToolboxController::~SearchFormattedToolboxController()
{
}
// XInterface
css::uno::Any SAL_CALL SearchFormattedToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException, std::exception )
{
css::uno::Any a = ToolboxController::queryInterface( aType );
if ( a.hasValue() )
return a;
return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) );
}
void SAL_CALL SearchFormattedToolboxController::acquire() throw ()
{
ToolboxController::acquire();
}
void SAL_CALL SearchFormattedToolboxController::release() throw ()
{
ToolboxController::release();
}
// XServiceInfo
OUString SAL_CALL SearchFormattedToolboxController::getImplementationName() throw( css::uno::RuntimeException, std::exception )
{
return OUString( "com.sun.star.svx.SearchFormattedToolboxController" );
}
sal_Bool SAL_CALL SearchFormattedToolboxController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException, std::exception )
{
return cppu::supportsService(this, ServiceName);
}
css::uno::Sequence< OUString > SAL_CALL SearchFormattedToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException, std::exception )
{
css::uno::Sequence< OUString > aSNS( 1 );
aSNS[0] = "com.sun.star.frame.ToolbarController";
return aSNS;
}
// XComponent
void SAL_CALL SearchFormattedToolboxController::dispose() throw ( css::uno::RuntimeException, std::exception )
{
SolarMutexGuard aSolarMutexGuard;
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();
m_pSearchFormattedControl.disposeAndClear();
}
// XInitialization
void SAL_CALL SearchFormattedToolboxController::initialize( const css::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException, std::exception)
{
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);
}
css::uno::Reference< css::awt::XWindow > SAL_CALL SearchFormattedToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException, std::exception )
{
css::uno::Reference< css::awt::XWindow > xItemWindow;
css::uno::Reference< css::awt::XWindow > xParent( Parent );
vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent );
if ( pParent )
{
ToolBox* pToolbar = static_cast<ToolBox*>(pParent);
m_pSearchFormattedControl = VclPtr<CheckBox>::Create( pToolbar, 0 );
m_pSearchFormattedControl->SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_SEARCHFORMATTED ) );
Size aSize( m_pSearchFormattedControl->GetOptimalSize() );
m_pSearchFormattedControl->SetSizePixel( aSize );
}
xItemWindow = VCLUnoHelper::GetInterface( m_pSearchFormattedControl );
return xItemWindow;
}
// XStatusListener
void SAL_CALL SearchFormattedToolboxController::statusChanged( const css::frame::FeatureStateEvent& ) throw ( css::uno::RuntimeException, std::exception )
{
}
FindAllToolboxController::FindAllToolboxController( const css::uno::Reference< css::uno::XComponentContext > & rxContext ) FindAllToolboxController::FindAllToolboxController( const css::uno::Reference< css::uno::XComponentContext > & rxContext )
: svt::ToolboxController( rxContext, : svt::ToolboxController( rxContext,
css::uno::Reference< css::frame::XFrame >(), css::uno::Reference< css::frame::XFrame >(),
@@ -1144,6 +1248,14 @@ com_sun_star_svx_MatchCaseToolboxController_get_implementation(
return cppu::acquire(new MatchCaseToolboxController(context)); return cppu::acquire(new MatchCaseToolboxController(context));
} }
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
com_sun_star_svx_SearchFormattedToolboxController_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(new SearchFormattedToolboxController(context));
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
com_sun_star_svx_FindAllToolboxController_get_implementation( com_sun_star_svx_FindAllToolboxController_get_implementation(
css::uno::XComponentContext *context, css::uno::XComponentContext *context,

View File

@@ -29,4 +29,9 @@ String RID_SVXSTR_FINDBAR_MATCHCASE
Text [ en-US ] = "Match Case" ; Text [ en-US ] = "Match Case" ;
}; };
String RID_SVXSTR_FINDBAR_SEARCHFORMATTED
{
Text [ en-US ] = "Search Formatted Display String" ;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -920,6 +920,21 @@
<property name="top_attach">0</property> <property name="top_attach">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="searchformatted">
<property name="label" translatable="yes">Search formatted display string</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child> <child>
<object class="GtkBox" id="box6"> <object class="GtkBox" id="box6">
<property name="visible">True</property> <property name="visible">True</property>
@@ -955,7 +970,7 @@
</child> </child>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">2</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
</packing> </packing>
</child> </child>

View File

@@ -56,6 +56,10 @@
constructor="com_sun_star_svx_MatchCaseToolboxController_get_implementation"> constructor="com_sun_star_svx_MatchCaseToolboxController_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/> <service name="com.sun.star.frame.ToolbarController"/>
</implementation> </implementation>
<implementation name="com.sun.star.svx.SearchFormattedToolboxController"
constructor="com_sun_star_svx_SearchFormattedToolboxController_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
<implementation name="com.sun.star.svx.FindAllToolboxController" <implementation name="com.sun.star.svx.FindAllToolboxController"
constructor="com_sun_star_svx_FindAllToolboxController_get_implementation"> constructor="com_sun_star_svx_FindAllToolboxController_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/> <service name="com.sun.star.frame.ToolbarController"/>

View File

@@ -33,7 +33,7 @@ using namespace utl;
using namespace com::sun::star::uno; using namespace com::sun::star::uno;
using namespace com::sun::star::i18n; using namespace com::sun::star::i18n;
#define MAX_FLAGS_OFFSET 27 #define MAX_FLAGS_OFFSET 28
class SvtSearchOptions_Impl : public ConfigItem class SvtSearchOptions_Impl : public ConfigItem
{ {
@@ -148,7 +148,8 @@ Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames()
"Japanese/IsIgnoreMiddleDot", // 24 "Japanese/IsIgnoreMiddleDot", // 24
"IsNotes", // 25 "IsNotes", // 25
"IsIgnoreDiacritics_CTL", // 26 "IsIgnoreDiacritics_CTL", // 26
"IsIgnoreKashida_CTL" // 27 "IsIgnoreKashida_CTL", // 27
"IsSearchFormatted" // 28
}; };
const int nCount = SAL_N_ELEMENTS( aPropNames ); const int nCount = SAL_N_ELEMENTS( aPropNames );
@@ -577,4 +578,14 @@ void SvtSearchOptions::SetIgnoreKashida_CTL( bool bVal )
pImpl->SetFlag( 27, bVal ); pImpl->SetFlag( 27, bVal );
} }
bool SvtSearchOptions::IsSearchFormatted() const
{
return pImpl->GetFlag( 28 );
}
void SvtSearchOptions::SetSearchFormatted( bool bVal )
{
pImpl->SetFlag( 28, bVal );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */