LCOV - code coverage report
Current view: top level - include/svl - srchitem.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 57 74 77.0 %
Date: 2014-11-03 Functions: 31 42 73.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef INCLUDED_SVL_SRCHITEM_HXX
      20             : #define INCLUDED_SVL_SRCHITEM_HXX
      21             : 
      22             : #include <sal/config.h>
      23             : #include <svl/svldllapi.h>
      24             : #include <com/sun/star/util/XSearchDescriptor.hpp>
      25             : #include <com/sun/star/util/SearchOptions.hpp>
      26             : #include <com/sun/star/util/SearchFlags.hpp>
      27             : #include <com/sun/star/i18n/TransliterationModules.hpp>
      28             : #include <unotools/configitem.hxx>
      29             : #include <rsc/rscsfx.hxx>
      30             : #include <svl/poolitem.hxx>
      31             : #include <svl/srchdefs.hxx>
      32             : 
      33             : // defines ---------------------------------------------------------------
      34             : 
      35             : // commands
      36             : #define     SVX_SEARCHCMD_FIND          ((sal_uInt16)0)
      37             : #define     SVX_SEARCHCMD_FIND_ALL      ((sal_uInt16)1)
      38             : #define     SVX_SEARCHCMD_REPLACE       ((sal_uInt16)2)
      39             : #define     SVX_SEARCHCMD_REPLACE_ALL   ((sal_uInt16)3)
      40             : 
      41             : // search flags
      42             : #define     SVX_SEARCHIN_FORMULA        ((sal_uInt16)0)
      43             : #define     SVX_SEARCHIN_VALUE          ((sal_uInt16)1)
      44             : #define     SVX_SEARCHIN_NOTE           ((sal_uInt16)2)
      45             : #define     SVX_SEARCHAPP_WRITER        ((sal_uInt16)0)
      46             : #define     SVX_SEARCHAPP_CALC          ((sal_uInt16)1)
      47             : #define     SVX_SEARCHAPP_DRAW          ((sal_uInt16)2)
      48             : #define     SVX_SEARCHAPP_BASE          ((sal_uInt16)3)
      49             : 
      50             : // class SvxSearchItem ---------------------------------------------------
      51             : 
      52             : class SVL_DLLPUBLIC SvxSearchItem :
      53             :         public SfxPoolItem,
      54             :         public utl::ConfigItem
      55             : {
      56             :     com::sun::star::util::SearchOptions aSearchOpt;
      57             : 
      58             :     SfxStyleFamily  eFamily;            // Vorlagen-Familie
      59             : 
      60             :     sal_uInt16      nCommand;           // Kommando (Suchen, Alle Suchen, Ersetzen, Alle Ersetzen)
      61             : 
      62             :     // Calc-Spezifische Daten
      63             :     sal_uInt16      nCellType;          // Suche in Formeln/Werten/Notizen
      64             :     sal_uInt16      nAppFlag;           // Fuer welche Applikation ist der Dialog ueberhaupt
      65             :     bool            bRowDirection;      // Suchrichtung Zeilenweise/Spaltenweise
      66             :     bool            bAllTables;         // in alle Tabellen suchen
      67             :     bool            bSearchFiltered;      // search filtered cells.
      68             : 
      69             :     // Writer-spezifisch
      70             :     bool            bNotes;
      71             : 
      72             :     bool            bBackward;          // Suche Rueckwaerts
      73             :     bool            bPattern;           // Suche nach Vorlagen
      74             :     bool            bContent;           // Suche im Inhalt
      75             :     bool            bAsianOptions;      // use asian options?
      76             : 
      77             : public:
      78             :     TYPEINFO_OVERRIDE();
      79             : 
      80             :     explicit SvxSearchItem( const sal_uInt16 nId );
      81             :     SvxSearchItem( const SvxSearchItem& rItem );
      82             :     virtual ~SvxSearchItem();
      83             : 
      84             :     virtual bool             QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
      85             :     virtual bool             PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
      86             :     virtual bool             operator == ( const SfxPoolItem& ) const SAL_OVERRIDE;
      87             :     virtual SfxPoolItem*     Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
      88             :     virtual bool GetPresentation( SfxItemPresentation ePres,
      89             :                                     SfxMapUnit eCoreMetric,
      90             :                                     SfxMapUnit ePresMetric,
      91             :                                     OUString &rText, const IntlWrapper * = 0 ) const SAL_OVERRIDE;
      92             : 
      93             :     // ConfigItem
      94             :     virtual void            Notify( const com::sun::star::uno::Sequence< OUString > &rPropertyNames ) SAL_OVERRIDE;
      95             :     virtual void            Commit() SAL_OVERRIDE;
      96             : 
      97        5748 :             sal_uInt16      GetCommand() const { return nCommand; }
      98         144 :             void            SetCommand(sal_uInt16 nNewCommand) { nCommand = nNewCommand; }
      99             : 
     100             :     inline  const OUString  GetSearchString() const;
     101             :     inline  void            SetSearchString(const OUString& rNewString);
     102             : 
     103             :     inline  const OUString  GetReplaceString() const;
     104             :     inline  void            SetReplaceString(const OUString& rNewString);
     105             : 
     106             :     inline  bool            GetWordOnly() const;
     107             :             void            SetWordOnly(bool bNewWordOnly);
     108             : 
     109             :     inline  bool            GetExact() const;
     110             :             void            SetExact(bool bNewExact);
     111             : 
     112        9356 :             bool            GetBackward() const { return bBackward; }
     113          84 :             void            SetBackward(bool bNewBackward) { bBackward = bNewBackward; }
     114             : 
     115             :     inline  bool            GetSelection() const;
     116             :             void            SetSelection(bool bNewSelection);
     117             : 
     118             :     inline  bool            GetRegExp() const;
     119             :             void            SetRegExp( bool bVal );
     120             : 
     121         216 :             bool            GetPattern() const { return bPattern; }
     122          78 :             void            SetPattern(bool bNewPattern) { bPattern = bNewPattern; }
     123             : 
     124             :             bool            IsContent() const { return bContent; }
     125             :             void            SetContent( bool bNew ) { bContent = bNew; }
     126             : 
     127           0 :             SfxStyleFamily  GetFamily() const { return eFamily; }
     128           0 :             void            SetFamily( SfxStyleFamily eNewFamily )
     129           0 :                                 { eFamily = eNewFamily; }
     130             : 
     131         150 :             bool            GetRowDirection() const { return bRowDirection; }
     132         144 :             void            SetRowDirection(bool bNewRowDirection) { bRowDirection = bNewRowDirection; }
     133             : 
     134           0 :             bool            IsAllTables() const { return bAllTables; }
     135           0 :             void            SetAllTables(bool bNew) { bAllTables = bNew; }
     136             : 
     137        1274 :             bool            IsSearchFiltered() const { return bSearchFiltered; }
     138           0 :             void            SetSearchFiltered(bool b) { bSearchFiltered = b; }
     139             : 
     140        2048 :             sal_uInt16      GetCellType() const { return nCellType; }
     141          76 :             void            SetCellType(sal_uInt16 nNewCellType) { nCellType = nNewCellType; }
     142             : 
     143           0 :             bool            GetNotes() const { return bNotes; }
     144           0 :             void            SetNotes(bool bNew) { bNotes = bNew; }
     145             : 
     146           0 :             sal_uInt16      GetAppFlag() const { return nAppFlag; }
     147          74 :             void            SetAppFlag(sal_uInt16 nNewAppFlag) { nAppFlag = nNewAppFlag; }
     148             : 
     149             :     inline  bool            IsLevenshtein() const;
     150             :             void            SetLevenshtein( bool bVal );
     151             : 
     152             :     inline  bool            IsLEVRelaxed() const;
     153             :             void            SetLEVRelaxed(bool bSet);
     154             : 
     155             :     inline  sal_uInt16      GetLEVOther() const;
     156             :     inline  void            SetLEVOther(sal_uInt16 nSet);
     157             : 
     158             :     inline  sal_uInt16      GetLEVShorter() const;
     159             :     inline  void            SetLEVShorter(sal_uInt16 nSet);
     160             : 
     161             :     inline  sal_uInt16      GetLEVLonger() const;
     162             :     inline  void            SetLEVLonger(sal_uInt16 nSet);
     163             : 
     164             :     inline const com::sun::star::util::SearchOptions &
     165             :                 GetSearchOptions() const;
     166             :     inline void SetSearchOptions( const com::sun::star::util::SearchOptions &rOpt );
     167             : 
     168             :     inline  sal_Int32       GetTransliterationFlags() const;
     169             :             void            SetTransliterationFlags( sal_Int32 nFlags );
     170             : 
     171             :     inline  bool            IsMatchFullHalfWidthForms() const;
     172             :     void                    SetMatchFullHalfWidthForms( bool bVal );
     173             : 
     174         144 :     inline  bool            IsUseAsianOptions() const           { return bAsianOptions; }
     175          72 :     inline  void            SetUseAsianOptions( bool bVal ) { bAsianOptions = bVal; }
     176             : };
     177             : 
     178           6 : const OUString SvxSearchItem::GetSearchString() const
     179             : {
     180           6 :     return aSearchOpt.searchString;
     181             : }
     182             : 
     183          94 : void SvxSearchItem::SetSearchString(const OUString& rNewString)
     184             : {
     185          94 :     aSearchOpt.searchString = rNewString;
     186          94 : }
     187             : 
     188         608 : const OUString SvxSearchItem::GetReplaceString() const
     189             : {
     190         608 :     return aSearchOpt.replaceString;
     191             : }
     192             : 
     193          54 : void SvxSearchItem::SetReplaceString(const OUString& rNewString)
     194             : {
     195          54 :     aSearchOpt.replaceString = rNewString;
     196          54 : }
     197             : 
     198        1992 : bool SvxSearchItem::GetWordOnly() const
     199             : {
     200        1992 :     return 0 != (aSearchOpt.searchFlag &
     201        1992 :                         com::sun::star::util::SearchFlags::NORM_WORD_ONLY);
     202             : }
     203             : 
     204          14 : bool SvxSearchItem::GetExact() const
     205             : {
     206          14 :     return 0 == (aSearchOpt.transliterateFlags &
     207          14 :                         com::sun::star::i18n::TransliterationModules_IGNORE_CASE);
     208             : }
     209             : 
     210        9192 : bool SvxSearchItem::GetSelection() const
     211             : {
     212        9192 :     return 0 != (aSearchOpt.searchFlag &
     213        9192 :                         com::sun::star::util::SearchFlags::REG_NOT_BEGINOFLINE);
     214             : }
     215             : 
     216         584 : bool SvxSearchItem::GetRegExp() const
     217             : {
     218         584 :     return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_REGEXP ;
     219             : }
     220             : 
     221          14 : bool SvxSearchItem::IsLEVRelaxed() const
     222             : {
     223          14 :     return 0 != (aSearchOpt.searchFlag &
     224          14 :                         com::sun::star::util::SearchFlags::LEV_RELAXED);
     225             : }
     226             : 
     227          14 : sal_uInt16 SvxSearchItem::GetLEVOther() const
     228             : {
     229          14 :     return (sal_Int16) aSearchOpt.changedChars;
     230             : }
     231             : 
     232          78 : void SvxSearchItem::SetLEVOther( sal_uInt16 nVal )
     233             : {
     234          78 :     aSearchOpt.changedChars = nVal;
     235          78 : }
     236             : 
     237          14 : sal_uInt16 SvxSearchItem::GetLEVShorter() const
     238             : {
     239          14 :     return (sal_Int16) aSearchOpt.insertedChars;
     240             : }
     241             : 
     242          78 : void SvxSearchItem::SetLEVShorter( sal_uInt16 nVal )
     243             : {
     244          78 :     aSearchOpt.insertedChars = nVal;
     245          78 : }
     246             : 
     247          14 : sal_uInt16 SvxSearchItem::GetLEVLonger() const
     248             : {
     249          14 :     return (sal_Int16) aSearchOpt.deletedChars;
     250             : }
     251             : 
     252          78 : void SvxSearchItem::SetLEVLonger( sal_uInt16 nVal )
     253             : {
     254          78 :     aSearchOpt.deletedChars = nVal;
     255          78 : }
     256             : 
     257          14 : bool SvxSearchItem::IsLevenshtein() const
     258             : {
     259          14 :     return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_APPROXIMATE;
     260             : }
     261             : 
     262         148 : const com::sun::star::util::SearchOptions & SvxSearchItem::GetSearchOptions() const
     263             : {
     264         148 :     return aSearchOpt;
     265             : }
     266             : 
     267           0 : void SvxSearchItem::SetSearchOptions( const com::sun::star::util::SearchOptions &rOpt )
     268             : {
     269           0 :     aSearchOpt = rOpt;
     270           0 : }
     271             : 
     272           0 : sal_Int32 SvxSearchItem::GetTransliterationFlags() const
     273             : {
     274           0 :     return aSearchOpt.transliterateFlags;
     275             : }
     276             : 
     277           0 : bool SvxSearchItem::IsMatchFullHalfWidthForms() const
     278             : {
     279           0 :     return 0 != (aSearchOpt.transliterateFlags &
     280           0 :                         com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH);
     281             : }
     282             : 
     283             : #endif
     284             : 
     285             : 
     286             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10