LCOV - code coverage report
Current view: top level - sw/source/ui/inc - fldmgr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 15 0.0 %
Date: 2012-08-25 Functions: 0 10 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 4 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _FLDMGR_HXX
      29                 :            : #define _FLDMGR_HXX
      30                 :            : 
      31                 :            : #include <tools/string.hxx>
      32                 :            : #include "swdllapi.h"
      33                 :            : #include "swtypes.hxx"
      34                 :            : #include <com/sun/star/uno/Reference.h>
      35                 :            : #include <com/sun/star/uno/Any.h>
      36                 :            : #include <vector>
      37                 :            : 
      38                 :            : namespace com{namespace sun{namespace star{
      39                 :            :     namespace container{
      40                 :            :         class XNameAccess;
      41                 :            :     }
      42                 :            :     namespace text{
      43                 :            :         class XNumberingTypeInfo;
      44                 :            :     }
      45                 :            : }}}
      46                 :            : 
      47                 :            : class SwWrtShell;
      48                 :            : class SwField;
      49                 :            : class SwFieldType;
      50                 :            : class SwPaM;
      51                 :            : class SbModule;
      52                 :            : class SvxMacroItem;
      53                 :            : class SvNumberFormatter;
      54                 :            : class Window;
      55                 :            : 
      56                 :            : /*--------------------------------------------------------------------
      57                 :            :     Description: the groups of fields
      58                 :            :  --------------------------------------------------------------------*/
      59                 :            : enum SwFldGroups
      60                 :            : {
      61                 :            :     GRP_DOC,
      62                 :            :     GRP_FKT,
      63                 :            :     GRP_REF,
      64                 :            :     GRP_REG,
      65                 :            :     GRP_DB,
      66                 :            :     GRP_VAR
      67                 :            : };
      68                 :            : 
      69                 :            : struct SwFldGroupRgn
      70                 :            : {
      71                 :            :     sal_uInt16 nStart;
      72                 :            :     sal_uInt16 nEnd;
      73                 :            : };
      74                 :            : 
      75                 :            : /*--------------------------------------------------------------------
      76                 :            :     Description:  the field manager handles the insertation of fields
      77                 :            :                   with command strings
      78                 :            :  --------------------------------------------------------------------*/
      79         [ #  # ]:          0 : struct SwInsertFld_Data
      80                 :            : {
      81                 :            :     sal_uInt16 nTypeId;
      82                 :            :     sal_uInt16 nSubType;
      83                 :            :     const String sPar1;
      84                 :            :     const String sPar2;
      85                 :            :     sal_uLong nFormatId;
      86                 :            :     SwWrtShell* pSh;
      87                 :            :     sal_Unicode cSeparator;
      88                 :            :     sal_Bool bIsAutomaticLanguage;
      89                 :            :     ::com::sun::star::uno::Any aDBDataSource;
      90                 :            :     ::com::sun::star::uno::Any aDBConnection;
      91                 :            :     ::com::sun::star::uno::Any aDBColumn;
      92                 :            :     Window* pParent; // parent dialog used for SwWrtShell::StartInputFldDlg()
      93                 :            : 
      94                 :          0 :     SwInsertFld_Data(sal_uInt16 nType, sal_uInt16 nSub, const String& rPar1, const String& rPar2,
      95                 :            :                     sal_uLong nFmtId, SwWrtShell* pShell = NULL, sal_Unicode cSep = ' ', sal_Bool bIsAutoLanguage = sal_True) :
      96                 :            :         nTypeId(nType),
      97                 :            :         nSubType(nSub),
      98                 :            :         sPar1(rPar1),
      99                 :            :         sPar2(rPar2),
     100                 :            :         nFormatId(nFmtId),
     101                 :            :         pSh(pShell),
     102                 :            :         cSeparator(cSep),
     103                 :            :         bIsAutomaticLanguage(bIsAutoLanguage),
     104         [ #  # ]:          0 :         pParent(0) {}
     105                 :            : 
     106                 :            :     SwInsertFld_Data() :
     107                 :            :         pSh(0),
     108                 :            :         cSeparator(' '),
     109                 :            :         bIsAutomaticLanguage(sal_True){}
     110                 :            : 
     111                 :            : };
     112                 :            : 
     113                 :            : class SW_DLLPUBLIC SwFldMgr
     114                 :            : {
     115                 :            : private:
     116                 :            :     SwField*            pCurFld;
     117                 :            :     SbModule*           pModule;
     118                 :            :     const SvxMacroItem* pMacroItem;
     119                 :            :     SwWrtShell*         pWrtShell; // can be ZERO too!
     120                 :            :     String          aCurPar1;
     121                 :            :     String          aCurPar2;
     122                 :            :     String          sCurFrame;
     123                 :            : 
     124                 :            :     String          sMacroPath;
     125                 :            :     String          sMacroName;
     126                 :            : 
     127                 :            :     sal_uLong           nCurFmt;
     128                 :            :     sal_Bool            bEvalExp;
     129                 :            : 
     130                 :            :     SW_DLLPRIVATE sal_uInt16            GetCurrLanguage() const;
     131                 :            : 
     132                 :            :     com::sun::star::uno::Reference<com::sun::star::container::XNameAccess> xDBContext;
     133                 :            :     com::sun::star::uno::Reference<com::sun::star::text::XNumberingTypeInfo> xNumberingInfo;
     134                 :            :     SW_DLLPRIVATE com::sun::star::uno::Reference<com::sun::star::text::XNumberingTypeInfo> GetNumberingInfo()const;
     135                 :            : 
     136                 :            : public:
     137                 :            :     SwFldMgr(SwWrtShell* pSh = 0);
     138                 :            :     ~SwFldMgr();
     139                 :            : 
     140                 :          0 :     void                SetWrtShell( SwWrtShell* pShell )
     141                 :          0 :                         {   pWrtShell = pShell;     }
     142                 :            : 
     143                 :            :     // insert field using TypeID (TYP_ ...)
     144                 :            :     sal_Bool            InsertFld(  const SwInsertFld_Data& rData, SwPaM* pPam = 0 );
     145                 :            : 
     146                 :            :     // change the current field directly
     147                 :            :     void            UpdateCurFld(sal_uLong nFormat,
     148                 :            :                                  const String& rPar1,
     149                 :            :                                  const String& rPar2,
     150                 :            :                                  SwField * _pField = 0); // #111840#
     151                 :            : 
     152                 :            :     inline const String& GetCurFldPar1() const;
     153                 :            :     inline const String& GetCurFldPar2() const;
     154                 :            :     inline sal_uLong   GetCurFldFmt() const;
     155                 :            : 
     156                 :            :     // determine a field
     157                 :            :     SwField*        GetCurFld();
     158                 :            : 
     159                 :            :     void            InsertFldType(SwFieldType& rType);
     160                 :            : 
     161                 :            :     sal_Bool            ChooseMacro(const String &rSelMacro = aEmptyStr);
     162                 :            :     void            SetMacroPath(const String& rPath);
     163                 :          0 :     inline const String& GetMacroPath() const         { return (sMacroPath); }
     164                 :          0 :     inline const String& GetMacroName() const         { return (sMacroName); }
     165                 :            :     inline void     SetMacroModule(SbModule* pMod)    { pModule = pMod; }
     166                 :            : 
     167                 :            :     // previous and next of the same type
     168                 :            :     sal_Bool GoNextPrev( sal_Bool bNext = sal_True, SwFieldType* pTyp = 0 );
     169                 :          0 :     sal_Bool GoNext( SwFieldType* pTyp = 0 )    { return GoNextPrev( sal_True, pTyp ); }
     170                 :          0 :     sal_Bool GoPrev( SwFieldType* pTyp = 0 )    { return GoNextPrev( sal_False, pTyp ); }
     171                 :            : 
     172                 :            :     // query values from database fields (BASIC )
     173                 :            : //  String          GetDataBaseFieldValue(const String &rDBName, const String &rFieldName, SwWrtShell* pSh);
     174                 :            :     sal_Bool            IsDBNumeric(const String& rDBName, const String& rTblQryName,
     175                 :            :                                         sal_Bool bIsTable, const String& rFldName);
     176                 :            : 
     177                 :            :     // organise RefMark with names
     178                 :            :     sal_Bool            CanInsertRefMark( const String& rStr );
     179                 :            : 
     180                 :            : 
     181                 :            :     // access to field types via ResId
     182                 :            :     sal_uInt16          GetFldTypeCount(sal_uInt16 nResId = USHRT_MAX) const;
     183                 :            :     SwFieldType*    GetFldType(sal_uInt16 nResId, sal_uInt16 nId = 0) const;
     184                 :            :     SwFieldType*    GetFldType(sal_uInt16 nResId, const String& rName) const;
     185                 :            : 
     186                 :            :     void            RemoveFldType(sal_uInt16 nResId, const String& rName);
     187                 :            : 
     188                 :            :     // access via TypeId from the dialog
     189                 :            :     // Ids for a range of fields
     190                 :            :     const SwFldGroupRgn& GetGroupRange(sal_Bool bHtmlMode, sal_uInt16 nGrpId) const;
     191                 :            :     sal_uInt16          GetGroup(sal_Bool bHtmlMode, sal_uInt16 nTypeId, sal_uInt16 nSubType = 0) const;
     192                 :            : 
     193                 :            :     // the current field's TypeId
     194                 :            :     sal_uInt16          GetCurTypeId() const;
     195                 :            : 
     196                 :            :     // TypeId for a concrete position in the list
     197                 :            :     static sal_uInt16   GetTypeId(sal_uInt16 nPos);
     198                 :            :     // name of the type in the list of fields
     199                 :            :     static const String&  GetTypeStr(sal_uInt16 nPos);
     200                 :            : 
     201                 :            :     // Pos in the list of fields
     202                 :            :     static sal_uInt16   GetPos(sal_uInt16 nTypeId);
     203                 :            : 
     204                 :            :     // subtypes to a type
     205                 :            :     sal_Bool            GetSubTypes(sal_uInt16 nId, std::vector<rtl::OUString>& rToFill);
     206                 :            : 
     207                 :            :     // format to a type
     208                 :            :     sal_uInt16          GetFormatCount(sal_uInt16 nTypeId, sal_Bool bIsText, sal_Bool bHtmlMode = sal_False) const;
     209                 :            :     String          GetFormatStr(sal_uInt16 nTypeId, sal_uLong nFormatId) const;
     210                 :            :     sal_uInt16          GetFormatId(sal_uInt16 nTypeId, sal_uLong nFormatId) const;
     211                 :            :     sal_uLong           GetDefaultFormat(sal_uInt16 nTypeId, sal_Bool bIsText, SvNumberFormatter* pFormatter, double* pVal = 0L);
     212                 :            : 
     213                 :            :     // turn off evaluation of expression fields for insertation
     214                 :            :     // of many expressino fields (see labels)
     215                 :            :     //
     216                 :            :     inline void     SetEvalExpFlds(sal_Bool bEval);
     217                 :            :     void            EvalExpFlds(SwWrtShell* pSh = NULL);
     218                 :            : };
     219                 :            : 
     220                 :          0 : inline void SwFldMgr::SetEvalExpFlds(sal_Bool bEval)
     221                 :          0 :     { bEvalExp = bEval; }
     222                 :            : 
     223                 :          0 : inline const String& SwFldMgr::GetCurFldPar1() const
     224                 :          0 :     { return aCurPar1; }
     225                 :            : 
     226                 :          0 : inline const String& SwFldMgr::GetCurFldPar2() const
     227                 :          0 :     { return aCurPar2; }
     228                 :            : 
     229                 :            : inline sal_uLong SwFldMgr::GetCurFldFmt() const
     230                 :            :     { return nCurFmt; }
     231                 :            : 
     232                 :            : #endif
     233                 :            : 
     234                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10