summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennisfrancis.in@gmail.com>2015-10-17 23:14:35 +0530
committerEike Rathke <erack@redhat.com>2015-10-23 00:24:18 +0000
commit9a85743766e8a063d20d5f93ee88758e243397f4 (patch)
tree5cfcdbf0072a5ba099ee22d06af618717bffa22b
parentb5a1a23ed05d5b72d50bf08b8f6fd550eea17b64 (diff)
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>
-rw-r--r--include/sfx2/msg.hxx2
-rw-r--r--include/svl/memberid.hrc1
-rw-r--r--include/svl/srchitem.hxx4
-rw-r--r--include/svx/dialogs.hrc1
-rw-r--r--include/svx/srchdlg.hxx1
-rw-r--r--include/unotools/searchopt.hxx2
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu11
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu5
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs7
-rw-r--r--sc/inc/unonames.hxx1
-rw-r--r--sc/source/core/data/table6.cxx11
-rw-r--r--sc/source/ui/unoobj/srchuno.cxx2
-rw-r--r--sc/uiconfig/scalc/toolbar/findbar.xml1
-rw-r--r--sfx2/sdi/sfxitems.sdi1
-rw-r--r--svl/source/items/srchitem.cxx33
-rw-r--r--svx/inc/tbunosearchcontrollers.hxx33
-rw-r--r--svx/source/dialog/srchdlg.cxx7
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx114
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.src5
-rw-r--r--svx/uiconfig/ui/findreplacedialog.ui17
-rw-r--r--svx/util/svx.component4
-rw-r--r--unotools/source/config/searchopt.cxx15
22 files changed, 262 insertions, 16 deletions
diff --git a/include/sfx2/msg.hxx b/include/sfx2/msg.hxx
index 94b3ecf9fbda..d9e2c12d650e 100644
--- a/include/sfx2/msg.hxx
+++ b/include/sfx2/msg.hxx
@@ -153,7 +153,7 @@ SFX_DECL_TYPE(13); // for SwAddPrinterItem, Sd...
SFX_DECL_TYPE(14);
SFX_DECL_TYPE(16); // for SwDocDisplayItem
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
#undef SFX_DECL_TYPE
diff --git a/include/svl/memberid.hrc b/include/svl/memberid.hrc
index 5c9f4e249d14..f3fdd5334667 100644
--- a/include/svl/memberid.hrc
+++ b/include/svl/memberid.hrc
@@ -59,6 +59,7 @@
#define MID_SEARCH_COMMAND 19
#define MID_SEARCH_STARTPOINTX 20
#define MID_SEARCH_STARTPOINTY 21
+#define MID_SEARCH_SEARCHFORMATTED 22
#endif
diff --git a/include/svl/srchitem.hxx b/include/svl/srchitem.hxx
index 70b54103a96b..4813458afb9a 100644
--- a/include/svl/srchitem.hxx
+++ b/include/svl/srchitem.hxx
@@ -75,6 +75,7 @@ class SVL_DLLPUBLIC SvxSearchItem :
bool m_bRowDirection; // search direction: row-wise/column-wise
bool m_bAllTables; // search in all sheets
bool m_bSearchFiltered; // search filtered cells.
+ bool m_bSearchFormatted; // search formatted display strings
// Writer-specific
bool m_bNotes;
@@ -149,6 +150,9 @@ public:
bool IsSearchFiltered() const { return m_bSearchFiltered; }
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; }
void SetCellType(SvxSearchCellType nNewCellType) { m_nCellType = nNewCellType; }
diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index 222440fc2ec7..88da6a980e59 100644
--- a/include/svx/dialogs.hrc
+++ b/include/svx/dialogs.hrc
@@ -942,6 +942,7 @@
#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_FIND (RID_SVX_START + 1190)
diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx
index b27a0478bf64..556659fa618a 100644
--- a/include/svx/srchdlg.hxx
+++ b/include/svx/srchdlg.hxx
@@ -171,6 +171,7 @@ private:
VclPtr<PushButton> m_pSearchComponent2PB;
VclPtr<CheckBox> m_pMatchCaseCB;
+ VclPtr<CheckBox> m_pSearchFormattedCB;
VclPtr<CheckBox> m_pWordBtn;
VclPtr<PushButton> m_pCloseBtn;
diff --git a/include/unotools/searchopt.hxx b/include/unotools/searchopt.hxx
index df655d74dec5..c560ae98e429 100644
--- a/include/unotools/searchopt.hxx
+++ b/include/unotools/searchopt.hxx
@@ -47,6 +47,7 @@ public:
bool IsSimilaritySearch() const;
bool IsUseAsianOptions() const;
bool IsMatchCase() const; // also Japanese search option
+ bool IsSearchFormatted() const;
bool IsNotes() const;
void SetWholeWordsOnly( bool bVal );
@@ -56,6 +57,7 @@ public:
void SetSimilaritySearch( bool bVal );
void SetUseAsianOptions( bool bVal );
void SetMatchCase( bool bVal ); // also Japanese search option
+ void SetSearchFormatted( bool bVal );
void SetNotes( bool bVal);
// Japanese search options
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index cb12c82e5ae3..5e885fd81b89 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -793,6 +793,17 @@
<value>com.sun.star.svx.MatchCaseToolboxController</value>
</prop>
</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">
<prop oor:name="Command">
<value>.uno:FindAll</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index a53158bc33c3..4c0b47d21788 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -1534,6 +1534,11 @@
<value xml:lang="en-US">Match Case</value>
</prop>
</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">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Find All</value>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 9c40c457bbc1..ac5b6348873a 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6020,6 +6020,13 @@
</info>
<value>false</value>
</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">
<info>
<desc>Contains search options for the Japanese language.</desc>
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index b064995a1468..59398959387e 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -376,6 +376,7 @@
#define SC_UNO_SRCHTYPE "SearchType"
#define SC_UNO_SRCHWORDS "SearchWords"
#define SC_UNO_SRCHFILTERED "SearchFiltered"
+#define SC_UNO_SRCHFORMATTED "SearchFormatted"
// old (5.2) property names for page styles - for compatibility only!
#define OLD_UNO_PAGE_BACKCOLOR "BackgroundColor"
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 386843749c2a..859b1b189012 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -60,6 +60,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
bool bFound = false;
bool bDoSearch = true;
bool bDoBack = rSearchItem.GetBackward();
+ bool bSearchFormatted = rSearchItem.IsSearchFormatted();
OUString aString;
ScRefCellValue aCell;
@@ -85,7 +86,10 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, pDocument, aString);
else
{
- aCol[nCol].GetInputString( nRow, aString );
+ if( !bSearchFormatted )
+ aCol[nCol].GetInputString( nRow, aString );
+ else
+ aCol[nCol].GetString( nRow, aString );
}
}
break;
@@ -94,7 +98,10 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, pDocument, aString);
else
{
- aCol[nCol].GetInputString( nRow, aString );
+ if( !bSearchFormatted )
+ aCol[nCol].GetInputString( nRow, aString );
+ else
+ aCol[nCol].GetString( nRow, aString );
}
break;
case SvxSearchCellType::NOTE:
diff --git a/sc/source/ui/unoobj/srchuno.cxx b/sc/source/ui/unoobj/srchuno.cxx
index 072ff437d798..08bcccba422c 100644
--- a/sc/source/ui/unoobj/srchuno.cxx
+++ b/sc/source/ui/unoobj/srchuno.cxx
@@ -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_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_SRCHFORMATTED) pSearchItem->SetSearchFormatted( ScUnoHelpFunctions::GetBoolFromAny(aValue) );
}
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_SRCHTYPE) aRet <<= (sal_Int16) pSearchItem->GetCellType();
else if (aString == SC_UNO_SRCHFILTERED) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsSearchFiltered() );
+ else if (aString == SC_UNO_SRCHFORMATTED) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsSearchFormatted() );
return aRet;
}
diff --git a/sc/uiconfig/scalc/toolbar/findbar.xml b/sc/uiconfig/scalc/toolbar/findbar.xml
index 990cc6a8e8ed..0eac979e0afb 100644
--- a/sc/uiconfig/scalc/toolbar/findbar.xml
+++ b/sc/uiconfig/scalc/toolbar/findbar.xml
@@ -23,6 +23,7 @@
<toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
<toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
<toolbar:toolbaritem xlink:href=".uno:FindAll"/>
+ <toolbar:toolbaritem xlink:href=".uno:SearchFormattedDisplayString"/>
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
diff --git a/sfx2/sdi/sfxitems.sdi b/sfx2/sdi/sfxitems.sdi
index f98e9c9f4e41..f7a24105015f 100644
--- a/sfx2/sdi/sfxitems.sdi
+++ b/sfx2/sdi/sfxitems.sdi
@@ -92,6 +92,7 @@
INT16 Command MID_SEARCH_COMMAND;
INT32 SearchStartPointX MID_SEARCH_STARTPOINTX;
INT32 SearchStartPointY MID_SEARCH_STARTPOINTY;
+ BOOL SearchFormatted MID_SEARCH_SEARCHFORMATTED;
};
item SvxSearch SvxSearchItem;
diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx
index 62b9d93442a7..6d98b8c5cc3f 100644
--- a/svl/source/items/srchitem.cxx
+++ b/svl/source/items/srchitem.cxx
@@ -44,7 +44,7 @@ using namespace com::sun::star::util;
#define CFG_ROOT_NODE "Office.Common/SearchOptions"
-#define SRCH_PARAMS 12
+#define SRCH_PARAMS 13
#define SRCH_PARA_OPTIONS "Options"
#define SRCH_PARA_FAMILY "Family"
#define SRCH_PARA_COMMAND "Command"
@@ -53,6 +53,7 @@ using namespace com::sun::star::util;
#define SRCH_PARA_ROWDIR "RowDirection"
#define SRCH_PARA_ALLTABLES "AllTables"
#define SRCH_PARA_SEARCHFILTERED "SearchFiltered"
+#define SRCH_PARA_SEARCHFORMATTED "SearchFormatted"
#define SRCH_PARA_BACKWARD "Backward"
#define SRCH_PARA_PATTERN "Pattern"
#define SRCH_PARA_CONTENT "Content"
@@ -121,6 +122,7 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) :
m_bRowDirection ( true ),
m_bAllTables ( false ),
m_bSearchFiltered ( false ),
+ m_bSearchFormatted( false ),
m_bNotes ( false),
m_bBackward ( false ),
m_bPattern ( false ),
@@ -209,6 +211,7 @@ SvxSearchItem::SvxSearchItem( const SvxSearchItem& rItem ) :
m_bRowDirection ( rItem.m_bRowDirection ),
m_bAllTables ( rItem.m_bAllTables ),
m_bSearchFiltered ( rItem.m_bSearchFiltered ),
+ m_bSearchFormatted ( rItem.m_bSearchFormatted ),
m_bNotes ( rItem.m_bNotes),
m_bBackward ( rItem.m_bBackward ),
m_bPattern ( rItem.m_bPattern ),
@@ -261,6 +264,7 @@ bool SvxSearchItem::operator==( const SfxPoolItem& rItem ) const
( m_bRowDirection == rSItem.m_bRowDirection ) &&
( m_bAllTables == rSItem.m_bAllTables ) &&
( m_bSearchFiltered == rSItem.m_bSearchFiltered ) &&
+ ( m_bSearchFormatted == rSItem.m_bSearchFormatted ) &&
( m_nCellType == rSItem.m_nCellType ) &&
( m_nAppFlag == rSItem.m_nAppFlag ) &&
( 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[7].Name = SRCH_PARA_SEARCHFILTERED;
aSeq[7].Value <<= m_bSearchFiltered;
- aSeq[8].Name = SRCH_PARA_BACKWARD;
- aSeq[8].Value <<= m_bBackward;
- aSeq[9].Name = SRCH_PARA_PATTERN;
- aSeq[9].Value <<= m_bPattern;
- aSeq[10].Name = SRCH_PARA_CONTENT;
- aSeq[10].Value <<= m_bContent;
- aSeq[11].Name = SRCH_PARA_ASIANOPT;
- aSeq[11].Value <<= m_bAsianOptions;
+ aSeq[8].Name = SRCH_PARA_SEARCHFORMATTED;
+ aSeq[8].Value <<= m_bSearchFormatted;
+ aSeq[9].Name = SRCH_PARA_BACKWARD;
+ aSeq[9].Value <<= m_bBackward;
+ aSeq[10].Name = SRCH_PARA_PATTERN;
+ aSeq[10].Value <<= m_bPattern;
+ aSeq[11].Name = SRCH_PARA_CONTENT;
+ aSeq[11].Value <<= m_bContent;
+ aSeq[12].Name = SRCH_PARA_ASIANOPT;
+ aSeq[12].Value <<= m_bAsianOptions;
rVal <<= aSeq;
}
break;
@@ -414,6 +420,8 @@ bool SvxSearchItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMembe
rVal <<= m_bAllTables; break;
case MID_SEARCH_SEARCHFILTERED:
rVal <<= m_bSearchFiltered; break;
+ case MID_SEARCH_SEARCHFORMATTED:
+ rVal <<= m_bSearchFormatted; break;
case MID_SEARCH_BACKWARD:
rVal <<= m_bBackward; break;
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 )
++nConvertedCount;
}
+ else if ( aSeq[i].Name == SRCH_PARA_SEARCHFORMATTED )
+ {
+ if ( aSeq[i].Value >>= m_bSearchFormatted )
+ ++nConvertedCount;
+ }
else if ( aSeq[i].Name == SRCH_PARA_BACKWARD )
{
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;
case MID_SEARCH_SEARCHFILTERED:
bRet = (rVal >>= m_bSearchFiltered); break;
+ case MID_SEARCH_SEARCHFORMATTED:
+ bRet = (rVal >>= m_bSearchFormatted); break;
case MID_SEARCH_BACKWARD:
bRet = (rVal >>= m_bBackward); break;
case MID_SEARCH_PATTERN:
diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx
index c180023d28a3..f7477dfacd15 100644
--- a/svx/inc/tbunosearchcontrollers.hxx
+++ b/svx/inc/tbunosearchcontrollers.hxx
@@ -222,6 +222,39 @@ private:
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,
public css::lang::XServiceInfo
{
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 49533b2cf6f3..c3e58152a1bd 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -300,6 +300,7 @@ SvxSearchDialog::SvxSearchDialog( vcl::Window* pParent, SfxChildWindow* pChildWi
get(m_pSearchComponent2PB, "component2");
get(m_pMatchCaseCB, "matchcase");
+ get(m_pSearchFormattedCB, "searchformatted");
get(m_pWordBtn, "wholewords");
aCalcStr = get<FixedText>("entirecells")->GetText();
@@ -383,6 +384,7 @@ void SvxSearchDialog::dispose()
m_pSearchComponent1PB.clear();
m_pSearchComponent2PB.clear();
m_pMatchCaseCB.clear();
+ m_pSearchFormattedCB.clear();
m_pWordBtn.clear();
m_pCloseBtn.clear();
m_pIgnoreDiacritics.clear();
@@ -740,6 +742,7 @@ void SvxSearchDialog::ShowOptionalControls_Impl()
m_pRowsBtn->Show();
m_pColumnsBtn->Show();
m_pAllSheetsCB->Show();
+ m_pSearchFormattedCB->Show();
}
}
@@ -813,6 +816,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
m_pRowsBtn->SetClickHdl( aLink );
m_pColumnsBtn->SetClickHdl( aLink );
m_pAllSheetsCB->SetClickHdl( aLink );
+ m_pSearchFormattedCB->SetClickHdl( aLink );
sal_uIntPtr nModifyFlagCheck;
switch ( pSearchItem->GetCellType() )
@@ -854,6 +858,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
}
else
{
+ m_pSearchFormattedCB->Hide();
m_pWordBtn->SetText( aCalcStr.getToken( 1, '#' ) );
if ( pSearchItem->GetAppFlag() == SvxSearchApp::DRAW )
@@ -1293,6 +1298,7 @@ IMPL_LINK_TYPED( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn, void )
pSearchItem->SetRowDirection( m_pRowsBtn->IsChecked() );
pSearchItem->SetAllTables( m_pAllSheetsCB->IsChecked() );
+ pSearchItem->SetSearchFormatted( m_pSearchFormattedCB->IsChecked() );
}
if (pBtn == m_pSearchBtn)
@@ -2230,6 +2236,7 @@ void SvxSearchDialog::SaveToModule_Impl()
pSearchItem->SetRowDirection( m_pRowsBtn->IsChecked() );
pSearchItem->SetAllTables( m_pAllSheetsCB->IsChecked() );
+ pSearchItem->SetSearchFormatted( m_pSearchFormattedCB->IsChecked() );
}
pSearchItem->SetCommand( SvxSearchCmd::FIND );
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index b7e71b5bee98..0dd67acaf7d9 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -53,6 +53,7 @@ namespace {
static const char SEARCHITEM_COMMAND[] = "SearchItem.Command";
static const char SEARCHITEM_SEARCHSTRING[] = "SearchItem.SearchString";
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_TRANSLITERATEFLAGS[] = "SearchItem.TransliterateFlags";
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_EXITSEARCH[] = ".uno:ExitSearch";
static const char COMMAND_MATCHCASE[] = ".uno:MatchCase";
+static const char COMMAND_SEARCHFORMATTED[] = ".uno:SearchFormattedDisplayString";
static const char COMMAND_APPENDSEARCHHISTORY[] = "AppendSearchHistory";
static const sal_Int32 REMEMBER_SIZE = 10;
@@ -80,6 +82,7 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
OUString sFindText;
bool aMatchCase = false;
+ bool bSearchFormatted = false;
if ( pToolBox )
{
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) );
if (pItemWin)
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].Value <<= sFindText;
lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD;
@@ -119,6 +127,8 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND );
lArgs[5].Name = SEARCHITEM_ALGORITHMTYPE;
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);
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 )
: svt::ToolboxController( rxContext,
css::uno::Reference< css::frame::XFrame >(),
@@ -1145,6 +1249,14 @@ com_sun_star_svx_MatchCaseToolboxController_get_implementation(
}
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
com_sun_star_svx_FindAllToolboxController_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.src b/svx/source/tbxctrls/tbunosearchcontrollers.src
index d3b89201994c..e722d649d602 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.src
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.src
@@ -29,4 +29,9 @@ String RID_SVXSTR_FINDBAR_MATCHCASE
Text [ en-US ] = "Match Case" ;
};
+String RID_SVXSTR_FINDBAR_SEARCHFORMATTED
+{
+ Text [ en-US ] = "Search Formatted Display String" ;
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/uiconfig/ui/findreplacedialog.ui b/svx/uiconfig/ui/findreplacedialog.ui
index 49305d5da51a..aa25614eb5fe 100644
--- a/svx/uiconfig/ui/findreplacedialog.ui
+++ b/svx/uiconfig/ui/findreplacedialog.ui
@@ -921,6 +921,21 @@
</packing>
</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>
<object class="GtkBox" id="box6">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -955,7 +970,7 @@
</child>
</object>
<packing>
- <property name="left_attach">1</property>
+ <property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
diff --git a/svx/util/svx.component b/svx/util/svx.component
index 967677befed0..0cff72e9b423 100644
--- a/svx/util/svx.component
+++ b/svx/util/svx.component
@@ -56,6 +56,10 @@
constructor="com_sun_star_svx_MatchCaseToolboxController_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</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"
constructor="com_sun_star_svx_FindAllToolboxController_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
diff --git a/unotools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx
index c98eb3e43301..b1bec8b9a846 100644
--- a/unotools/source/config/searchopt.cxx
+++ b/unotools/source/config/searchopt.cxx
@@ -33,7 +33,7 @@ using namespace utl;
using namespace com::sun::star::uno;
using namespace com::sun::star::i18n;
-#define MAX_FLAGS_OFFSET 27
+#define MAX_FLAGS_OFFSET 28
class SvtSearchOptions_Impl : public ConfigItem
{
@@ -148,7 +148,8 @@ Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames()
"Japanese/IsIgnoreMiddleDot", // 24
"IsNotes", // 25
"IsIgnoreDiacritics_CTL", // 26
- "IsIgnoreKashida_CTL" // 27
+ "IsIgnoreKashida_CTL", // 27
+ "IsSearchFormatted" // 28
};
const int nCount = SAL_N_ELEMENTS( aPropNames );
@@ -577,4 +578,14 @@ void SvtSearchOptions::SetIgnoreKashida_CTL( bool 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: */