LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/svl - srchitem.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 53 69 76.8 %
Date: 2012-08-25 Functions: 31 42 73.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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 _SFX_SRCHITEM_HXX
      20                 :            : #define _SFX_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 <tools/string.hxx>
      31                 :            : #include <svl/poolitem.hxx>
      32                 :            : #include <svl/srchdefs.hxx>
      33                 :            : 
      34                 :            : // defines ---------------------------------------------------------------
      35                 :            : 
      36                 :            : // commands
      37                 :            : #define     SVX_SEARCHCMD_FIND          ((sal_uInt16)0)
      38                 :            : #define     SVX_SEARCHCMD_FIND_ALL      ((sal_uInt16)1)
      39                 :            : #define     SVX_SEARCHCMD_REPLACE       ((sal_uInt16)2)
      40                 :            : #define     SVX_SEARCHCMD_REPLACE_ALL   ((sal_uInt16)3)
      41                 :            : 
      42                 :            : // search flags
      43                 :            : #define     SVX_SEARCHIN_FORMULA        ((sal_uInt16)0)
      44                 :            : #define     SVX_SEARCHIN_VALUE          ((sal_uInt16)1)
      45                 :            : #define     SVX_SEARCHIN_NOTE           ((sal_uInt16)2)
      46                 :            : #define     SVX_SEARCHAPP_WRITER        ((sal_uInt16)0)
      47                 :            : #define     SVX_SEARCHAPP_CALC          ((sal_uInt16)1)
      48                 :            : #define     SVX_SEARCHAPP_DRAW          ((sal_uInt16)2)
      49                 :            : #define     SVX_SEARCHAPP_BASE          ((sal_uInt16)3)
      50                 :            : 
      51                 :            : // class SvxSearchItem ---------------------------------------------------
      52                 :            : 
      53                 :            : class SVL_DLLPUBLIC SvxSearchItem :
      54                 :            :         public SfxPoolItem,
      55                 :            :         public utl::ConfigItem
      56                 :            : {
      57                 :            :     com::sun::star::util::SearchOptions aSearchOpt;
      58                 :            : 
      59                 :            :     SfxStyleFamily  eFamily;            // Vorlagen-Familie
      60                 :            : 
      61                 :            :     sal_uInt16      nCommand;           // Kommando (Suchen, Alle Suchen, Ersetzen, Alle Ersetzen)
      62                 :            : 
      63                 :            :     // Calc-Spezifische Daten
      64                 :            :     sal_uInt16      nCellType;          // Suche in Formeln/Werten/Notizen
      65                 :            :     sal_uInt16      nAppFlag;           // Fuer welche Applikation ist der Dialog ueberhaupt
      66                 :            :     sal_Bool        bRowDirection;      // Suchrichtung Zeilenweise/Spaltenweise
      67                 :            :     sal_Bool        bAllTables;         // in alle Tabellen suchen
      68                 :            :     sal_Bool        bSearchFiltered;      // search filtered cells.
      69                 :            : 
      70                 :            :     // Writer-spezifisch
      71                 :            :     sal_Bool        bNotes;
      72                 :            : 
      73                 :            :     sal_Bool        bBackward;          // Suche Rueckwaerts
      74                 :            :     sal_Bool        bPattern;           // Suche nach Vorlagen
      75                 :            :     sal_Bool        bContent;           // Suche im Inhalt
      76                 :            :     sal_Bool        bAsianOptions;      // use asian options?
      77                 :            : 
      78                 :            : public:
      79                 :            :     TYPEINFO();
      80                 :            : 
      81                 :            :     SvxSearchItem( const sal_uInt16 nId );
      82                 :            :     SvxSearchItem( const SvxSearchItem& rItem );
      83                 :            :     virtual ~SvxSearchItem();
      84                 :            : 
      85                 :            :     virtual bool             QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
      86                 :            :     virtual bool             PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
      87                 :            :     virtual int              operator == ( const SfxPoolItem& ) const;
      88                 :            :     virtual SfxPoolItem*     Clone( SfxItemPool *pPool = 0 ) const;
      89                 :            :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
      90                 :            :                                     SfxMapUnit eCoreMetric,
      91                 :            :                                     SfxMapUnit ePresMetric,
      92                 :            :                                     String &rText, const IntlWrapper * = 0 ) const;
      93                 :            : 
      94                 :            :     // ConfigItem
      95                 :            :     virtual void            Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames );
      96                 :            :     virtual void            Commit();
      97                 :            : 
      98                 :        584 :             sal_uInt16      GetCommand() const { return nCommand; }
      99                 :         64 :             void            SetCommand(sal_uInt16 nNewCommand) { nCommand = nNewCommand; }
     100                 :            : 
     101                 :            :     inline  const String    GetSearchString() const;
     102                 :            :     inline  void            SetSearchString(const String& rNewString);
     103                 :            : 
     104                 :            :     inline  const String    GetReplaceString() const;
     105                 :            :     inline  void            SetReplaceString(const String& rNewString);
     106                 :            : 
     107                 :            :     inline  sal_Bool        GetWordOnly() const;
     108                 :            :             void            SetWordOnly(sal_Bool bNewWordOnly);
     109                 :            : 
     110                 :            :     inline  sal_Bool        GetExact() const;
     111                 :            :             void            SetExact(sal_Bool bNewExact);
     112                 :            : 
     113                 :       1132 :             sal_Bool        GetBackward() const { return bBackward; }
     114                 :         35 :             void            SetBackward(sal_Bool bNewBackward) { bBackward = bNewBackward; }
     115                 :            : 
     116                 :            :     inline sal_Bool         GetSelection() const;
     117                 :            :             void            SetSelection(sal_Bool bNewSelection);
     118                 :            : 
     119                 :            :     inline  sal_Bool        GetRegExp() const;
     120                 :            :             void            SetRegExp( sal_Bool bVal );
     121                 :            : 
     122                 :        125 :             sal_Bool        GetPattern() const { return bPattern; }
     123                 :         35 :             void            SetPattern(sal_Bool bNewPattern) { bPattern = bNewPattern; }
     124                 :            : 
     125                 :            :             sal_Bool        IsContent() const { return bContent; }
     126                 :            :             void            SetContent( sal_Bool bNew ) { bContent = bNew; }
     127                 :            : 
     128                 :          0 :             SfxStyleFamily  GetFamily() const { return eFamily; }
     129                 :          0 :             void            SetFamily( SfxStyleFamily eNewFamily )
     130                 :          0 :                                 { eFamily = eNewFamily; }
     131                 :            : 
     132                 :        102 :             sal_Bool        GetRowDirection() const { return bRowDirection; }
     133                 :         34 :             void            SetRowDirection(sal_Bool bNewRowDirection) { bRowDirection = bNewRowDirection; }
     134                 :            : 
     135                 :          0 :             sal_Bool        IsAllTables() const { return bAllTables; }
     136                 :          0 :             void            SetAllTables(sal_Bool bNew) { bAllTables = bNew; }
     137                 :            : 
     138                 :        109 :             sal_Bool        IsSearchFiltered() const { return bSearchFiltered; }
     139                 :          0 :             void            SetSearchFiltered(sal_Bool b) { bSearchFiltered = b; }
     140                 :            : 
     141                 :        381 :             sal_uInt16      GetCellType() const { return nCellType; }
     142                 :         34 :             void            SetCellType(sal_uInt16 nNewCellType) { nCellType = nNewCellType; }
     143                 :            : 
     144                 :          0 :             sal_Bool        GetNotes() const { return bNotes; }
     145                 :          0 :             void            SetNotes(sal_Bool bNew) { bNotes = bNew; }
     146                 :            : 
     147                 :          0 :             sal_uInt16      GetAppFlag() const { return nAppFlag; }
     148                 :         25 :             void            SetAppFlag(sal_uInt16 nNewAppFlag) { nAppFlag = nNewAppFlag; }
     149                 :            : 
     150                 :            :     inline  sal_Bool        IsLevenshtein() const;
     151                 :            :             void            SetLevenshtein( sal_Bool bVal );
     152                 :            : 
     153                 :            :     inline  sal_Bool        IsLEVRelaxed() const;
     154                 :            :             void            SetLEVRelaxed(sal_Bool bSet);
     155                 :            : 
     156                 :            :     inline  sal_uInt16      GetLEVOther() const;
     157                 :            :     inline  void            SetLEVOther(sal_uInt16 nSet);
     158                 :            : 
     159                 :            :     inline  sal_uInt16      GetLEVShorter() const;
     160                 :            :     inline  void            SetLEVShorter(sal_uInt16 nSet);
     161                 :            : 
     162                 :            :     inline  sal_uInt16      GetLEVLonger() const;
     163                 :            :     inline  void            SetLEVLonger(sal_uInt16 nSet);
     164                 :            : 
     165                 :            :     inline const com::sun::star::util::SearchOptions &
     166                 :            :                 GetSearchOptions() const;
     167                 :            :     inline void SetSearchOptions( const com::sun::star::util::SearchOptions &rOpt );
     168                 :            : 
     169                 :            :     inline  sal_Int32       GetTransliterationFlags() const;
     170                 :            :             void            SetTransliterationFlags( sal_Int32 nFlags );
     171                 :            : 
     172                 :            :     inline  sal_Bool        IsMatchFullHalfWidthForms() const;
     173                 :            :     void                    SetMatchFullHalfWidthForms( sal_Bool bVal );
     174                 :            : 
     175                 :         64 :     inline  sal_Bool        IsUseAsianOptions() const           { return bAsianOptions; }
     176                 :         32 :     inline  void            SetUseAsianOptions( sal_Bool bVal ) { bAsianOptions = bVal; }
     177                 :            : };
     178                 :            : 
     179                 :          3 : const String SvxSearchItem::GetSearchString() const
     180                 :            : {
     181                 :          3 :     return aSearchOpt.searchString;
     182                 :            : }
     183                 :            : 
     184                 :         47 : void SvxSearchItem::SetSearchString(const String& rNewString)
     185                 :            : {
     186                 :         47 :     aSearchOpt.searchString = rNewString;
     187                 :         47 : }
     188                 :            : 
     189                 :         63 : const String SvxSearchItem::GetReplaceString() const
     190                 :            : {
     191                 :         63 :     return aSearchOpt.replaceString;
     192                 :            : }
     193                 :            : 
     194                 :         15 : void SvxSearchItem::SetReplaceString(const String& rNewString)
     195                 :            : {
     196                 :         15 :     aSearchOpt.replaceString = rNewString;
     197                 :         15 : }
     198                 :            : 
     199                 :        110 : sal_Bool SvxSearchItem::GetWordOnly() const
     200                 :            : {
     201                 :            :     return 0 != (aSearchOpt.searchFlag &
     202                 :        110 :                         com::sun::star::util::SearchFlags::NORM_WORD_ONLY);
     203                 :            : }
     204                 :            : 
     205                 :          7 : sal_Bool SvxSearchItem::GetExact() const
     206                 :            : {
     207                 :            :     return 0 == (aSearchOpt.transliterateFlags &
     208                 :          7 :                         com::sun::star::i18n::TransliterationModules_IGNORE_CASE);
     209                 :            : }
     210                 :            : 
     211                 :        985 : sal_Bool SvxSearchItem::GetSelection() const
     212                 :            : {
     213                 :            :     return 0 != (aSearchOpt.searchFlag &
     214                 :        985 :                         com::sun::star::util::SearchFlags::REG_NOT_BEGINOFLINE);
     215                 :            : }
     216                 :            : 
     217                 :         37 : sal_Bool SvxSearchItem::GetRegExp() const
     218                 :            : {
     219                 :         37 :     return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_REGEXP ;
     220                 :            : }
     221                 :            : 
     222                 :          7 : sal_Bool SvxSearchItem::IsLEVRelaxed() const
     223                 :            : {
     224                 :            :     return 0 != (aSearchOpt.searchFlag &
     225                 :          7 :                         com::sun::star::util::SearchFlags::LEV_RELAXED);
     226                 :            : }
     227                 :            : 
     228                 :          7 : sal_uInt16 SvxSearchItem::GetLEVOther() const
     229                 :            : {
     230                 :          7 :     return (sal_Int16) aSearchOpt.changedChars;
     231                 :            : }
     232                 :            : 
     233                 :         35 : void SvxSearchItem::SetLEVOther( sal_uInt16 nVal )
     234                 :            : {
     235                 :         35 :     aSearchOpt.changedChars = nVal;
     236                 :         35 : }
     237                 :            : 
     238                 :          7 : sal_uInt16 SvxSearchItem::GetLEVShorter() const
     239                 :            : {
     240                 :          7 :     return (sal_Int16) aSearchOpt.insertedChars;
     241                 :            : }
     242                 :            : 
     243                 :         35 : void SvxSearchItem::SetLEVShorter( sal_uInt16 nVal )
     244                 :            : {
     245                 :         35 :     aSearchOpt.insertedChars = nVal;
     246                 :         35 : }
     247                 :            : 
     248                 :          7 : sal_uInt16 SvxSearchItem::GetLEVLonger() const
     249                 :            : {
     250                 :          7 :     return (sal_Int16) aSearchOpt.deletedChars;
     251                 :            : }
     252                 :            : 
     253                 :         35 : void SvxSearchItem::SetLEVLonger( sal_uInt16 nVal )
     254                 :            : {
     255                 :         35 :     aSearchOpt.deletedChars = nVal;
     256                 :         35 : }
     257                 :            : 
     258                 :          7 : sal_Bool SvxSearchItem::IsLevenshtein() const
     259                 :            : {
     260                 :          7 :     return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_APPROXIMATE;
     261                 :            : }
     262                 :            : 
     263                 :         64 : const com::sun::star::util::SearchOptions & SvxSearchItem::GetSearchOptions() const
     264                 :            : {
     265                 :         64 :     return aSearchOpt;
     266                 :            : }
     267                 :            : 
     268                 :          0 : void SvxSearchItem::SetSearchOptions( const com::sun::star::util::SearchOptions &rOpt )
     269                 :            : {
     270                 :          0 :     aSearchOpt = rOpt;
     271                 :          0 : }
     272                 :            : 
     273                 :          0 : sal_Int32 SvxSearchItem::GetTransliterationFlags() const
     274                 :            : {
     275                 :          0 :     return aSearchOpt.transliterateFlags;
     276                 :            : }
     277                 :            : 
     278                 :          0 : sal_Bool SvxSearchItem::IsMatchFullHalfWidthForms() const
     279                 :            : {
     280                 :            :     return 0 != (aSearchOpt.transliterateFlags &
     281                 :          0 :                         com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH);
     282                 :            : }
     283                 :            : 
     284                 :            : #endif
     285                 :            : 
     286                 :            : 
     287                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10