LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/svl - srchitem.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 69 1.4 %
Date: 2012-12-27 Functions: 1 42 2.4 %
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 _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             :     bool            bRowDirection;      // Suchrichtung Zeilenweise/Spaltenweise
      67             :     bool            bAllTables;         // in alle Tabellen suchen
      68             :     bool            bSearchFiltered;      // search filtered cells.
      69             : 
      70             :     // Writer-spezifisch
      71             :     bool            bNotes;
      72             : 
      73             :     bool            bBackward;          // Suche Rueckwaerts
      74             :     bool            bPattern;           // Suche nach Vorlagen
      75             :     bool            bContent;           // Suche im Inhalt
      76             :     bool            bAsianOptions;      // use asian options?
      77             : 
      78             : public:
      79             :     TYPEINFO();
      80             : 
      81             :     explicit 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           0 :             sal_uInt16      GetCommand() const { return nCommand; }
      99           0 :             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  bool            GetWordOnly() const;
     108             :             void            SetWordOnly(bool bNewWordOnly);
     109             : 
     110             :     inline  bool            GetExact() const;
     111             :             void            SetExact(bool bNewExact);
     112             : 
     113           0 :             bool            GetBackward() const { return bBackward; }
     114           0 :             void            SetBackward(bool bNewBackward) { bBackward = bNewBackward; }
     115             : 
     116             :     inline  bool            GetSelection() const;
     117             :             void            SetSelection(bool bNewSelection);
     118             : 
     119             :     inline  bool            GetRegExp() const;
     120             :             void            SetRegExp( bool bVal );
     121             : 
     122           0 :             bool            GetPattern() const { return bPattern; }
     123           0 :             void            SetPattern(bool bNewPattern) { bPattern = bNewPattern; }
     124             : 
     125             :             bool            IsContent() const { return bContent; }
     126             :             void            SetContent( bool bNew ) { bContent = bNew; }
     127             : 
     128           0 :             SfxStyleFamily  GetFamily() const { return eFamily; }
     129           0 :             void            SetFamily( SfxStyleFamily eNewFamily )
     130           0 :                                 { eFamily = eNewFamily; }
     131             : 
     132           0 :             bool            GetRowDirection() const { return bRowDirection; }
     133           0 :             void            SetRowDirection(bool bNewRowDirection) { bRowDirection = bNewRowDirection; }
     134             : 
     135           0 :             bool            IsAllTables() const { return bAllTables; }
     136           0 :             void            SetAllTables(bool bNew) { bAllTables = bNew; }
     137             : 
     138           0 :             bool            IsSearchFiltered() const { return bSearchFiltered; }
     139           0 :             void            SetSearchFiltered(bool b) { bSearchFiltered = b; }
     140             : 
     141           0 :             sal_uInt16      GetCellType() const { return nCellType; }
     142           0 :             void            SetCellType(sal_uInt16 nNewCellType) { nCellType = nNewCellType; }
     143             : 
     144           0 :             bool            GetNotes() const { return bNotes; }
     145           0 :             void            SetNotes(bool bNew) { bNotes = bNew; }
     146             : 
     147           0 :             sal_uInt16      GetAppFlag() const { return nAppFlag; }
     148           3 :             void            SetAppFlag(sal_uInt16 nNewAppFlag) { nAppFlag = nNewAppFlag; }
     149             : 
     150             :     inline  bool            IsLevenshtein() const;
     151             :             void            SetLevenshtein( bool bVal );
     152             : 
     153             :     inline  bool            IsLEVRelaxed() const;
     154             :             void            SetLEVRelaxed(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  bool            IsMatchFullHalfWidthForms() const;
     173             :     void                    SetMatchFullHalfWidthForms( bool bVal );
     174             : 
     175           0 :     inline  bool            IsUseAsianOptions() const           { return bAsianOptions; }
     176           0 :     inline  void            SetUseAsianOptions( bool bVal ) { bAsianOptions = bVal; }
     177             : };
     178             : 
     179           0 : const String SvxSearchItem::GetSearchString() const
     180             : {
     181           0 :     return aSearchOpt.searchString;
     182             : }
     183             : 
     184           0 : void SvxSearchItem::SetSearchString(const String& rNewString)
     185             : {
     186           0 :     aSearchOpt.searchString = rNewString;
     187           0 : }
     188             : 
     189           0 : const String SvxSearchItem::GetReplaceString() const
     190             : {
     191           0 :     return aSearchOpt.replaceString;
     192             : }
     193             : 
     194           0 : void SvxSearchItem::SetReplaceString(const String& rNewString)
     195             : {
     196           0 :     aSearchOpt.replaceString = rNewString;
     197           0 : }
     198             : 
     199           0 : bool SvxSearchItem::GetWordOnly() const
     200             : {
     201             :     return 0 != (aSearchOpt.searchFlag &
     202           0 :                         com::sun::star::util::SearchFlags::NORM_WORD_ONLY);
     203             : }
     204             : 
     205           0 : bool SvxSearchItem::GetExact() const
     206             : {
     207             :     return 0 == (aSearchOpt.transliterateFlags &
     208           0 :                         com::sun::star::i18n::TransliterationModules_IGNORE_CASE);
     209             : }
     210             : 
     211           0 : bool SvxSearchItem::GetSelection() const
     212             : {
     213             :     return 0 != (aSearchOpt.searchFlag &
     214           0 :                         com::sun::star::util::SearchFlags::REG_NOT_BEGINOFLINE);
     215             : }
     216             : 
     217           0 : bool SvxSearchItem::GetRegExp() const
     218             : {
     219           0 :     return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_REGEXP ;
     220             : }
     221             : 
     222           0 : bool SvxSearchItem::IsLEVRelaxed() const
     223             : {
     224             :     return 0 != (aSearchOpt.searchFlag &
     225           0 :                         com::sun::star::util::SearchFlags::LEV_RELAXED);
     226             : }
     227             : 
     228           0 : sal_uInt16 SvxSearchItem::GetLEVOther() const
     229             : {
     230           0 :     return (sal_Int16) aSearchOpt.changedChars;
     231             : }
     232             : 
     233           0 : void SvxSearchItem::SetLEVOther( sal_uInt16 nVal )
     234             : {
     235           0 :     aSearchOpt.changedChars = nVal;
     236           0 : }
     237             : 
     238           0 : sal_uInt16 SvxSearchItem::GetLEVShorter() const
     239             : {
     240           0 :     return (sal_Int16) aSearchOpt.insertedChars;
     241             : }
     242             : 
     243           0 : void SvxSearchItem::SetLEVShorter( sal_uInt16 nVal )
     244             : {
     245           0 :     aSearchOpt.insertedChars = nVal;
     246           0 : }
     247             : 
     248           0 : sal_uInt16 SvxSearchItem::GetLEVLonger() const
     249             : {
     250           0 :     return (sal_Int16) aSearchOpt.deletedChars;
     251             : }
     252             : 
     253           0 : void SvxSearchItem::SetLEVLonger( sal_uInt16 nVal )
     254             : {
     255           0 :     aSearchOpt.deletedChars = nVal;
     256           0 : }
     257             : 
     258           0 : bool SvxSearchItem::IsLevenshtein() const
     259             : {
     260           0 :     return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_APPROXIMATE;
     261             : }
     262             : 
     263           0 : const com::sun::star::util::SearchOptions & SvxSearchItem::GetSearchOptions() const
     264             : {
     265           0 :     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 : 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