1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22 #ifndef _EDITSH_HXX
23 #define _EDITSH_HXX
24
25 #include <com/sun/star/text/HoriOrientation.hpp>
26 #include <com/sun/star/embed/XEmbeddedObject.hpp>
27 #include <tools/string.hxx>
28 #include <svl/svarray.hxx>
29 #include <vcl/font.hxx>
30 #include <editeng/swafopt.hxx>
31 #include "swdllapi.h"
32 #include <crsrsh.hxx> // fuer Basisklasse
33 #include <itabenum.hxx>
34 #include <swdbdata.hxx>
35 #include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
36 #include <com/sun/star/linguistic2/ProofreadingResult.hpp>
37 #include <fldupde.hxx>
38 #include <tblenum.hxx>
39 #include <IMark.hxx>
40
41 #include <vector>
42 #include <swundo.hxx>
43 #include <svtools/embedhlp.hxx>
44
45 class PolyPolygon;
46 class SwDoc;
47 class DateTime;
48 class CommandExtTextInputData;
49
50 class SvUShortsSort;
51 class SvNumberFormatter;
52 class SfxPoolItem;
53 class SfxItemSet;
54 class SvxAutoCorrect;
55
56 class SwField;
57 class SwFieldType;
58 class SwDDEFieldType;
59 class SwNewDBMgr;
60
61 struct SwDocStat;
62 class SvStringsDtor;
63 class SvStringsSort;
64 class SwAutoCompleteWord;
65
66 class SwFmtRefMark;
67
68 class SwNumRule; // Numerierung
69 //class SwNodeNum; // Numerierung
70
71 class SwTxtFmtColl;
72 class SwGrfNode;
73 class SwFlyFrmFmt;
74
75 class SwFrmFmt; // fuer GetTxtNodeFmts()
76 class SwCharFmt;
77 class SwExtTextInput;
78 class SwRootFrm; // fuer CTOR
79 class Graphic; // fuer GetGraphic
80 class GraphicObject; // fuer GetGraphicObj
81 class SwFmtINetFmt; // InsertURL
82 class SwTable;
83 class SwTextBlocks; // fuer GlossaryRW
84 class SwFmtFtn;
85 class SwSection;
86 class SwSectionData;
87 class SwSectionFmt;
88 class SwTOXMarks;
89 class SwTOXBase;
90 class SwTOXType;
91 class SwTableAutoFmt;
92 class SwPageDesc;
93 class SwTxtINetFmt;
94 class SwSeqFldList;
95 class SwGlblDocContent;
96 class SwGlblDocContents;
97 class SwRedline;
98 class SwRedlineData;
99 class SwFtnInfo;
100 class SwEndNoteInfo;
101 class SwLineNumberInfo;
102 class SwAuthEntry;
103 class SwRewriter;
104 struct SwConversionArgs;
105
106 namespace com { namespace sun { namespace star { namespace uno {
107 template < class > class Sequence;
108 }}}}
109
110 namespace svx{
111 struct SpellPortion;
112 typedef std::vector<SpellPortion> SpellPortions;
113 }
114
115 namespace sfx2{
116 class LinkManager;
117 }
118
119 namespace sw {
120 class UndoRedoContext;
121 }
122
123 #define GETSELTXT_PARABRK_TO_BLANK 0
124 #define GETSELTXT_PARABRK_KEEP 1
125 #define GETSELTXT_PARABRK_TO_ONLYCR 2
126
127 /****************************************************************
128 * zum Abfragen der INet-Attribute für den Navigator
129 ****************************************************************/
130 struct SwGetINetAttr
131 {
132 String sText;
133 const SwTxtINetFmt& rINetAttr;
134
SwGetINetAttrSwGetINetAttr135 SwGetINetAttr( const String& rTxt, const SwTxtINetFmt& rAttr )
136 : sText( rTxt ), rINetAttr( rAttr )
137 {}
138 };
139 SV_DECL_PTRARR_DEL( SwGetINetAttrs, SwGetINetAttr*, 0, 5 )
140
141 /****************************************************************
142 * Typen der Inhaltsformen
143 ****************************************************************/
144 #define CNT_TXT 0x0001
145 #define CNT_GRF 0x0002
146 #define CNT_OLE 0x0010
147 /* Teste einen sal_uInt16 auf eine bestimmte Inhaltsform */
148 #define CNT_HasTxt(USH) ((USH)&CNT_TXT)
149 #define CNT_HasGrf(USH) ((USH)&CNT_GRF)
150 #define CNT_HasOLE(USH) ((USH)&CNT_OLE)
151
152 class SW_DLLPUBLIC SwEditShell: public SwCrsrShell
153 {
154 static SvxSwAutoFmtFlags* pAutoFmtFlags;
155
156 // für die privaten Methoden DelRange und die vom AutoCorrect
157 friend class SwAutoFormat;
158 friend void _InitCore();
159 friend void _FinitCore();
160 // für die PamCorrAbs/-Rel Methoden
161 friend class SwUndo;
162
163 SW_DLLPRIVATE SfxPoolItem& _GetChrFmt( SfxPoolItem& ) const;
164
165 /*
166 * liefert einen Pointer auf einen SwGrfNode; dieser wird von
167 * GetGraphic() und GetGraphicSize() verwendet.
168 */
169 SW_DLLPRIVATE SwGrfNode *_GetGrfNode() const ;
170
171 SW_DLLPRIVATE void DeleteSel( SwPaM& rPam, sal_Bool* pUndo = 0 );
172
173 SW_DLLPRIVATE void _SetSectionAttr( SwSectionFmt& rSectFmt, const SfxItemSet& rSet );
174
175 using ViewShell::UpdateFlds;
176 using SwModify::GetInfo;
177
178 public:
179 // Editieren (immer auf allen selektierten Bereichen)
180 void Insert( sal_Unicode, sal_Bool bOnlyCurrCrsr = sal_False );
181 void Insert2( const String &, const bool bForceExpandHints = false );
182 void Overwrite( const String & );
183
184 // Ersetz einen selektierten Bereich in einem TextNode mit dem
185 // String. Ist fürs Suchen&Ersetzen gedacht.
186 // bRegExpRplc - ersetze Tabs (\\t) und setze den gefundenen String
187 // ein ( nicht \& )
188 // z.B.: Fnd: "zzz", Repl: "xx\t\\t..&..\&"
189 // --> "xx\t<Tab>..zzz..&"
190 sal_Bool Replace( const String& rNewStr, sal_Bool bRegExpRplc = sal_False );
191
192 // löscht den Inhalt aller Bereiche;
193 // werden ganze Nodes selektiert, werden die Nodes gelöscht
194 long Delete();
195
196 // remove a complete paragraph
197 sal_Bool DelFullPara();
198
199 // change text to Upper/Lower/Hiragana/Katagana/...
200 void TransliterateText( sal_uInt32 nType );
201
202 // count words in current selection
203 void CountWords( SwDocStat& rStat ) const;
204
205 // lösche den nicht sichtbaren Content aus dem Document, wie z.B.:
206 // versteckte Bereiche, versteckte Absätze
207 sal_Bool RemoveInvisibleContent();
208
209 // replace fields by text - mailmerge support
210 sal_Bool ConvertFieldsToText();
211 // set all numbering start points to a fixed value - mailmerge support
212 void SetNumberingRestart();
213
214 // embedded alle lokalen Links (Bereiche/Grafiken)
215 sal_uInt16 GetLinkUpdMode(sal_Bool bDocSettings = sal_False) const;
216 void SetLinkUpdMode( sal_uInt16 nMode );
217
218 // kopiere den Inhalt aller Bereiche an die akt. Cursor-Position
219 // in die angegebene Shell
220 long Copy( SwEditShell* pDestShell = 0 );
221
222 // fürs Kopieren übers ClipBoard:
223 // wird Tabelle in Tabelle kopiert, verschiebe aus dieser dann
224 // alle Cursor. Copy und Paste muss aufgrund der FlyFrames in
225 // der FEShell stehen!
226 // kopiere alle Selectionen und das Doc
227 //JP 21.10.96: und für die SVX-Autokorrektur
228 sal_Bool _CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pNdInsPos = 0 );
229
230 long SplitNode( sal_Bool bAutoFormat = sal_False, sal_Bool bCheckTableStart = sal_True );
231 sal_Bool AppendTxtNode();
232 void AutoFmtBySplitNode();
233
234 // ist der Cursor in einem INetAttribut, dann wird das komplett
235 // gelöscht; inclusive des Hinweistextes (wird beim Drag&Drop gebraucht)
236 sal_Bool DelINetAttrWithText();
237
238 // ist der Cursor am Ende einer Zeichenvorlage, an der das DontExpand-Flag
239 // noch nicht gesetzt ist, wird dies gesetzt ( => return sal_True; )
240 sal_Bool DontExpandFmt();
241
242 // Anwenden / Entfernen von Attributen
243 // liefert Attribute im angeforderten AttributSet. Wenn nicht eindeutig
244 // steht im Set ein DONT_CARE !!
245 // --> OD 2008-01-16 #newlistlevelattrs#
246 // Renaming method to <GetCurAttr(..)> indicating that the attributes at
247 // the current cursors are retrieved.
248 // Introduce 2nd optional parameter <bMergeIndentValuesOfNumRule>.
249 // If <bMergeIndentValuesOfNumRule> == sal_True, the indent attributes of
250 // the corresponding list level of an applied list style is merged into
251 // the requested item set as a LR-SPACE item, if corresponding node has not
252 // its own indent attributes and the position-and-space mode of the list
253 // level is SvxNumberFormat::LABEL_ALIGNMENT.
254 sal_Bool GetCurAttr( SfxItemSet& ,
255 const bool bMergeIndentValuesOfNumRule = false ) const;
256 // <--
257 void SetAttrItem( const SfxPoolItem&, sal_uInt16 nFlags = 0 );
258 void SetAttrSet( const SfxItemSet&, sal_uInt16 nFlags = 0 );
259
260 // Setze das Attribut als neues default Attribut im Dokument.
261 void SetDefault( const SfxPoolItem& );
262
263 // Erfrage das Default Attribut vom Dokument.
264 const SfxPoolItem& GetDefault( sal_uInt16 nFmtHint ) const;
265
266 void ResetAttr( const SvUShortsSort* pAttrs = 0 );
267 void GCAttr();
268
269 // returns the scripttype of the selection
270 sal_uInt16 GetScriptType() const;
271
272 // returns the language at current cursor position
273 sal_uInt16 GetCurLang() const;
274
275 // TABLE
276 sal_uInt16 GetTblFrmFmtCount( sal_Bool bUsed = sal_False ) const;
277 SwFrmFmt& GetTblFrmFmt(sal_uInt16 nFmt, sal_Bool bUsed = sal_False ) const;
278 String GetUniqueTblName() const;
279
280 // CHAR
281 sal_uInt16 GetCharFmtCount() const;
282 SwCharFmt& GetCharFmt(sal_uInt16 nFmt) const;
283 SwCharFmt* GetCurCharFmt() const;
284 void FillByEx(SwCharFmt*, sal_Bool bReset = sal_False);
285 SwCharFmt* MakeCharFmt( const String& rName, SwCharFmt* pDerivedFrom = 0 );
286 SwCharFmt* FindCharFmtByName( const String& rName ) const;
287
288
289 /* Formatcollections, neu */
290 /* GetXXXCount() liefert die Anzahl der im Dokument vorhandenen XXX
291 * GetXXX(i) liefert das i-te XXX (ERR_RAISE bei Überindizierung!)
292 * DelXXX(i) loescht das i-te XXX (ERR_RAISE bei Überindizierung!)
293 * GetCurXXX() liefert das am Cursor oder in den Bereichen
294 * geltende XXX (0, wenn nicht eindeutig!)
295 * SetXXX() setzt am Cursor oder in den Bereichen das XXX
296 * MakeXXX() macht ein XXX, abgeleitet vom pDerivedFrom
297 */
298
299 // TXT
300 SwTxtFmtColl& GetDfltTxtFmtColl() const;
301 sal_uInt16 GetTxtFmtCollCount() const;
302 SwTxtFmtColl& GetTxtFmtColl( sal_uInt16 nTxtFmtColl) const;
303 SwTxtFmtColl* GetCurTxtFmtColl() const;
304
305 // Add 2nd optional parameter <bResetListAttrs> - see also <SwDoc::SetTxtFmtColl(..)>
306 void SetTxtFmtColl( SwTxtFmtColl*,
307 const bool bResetListAttrs = false );
308
309 SwTxtFmtColl *MakeTxtFmtColl(const String &rFmtCollName,
310 SwTxtFmtColl *pDerivedFrom = 0);
311 void FillByEx(SwTxtFmtColl*, sal_Bool bReset = sal_False);
312 SwTxtFmtColl* FindTxtFmtCollByName( const String& rName ) const;
313
314 // Gebe die "Auto-Collection" mit der Id zurück. Existiert
315 // sie noch nicht, dann erzeuge sie
316 SwTxtFmtColl* GetTxtCollFromPool( sal_uInt16 nId );
317 // return das geforderte automatische Format - Basis-Klasse !
318 SwFmt* GetFmtFromPool( sal_uInt16 nId );
319 // returne die geforderte automatische Seiten-Vorlage
320 SwPageDesc* GetPageDescFromPool( sal_uInt16 nId );
321
322 // erfrage ob die Absatz-/Zeichen-/Rahmen-/Seiten - Vorlage benutzt wird
323 sal_Bool IsUsed( const SwModify& ) const;
324
325 // returne das geforderte automatische Format
GetFrmFmtFromPool(sal_uInt16 nId)326 SwFrmFmt* GetFrmFmtFromPool( sal_uInt16 nId )
327 { return (SwFrmFmt*)SwEditShell::GetFmtFromPool( nId ); }
GetCharFmtFromPool(sal_uInt16 nId)328 SwCharFmt* GetCharFmtFromPool( sal_uInt16 nId )
329 { return (SwCharFmt*)SwEditShell::GetFmtFromPool( nId ); }
330
331 // Felder
332 void Insert2(SwField&, const bool bForceExpandHints = false);
333
334 void UpdateFlds( SwField & ); // ein einzelnes Feld
335
336 sal_uInt16 GetFldTypeCount(sal_uInt16 nResId = USHRT_MAX, sal_Bool bUsed = sal_False) const;
337 SwFieldType* GetFldType(sal_uInt16 nId, sal_uInt16 nResId = USHRT_MAX, sal_Bool bUsed = sal_False) const;
338 SwFieldType* GetFldType(sal_uInt16 nResId, const String& rName) const;
339
340 void RemoveFldType(sal_uInt16 nId, sal_uInt16 nResId = USHRT_MAX);
341 void RemoveFldType(sal_uInt16 nResId, const String& rName);
342
343 void FieldToText( SwFieldType* pType );
344
345 void ChangeAuthorityData(const SwAuthEntry* pNewData);
346
347 // Datenbankinfo
348 SwDBData GetDBData() const;
349 const SwDBData& GetDBDesc() const;
350 void ChgDBData(const SwDBData& SwDBData);
351 void ChangeDBFields( const SvStringsDtor& rOldNames,
352 const String& rNewName );
353 void GetAllUsedDB( SvStringsDtor& rDBNameList,
354 SvStringsDtor* pAllDBNames = 0 );
355
356 sal_Bool IsAnyDatabaseFieldInDoc()const;
357 //check whether DB fields point to an available data source and returns it
358 sal_Bool IsFieldDataSourceAvailable(String& rUsedDataSource) const;
359 void UpdateExpFlds(sal_Bool bCloseDB = sal_False);// nur alle ExpressionFelder updaten
360 void SetFixFields( sal_Bool bOnlyTimeDate = sal_False,
361 const DateTime* pNewDateTime = 0 );
362 void LockExpFlds();
363 void UnlockExpFlds();
364
365 SwFldUpdateFlags GetFldUpdateFlags(sal_Bool bDocSettings = sal_False) const;
366 void SetFldUpdateFlags( SwFldUpdateFlags eFlags );
367
368 // für die Evaluierung der DBFelder (neuer DB-Manager)
369 SwNewDBMgr* GetNewDBMgr() const;
370
371 SwFieldType* InsertFldType(const SwFieldType &);
372
373 // Aenderungen am Dokument?
374 sal_Bool IsModified() const;
375 void SetModified();
376 void ResetModified();
377 void SetUndoNoResetModified();
378
379 // Dokument - Statistics
380 void UpdateDocStat( SwDocStat& rStat );
381
382 // Verzeichnismarke einfuegen löschen
383 void Insert(const SwTOXMark& rMark);
384 void DeleteTOXMark(SwTOXMark* pMark);
385
386 // Alle Markierungen am aktuellen SPoint ermitteln
387 sal_uInt16 GetCurTOXMarks(SwTOXMarks& rMarks) const ;
388
389 // Verzeichnis einfuegen, und bei Bedarf erneuern
390 void InsertTableOf(const SwTOXBase& rTOX,
391 const SfxItemSet* pSet = 0);
392 sal_Bool UpdateTableOf(const SwTOXBase& rTOX,
393 const SfxItemSet* pSet = 0);
394 const SwTOXBase* GetCurTOX() const;
395 const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, sal_Bool bCreate = sal_False );
396 void SetDefaultTOXBase(const SwTOXBase& rBase);
397
398 sal_Bool IsTOXBaseReadonly(const SwTOXBase& rTOXBase) const;
399 void SetTOXBaseReadonly(const SwTOXBase& rTOXBase, sal_Bool bReadonly);
400
401 sal_uInt16 GetTOXCount() const;
402 const SwTOXBase* GetTOX( sal_uInt16 nPos ) const;
403 sal_Bool DeleteTOX( const SwTOXBase& rTOXBase, sal_Bool bDelNodes = sal_False );
404
405 // nach einlesen einer Datei alle Verzeichnisse updaten
406 void SetUpdateTOX( sal_Bool bFlag = sal_True );
407 sal_Bool IsUpdateTOX() const;
408
409 // Verzeichnis-Typen verwalten
410 sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const;
411 const SwTOXType* GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const;
412 void InsertTOXType(const SwTOXType& rTyp);
413
414 //AutoMark file
415 const String& GetTOIAutoMarkURL() const;
416 void SetTOIAutoMarkURL(const String& rSet);
417 void ApplyAutoMark();
418
419 // Schlüssel fuer die Indexverwaltung
420 sal_uInt16 GetTOIKeys( SwTOIKeyType eTyp, SvStringsSort& rArr ) const;
421
422 void SetOutlineNumRule(const SwNumRule&);
423 const SwNumRule* GetOutlineNumRule() const;
424 // Gliederung - hoch-/runterstufen
425 sal_Bool OutlineUpDown( short nOffset = 1 );
426 // Gliederung - hoch-/runtermoven
427 sal_Bool MoveOutlinePara( short nOffset = 1);
428 // Outlines and SubOutline are protected ?
429 sal_Bool IsProtectedOutlinePara() const;
430
431
432 const SwNumRule* GetNumRuleAtCurrCrsrPos() const;
433
434 // Returns the numbering rule found at the paragraphs of the current selection,
435 // if all paragraphs of the current selection have the same or none numbering rule applied.
436 const SwNumRule* GetNumRuleAtCurrentSelection() const;
437
438 // Optional parameter <bResetIndentAttrs> (default value sal_False).
439 // If <bResetIndentAttrs> equals true, the indent attributes "before text"
440 // and "first line indent" are additionally reset at the current selection,
441 // if the list style makes use of the new list level attributes.
442 // Parameters <bCreateNewList> and <sContinuedListId>
443 // <bCreateNewList> indicates, if a new list is created by applying the given list style.
444 // If <bCreateNewList> equals false, <sContinuedListId> may contain the
445 // list Id of a list, which has to be continued by applying the given list style
446 void SetCurNumRule( const SwNumRule&,
447 const bool bCreateNewList /*= false*/,
448 const String sContinuedListId = String(),
449 const bool bResetIndentAttrs = false );
450
451 // Absätze ohne Numerierung, aber mit Einzügen
452 sal_Bool NoNum();
453 // Löschen, Splitten der Aufzählungsliste
454 void DelNumRules();
455 // Hoch-/Runterstufen
456 sal_Bool NumUpDown( sal_Bool bDown = sal_True );
457 // Hoch-/Runtermoven sowohl innerhalb als auch ausserhalb von Numerierungen
458 sal_Bool MoveParagraph( long nOffset = 1 );
459 sal_Bool MoveNumParas( sal_Bool bUpperLower, sal_Bool bUpperLeft );
460 // No-/Numerierung über Delete/Backspace ein/abschalten #115901#
461 sal_Bool NumOrNoNum( sal_Bool bDelete = sal_False, sal_Bool bChkStart = sal_True );
462 // -> #i23726#
463
464 void ChangeIndentOfAllListLevels( const short nDiff );
465 void SetIndent(short nIndent, const SwPosition & rPos);
466 bool IsFirstOfNumRuleAtCrsrPos() const;
467
468 sal_Bool IsNoNum( sal_Bool bChkStart = sal_True ) const;
469 // returne den Num-Level des Nodes, in dem sich der Point vom
470 // Cursor befindet. Return kann sein :
471 // - NO_NUMBERING, 0..MAXLEVEL-1, NO_NUMLEVEL .. NO_NUMLEVEL|MAXLEVEL-1
472 sal_uInt8 GetNumLevel() const;
473
474 // detect highest and lowest level to check moving of outline levels
475 void GetCurrentOutlineLevels( sal_uInt8& rUpper, sal_uInt8& rLower );
476
477
478 // get Outline level of current paragraph
479 int GetCurrentParaOutlineLevel( ) const;// #outlinelevel add by zhaojianwei
480
481 // -> i29560
482 sal_Bool HasNumber() const;
483 sal_Bool HasBullet() const;
484 // <- i29560
485
486 sal_Bool SelectionHasNumber() const;
487 sal_Bool SelectionHasBullet() const;
488
489 String GetUniqueNumRuleName( const String* pChkStr = 0, sal_Bool bAutoNum = sal_True ) const;
490 void ChgNumRuleFmts( const SwNumRule& rRule );
491 // setze und erfrage, ob an aktueller PointPos eine Numerierung mit
492 // dem StartFlag startet
493 void SetNumRuleStart( sal_Bool bFlag = sal_True );
494 sal_Bool IsNumRuleStart() const;
495 void SetNodeNumStart( sal_uInt16 nStt );
496 // --> OD 2008-02-29 #refactorlists#
497 sal_uInt16 GetNodeNumStart() const;
498 // <--
499 sal_Bool ReplaceNumRule( const String& rOldRule, const String& rNewRule );
500 // Searches for a text node with a numbering rule.
501 // --> OD 2008-03-18 #refactorlists# - add output parameter <sListId>
502 // in case a list style is found, <sListId> holds the list id, to which the
503 // text node belongs, which applies the found list style.
504 const SwNumRule * SearchNumRule(const bool bForward,
505 const bool bNum,
506 const bool bOutline,
507 int nNonEmptyAllowed,
508 String& sListId );
509 // <--
510
511 // Undo
512 // UndoHistory am Dokument pflegen
513 // bei Save, SaveAs, Create wird UndoHistory zurückgesetzt ???
514 void DoUndo( sal_Bool bOn = sal_True );
515 sal_Bool DoesUndo() const;
516 void DoGroupUndo( sal_Bool bUn = sal_True );
517 sal_Bool DoesGroupUndo() const;
518 void DelAllUndoObj();
519
520 // macht rückgängig:
521 // setzt Undoklammerung auf, liefert nUndoId der Klammerung
522 SwUndoId StartUndo( SwUndoId eUndoId = UNDO_EMPTY, const SwRewriter * pRewriter = 0 );
523 // schliesst Klammerung der nUndoId, nicht vom UI benutzt
524 SwUndoId EndUndo( SwUndoId eUndoId = UNDO_EMPTY, const SwRewriter * pRewriter = 0 );
525
526 bool GetLastUndoInfo(::rtl::OUString *const o_pStr,
527 SwUndoId *const o_pId) const;
528 bool GetFirstRedoInfo(::rtl::OUString *const o_pStr) const;
529 SwUndoId GetRepeatInfo(::rtl::OUString *const o_pStr) const;
530
531 /// is it forbidden to modify cursors via API calls?
532 bool CursorsLocked() const;
533 /// set selections to those contained in the UndoRedoContext
534 /// should only be called by sw::UndoManager!
535 void HandleUndoRedoContext(::sw::UndoRedoContext & rContext);
536
537 bool Undo(sal_uInt16 const nCount = 1);
538 bool Redo(sal_uInt16 const nCount = 1);
539 bool Repeat(sal_uInt16 const nCount);
540
541 // für alle Sichten auf dieses Dokument
542 void StartAllAction();
543 void EndAllAction();
544
545 //Damit Start-/EndActions aufgesetzt werden können.
546 void CalcLayout();
547
548 // Inhaltsform bestimmen, holen, liefert Type am CurCrsr->SPoint
549 sal_uInt16 GetCntType() const;
550 sal_Bool HasOtherCnt() const; // gibt es Rahmen, Fussnoten, ...
551
552 /* Anwenden der ViewOptions mit Start-/EndAction */
553 virtual void ApplyViewOptions( const SwViewOption &rOpt );
554
555 // Text innerhalb der Selektion erfragen
556 // Returnwert liefert sal_False, wenn der selektierte Bereich
557 // zu gross ist, um in den Stringpuffer kopiert zu werden
558 // oder andere Fehler auftreten
559 sal_Bool GetSelectedText( String &rBuf,
560 int nHndlParaBreak = GETSELTXT_PARABRK_TO_BLANK );
561
562 /*
563 * liefert eine Graphic, wenn CurCrsr->Point() auf einen
564 * SwGrfNode zeigt (und Mark nicht gesetzt ist oder auf die
565 * gleiche Graphic zeigt), sonst gibt's was auf die Finger
566 */
567 // --> OD 2005-02-09 #119353# - robust
568 const Graphic* GetGraphic( sal_Bool bWait = sal_True ) const;
569 const GraphicObject* GetGraphicObj() const;
570 // <--
571 sal_Bool IsGrfSwapOut( sal_Bool bOnlyLinked = sal_False ) const;
572 sal_uInt16 GetGraphicType() const;
573
574 const PolyPolygon *GetGraphicPolygon() const;
575 void SetGraphicPolygon( const PolyPolygon *pPoly );
576
577 // If there's an automatic, not manipulated polygon at the selected
578 // notxtnode, it has to be deleted, e.g. cause the object has changed.
579 void ClearAutomaticContour();
580
581 /*
582 * liefert die Grösse einer Graphic in Twips, wenn der Cursor
583 * auf einer Graphic steht; sal_Bool liefert sal_False, wenn s.o.
584 */
585 sal_Bool GetGrfSize(Size&) const;
586 /*
587 * liefert den Namen und den Filter einer Graphic, wenn der Cursor
588 * auf einer Graphic steht, sonst gibt's was auf die Finger!
589 * Ist ein String-Ptr != 0 dann returne den entsp. Namen
590 */
591 void GetGrfNms( String* pGrfName, String* pFltName,
592 const SwFlyFrmFmt* = 0 ) const;
593 /*
594 * erneutes Einlesen, falls Graphic nicht Ok ist. Die
595 * aktuelle wird durch die neue ersetzt.
596 */
597 void ReRead( const String& rGrfName, const String& rFltName,
598 const Graphic* pGraphic = 0,
599 const GraphicObject* pGrafObj = 0 );
600
601 // // alternativen Text einer Grafik/OLe-Objectes abfragen/setzen
602 // const String& GetAlternateText() const;
603 // void SetAlternateText( const String& rTxt );
604
605 //eindeutige Identifikation des Objektes (fuer ImageMapDlg)
606 void *GetIMapInventor() const;
607 // --> OD 2007-03-01 #i73788#
608 // remove default parameter, because method always called this default value
609 Graphic GetIMapGraphic() const; //liefert eine Graphic fuer alle Flys!
610 // <--
611 const SwFlyFrmFmt* FindFlyByName( const String& rName, sal_uInt8 nNdTyp = 0 ) const;
612
613 //liefert ein ClientObject, wenn CurCrsr->Point() auf einen
614 //SwOLENode zeigt (und Mark nicht gesetzt ist oder auf das
615 //gleiche ClientObject zeigt), sonst gibt's was auf die
616 //Finger.
617 svt::EmbeddedObjectRef& GetOLEObject() const;
618 //Gibt es ein OleObject mit diesem Namen (SwFmt)?
619 sal_Bool HasOLEObj( const String &rName ) const;
620
621 //Liefert den Pointer auf die Daten des Chart, indem sich der Crsr
622 //befindet.
623 void SetChartName( const String &rName );
624
625 //Updaten der Inhalte aller Charts zu der Tabelle mit dem angegeben Namen
626 void UpdateCharts( const String &rName );
627
628 // aktuelles Wort erfragen
629 String GetCurWord();
630
631 // Textbaustein aus dem Textbausteindokument in
632 // das aktuelle Dokument, Vorlagen nur wenn es nicht schon gibt
633 void InsertGlossary( SwTextBlocks& rGlossary, const String& );
634 // aktuelle Selektion zum Textbaustein machen und ins
635 // Textbausteindokument einfügen, einschliesslich Vorlagen
636 sal_uInt16 MakeGlossary( SwTextBlocks& rToFill, const String& rName,
637 const String& rShortName, sal_Bool bSaveRelFile = sal_False,
638 const String* pOnlyTxt=0 );
639 // speicher den gesamten Inhalt des Docs als Textbaustein
640 sal_uInt16 SaveGlossaryDoc( SwTextBlocks& rGlossary, const String& rName,
641 const String& rShortName,
642 sal_Bool bSaveRelFile = sal_False,
643 sal_Bool bOnlyTxt = sal_False );
644
645 // Linguistik
646 // Selektionen sichern
647 void HyphStart( SwDocPositions eStart, SwDocPositions eEnde );
648 // Selektionen wiederherstellen
649 void HyphEnd();
650 com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>
651 HyphContinue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
652 // zu trennendes Wort ignorieren
653 void HyphIgnore();
654
655 // zum Einfügen des SoftHyphens, Position ist der Offset
656 // innerhalb des getrennten Wortes.
657 void InsertSoftHyph( const xub_StrLen nHyphPos );
658
659 //Tabelle
660 const SwTable& InsertTable( const SwInsertTableOptions& rInsTblOpts, // ALL_TBL_INS_ATTR
661 sal_uInt16 nRows, sal_uInt16 nCols,
662 sal_Int16 eAdj = com::sun::star::text::HoriOrientation::FULL,
663 const SwTableAutoFmt* pTAFmt = 0 );
664
665 void InsertDDETable( const SwInsertTableOptions& rInsTblOpts, // HEADLINE_NO_BORDER
666 SwDDEFieldType* pDDEType,
667 sal_uInt16 nRows, sal_uInt16 nCols,
668 sal_Int16 eAdj = com::sun::star::text::HoriOrientation::FULL );
669
670 void UpdateTable();
671 void SetTableName( SwFrmFmt& rTblFmt, const String &rNewName );
672
673 SwFrmFmt *GetTableFmt();
674 sal_Bool TextToTable( const SwInsertTableOptions& rInsTblOpts, //ALL_TBL_INS_ATTR
675 sal_Unicode cCh,
676 sal_Int16 eAdj = com::sun::star::text::HoriOrientation::FULL,
677 const SwTableAutoFmt* pTAFmt = 0 );
678 sal_Bool TableToText( sal_Unicode cCh );
679 sal_Bool IsTextToTableAvailable() const;
680
681 sal_Bool GetTblBoxFormulaAttrs( SfxItemSet& rSet ) const;
682 void SetTblBoxFormulaAttrs( const SfxItemSet& rSet );
683
684 sal_Bool IsTableBoxTextFormat() const;
685 String GetTableBoxText() const;
686
687 // Change Modus erfragen/setzen
688 TblChgMode GetTblChgMode() const;
689 void SetTblChgMode( TblChgMode eMode );
690
691 // Tabelle an der Cursor Position aufsplitten
692 sal_Bool SplitTable( sal_uInt16 eMode );
693 // Tabellen verbinden
694 // CanMerge kann feststellen, ob Prev oder Next möglich ist. Wird
695 // der Pointer pChkNxtPrv übergeben, wird festgestellt in welche
696 // Richtung es möglich ist.
697 sal_Bool CanMergeTable( sal_Bool bWithPrev = sal_True, sal_Bool* pChkNxtPrv = 0 ) const;
698 sal_Bool MergeTable( sal_Bool bWithPrev = sal_True, sal_uInt16 nMode = 0 );
699 // setze das InsertDB als Tabelle Undo auf:
700 void AppendUndoForInsertFromDB( sal_Bool bIsTable );
701
702 /*
703 functions used for spell checking and text conversion
704 */
705
706 // Selektionen sichern
707 void SpellStart( SwDocPositions eStart, SwDocPositions eEnde,
708 SwDocPositions eCurr, SwConversionArgs *pConvArgs = 0 );
709 // Selektionen wiederherstellen
710 void SpellEnd( SwConversionArgs *pConvArgs = 0, bool bRestoreSelection = true );
711 ::com::sun::star::uno::Any SpellContinue(
712 sal_uInt16* pPageCnt, sal_uInt16* pPageSt,
713 SwConversionArgs *pConvArgs = 0 );
714
715 // spells on a sentence basis - the SpellPortions are needed
716 // returns false if no error could be found
717 bool SpellSentence(::svx::SpellPortions& rToFill, bool bIsGrammarCheck );
718 // make SpellIter start with the current sentence when called next time
719 void PutSpellingToSentenceStart();
720 // moves the continuation position to the end of the currently checked sentence
721 void MoveContinuationPosToEndOfCheckedSentence();
722 //applies a changed sentence
723 void ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions, bool bRecheck);
724
725
726 // check SwSpellIter data to see if the last sentence got grammar checked
727 bool HasLastSentenceGotGrammarChecked() const;
728 // Is text conversion active somewhere else?
729 sal_Bool HasConvIter() const;
730 // Is hyphenation active somewhere else?
731 sal_Bool HasHyphIter() const;
732
733 ::com::sun::star::uno::Reference<
734 ::com::sun::star::linguistic2::XSpellAlternatives >
735 GetCorrection( const Point* pPt, SwRect& rSelectRect );
736
737
738 bool GetGrammarCorrection( ::com::sun::star::linguistic2::ProofreadingResult /*out*/ &rResult,
739 sal_Int32 /*out*/ &rErrorPosInText,
740 sal_Int32 /*out*/ &rErrorIndexInResult,
741 ::com::sun::star::uno::Sequence< rtl::OUString > /*out*/ &rSuggestions,
742 const Point* pPt, SwRect& rSelectRect );
743
744 void IgnoreGrammarErrorAt( SwPaM& rErrorPosition );
745 void SetLinguRange( SwDocPositions eStart, SwDocPositions eEnde );
746
747 // returne zum Namen die im Doc gesetzte Referenz
748 const SwFmtRefMark* GetRefMark( const String& rName ) const;
749 // returne die Namen aller im Doc gesetzten Referenzen
750 // Ist der ArrayPointer 0 dann returne nur, ob im Doc. eine RefMark
751 // gesetzt ist
752 sal_uInt16 GetRefMarks( SvStringsDtor* = 0 ) const;
753
754 // rufe die Autokorrektur auf
755 void AutoCorrect( SvxAutoCorrect& rACorr, sal_Bool bInsertMode = sal_True,
756 sal_Unicode cChar = ' ' );
757 sal_Bool GetPrevAutoCorrWord( SvxAutoCorrect& rACorr, String& rWord );
758
759 // dann setze nach entsprechenden Regeln unsere Vorlagen
760 void AutoFormat( const SvxSwAutoFmtFlags* pAFlags = 0 );
761
762 static SvxSwAutoFmtFlags* GetAutoFmtFlags();
763 static void SetAutoFmtFlags(SvxSwAutoFmtFlags *);
764
765 // errechnet die Selektion
766 String Calculate();
767
768 sal_Bool InsertURL( const SwFmtINetFmt& rFmt, const String& rStr,
769 sal_Bool bKeepSelection = sal_False );
770 sal_uInt16 GetINetAttrs( SwGetINetAttrs& rArr );
771
772 //SS Für holen/ersetzen DropCap-Inhalt
773 String GetDropTxt( const sal_uInt16 nChars ) const;
774 void ReplaceDropTxt( const String &rStr );
775
776 // may an outline be moved or copied?
777 // Check whether it's in text body, not in table, and not read-only (move)
778 sal_Bool IsOutlineMovable( sal_uInt16 nIdx ) const;
779 sal_Bool IsOutlineCopyable( sal_uInt16 nIdx ) const;
780
781 sal_uInt16 GetLineCount( sal_Bool bActPos = sal_True );
782
783 // erfrage und setze den Fussnoten-Text/Nummer. Set.. auf akt. SSelection!
784 sal_Bool GetCurFtn( SwFmtFtn* pToFillFtn = 0 );
785 bool SetCurFtn( const SwFmtFtn& rFillFtn );
786 bool HasFtns( bool bEndNotes = false ) const;
787 //z.Zt nicht benötigt sal_uInt16 GetFtnCnt( sal_Bool bEndNotes = sal_False ) const;
788 // gebe Liste aller Fussnoten und deren Anfangstexte
789 sal_uInt16 GetSeqFtnList( SwSeqFldList& rList, bool bEndNotes = false );
790
791 SwSection const* InsertSection(
792 SwSectionData & rNewData, SfxItemSet const*const = 0 );
793 sal_Bool IsInsRegionAvailable() const;
794 const SwSection* GetCurrSection() const;
795 // liefert wie GetCurrSection() den aktuellen Bereich, allerdings geht diese Funktion
796 // über die Frames und erwischt dabei auch den Bereich, wenn der Cursor in einer
797 // Fussnote steht, deren Referenz in einem spaltigen Bereich steckt.
798 // Wenn man bOutOfTab setzt, wird der Bereich gesucht,
799 // der die Tabelle umfasst, nicht etwa ein innerer.
800 const SwSection* GetAnySection( sal_Bool bOutOfTab = sal_False, const Point* pPt = 0 ) const;
801
802 sal_uInt16 GetSectionFmtCount() const;
803 sal_uInt16 GetSectionFmtPos( const SwSectionFmt& ) const;
804 const SwSectionFmt& GetSectionFmt(sal_uInt16 nFmt) const;
805 void DelSectionFmt( sal_uInt16 nFmt );
806 void UpdateSection(sal_uInt16 const nSect, SwSectionData &,
807 SfxItemSet const*const = 0);
808 sal_Bool IsAnySectionInDoc( sal_Bool bChkReadOnly = sal_False,
809 sal_Bool bChkHidden = sal_False,
810 sal_Bool BChkTOX = sal_False ) const;
811
812 String GetUniqueSectionName( const String* pChkStr = 0 ) const;
813
814 // Attribute setzen
815 void SetSectionAttr(const SfxItemSet& rSet, SwSectionFmt* pSectFmt = 0);
816
817 // search inside the cursor selection for full selected sections.
818 // if any part of section in the selection return 0.
819 // if more than one in the selection return the count
820 sal_uInt16 GetFullSelectedSectionCount() const;
821
822 // special insert: Insert a new text node just before or after a section or
823 // table, if the cursor is positioned at the start/end of said
824 // section/table. The purpose of the method is to allow users to inert text
825 // at certain 'impossible' position, e.g. before a table at the document
826 // start or between to sections.
827 bool DoSpecialInsert();
828 bool CanSpecialInsert() const;
829
830 // Optimierung UI
831 void SetNewDoc(sal_Bool bNew = sal_True);
832
833 sfx2::LinkManager& GetLinkManager();
834 inline const sfx2::LinkManager& GetLinkManager() const;
835
836 // linken Rand über Objectleiste einstellen (ähnlich dem Stufen von
837 // Numerierungen), optional kann man "um" den Offset stufen oder "auf"
838 // die Position gestuft werden (bModulus = sal_True)
839 sal_Bool IsMoveLeftMargin( sal_Bool bRight = sal_True, sal_Bool bModulus = sal_True ) const;
840 void MoveLeftMargin( sal_Bool bRight = sal_True, sal_Bool bModulus = sal_True );
841
842 // Numberformatter vom Doc erfragen
843 SvNumberFormatter* GetNumberFormatter();
GetNumberFormatter() const844 const SvNumberFormatter* GetNumberFormatter() const
845 { return ((SwEditShell*)this)->GetNumberFormatter(); }
846
847 // Schnitstellen fürs GlobalDokument
848 sal_Bool IsGlobalDoc() const;
849 void SetGlblDocSaveLinks( sal_Bool bFlag = sal_True );
850 sal_Bool IsGlblDocSaveLinks() const;
851 sal_uInt16 GetGlobalDocContent( SwGlblDocContents& rArr ) const;
852 sal_Bool InsertGlobalDocContent( const SwGlblDocContent& rPos,
853 SwSectionData & rNew );
854 sal_Bool InsertGlobalDocContent( const SwGlblDocContent& rPos,
855 const SwTOXBase& rTOX );
856 sal_Bool InsertGlobalDocContent( const SwGlblDocContent& rPos );
857 sal_Bool DeleteGlobalDocContent( const SwGlblDocContents& rArr,
858 sal_uInt16 nPos );
859 sal_Bool MoveGlobalDocContent( const SwGlblDocContents& rArr ,
860 sal_uInt16 nFromPos, sal_uInt16 nToPos,
861 sal_uInt16 nNewPos );
862 sal_Bool GotoGlobalDocContent( const SwGlblDocContent& rPos );
863
864 // alles fürs Redlining
865 sal_uInt16 GetRedlineMode() const;
866 void SetRedlineMode( sal_uInt16 eMode );
867 sal_Bool IsRedlineOn() const;
868 sal_uInt16 GetRedlineCount() const;
869 const SwRedline& GetRedline( sal_uInt16 nPos ) const;
870 sal_Bool AcceptRedline( sal_uInt16 nPos );
871 sal_Bool RejectRedline( sal_uInt16 nPos );
872 // suche das Redline zu diesem Data und returne die Pos im Array
873 // USHRT_MAX wird returnt, falls nicht vorhanden
874 sal_uInt16 FindRedlineOfData( const SwRedlineData& ) const;
875
876 // Kommentar am Redline an der Position setzen
877 sal_Bool SetRedlineComment( const String& rS );
878 const SwRedline* GetCurrRedline() const;
879
880 // Redline Anzeigeattribute wurden geändert, Views updaten
881 void UpdateRedlineAttr();
882
883 // vergleiche zwei Dokument miteinander
884 long CompareDoc( const SwDoc& rDoc );
885 // merge zweier Dokumente
886 long MergeDoc( const SwDoc& rDoc );
887
888 // Dokumentglobale Fussnoteneigenschaften
889 const SwFtnInfo& GetFtnInfo() const;
890 void SetFtnInfo(const SwFtnInfo& rInfo);
891 const SwEndNoteInfo& GetEndNoteInfo() const;
892 void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
893
894 //Einstellungen für Zeilennummierung
895 const SwLineNumberInfo &GetLineNumberInfo() const;
896 void SetLineNumberInfo( const SwLineNumberInfo& rInfo);
897
898 // Etiketten: Bereiche synchronisieren
899 void SetLabelDoc( sal_Bool bFlag = sal_True );
900 sal_Bool IsLabelDoc() const;
901
902 // Schnittstelle für die TextInputDaten - (für die Texteingabe
903 // von japanischen/chinesischen Zeichen)
904 SwExtTextInput* CreateExtTextInput(LanguageType eInputLanguage);
905 String DeleteExtTextInput( SwExtTextInput* pDel = 0, sal_Bool bInsText = sal_True);
906 // SwExtTextInput* GetExtTextInput() const;
907 void SetExtTextInputData( const CommandExtTextInputData& );
908
909 // Schnistelle für den Zugriff auf die AutoComplete-Liste
910 static SwAutoCompleteWord& GetAutoCompleteWords();
911
912 // returns a scaling factor of selected text. Used for the rotated
913 // character attribut dialog.
914 sal_uInt16 GetScalingOfSelectedText() const;
915
916 // ctor/dtor
917 SwEditShell( SwDoc&, Window*, const SwViewOption *pOpt = 0 );
918 // verkleideter Copy-Constructor
919 SwEditShell( SwEditShell&, Window* );
920 virtual ~SwEditShell();
921
922 private:
923 // für METWARE:
924 // es wird nicht kopiert und nicht zugewiesen
925 SwEditShell(const SwEditShell &);
926 const SwEditShell &operator=(const SwEditShell &);
927 };
928
GetLinkManager() const929 inline const sfx2::LinkManager& SwEditShell::GetLinkManager() const
930 { return ((SwEditShell*)this)->GetLinkManager(); }
931
932 /*
933 * Klasse für den automatisierten Aufruf von Start- und
934 * EndAction();
935 */
936 class SwActContext {
937 SwEditShell *pSh;
938 public:
939 SwActContext(SwEditShell *pShell);
940 ~SwActContext();
941 };
942
943 #define ACT_CONTEXT(x) SwActContext _aActContext_(x)
944
945 /*
946 * Klasse für den automatisierten Aufruf von Start- und
947 * EndCrsrMove();
948 */
949 class SwMvContext {
950 SwEditShell *pSh;
951 public:
952 SwMvContext(SwEditShell *pShell );
953 ~SwMvContext();
954 };
955
956 #define MV_CONTEXT(x) SwMvContext _aMvContext_(x)
957
958 #endif
959
960 /* vim: set noet sw=4 ts=4: */
961