1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fldmgr.hxx,v $
10 * $Revision: 1.16.214.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #define _SVSTDARR_STRINGSDTOR
34 #include <svtools/svstdarr.hxx>
36 #include <tools/string.hxx>
38 #include "swtypes.hxx"
39 #include <com/sun/star/uno/Reference.h>
40 #include <com/sun/star/uno/Any.h>
42 namespace com
{namespace sun
{namespace star
{
47 class XNumberingTypeInfo
;
56 class SvNumberFormatter
;
58 /*--------------------------------------------------------------------
59 Beschreibung: Die Gruppen von Feldern
60 --------------------------------------------------------------------*/
78 /*--------------------------------------------------------------------
79 Beschreibung: Der FeldManager handelt das Einfuegen von Felder
81 --------------------------------------------------------------------*/
82 struct SwInsertFld_Data
90 sal_Unicode cSeparator
;
91 BOOL bIsAutomaticLanguage
;
92 ::com::sun::star::uno::Any aDBDataSource
;
93 ::com::sun::star::uno::Any aDBConnection
;
94 ::com::sun::star::uno::Any aDBColumn
;
95 Window
* pParent
; // parent dialog used for SwWrtShell::StartInputFldDlg()
97 SwInsertFld_Data(USHORT nType
, USHORT nSub
, const String
& rPar1
, const String
& rPar2
,
98 ULONG nFmtId
, SwWrtShell
* pShell
= NULL
, sal_Unicode cSep
= ' ', BOOL bIsAutoLanguage
= TRUE
) :
106 bIsAutomaticLanguage(bIsAutoLanguage
),
112 bIsAutomaticLanguage(TRUE
){}
116 class SW_DLLPUBLIC SwFldMgr
121 const SvxMacroItem
* pMacroItem
;
122 SwWrtShell
* pWrtShell
; // darf auch NULL sein!
133 SW_DLLPRIVATE USHORT
GetCurrLanguage() const;
135 com::sun::star::uno::Reference
<com::sun::star::container::XNameAccess
> xDBContext
;
136 com::sun::star::uno::Reference
<com::sun::star::text::XNumberingTypeInfo
> xNumberingInfo
;
137 SW_DLLPRIVATE
com::sun::star::uno::Reference
<com::sun::star::text::XNumberingTypeInfo
> GetNumberingInfo()const;
140 SwFldMgr(SwWrtShell
* pSh
= 0);
143 void SetWrtShell( SwWrtShell
* pShell
)
144 { pWrtShell
= pShell
; }
146 // Feld einfuegen ueber TypeId (TYP_ ...)
147 BOOL
InsertFld( const SwInsertFld_Data
& rData
);
149 // Direkt das aktuelle Feld aendern
150 void UpdateCurFld(ULONG nFormat
,
153 SwField
* _pField
= 0); // #111840#
155 inline const String
& GetCurFldPar1() const;
156 inline const String
& GetCurFldPar2() const;
157 inline ULONG
GetCurFldFmt() const;
159 // Ein Feld ermitteln
160 SwField
* GetCurFld();
162 void InsertFldType(SwFieldType
& rType
);
164 BOOL
ChooseMacro(const String
&rSelMacro
= aEmptyStr
);
165 void SetMacroPath(const String
& rPath
);
166 inline const String
& GetMacroPath() const { return (sMacroPath
); }
167 inline const String
& GetMacroName() const { return (sMacroName
); }
168 inline void SetMacroModule(SbModule
* pMod
) { pModule
= pMod
; }
170 // Vorheriger Naechster gleichen Typ
171 BOOL
GoNextPrev( BOOL bNext
= TRUE
, SwFieldType
* pTyp
= 0 );
172 BOOL
GoNext( SwFieldType
* pTyp
= 0 ) { return GoNextPrev( TRUE
, pTyp
); }
173 BOOL
GoPrev( SwFieldType
* pTyp
= 0 ) { return GoNextPrev( FALSE
, pTyp
); }
175 // Erfragen von Werten aus Datenbankfeldern (BASIC )
176 // String GetDataBaseFieldValue(const String &rDBName, const String &rFieldName, SwWrtShell* pSh);
177 BOOL
IsDBNumeric(const String
& rDBName
, const String
& rTblQryName
,
178 BOOL bIsTable
, const String
& rFldName
);
180 // RefMark mit Namen organisieren
181 BOOL
CanInsertRefMark( const String
& rStr
);
184 // Zugriff ueber ResId auf Feldtypen
185 USHORT
GetFldTypeCount(USHORT nResId
= USHRT_MAX
) const;
186 SwFieldType
* GetFldType(USHORT nResId
, USHORT nId
= 0) const;
187 SwFieldType
* GetFldType(USHORT nResId
, const String
& rName
) const;
189 void RemoveFldType(USHORT nResId
, const String
& rName
);
191 // Zugriff ueber TypeId aus dem Dialog
192 // Ids fuer einen Bereich von Feldern
193 const SwFldGroupRgn
& GetGroupRange(BOOL bHtmlMode
, USHORT nGrpId
) const;
194 USHORT
GetGroup(BOOL bHtmlMode
, USHORT nTypeId
, USHORT nSubType
= 0) const;
196 // TypeId des aktuellen Feldes
197 USHORT
GetCurTypeId() const;
199 // TypeId fuer einen konkrete Pos in der Liste
200 static USHORT
GetTypeId(USHORT nPos
);
201 // Name des Typen in der Liste der Felder
202 static const String
& GetTypeStr(USHORT nPos
);
204 // Pos in der Liste der Felder
205 static USHORT
GetPos(USHORT nTypeId
);
207 // Untertypen zu einem Typ
208 BOOL
GetSubTypes(USHORT nId
, SvStringsDtor
& rToFill
);
210 // Formate zu einem Typ
211 USHORT
GetFormatCount(USHORT nTypeId
, BOOL bIsText
, BOOL bHtmlMode
= FALSE
) const;
212 String
GetFormatStr(USHORT nTypeId
, ULONG nFormatId
) const;
213 USHORT
GetFormatId(USHORT nTypeId
, ULONG nFormatId
) const;
214 ULONG
GetDefaultFormat(USHORT nTypeId
, BOOL bIsText
, SvNumberFormatter
* pFormatter
, double* pVal
= 0L);
216 // Evaluierung der ExpressionFelder ausschalten fuer das Einfuegen
217 // vieler Expressionfelder (siehe Etiketten)
219 inline void SetEvalExpFlds(BOOL bEval
);
220 void EvalExpFlds(SwWrtShell
* pSh
= NULL
);
223 inline void SwFldMgr::SetEvalExpFlds(BOOL bEval
)
224 { bEvalExp
= bEval
; }
226 inline const String
& SwFldMgr::GetCurFldPar1() const
229 inline const String
& SwFldMgr::GetCurFldPar2() const
232 inline ULONG
SwFldMgr::GetCurFldFmt() const