diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-05-28 17:13:38 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-05-28 17:37:18 +0200 |
commit | 1dc60bc9e99304c58007bfd5a964ff3f78480106 (patch) | |
tree | 8ddc1154e6fb6ca71ae36e24612ab1173240981b /svl | |
parent | 2ecf0ced9d2e55881033786fe95d45ceaeb73d37 (diff) |
SvxSearchItem: add m_nStartPoint{X,Y}
The idea is that if you have your cursor at the begining of a Writer
document, and you scroll down a lot, then search, then it's annoying
that search jumps back to the start of the document for the first hit.
Add an optional way to provide what is the starting point of such a
search, so we can have "when nothing is selected, then search from the
top left corner of the visible area".
No UI yet to enable this, but available via the UNO API.
Change-Id: Ibcf3a5f2eeba1372b1dfe8474081e6591a6e0134
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/items/srchitem.cxx | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx index e46d2557e7d9..986463e1d489 100644 --- a/svl/source/items/srchitem.cxx +++ b/svl/source/items/srchitem.cxx @@ -125,7 +125,9 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : bBackward ( false ), bPattern ( false ), bContent ( false ), - bAsianOptions ( false ) + bAsianOptions ( false ), + m_nStartPointX(0), + m_nStartPointY(0) { EnableNotification( lcl_GetNotifyNames() ); @@ -211,7 +213,9 @@ SvxSearchItem::SvxSearchItem( const SvxSearchItem& rItem ) : bBackward ( rItem.bBackward ), bPattern ( rItem.bPattern ), bContent ( rItem.bContent ), - bAsianOptions ( rItem.bAsianOptions ) + bAsianOptions ( rItem.bAsianOptions ), + m_nStartPointX(rItem.m_nStartPointX), + m_nStartPointY(rItem.m_nStartPointY) { EnableNotification( lcl_GetNotifyNames() ); } @@ -604,6 +608,16 @@ bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nM } break; } + case MID_SEARCH_STARTPOINTX: + { + bRet = (rVal >>= m_nStartPointX); + break; + } + case MID_SEARCH_STARTPOINTY: + { + bRet = (rVal >>= m_nStartPointY); + break; + } default: OSL_FAIL( "Unknown MemberId" ); } @@ -611,5 +625,19 @@ bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nM return bRet; } +sal_Int32 SvxSearchItem::GetStartPointX() const +{ + return m_nStartPointX; +} + +sal_Int32 SvxSearchItem::GetStartPointY() const +{ + return m_nStartPointY; +} + +bool SvxSearchItem::HasStartPoint() const +{ + return m_nStartPointX > 0 || m_nStartPointY > 0; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |