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 : :
29 : : #include <unotools/charclass.hxx>
30 : : #include <editsh.hxx>
31 : : #include <fldbas.hxx>
32 : : #include <ndtxt.hxx> // GetCurFld
33 : : #include <doc.hxx>
34 : : #include <docary.hxx>
35 : : #include <fmtfld.hxx>
36 : : #include <txtfld.hxx>
37 : : #include <edimp.hxx>
38 : : #include <dbfld.hxx>
39 : : #include <expfld.hxx>
40 : : #include <flddat.hxx>
41 : : #include <swundo.hxx>
42 : : #include <dbmgr.hxx>
43 : : #include <swddetbl.hxx>
44 : : #include <hints.hxx>
45 : : #include <switerator.hxx>
46 : : #include <fieldhint.hxx>
47 : :
48 : : /*--------------------------------------------------------------------
49 : : Beschreibung: Feldtypen zu einer ResId zaehlen
50 : : wenn 0 alle zaehlen
51 : : --------------------------------------------------------------------*/
52 : :
53 : 0 : sal_uInt16 SwEditShell::GetFldTypeCount(sal_uInt16 nResId, sal_Bool bUsed ) const
54 : : {
55 : 0 : const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
56 : 0 : const sal_uInt16 nSize = pFldTypes->size();
57 : :
58 [ # # ]: 0 : if(nResId == USHRT_MAX)
59 : : {
60 [ # # ]: 0 : if(!bUsed)
61 : 0 : return nSize;
62 : : else
63 : : {
64 : 0 : sal_uInt16 nUsed = 0;
65 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < nSize; i++ )
66 : : {
67 [ # # ]: 0 : if(IsUsed(*(*pFldTypes)[i]))
68 : 0 : nUsed++;
69 : : }
70 : 0 : return nUsed;
71 : : }
72 : : }
73 : :
74 : : // Alle Typen mit gleicher ResId
75 : 0 : sal_uInt16 nIdx = 0;
76 [ # # ]: 0 : for(sal_uInt16 i = 0; i < nSize; ++i)
77 : : { // Gleiche ResId -> Index erhoehen
78 : 0 : SwFieldType& rFldType = *((*pFldTypes)[i]);
79 [ # # ]: 0 : if(rFldType.Which() == nResId)
80 : 0 : nIdx++;
81 : : }
82 : 0 : return nIdx;
83 : : }
84 : :
85 : : /*--------------------------------------------------------------------
86 : : Beschreibung: Feldtypen zu einer ResId finden
87 : : wenn 0 alle finden
88 : : --------------------------------------------------------------------*/
89 : 0 : SwFieldType* SwEditShell::GetFldType(sal_uInt16 nFld, sal_uInt16 nResId, sal_Bool bUsed ) const
90 : : {
91 : 0 : const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
92 : 0 : const sal_uInt16 nSize = pFldTypes->size();
93 : :
94 [ # # ][ # # ]: 0 : if(nResId == USHRT_MAX && nFld < nSize)
95 : : {
96 [ # # ]: 0 : if(!bUsed)
97 : 0 : return (*pFldTypes)[nFld];
98 : : else
99 : : {
100 : 0 : sal_uInt16 i, nUsed = 0;
101 [ # # ]: 0 : for ( i = 0; i < nSize; i++ )
102 : : {
103 [ # # ]: 0 : if(IsUsed(*(*pFldTypes)[i]))
104 : : {
105 [ # # ]: 0 : if(nUsed == nFld)
106 : 0 : break;
107 : 0 : nUsed++;
108 : : }
109 : : }
110 [ # # ]: 0 : return i < nSize ? (*pFldTypes)[i] : 0;
111 : : }
112 : : }
113 : :
114 : 0 : sal_uInt16 nIdx = 0;
115 [ # # ]: 0 : for(sal_uInt16 i = 0; i < nSize; ++i)
116 : : { // Gleiche ResId -> Index erhoehen
117 : 0 : SwFieldType* pFldType = (*pFldTypes)[i];
118 [ # # ]: 0 : if(pFldType->Which() == nResId)
119 : : {
120 [ # # ][ # # ]: 0 : if (!bUsed || IsUsed(*pFldType))
[ # # ]
121 : : {
122 [ # # ]: 0 : if(nIdx == nFld)
123 : 0 : return pFldType;
124 : 0 : nIdx++;
125 : : }
126 : : }
127 : : }
128 : 0 : return 0;
129 : : }
130 : :
131 : : /*--------------------------------------------------------------------
132 : : Beschreibung: Den ersten Typen mit ResId und Namen finden
133 : : --------------------------------------------------------------------*/
134 : 0 : SwFieldType* SwEditShell::GetFldType(sal_uInt16 nResId, const String& rName) const
135 : : {
136 : 0 : return GetDoc()->GetFldType( nResId, rName, false );
137 : : }
138 : :
139 : : /*--------------------------------------------------------------------
140 : : Beschreibung: Feldtypen loeschen
141 : : --------------------------------------------------------------------*/
142 : 0 : void SwEditShell::RemoveFldType(sal_uInt16 nFld, sal_uInt16 nResId)
143 : : {
144 [ # # ]: 0 : if( USHRT_MAX == nResId )
145 : : {
146 : 0 : GetDoc()->RemoveFldType(nFld);
147 : 0 : return;
148 : : }
149 : :
150 : 0 : const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
151 : 0 : const sal_uInt16 nSize = pFldTypes->size();
152 : 0 : sal_uInt16 nIdx = 0;
153 [ # # ]: 0 : for( sal_uInt16 i = 0; i < nSize; ++i )
154 : : // Gleiche ResId -> Index erhoehen
155 [ # # ][ # # ]: 0 : if( (*pFldTypes)[i]->Which() == nResId &&
[ # # ]
156 : : nIdx++ == nFld )
157 : : {
158 : 0 : GetDoc()->RemoveFldType( i );
159 : 0 : return;
160 : : }
161 : : }
162 : :
163 : : /*--------------------------------------------------------------------
164 : : Beschreibung: FieldType ueber Name loeschen
165 : : --------------------------------------------------------------------*/
166 : 0 : void SwEditShell::RemoveFldType(sal_uInt16 nResId, const String& rStr)
167 : : {
168 [ # # ]: 0 : const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
169 : 0 : const sal_uInt16 nSize = pFldTypes->size();
170 [ # # ]: 0 : const CharClass& rCC = GetAppCharClass();
171 : :
172 [ # # ][ # # ]: 0 : String aTmp( rCC.lowercase( rStr ));
[ # # ]
173 : :
174 [ # # ]: 0 : for(sal_uInt16 i = 0; i < nSize; ++i)
175 : : {
176 : : // Gleiche ResId -> Index erhoehen
177 [ # # ]: 0 : SwFieldType* pFldType = (*pFldTypes)[i];
178 [ # # ]: 0 : if( pFldType->Which() == nResId )
179 : : {
180 [ # # ][ # # ]: 0 : if( aTmp.Equals( rCC.lowercase( pFldType->GetName() ) ))
[ # # ][ # # ]
[ # # ][ # # ]
181 : : {
182 [ # # ]: 0 : GetDoc()->RemoveFldType(i);
183 : 0 : return;
184 : : }
185 : : }
186 [ # # ][ # # ]: 0 : }
187 : : }
188 : :
189 : :
190 : 0 : void SwEditShell::FieldToText( SwFieldType* pType )
191 : : {
192 [ # # ]: 0 : if( !pType->GetDepends() )
193 : 0 : return;
194 : :
195 [ # # ]: 0 : SET_CURR_SHELL( this );
196 [ # # ]: 0 : StartAllAction();
197 [ # # ]: 0 : StartUndo( UNDO_DELETE );
198 [ # # ]: 0 : Push();
199 [ # # ]: 0 : SwPaM* pPaM = GetCrsr();
200 : :
201 [ # # ]: 0 : SwFieldHint aHint( pPaM );
202 [ # # ]: 0 : SwClientIter aIter( *pType );
203 [ # # ][ # # ]: 0 : for ( SwClient* pClient = aIter.GoStart(); pClient; pClient = aIter++ )
[ # # ]
204 : : {
205 [ # # ]: 0 : pPaM->DeleteMark();
206 [ # # ]: 0 : pClient->SwClientNotifyCall( *pType, aHint );
207 : : }
208 : :
209 [ # # ]: 0 : Pop( sal_False );
210 [ # # ]: 0 : EndAllAction();
211 [ # # ][ # # ]: 0 : EndUndo( UNDO_DELETE );
[ # # ][ # # ]
212 : : }
213 : :
214 : : /*************************************************************************
215 : : |*
216 : : |* SwEditShell::Insert( SwField )
217 : : |*
218 : : |* Beschreibung an der Cursorposition ein Feld einfuegen
219 : : |* Quelle: vgl. SwEditShell::Insert( String )
220 : : |*
221 : : *************************************************************************/
222 : 0 : void SwEditShell::Insert2(SwField& rFld, const bool bForceExpandHints)
223 : : {
224 [ # # ]: 0 : SET_CURR_SHELL( this );
225 [ # # ]: 0 : StartAllAction();
226 [ # # ]: 0 : SwFmtFld aFld( rFld );
227 : :
228 : : const SetAttrMode nInsertFlags = (bForceExpandHints)
229 : : ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
230 [ # # ]: 0 : : nsSetAttrMode::SETATTR_DEFAULT;
231 : :
232 [ # # ][ # # ]: 0 : FOREACHPAM_START(this) // fuer jeden PaM
233 [ # # ]: 0 : bool bSuccess(GetDoc()->InsertPoolItem(*PCURCRSR, aFld, nInsertFlags));
234 : : OSL_ENSURE( bSuccess, "Doc->Insert(Field) failed");
235 : : (void) bSuccess;
236 : 0 : FOREACHPAM_END() // fuer jeden PaM
237 : :
238 [ # # ][ # # ]: 0 : EndAllAction();
[ # # ]
239 : 0 : }
240 : :
241 : : /*************************************************************************
242 : : |*
243 : : |* SwEditShell::GetCurFld()
244 : : |*
245 : : |* Beschreibung Stehen die PaMs auf Feldern ?
246 : : |* Quelle: edtfrm.cxx:
247 : : |*
248 : : *************************************************************************/
249 : :
250 : 38 : inline SwTxtFld *GetDocTxtFld( const SwPosition* pPos )
251 : : {
252 : 38 : SwTxtNode * const pNode = pPos->nNode.GetNode().GetTxtNode();
253 : : return (pNode)
254 : : ? static_cast<SwTxtFld*>( pNode->GetTxtAttrForCharAt(
255 : 38 : pPos->nContent.GetIndex(), RES_TXTATR_FIELD ))
256 [ + - ]: 76 : : 0;
257 : : }
258 : :
259 : 38 : SwField* SwEditShell::GetCurFld() const
260 : : {
261 : : // Wenn es keine Selektionen gibt, gilt der Wert der aktuellen
262 : : // Cursor-Position.
263 : :
264 : 38 : SwPaM* pCrsr = GetCrsr();
265 : 38 : SwTxtFld *pTxtFld = GetDocTxtFld( pCrsr->Start() );
266 : 38 : SwField *pCurFld = NULL;
267 : :
268 : : /* Field was only recognized if no selection was
269 : : present. Now it is recognized if either the cursor is in the
270 : : field or the selection spans exactly over the field. */
271 [ - + ][ - + : 38 : if( pTxtFld &&
# # # # #
# ]
272 : 0 : pCrsr->GetNext() == pCrsr &&
273 : 0 : pCrsr->Start()->nNode == pCrsr->End()->nNode &&
274 : 0 : (pCrsr->End()->nContent.GetIndex() -
275 : 0 : pCrsr->Start()->nContent.GetIndex()) <= 1)
276 : : {
277 : 0 : pCurFld = (SwField*)pTxtFld->GetFld().GetFld();
278 : : // TabellenFormel ? wandel internen in externen Namen um
279 [ # # ]: 0 : if( RES_TABLEFLD == pCurFld->GetTyp()->Which() )
280 : : {
281 : 0 : const SwTableNode* pTblNd = IsCrsrInTbl();
282 [ # # ]: 0 : ((SwTblField*)pCurFld)->PtrToBoxNm( pTblNd ? &pTblNd->GetTable() : 0 );
283 : : }
284 : :
285 : : }
286 : :
287 : : /* removed handling of multi-selections */
288 : :
289 : 38 : return pCurFld;
290 : : }
291 : :
292 : :
293 : : /*************************************************************************
294 : : |*
295 : : |* SwEditShell::UpdateFlds()
296 : : |*
297 : : |* Beschreibung Stehen die PaMs auf Feldern ?
298 : : |*
299 : : *************************************************************************/
300 : 0 : SwTxtFld* lcl_FindInputFld( SwDoc* pDoc, SwField& rFld )
301 : : {
302 : : // suche das Feld ueber seine Addresse. Muss fuer InputFelder in
303 : : // geschuetzten Feldern erfolgen
304 : 0 : SwTxtFld* pTFld = 0;
305 [ # # ]: 0 : if( RES_INPUTFLD == rFld.Which() || ( RES_SETEXPFLD == rFld.Which() &&
[ # # # # ]
[ # # ]
306 : 0 : ((SwSetExpField&)rFld).GetInputFlag() ) )
307 : : {
308 : : const SfxPoolItem* pItem;
309 : : sal_uInt32 n, nMaxItems =
310 : 0 : pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_FIELD );
311 [ # # ]: 0 : for( n = 0; n < nMaxItems; ++n )
312 [ # # ]: 0 : if( 0 != (pItem =
[ # # # # ]
313 : 0 : pDoc->GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) )
314 : 0 : && ((SwFmtFld*)pItem)->GetFld() == &rFld )
315 : : {
316 : 0 : pTFld = ((SwFmtFld*)pItem)->GetTxtFld();
317 : 0 : break;
318 : : }
319 : : }
320 : 0 : return pTFld;
321 : : }
322 : :
323 : 0 : void SwEditShell::UpdateFlds( SwField &rFld )
324 : : {
325 [ # # ]: 0 : SET_CURR_SHELL( this );
326 [ # # ]: 0 : StartAllAction();
327 : : {
328 : 0 : SwField *pCurFld = 0;
329 : :
330 : : // Wenn es keine Selektionen gibt, gilt der Wert der aktuellen
331 : : // Cursor-Position.
332 : 0 : SwMsgPoolItem* pMsgHnt = 0;
333 [ # # ]: 0 : SwRefMarkFldUpdate aRefMkHt( GetOut() );
334 : 0 : sal_uInt16 nFldWhich = rFld.GetTyp()->Which();
335 [ # # ]: 0 : if( RES_GETREFFLD == nFldWhich )
336 : 0 : pMsgHnt = &aRefMkHt;
337 : :
338 [ # # ]: 0 : SwPaM* pCrsr = GetCrsr();
339 : : SwTxtFld *pTxtFld;
340 : : SwFmtFld *pFmtFld;
341 : :
342 [ # # ][ # # ]: 0 : if ( pCrsr->GetNext() == pCrsr && !pCrsr->HasMark())
[ # # ]
343 : : {
344 [ # # ][ # # ]: 0 : pTxtFld = GetDocTxtFld(pCrsr->Start());
345 : :
346 [ # # ]: 0 : if (!pTxtFld) // #i30221#
347 [ # # ]: 0 : pTxtFld = lcl_FindInputFld( GetDoc(), rFld);
348 : :
349 [ # # ]: 0 : if (pTxtFld != 0)
350 [ # # ]: 0 : GetDoc()->UpdateFld(pTxtFld, rFld, pMsgHnt, sal_True);
351 : : }
352 : :
353 : : // bOkay (statt return wg. EndAllAction) wird sal_False,
354 : : // 1) wenn nur ein Pam mehr als ein Feld enthaelt oder
355 : : // 2) bei gemischten Feldtypen
356 : 0 : sal_Bool bOkay = sal_True;
357 : 0 : sal_Bool bTblSelBreak = sal_False;
358 : :
359 [ # # ]: 0 : SwMsgPoolItem aHint( RES_TXTATR_FIELD ); // Such-Hint
360 [ # # ][ # # ]: 0 : FOREACHPAM_START(this) // fuer jeden PaM
361 [ # # ][ # # ]: 0 : if( PCURCRSR->HasMark() && bOkay ) // ... mit Selektion
[ # # ]
362 : : {
363 : : // Kopie des PaM
364 [ # # ]: 0 : SwPaM aCurPam( *PCURCRSR->GetMark(), *PCURCRSR->GetPoint() );
365 [ # # ]: 0 : SwPaM aPam( *PCURCRSR->GetPoint() );
366 : :
367 [ # # ]: 0 : SwPosition *pCurStt = aCurPam.Start(), *pCurEnd =
368 [ # # ]: 0 : aCurPam.End();
369 : : /*
370 : : * Fuer den Fall, dass zwei aneinanderliegende Felder in einem
371 : : * PaM liegen, hangelt sich aPam portionsweise bis zum Ende.
372 : : * aCurPam wird dabei nach jeder Schleifenrunde verkuerzt.
373 : : * Wenn aCurPam vollstaendig durchsucht wurde, ist Start = End
374 : : * und die Schleife terminiert.
375 : : */
376 : :
377 : : // Suche nach SwTxtFld ...
378 [ # # # # ]: 0 : while( bOkay
[ # # ][ # # ]
379 : 0 : && pCurStt->nContent != pCurEnd->nContent
380 [ # # ]: 0 : && aPam.Find( aHint, sal_False, fnMoveForward, &aCurPam ) )
381 : : {
382 : : // wenn nur ein Pam mehr als ein Feld enthaelt ...
383 [ # # ][ # # ]: 0 : if( aPam.Start()->nContent != pCurStt->nContent )
384 : 0 : bOkay = sal_False;
385 : :
386 [ # # ][ # # ]: 0 : if( 0 != (pTxtFld = GetDocTxtFld( pCurStt )) )
387 : : {
388 : 0 : pFmtFld = (SwFmtFld*)&pTxtFld->GetFld();
389 : 0 : pCurFld = pFmtFld->GetFld();
390 : :
391 : : // bei gemischten Feldtypen
392 [ # # ]: 0 : if( pCurFld->GetTyp()->Which() !=
393 : 0 : rFld.GetTyp()->Which() )
394 : 0 : bOkay = sal_False;
395 : :
396 : 0 : bTblSelBreak = GetDoc()->UpdateFld(pTxtFld, rFld,
397 [ # # ]: 0 : pMsgHnt, sal_False);
398 : : }
399 : : // Der Suchbereich wird um den gefundenen Bereich
400 : : // verkuerzt.
401 [ # # ]: 0 : pCurStt->nContent++;
402 [ # # ][ # # ]: 0 : }
403 : : }
404 : :
405 [ # # ]: 0 : if( bTblSelBreak ) // wenn Tabellen Selektion und Tabellen-
406 : 0 : break; // Formel aktualisiert wurde -> beenden
407 : :
408 [ # # ][ # # ]: 0 : FOREACHPAM_END() // fuer jeden PaM
409 : : }
410 [ # # ]: 0 : GetDoc()->SetModified();
411 [ # # ][ # # ]: 0 : EndAllAction();
412 : 0 : }
413 : :
414 : : /*--------------------------------------------------
415 : : Liefert den logischen fuer die Datenbank zurueck
416 : : --------------------------------------------------*/
417 : :
418 : 0 : SwDBData SwEditShell::GetDBData() const
419 : : {
420 : 0 : return GetDoc()->GetDBData();
421 : : }
422 : :
423 : 4 : const SwDBData& SwEditShell::GetDBDesc() const
424 : : {
425 : 4 : return GetDoc()->GetDBDesc();
426 : : }
427 : :
428 : 0 : void SwEditShell::ChgDBData(const SwDBData& rNewData)
429 : : {
430 : 0 : GetDoc()->ChgDBData(rNewData);
431 : 0 : }
432 : :
433 : 0 : void SwEditShell::GetAllUsedDB( std::vector<String>& rDBNameList,
434 : : std::vector<String>* pAllDBNames )
435 : : {
436 : 0 : GetDoc()->GetAllUsedDB( rDBNameList, pAllDBNames );
437 : 0 : }
438 : :
439 : 0 : void SwEditShell::ChangeDBFields( const std::vector<String>& rOldNames,
440 : : const String& rNewName )
441 : : {
442 : 0 : GetDoc()->ChangeDBFields( rOldNames, rNewName );
443 : 0 : }
444 : :
445 : : /*--------------------------------------------------------------------
446 : : Beschreibung: Alle Expression-Felder erneuern
447 : : --------------------------------------------------------------------*/
448 : 0 : void SwEditShell::UpdateExpFlds(sal_Bool bCloseDB)
449 : : {
450 [ # # ]: 0 : SET_CURR_SHELL( this );
451 [ # # ]: 0 : StartAllAction();
452 [ # # ]: 0 : GetDoc()->UpdateExpFlds(NULL, true);
453 [ # # ]: 0 : if (bCloseDB)
454 [ # # ]: 0 : GetDoc()->GetNewDBMgr()->CloseAll(); // Alle Datenbankverbindungen dichtmachen
455 [ # # ][ # # ]: 0 : EndAllAction();
456 : 0 : }
457 : :
458 : 0 : SwNewDBMgr* SwEditShell::GetNewDBMgr() const
459 : : {
460 : 0 : return GetDoc()->GetNewDBMgr();
461 : : }
462 : :
463 : : /*--------------------------------------------------------------------
464 : : Beschreibung: Feldtypen einfuegen
465 : : --------------------------------------------------------------------*/
466 : 0 : SwFieldType* SwEditShell::InsertFldType(const SwFieldType& rFldType)
467 : : {
468 : 0 : return GetDoc()->InsertFldType(rFldType);
469 : : }
470 : :
471 : 0 : void SwEditShell::LockExpFlds()
472 : : {
473 : 0 : GetDoc()->LockExpFlds();
474 : 0 : }
475 : :
476 : 0 : void SwEditShell::UnlockExpFlds()
477 : : {
478 : 0 : GetDoc()->UnlockExpFlds();
479 : 0 : }
480 : :
481 : :
482 : 0 : void SwEditShell::SetFldUpdateFlags( SwFldUpdateFlags eFlags )
483 : : {
484 : 0 : getIDocumentSettingAccess()->setFieldUpdateFlags( eFlags );
485 : 0 : }
486 : :
487 : 0 : SwFldUpdateFlags SwEditShell::GetFldUpdateFlags(sal_Bool bDocSettings) const
488 : : {
489 : 0 : return getIDocumentSettingAccess()->getFieldUpdateFlags( !bDocSettings );
490 : : }
491 : :
492 : 0 : void SwEditShell::SetLabelDoc( sal_Bool bFlag )
493 : : {
494 : 0 : GetDoc()->set(IDocumentSettingAccess::LABEL_DOCUMENT, bFlag );
495 : 0 : }
496 : :
497 : 3673 : sal_Bool SwEditShell::IsLabelDoc() const
498 : : {
499 : 3673 : return getIDocumentSettingAccess()->get(IDocumentSettingAccess::LABEL_DOCUMENT);
500 : : }
501 : :
502 : 0 : void SwEditShell::ChangeAuthorityData(const SwAuthEntry* pNewData)
503 : : {
504 : 0 : GetDoc()->ChangeAuthorityData(pNewData);
505 : 0 : }
506 : :
507 : 0 : sal_Bool SwEditShell::IsAnyDatabaseFieldInDoc()const
508 : : {
509 : 0 : const SwFldTypes * pFldTypes = GetDoc()->GetFldTypes();
510 : 0 : const sal_uInt16 nSize = pFldTypes->size();
511 [ # # ]: 0 : for(sal_uInt16 i = 0; i < nSize; ++i)
512 : : {
513 : 0 : SwFieldType& rFldType = *((*pFldTypes)[i]);
514 : 0 : sal_uInt16 nWhich = rFldType.Which();
515 [ # # ]: 0 : if(IsUsed(rFldType))
516 : : {
517 [ # # ]: 0 : switch(nWhich)
518 : : {
519 : : case RES_DBFLD:
520 : : case RES_DBNEXTSETFLD:
521 : : case RES_DBNUMSETFLD:
522 : : case RES_DBSETNUMBERFLD:
523 : : {
524 [ # # ]: 0 : SwIterator<SwFmtFld,SwFieldType> aIter( rFldType );
525 [ # # ]: 0 : SwFmtFld* pFld = aIter.First();
526 [ # # ]: 0 : while(pFld)
527 : : {
528 [ # # ][ # # ]: 0 : if(pFld->IsFldInDoc())
529 : 0 : return sal_True;
530 [ # # ]: 0 : pFld = aIter.Next();
531 [ # # ][ # # ]: 0 : }
532 : : }
533 : 0 : break;
534 : : }
535 : : }
536 : : }
537 : 0 : return sal_False;
538 : : }
539 : :
540 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|