1 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 2 /* AbiWord 3 * Copyright (C) 1998-2000 AbiSource, Inc. 4 * Copyright (c) 2001,2002 Tomas Frydrych 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19 * 02110-1301 USA. 20 */ 21 #ifndef FV_VIEW_H 22 #define FV_VIEW_H 23 24 #ifdef HAVE_CONFIG_H 25 #include "config.h" 26 #endif 27 28 #include <string> 29 #include <vector> 30 31 #include "xap_Features.h" 32 #include "ut_types.h" 33 #include "xav_View.h" 34 #include "pt_Types.h" 35 #include "fp_types.h" 36 #include "fl_PartOfBlock.h" 37 #ifdef ENABLE_SPELL 38 #include "fl_Squiggles.h" 39 #endif 40 #include "ev_EditBits.h" 41 42 // have to include these as they are instantiated in the FV_View 43 // class definition 44 #include "fv_FrameEdit.h" 45 #include "fv_Selection.h" 46 #include "fv_InlineImage.h" 47 48 #ifdef TOOLKIT_GTK_ALL 49 #include "fv_UnixVisualDrag.h" 50 #include "fv_UnixFrameEdit.h" 51 #include "fv_UnixInlineImage.h" 52 #if !defined(TOOLKIT_GTK2) 53 #include "fv_UnixSelectionHandles.h" 54 #endif 55 #else 56 #include "fv_VisualDragText.h" 57 #endif 58 #include "fv_SelectionHandles.h" 59 60 #define AUTO_SCROLL_MSECS 100 61 #define STD_DOUBLE_BUFFERING_FOR_THIS_FUNCTION FV_ViewDoubleBuffering dblBuffObj(this, true, true); dblBuffObj.beginDoubleBuffering(); 62 63 class FL_DocLayout; 64 class FV_Caret_Listener; 65 66 class fl_DocSectionLayout; 67 class fl_HdrFtrSectionLayout; 68 class fl_DocListener; 69 class fl_BlockLayout; 70 class fl_AutoNum; 71 class fl_EndnoteLayout; 72 73 class fp_PageSize; 74 class fp_Page; 75 class fp_Run; 76 class fp_HyperlinkRun; 77 class fp_CellContainer; 78 79 class FG_Graphic; 80 81 class pf_Frag_Strux; 82 class PD_Document; 83 class PP_AttrProp; 84 class PP_RevisionAttr; 85 86 class GR_Graphics; 87 class FV_ViewDoubleBuffering; 88 struct dg_DrawArgs; 89 90 class UT_Worker; 91 class UT_Timer; 92 class UT_UTF8String; 93 class UT_StringPtrMap; // TODO remove. 94 95 class AP_TopRulerInfo; 96 class AP_LeftRulerInfo; 97 class AP_TopRuler; 98 class AP_LeftRuler; 99 100 class AP_Dialog_Annotation; 101 class AP_Dialog_SplitCells; 102 103 class XAP_App; 104 class XAP_Prefs; 105 106 class SpellChecker; 107 108 class CellLine; 109 110 typedef enum 111 { 112 hori_left, 113 hori_mid, 114 hori_right, 115 vert_above, 116 vert_mid, 117 vert_below 118 } AP_CellSplitType; 119 120 121 typedef enum _AP_JumpTarget 122 { 123 AP_JUMPTARGET_PAGE, // beginning of page 124 AP_JUMPTARGET_LINE, 125 AP_JUMPTARGET_BOOKMARK, 126 // AP_JUMPTARGET_PICTURE, TODO 127 AP_JUMPTARGET_XMLID, 128 AP_JUMPTARGET_ANNOTATION 129 } AP_JumpTarget; 130 131 struct fv_ChangeState 132 { 133 bool bUndo; 134 bool bRedo; 135 bool bDirty; 136 bool bSelection; 137 UT_uint32 iColumn; 138 fl_CellLayout * pCellLayout; 139 const gchar ** propsChar; 140 const gchar ** propsBlock; 141 const gchar ** propsSection; 142 }; 143 144 struct FV_DocCount 145 { 146 UT_uint32 word; 147 UT_uint32 para; 148 UT_uint32 ch_no; 149 UT_uint32 ch_sp; 150 UT_uint32 line; 151 UT_uint32 page; 152 // sometimes people want to have a word count without footnotes/endnotes included 153 UT_uint32 words_no_notes; 154 }; 155 156 class ABI_EXPORT fv_PropCache 157 { 158 public: 159 fv_PropCache(void); 160 ~fv_PropCache(void); 161 UT_uint32 getTick(void) const; 162 void setTick(UT_uint32 iTick); 163 fl_ContainerLayout * getCurrentCL(void) const; 164 void setCurrentCL(fl_ContainerLayout* pCL); 165 bool isValid(void) const; 166 const gchar ** getCopyOfProps(void) const; 167 void fillProps(UT_uint32 numProps, const gchar ** props); 168 void clearProps(void); 169 private: 170 UT_uint32 m_iTick; 171 UT_uint32 m_iNumProps; 172 gchar ** m_pszProps; 173 fl_ContainerLayout* m_pCurrentCL; 174 }; 175 176 enum FV_BIDI_Order 177 { 178 FV_Order_Visual = 0, 179 FV_Order_Logical_LTR = UT_BIDI_LTR, 180 FV_Order_Logical_RTL = UT_BIDI_RTL 181 }; 182 183 class ABI_EXPORT fv_CaretProps 184 { 185 public: 186 fv_CaretProps(FV_View * pView, PT_DocPosition InsPoint); 187 virtual ~fv_CaretProps(void); 188 PT_DocPosition m_iInsPoint; 189 UT_sint32 m_xPoint; 190 UT_sint32 m_yPoint; 191 UT_sint32 m_xPoint2; 192 UT_sint32 m_yPoint2; 193 bool m_bPointDirection; 194 bool m_bDefaultDirectionRtl; 195 bool m_bUseHebrewContextGlyphs; 196 bool m_bPointEOL; 197 UT_uint32 m_iPointHeight; 198 UT_RGBColor m_caretColor; 199 FV_Caret_Listener* m_PropCaretListner; 200 GR_Caret* m_pCaret; 201 UT_uint32 m_ListenerID; 202 FV_View* m_pView; 203 UT_sint32 m_iAuthorId; 204 std::string m_sCaretID; 205 }; 206 207 /** 208 * A RAII class for blocking popup bubbles that are used by 209 * annotations, RDF and maybe other parts of the system. To get a real 210 * one of these use FV_View::getBubbleBlocker() when this object is 211 * destroyed the counter is decremented for you. To explicitly 212 * decrement, simply assign your FV_View_BubbleBlocker to 213 * FV_View_BubbleBlocker(). 214 * 215 * While any real FV_View_BubbleBlocker objects are held, popup 216 * bubbles are suspended and not created. This is useful for making 217 * dialog windows where you might want to avoid the popup bubbles from 218 * overlapping the dialog window. 219 * 220 * Both AP_Dialog_Modeless and AP_Dialog_Modal obtain and release 221 * these BubbleBlocker objects for you automatically, so dialog 222 * subclasses of those do not have to worry about this at all. 223 */ 224 class ABI_EXPORT FV_View_BubbleBlocker 225 { 226 friend class FV_View; 227 FV_View* m_pView; 228 public: 229 FV_View_BubbleBlocker( FV_View* pView = 0 ); 230 ~FV_View_BubbleBlocker(); 231 FV_View_BubbleBlocker& operator=( const FV_View_BubbleBlocker& r ); 232 233 }; 234 235 class ABI_EXPORT FV_View : public AV_View 236 { 237 friend class fl_DocListener; 238 friend class fl_BlockLayout; 239 friend class FL_DocLayout; 240 friend class fl_Squiggles; 241 friend class fl_DocSectionLayout; 242 friend class GR_Caret; 243 friend class FV_FrameEdit; 244 friend class FV_VisualDragText; 245 friend class FV_VisualInlineImage; 246 friend class FV_Selection; 247 friend class CellLine; 248 friend class FV_View_BubbleBlocker; 249 friend class FV_ViewDoubleBuffering; 250 friend class FV_SelectionHandles; 251 public: 252 FV_View(XAP_App*, void*, FL_DocLayout*); 253 virtual ~FV_View(); 254 getGraphics(void)255 virtual inline GR_Graphics* getGraphics(void) const { return m_pG; } 256 void setGraphics(GR_Graphics *pG); 257 void replaceGraphics(GR_Graphics *pG); 258 getPoint(void)259 virtual inline PT_DocPosition getPoint(void) const { return m_iInsPoint; } 260 PT_DocPosition getSelectionAnchor(void) const; 261 PT_DocPosition getSelectionLeftAnchor(void) const; 262 PT_DocPosition getSelectionRightAnchor(void) const; 263 UT_uint32 getSelectionLength(void) const; 264 265 UT_sint32 getFrameMargin(void) const; 266 267 virtual void focusChange(AV_Focus focus); 268 virtual bool isActive(void) const; 269 270 virtual void setXScrollOffset(UT_sint32); 271 virtual void setYScrollOffset(UT_sint32); 272 virtual void cmdScroll(AV_ScrollCmd cmd, UT_uint32 iPos = 0); 273 274 virtual void cmdHyperlinkJump(UT_sint32 xPos, UT_sint32 yPos); 275 void cmdHyperlinkJump(PT_DocPosition pos); 276 void cmdHyperlinkCopyLocation(PT_DocPosition pos); 277 278 virtual void draw(const UT_Rect* pRect=static_cast<UT_Rect*>(NULL)); 279 virtual void drawSelectionBox(UT_Rect & box, bool drawHandles); 280 281 void setVisualSelectionEnabled(bool bActive); 282 private: 283 inline void _drawResizeHandle(UT_Rect & box); 284 void getCmdInsertRangeVariables( PT_DocPosition& posStart, 285 PT_DocPosition& posEnd, 286 fl_BlockLayout*& pBL1, 287 fl_BlockLayout*& pBL2 ); 288 void _updateSelectionHandles (void); 289 290 291 public: 292 const PP_AttrProp * getAttrPropForPoint() const; 293 294 virtual bool notifyListeners(const AV_ChangeMask hint); 295 296 virtual bool canDo(bool bUndo) const; 297 virtual UT_uint32 undoCount (bool bUndo) const; 298 virtual void cmdUndo(UT_uint32 count); 299 virtual void cmdRedo(UT_uint32 count); 300 virtual UT_Error cmdSave(void); 301 virtual UT_Error cmdSaveAs(const char * szFilename, int ieft); 302 virtual UT_Error cmdSaveAs(const char * szFilename, int ieft, bool cpy); 303 304 UT_Error cmdInsertField(const char* szName, const gchar ** extra_attrs = NULL, const gchar ** extra_props = NULL); 305 UT_Error cmdInsertBookmark(const char* szName); 306 UT_Error cmdDeleteBookmark(const char* szName); 307 UT_Error cmdInsertHyperlink(const char* szName, const char* szTitle = NULL); 308 UT_Error cmdInsertXMLID(const std::string& name); 309 UT_Error cmdDeleteXMLID(const std::string& name); 310 311 fp_Run * getHyperLinkRun(PT_DocPosition pos); 312 UT_Error cmdDeleteHyperlink(); 313 bool cmdInsertMathML(const char * szFileName, 314 PT_DocPosition pos); 315 bool cmdInsertEmbed(const UT_ByteBuf * pBuf,PT_DocPosition pos,const char * szMime,const char * szProps); 316 bool cmdUpdateEmbed(const UT_ByteBuf * pBuf, const char * szMime, const char * szProps); 317 bool cmdUpdateEmbed(fp_Run * pRun, const UT_ByteBuf * pBuf, const char * szMime, const char * szProps); 318 bool cmdDeleteEmbed(fp_Run * pRun); 319 320 bool cmdInsertLatexMath(UT_UTF8String & sLatex, 321 UT_UTF8String & sMath); 322 323 UT_Error cmdInsertTOC(void); 324 UT_Error cmdHyperlinkStatusBar(UT_sint32 xPos, UT_sint32 yPos); 325 326 UT_Error cmdInsertGraphic(FG_Graphic*); 327 UT_Error cmdInsertGraphicAtStrux(FG_Graphic* pFG, PT_DocPosition iPos, PTStruxType iStruxType); 328 virtual void toggleCase(ToggleCase c); 329 virtual void setPaperColor(const gchar * clr); 330 331 virtual bool isDocumentPresent(void) const; 332 virtual void cmdCopy(bool bToClipboard = true); 333 virtual void cmdCut(void); 334 virtual void cmdPaste(bool bHonorFormatting = true); 335 virtual void cmdPasteSelectionAt(UT_sint32 xPos, UT_sint32 yPos); 336 337 void pasteFromLocalTo(PT_DocPosition pos); 338 void _pasteFromLocalTo(PT_DocPosition pos); 339 void copyToLocal(PT_DocPosition pos1, PT_DocPosition pos2); 340 void copyTextToClipboard(const UT_UCS4String sIncoming, bool useClipboard=true); 341 342 virtual void getTopRulerInfo(AP_TopRulerInfo * pInfo); 343 virtual void getTopRulerInfo(PT_DocPosition pos, AP_TopRulerInfo * pInfo); 344 virtual void getLeftRulerInfo(AP_LeftRulerInfo * pInfo); 345 virtual void getLeftRulerInfo(PT_DocPosition pos, AP_LeftRulerInfo * pInfo); 346 virtual void setCursorWait(void); 347 virtual void clearCursorWait(void); 348 virtual void setCursorToContext(void); 349 EV_EditMouseContext getLastMouseContext(void); 350 void getMousePos(UT_sint32 * x, UT_sint32 * y); 351 352 virtual EV_EditMouseContext getMouseContext(UT_sint32 xPos, UT_sint32 yPos); 353 EV_EditMouseContext _getMouseContext(UT_sint32 xPos, UT_sint32 yPos); 354 virtual EV_EditMouseContext getInsertionPointContext(UT_sint32 * pxPos, UT_sint32 * pyPos); setPrevMouseContext(EV_EditMouseContext emc)355 void setPrevMouseContext(EV_EditMouseContext emc) 356 {m_prevMouseContext = emc;} 357 358 virtual void updateLayout(void); 359 virtual void rebuildLayout(void); 360 virtual void remeasureCharsWithoutRebuild(); 361 virtual void fontMetricsChange(); 362 virtual bool isSelectionEmpty(void) const; isSelectAll(void)363 bool isSelectAll(void) const 364 { return m_Selection.isSelectAll();} 365 virtual void cmdUnselectSelection(void); 366 void getDocumentRangeOfCurrentSelection(PD_DocumentRange * pdr) const; 367 PT_DocPosition mapDocPos( FV_DocPos dp ); 368 PT_DocPosition mapDocPosSimple( FV_DocPos dp ); 369 PT_DocPosition saveSelectedImage (const char * toFile ); 370 PT_DocPosition saveSelectedImage (const UT_ByteBuf ** outByteBuf); 371 PT_DocPosition getSelectedImage(const char **dataId) const; 372 PT_DocPosition getSelectedImage(const char **dataId,const fp_Run **pImRun) const; 373 fp_Run *getSelectedObject(void) const; 374 375 void getTextInCurrentBlock(UT_GrowBuf & buf) const; 376 void getTextInCurrentSection(UT_GrowBuf & buf) const; 377 void getTextInDocument(UT_GrowBuf & buf) const; 378 bool getLineBounds(PT_DocPosition pos, PT_DocPosition *start, PT_DocPosition *end); 379 UT_UCSChar getChar(PT_DocPosition pos, UT_sint32 *x = NULL, UT_sint32 *y = NULL, UT_uint32 *width = NULL, UT_uint32 *height = NULL); 380 381 // ---------------------- 382 FL_DocLayout* getLayout() const; 383 UT_uint32 getCurrentPageNumForStatusBar(void) const; 384 fp_Page* getCurrentPage(void) const; 385 fl_BlockLayout* getCurrentBlock(void) const; 386 387 void draw(int page, dg_DrawArgs* da); 388 389 390 // TODO some of these functions should move into protected 391 392 void getPageScreenOffsets(const fp_Page* pPage, UT_sint32& xoff, UT_sint32& yoff); 393 void getPageYOffset(fp_Page* pPage, UT_sint32& yoff)const; 394 virtual UT_sint32 getPageViewLeftMargin(void) const; 395 virtual UT_sint32 getPageViewTopMargin(void) const; 396 virtual UT_sint32 getPageViewSep(void) const; 397 398 bool setSectionFormat(const gchar * properties[]); 399 bool getSectionFormat(const gchar *** properties) const; 400 401 bool setBlockIndents(bool doLists, double indentChange, double page_size); 402 bool setCollapsedRange(PT_DocPosition posLow,PT_DocPosition posHigh, const gchar * properties[]); 403 bool setBlockFormat(const gchar * properties[]); 404 bool getBlockFormat(const gchar *** properties,bool bExpandStyles=true) const; 405 bool removeStruxAttrProps(PT_DocPosition ipos1, PT_DocPosition ipos2, PTStruxType iStrux,const gchar * attributes[] ,const gchar * properties[]); 406 bool isImageAtStrux(PT_DocPosition ipos1, PTStruxType iStrux); 407 408 bool processPageNumber(HdrFtrType hfType, const gchar ** atts); 409 410 #ifdef ENABLE_SPELL 411 bool isTextMisspelled()const ; 412 #endif 413 bool isTabListBehindPoint(UT_sint32 & iNumToDelete) const; 414 bool isTabListAheadPoint(void) const; 415 void processSelectedBlocks(FL_ListType listType); 416 void getBlocksInSelection(UT_GenericVector<fl_BlockLayout*> * vBlock, bool bAllBlocks = true) const; 417 UT_sint32 getNumColumnsInSelection(void) const; 418 UT_sint32 getNumRowsInSelection(void) const; 419 void getAllBlocksInList(UT_GenericVector<fl_BlockLayout *> * vBlock) const; 420 bool isPointBeforeListLabel(void) const; 421 bool isCurrentListBlockEmpty(void) const; 422 bool cmdStartList(const gchar * style); 423 bool cmdStopList(void); 424 void changeListStyle(fl_AutoNum* pAuto, 425 FL_ListType lType, 426 UT_uint32 startv, 427 const gchar* pszDelim, 428 const gchar* pszDecimal, 429 const gchar* pszFormat, 430 float Aligm, 431 float Indent); 432 433 void setDontChangeInsPoint(void); 434 void allowChangeInsPoint(void); 435 436 bool getAttributes(const PP_AttrProp ** ppSpanAP, const PP_AttrProp ** ppBlockAP = NULL, PT_DocPosition posStart = 0) const; 437 438 /* Experimental, for the moment; use with caution. - fjf, 24th Oct. '04 439 */ 440 // - begin 441 bool getAllAttrProp(const PP_AttrProp *& pSpanAP, const PP_AttrProp *& pBlockAP, const PP_AttrProp *& pSectionAP, const PP_AttrProp *& pDocAP) const; 442 bool queryCharFormat(const gchar * szProperty, UT_UTF8String & szValue, bool & bExplicitlyDefined, bool & bMixedSelection) const; 443 bool queryCharFormat(const gchar * szProperty, UT_UTF8String & szValue, bool & bExplicitlyDefined, PT_DocPosition position) const; 444 // - end 445 446 bool setCharFormat(const gchar * properties[], const gchar * attribs[] = NULL); 447 bool setCharFormat(const std::vector<std::string>& properties); 448 bool resetCharFormat(bool bAll); 449 bool getCharFormat(const gchar *** properties,bool bExpandStyles=true) const; 450 bool getCharFormat(const gchar *** properties,bool bExpandStyles, PT_DocPosition posStart) const; 451 fl_BlockLayout * getBlockFromSDH(pf_Frag_Strux* sdh); 452 bool setStyle(const gchar * style, bool bDontGeneralUpdate=false); 453 bool setStyleAtPos(const gchar * style, PT_DocPosition posStart, PT_DocPosition posEnd, bool bDontGeneralUpdate=false); 454 bool isNumberedHeadingHere(fl_BlockLayout * pBlock) const; 455 bool getStyle(const gchar ** style) const; 456 bool appendStyle(const gchar ** style); 457 458 UT_uint32 getCurrentPageNumber(void) const; 459 460 bool getEditableBounds(bool bEnd, PT_DocPosition & docPos, bool bOverride=false)const; 461 462 bool isParaBreakNeededAtPos(PT_DocPosition pos) const; 463 bool insertParaBreakIfNeededAtPos(PT_DocPosition pos); 464 void insertParagraphBreak(void); 465 void insertParagraphBreaknoListUpdate(void); 466 void insertSectionBreak( BreakSectionType type); 467 void insertSectionBreak(void); 468 void insertSymbol(UT_UCSChar c, const gchar * symfont); 469 470 // ---------------------- 471 bool isLeftMargin(UT_sint32 xPos, UT_sint32 yPos) const; 472 void selectRange( PT_DocPosition start, PT_DocPosition end ); 473 void selectRange( const std::pair< PT_DocPosition, PT_DocPosition >& range ); 474 void cmdSelect(UT_sint32 xPos, UT_sint32 yPos, FV_DocPos dpBeg, FV_DocPos dpEnd); 475 void cmdSelectTOC(UT_sint32 xPos, UT_sint32 yPos); 476 bool isTOCSelected(void) const; 477 bool setTOCProps(PT_DocPosition pos, const char * szProps); 478 479 bool cmdSelectNoNotify(PT_DocPosition dpBeg, PT_DocPosition dpEnd); 480 void cmdSelect(PT_DocPosition dpBeg, PT_DocPosition dpEnd); 481 void cmdSelect( const std::pair< PT_DocPosition, PT_DocPosition >& range ); 482 void cmdCharMotion(bool bForward, UT_uint32 count); 483 bool cmdCharInsert(const UT_UCSChar * text, UT_uint32 count, bool bForce = false); 484 bool cmdCharInsert(const std::string& s, bool bForce = false); 485 void cmdCharDelete(bool bForward, UT_uint32 count); 486 void delTo(FV_DocPos dp); 487 void getSelectionText(UT_UCS4Char *& text) const; 488 489 UT_UCSChar * getTextBetweenPos(PT_DocPosition pos1, PT_DocPosition pos2) const; getInsPoint()490 inline PT_DocPosition getInsPoint () const { return m_iInsPoint; } 491 void warpInsPtToXY(UT_sint32 xPos, UT_sint32 yPos, bool bClick); 492 void moveInsPtTo(FV_DocPos dp, bool bClearSelection = true); 493 void moveInsPtTo(PT_DocPosition dp); 494 void warpInsPtNextPrevPage(bool bNext); 495 void warpInsPtNextPrevLine(bool bNext); 496 void warpInsPtNextPrevScreen(bool bNext); 497 void extSelHorizontal(bool bForward, UT_uint32 count); 498 void extSelToXY(UT_sint32 xPos, UT_sint32 yPos, bool bDrag); 499 void extSelToXYword(UT_sint32 xPos, UT_sint32 yPos, bool bDrag); 500 void extSelTo(FV_DocPos dp); 501 void swapSelectionOrientation(void); 502 503 #ifdef ENABLE_SPELL 504 SpellChecker * getDictForSelection () const; 505 #endif 506 void extSelNextPrevLine(bool bNext); 507 void extSelNextPrevPage(bool bNext); 508 void extSelNextPrevScreen(bool bNext); 509 void endDrag(UT_sint32 xPos, UT_sint32 yPos); 510 511 void endDragSelection(UT_sint32 xPos, UT_sint32 yPos); 512 513 PT_DocPosition getDocPositionFromXY(UT_sint32 xpos, UT_sint32 ypos, bool bNotFrames = false); 514 PT_DocPosition getDocPositionFromLastXY(void); 515 getBlockAtPosition(PT_DocPosition pos)516 fl_BlockLayout* getBlockAtPosition(PT_DocPosition pos) const {return _findBlockAtPosition(pos);}; 517 virtual void updateScreen(bool bDirtyRunsOnly=true); 518 bool isInDocSection(PT_DocPosition pos = 0) const; 519 520 //--------- 521 //Visual Drag stuff 522 // 523 void cutVisualText(UT_sint32 x, UT_sint32 y); 524 void copyVisualText(UT_sint32 x, UT_sint32 y); 525 void dragVisualText(UT_sint32 x, UT_sint32 y); 526 void pasteVisualText(UT_sint32 x, UT_sint32 y); 527 void btn0VisualDrag(UT_sint32 x, UT_sint32 y); getVisualText(void)528 const FV_VisualDragText * getVisualText(void) const 529 { return &m_VisualDragText;} getVisualText(void)530 FV_VisualDragText * getVisualText(void) 531 { return &m_VisualDragText;} 532 const UT_ByteBuf * getLocalBuf(void) const; 533 534 //--------- 535 //Visual Inline Image Drag stuff 536 // 537 void btn0InlineImage(UT_sint32 x, UT_sint32 y); 538 void btn1InlineImage(UT_sint32 x, UT_sint32 y); 539 void btn1CopyImage(UT_sint32 x, UT_sint32 y); 540 void dragInlineImage(UT_sint32 x, UT_sint32 y); 541 void releaseInlineImage(UT_sint32 x, UT_sint32 y); 542 543 // ------- 544 // Frame stuff 545 // 546 FV_FrameEdit * getFrameEdit(void); 547 void btn0Frame(UT_sint32 x, UT_sint32 y); 548 void btn1Frame(UT_sint32 x, UT_sint32 y); 549 void dragFrame(UT_sint32 x, UT_sint32 y); 550 void releaseFrame(UT_sint32 x, UT_sint32 y); 551 bool isInFrame(PT_DocPosition pos) const; 552 void deleteFrame(void); 553 void copyFrame(bool b_keepFrame = true); 554 void selectFrame(void); 555 bool isFrameSelected(void) const; 556 void activateFrame(void); 557 fl_FrameLayout * getFrameLayout(PT_DocPosition pos) const; 558 fl_FrameLayout * getFrameLayout(void) const; 559 void setFrameFormat(const gchar ** props); 560 void setFrameFormat(const gchar ** attribs, const gchar ** props, 561 fl_BlockLayout * pNewBL = NULL); 562 void setFrameFormat(const gchar ** props,FG_Graphic * pFG, const std::string & dataID, 563 fl_BlockLayout * pNewBL = NULL); 564 bool getFrameStrings_view(UT_sint32 x, UT_sint32 y,fv_FrameStrings & FrameStrings, 565 fl_BlockLayout ** pCloseBL,fp_Page ** ppPage); 566 void convertInLineToPositioned(PT_DocPosition pos, 567 const gchar ** attribs); 568 569 bool convertPositionedToInLine(fl_FrameLayout * pFrame); 570 UT_Error cmdInsertPositionedGraphic(FG_Graphic* pFG,UT_sint32 mouseX, UT_sint32 mouseY); 571 UT_Error cmdInsertPositionedGraphic(FG_Graphic* pFG); 572 573 // ---------------------- 574 575 bool isPosSelected(PT_DocPosition pos) const; 576 bool isXYSelected(UT_sint32 xPos, UT_sint32 yPos) const; 577 FV_SelectionMode getSelectionMode(void) const; 578 FV_SelectionMode getPrevSelectionMode(void) const; 579 PD_DocumentRange * getNthSelection(UT_sint32 i) const; 580 UT_sint32 getNumSelections(void) const; 581 void setSelectionMode(FV_SelectionMode selMode); 582 #ifdef ENABLE_SPELL 583 // ---------------------- 584 // Stuff for spellcheck context menu 585 // 586 UT_UCSChar * getContextSuggest(UT_uint32 ndx); 587 void cmdContextSuggest(UT_uint32 ndx, fl_BlockLayout * ppBL = NULL, const fl_PartOfBlockPtr& ppPOB = fl_PartOfBlockPtr()); 588 void cmdContextIgnoreAll(void); 589 void cmdContextAdd(void); 590 #endif 591 // ---------------------- 592 // Stuff for edittable Headers/Footers 593 // 594 bool isInHdrFtr(PT_DocPosition pos) const; 595 void setHdrFtrEdit(fl_HdrFtrShadow * pShadow); 596 void clearHdrFtrEdit(void); 597 bool isHdrFtrEdit(void) const; 598 fl_HdrFtrShadow * getEditShadow(void) const; 599 void rememberCurrentPosition(void); 600 PT_DocPosition getSavedPosition(void) const; 601 void clearSavedPosition(void); 602 void markSavedPositionAsNeeded(void); 603 bool needSavedPosition(void) const; 604 void insertHeaderFooter(HdrFtrType hfType); 605 bool insertHeaderFooter(const gchar ** props, HdrFtrType hfType, fl_DocSectionLayout * pDSL=NULL); 606 607 void cmdEditHeader(void); 608 void cmdEditFooter(void); 609 610 void cmdRemoveHdrFtr(bool isHeader); 611 bool isFooterOnPage(void) const; 612 bool isHeaderOnPage(void) const; 613 614 void SetupSavePieceTableState(void); 615 void RestoreSavedPieceTableState(void); 616 void removeThisHdrFtr(HdrFtrType hfType, bool bSkipPTSaves = false); 617 void createThisHdrFtr(HdrFtrType hfType, bool bSkipPTSaves = false); 618 void populateThisHdrFtr(HdrFtrType hfType, bool bSkipPTSaves = false); 619 void _populateThisHdrFtr(fl_HdrFtrSectionLayout * pHdrFtrSrc, fl_HdrFtrSectionLayout * pHdrFtrDest); 620 621 // 622 // ---------------------- 623 // Stuff for edittable Footnote/Endnotes 624 // 625 bool insertFootnote(bool bFootnote); 626 bool insertFootnoteSection(bool bFootnote,const gchar * enpid); 627 bool isInFootnote(PT_DocPosition pos) const; 628 bool isInFootnote(void) const; 629 bool isInEndnote(PT_DocPosition pos) const; 630 bool isInEndnote(void) const; 631 bool isInAnnotation(PT_DocPosition pos) const; 632 bool isInAnnotation(void) const; 633 fl_FootnoteLayout * getClosestFootnote(PT_DocPosition pos) const; 634 fl_EndnoteLayout * getClosestEndnote(PT_DocPosition pos) const; 635 fl_AnnotationLayout * getClosestAnnotation(PT_DocPosition pos) const; 636 UT_sint32 getEmbedDepth(PT_DocPosition pos) const; 637 // 638 // ---------------------------------- 639 // Stuff for Annotaions 640 // 641 bool insertAnnotation(UT_sint32 iAnnotation, 642 const std::string & sDescr, 643 const std::string & sAuthor, 644 const std::string & sTitle, 645 bool bReplace); 646 bool getAnnotationText(UT_uint32 iAnnotation, std::string & sText) const; 647 std::string getAnnotationText(UT_uint32 iAnnotation) const; 648 bool setAnnotationText(UT_uint32 iAnnotation, const std::string & sText); 649 bool setAnnotationText(UT_uint32 iAnnotation, const std::string & sText, 650 const std::string & sAuthor, const std::string & sTitle); 651 bool getAnnotationRichText(UT_uint32 iAnnotation, std::string & sRTF) const; 652 bool setAnnotationRichText(UT_uint32 iAnnotation, const std::string & sRTF); 653 // TODO getters and setters to implement/change/add as judged necessary 654 bool getAnnotationTitle(UT_uint32 iAnnotation, std::string & sTitle) const; 655 std::string getAnnotationTitle(UT_uint32 iAnnotation) const; 656 bool setAnnotationTitle(UT_uint32 iAnnotation, const std::string & sTitle); 657 bool getAnnotationAuthor(UT_uint32 iAnnotation, std::string & sAuthor) const; 658 std::string getAnnotationAuthor(UT_uint32 iAnnotation) const; 659 bool setAnnotationAuthor(UT_uint32 iAnnotation, const std::string & sAuthor); 660 isAnnotationPreviewActive(void)661 bool isAnnotationPreviewActive(void) const { return m_bAnnotationPreviewActive;} setAnnotationPreviewActive(bool b)662 void setAnnotationPreviewActive(bool b) { m_bAnnotationPreviewActive = b;} getActivePreviewAnnotationID()663 UT_uint32 getActivePreviewAnnotationID() const { return m_iAnnPviewID;} setActivePreviewAnnotationID(UT_uint32 iID)664 void setActivePreviewAnnotationID(UT_uint32 iID) { m_iAnnPviewID = iID;} 665 void killAnnotationPreview(); 666 bool cmdEditAnnotationWithDialog(UT_uint32 aID); 667 fl_AnnotationLayout * insertAnnotationDescription(UT_uint32 aID, AP_Dialog_Annotation *pDialog); 668 fl_AnnotationLayout * getAnnotationLayout(UT_uint32 iAnnotation) const; 669 bool selectAnnotation(fl_AnnotationLayout * pAL); 670 UT_uint32 countAnnotations(void) const; 671 672 FV_View_BubbleBlocker getBubbleBlocker(); 673 bool bubblesAreBlocked() const; 674 // ---------------------- 675 676 bool gotoTarget(AP_JumpTarget type, const UT_UCSChar * data); 677 bool gotoTarget(AP_JumpTarget type, const char *numberString); 678 679 void changeNumColumns(UT_uint32 iNumColumns); 680 681 // ---------------------- 682 683 // find and replace 684 685 void findSetFindString (const UT_UCSChar* string); 686 void findSetReplaceString(const UT_UCSChar* string); 687 void findSetReverseFind (bool newValue); 688 void findSetMatchCase (bool newValue); 689 void findSetWholeWord (bool newValue); 690 UT_UCSChar * findGetFindString (void); 691 UT_UCSChar * findGetReplaceString(void); 692 bool findGetReverseFind (); 693 bool findGetMatchCase (); 694 bool findGetWholeWord (); 695 696 bool findAgain(void); 697 698 void findSetStartAt(PT_DocPosition pos); 699 void findSetStartAtInsPoint(void); 700 701 bool findNext(bool& bDoneEntireDocument); 702 bool findNext(const UT_UCSChar* pFind, bool& bDoneEntireDocument); 703 704 UT_uint32* _computeFindPrefix(const UT_UCSChar* pFind); 705 706 bool _findNext(UT_uint32* pPrefix, 707 bool& bDoneEntireDocument); 708 709 bool findPrev(bool& bDoneEntireDocument); 710 bool findPrev(const UT_UCSChar* pFind, bool& bDoneEntireDocument); 711 712 bool _findPrev(UT_uint32* pPrefix, 713 bool& bDoneEntireDocument); 714 715 bool findReplaceReverse(bool& bDoneEntireDocument); 716 717 bool _findReplaceReverse(UT_uint32* pPrefix, 718 bool& bDoneEntireDocument, 719 bool bNoUpdate); 720 721 bool _findReplace(UT_uint32* pPrefix, 722 bool& bDoneEntireDocument, 723 bool bNoUpdate); 724 725 726 bool findReplace(bool& bDoneEntireDocument); 727 728 UT_uint32 findReplaceAll(); 729 730 // ---------------------- 731 732 #if defined(PT_TEST) || defined(FMT_TEST) || defined(UT_TEST) 733 void Test_Dump(void); 734 #endif 735 736 // ---------------------- 737 738 FV_DocCount countWords(bool bActuallyCountWords = true); 739 740 // ----------------------- 741 742 bool insertPageNum(const gchar ** props, HdrFtrType hfType); 743 virtual void setPoint(UT_uint32 pt); 744 void ensureInsertionPointOnScreen(void); 745 void removeCaret(const std::string& sCaretID); 746 void addCaret(PT_DocPosition docPos,UT_sint32 iAuthorId); 747 void setPointRemote(PT_DocPosition docPos); 748 void updateCarets(PT_DocPosition docPos, UT_sint32 iLen); 749 void fixInsertionPointCoords(void); 750 751 // ----------------------- 752 void killBlink(void); 753 void setShowPara(bool); getShowPara(void)754 inline bool getShowPara(void) const { return m_bShowPara; }; 755 756 const fp_PageSize& getPageSize(void) const; 757 virtual UT_uint32 calculateZoomPercentForPageWidth() const; 758 virtual UT_uint32 calculateZoomPercentForPageHeight() const; 759 virtual UT_uint32 calculateZoomPercentForWholePage() const; 760 void setViewMode (ViewMode vm); getViewMode(void)761 ViewMode getViewMode (void) const {return m_viewMode;} isPreview(void)762 bool isPreview(void) const {return VIEW_PREVIEW == m_viewMode;} setPreviewMode(PreViewMode pre)763 void setPreviewMode(PreViewMode pre) {m_previewMode = pre;} getPreviewMode(void)764 PreViewMode getPreviewMode(void) { return m_previewMode;} 765 766 UT_uint32 getTabToggleAreaWidth() const; 767 UT_sint32 getNormalModeXOffset() const; 768 setScreenUpdateOnGeneralUpdate(bool bDoit)769 void setScreenUpdateOnGeneralUpdate( bool bDoit) 770 {m_bDontUpdateScreenOnGeneralUpdate = !bDoit;} shouldScreenUpdateOnGeneralUpdate(void)771 bool shouldScreenUpdateOnGeneralUpdate(void) const 772 { return !m_bDontUpdateScreenOnGeneralUpdate;} 773 getDocument(void)774 inline PD_Document * getDocument (void) const {return m_pDoc;} 775 776 /* Revision related functions */ 777 void toggleMarkRevisions(); 778 void cmdAcceptRejectRevision(bool bReject, UT_sint32 x, UT_sint32 y); 779 // NB: 'mark revisions' state is document-wide 780 bool isMarkRevisions() const; 781 // NB: 'show revisions' state is view-specific isShowRevisions()782 bool isShowRevisions() const {return m_bShowRevisions;} 783 void toggleShowRevisions(); 784 void setShowRevisions(bool bShow); 785 786 void cmdSetRevisionLevel(UT_uint32 i); 787 UT_uint32 getRevisionLevel()const; 788 void setRevisionLevel(UT_uint32 i); 789 790 bool cmdFindRevision(bool bNext, UT_sint32 xPos, UT_sint32 yPos); 791 bool doesSelectionContainRevision() const; 792 793 void updateRevisionMode(); 794 protected: 795 void _fixInsertionPointAfterRevision(); 796 bool _makePointLegal(void); 797 public: 798 799 /* Table related functions */ 800 bool isPointLegal(PT_DocPosition pos) const; 801 bool isPointLegal(void) const; 802 bool isInTable() const; 803 fl_TableLayout * getTableAtPos(PT_DocPosition) const; 804 bool isInTable(PT_DocPosition pos) const; 805 bool cmdAutoSizeCols(void); 806 bool cmdTextToTable(UT_uint32 iDelim); 807 bool cmdAutoSizeRows(void); 808 bool cmdAdvanceNextPrevCell(bool bGoNext); 809 fp_CellContainer * getCellAtPos(PT_DocPosition pos) const; 810 PT_DocPosition findCellPosAt(PT_DocPosition posTable, UT_sint32 row, UT_sint32 col) const; 811 bool _deleteCellAt(PT_DocPosition posTable,UT_sint32 row, UT_sint32 col); 812 bool _restoreCellParams(PT_DocPosition posTable, UT_sint32 iLineWidth); 813 UT_sint32 _changeCellParams(PT_DocPosition posTable,pf_Frag_Strux* tableSDH ); 814 bool deleteCellAt(PT_DocPosition posTable,UT_sint32 row, UT_sint32 col); 815 bool cmdDeleteCell(PT_DocPosition pos); 816 bool cmdDeleteCol(PT_DocPosition pos); 817 bool cmdDeleteRow(PT_DocPosition pos); 818 bool cmdDeleteTable(PT_DocPosition pos, bool bDontNotify=false); 819 bool cmdInsertRow(PT_DocPosition posTable, bool bBfore); 820 bool cmdInsertCol(PT_DocPosition posTable, bool bBefore); 821 bool cmdSplitCells(AP_CellSplitType iSplitType); 822 bool cmdSelectColumn(PT_DocPosition posOfColumn); 823 bool cmdAutoFitTable(void); 824 bool cmdMergeCells(PT_DocPosition posSource, PT_DocPosition posDestination); 825 bool cmdTableToText(PT_DocPosition posSource,UT_sint32 iSepType); 826 827 bool _MergeCells( PT_DocPosition posDestination,PT_DocPosition posSource, bool bBefore); 828 bool getCellParams(PT_DocPosition posCol, UT_sint32 *iLeft, 829 UT_sint32 *iRight,UT_sint32 *iTop, UT_sint32 *iBot) const; 830 bool getCellLineStyle(PT_DocPosition posCell, UT_sint32 * pLeft, UT_sint32 * pRight, 831 UT_sint32 * pTop, UT_sint32 * pBot) const; 832 bool setCellFormat(const gchar * properties[], FormatTable applyTo, FG_Graphic * pFG, UT_String & sDataID); 833 bool getCellProperty(PT_DocPosition pos, const gchar * szPropName, gchar * &szPropValue) const; 834 bool setTableFormat(const gchar * properties[]); 835 bool setTableFormat(PT_DocPosition pos,const gchar * properties[]); 836 bool getCellFormat(PT_DocPosition pos, UT_String & sCellProps) const; 837 838 UT_Error cmdInsertTable(UT_sint32 numRows, UT_sint32 numCols, 839 const gchar * pPropsArray[]); 840 void _generalUpdate(void); 841 getColorShowPara(void)842 UT_RGBColor getColorShowPara(void) const { return m_colorShowPara; } 843 #ifdef ENABLE_SPELL 844 UT_RGBColor getColorSquiggle(FL_SQUIGGLE_TYPE iSquiggleType) const; 845 #endif getColorMargin(void)846 UT_RGBColor getColorMargin(void) const { return m_colorMargin; } 847 UT_RGBColor getColorSelBackground(void); 848 UT_RGBColor getColorSelForeground(void) const; getColorFieldOffset(void)849 UT_RGBColor getColorFieldOffset(void) const { return m_colorFieldOffset; } getColorImage(void)850 UT_RGBColor getColorImage(void) const { return m_colorImage; } getColorImageResize(void)851 UT_RGBColor getColorImageResize(void) const { return m_colorImageResize; } getColorHyperLink(void)852 UT_RGBColor getColorHyperLink(void) const { return m_colorHyperLink; } 853 UT_RGBColor getColorAnnotation(const fp_Run * pRun) const; 854 UT_RGBColor getColorAnnotation(fp_Page * pPage,UT_uint32 pid) const; 855 UT_RGBColor getColorRDFAnchor(const fp_Run * pRun) const; getColorRevisions(int rev)856 UT_RGBColor getColorRevisions(int rev) const { 857 if ((rev < 0) || (rev > 9)) rev = 9; 858 return m_colorRevisions[rev]; } getColorHdrFtr(void)859 UT_RGBColor getColorHdrFtr(void) const { return m_colorHdrFtr; } getColorColumnLine(void)860 UT_RGBColor getColorColumnLine(void) const { return m_colorColumnLine; } 861 862 void getVisibleDocumentPagesAndRectangles(UT_GenericVector<UT_Rect*> &vRect, 863 UT_GenericVector<fp_Page*> &vPages) const; 864 865 // 866 // image selection && resizing && dragging functions 867 // 868 UT_sint32 getImageSelInfo() const; 869 GR_Graphics::Cursor getImageSelCursor() const; 870 bool isImageSelected(void) const; 871 872 // 873 // Table resizing 874 // setDragTableLine(bool bSet)875 void setDragTableLine(bool bSet) 876 { m_bDragTableLine = bSet;} getDragTableLine(void)877 bool getDragTableLine(void) const 878 { return m_bDragTableLine;} setTopRuler(AP_TopRuler * pRuler)879 void setTopRuler(AP_TopRuler * pRuler) 880 { m_pTopRuler = pRuler;} getTopRuler(void)881 AP_TopRuler * getTopRuler(void) const 882 { return m_pTopRuler;} setLeftRuler(AP_LeftRuler * pRuler)883 void setLeftRuler(AP_LeftRuler * pRuler) 884 { m_pLeftRuler = pRuler;} getLeftRuler(void)885 AP_LeftRuler * getLeftRuler(void) const 886 { return m_pLeftRuler;} 887 888 889 const gchar ** getViewPersistentProps() const; getBidiOrder()890 FV_BIDI_Order getBidiOrder()const {return m_eBidiOrder;} setBidiOrder(FV_BIDI_Order o)891 void setBidiOrder(FV_BIDI_Order o) {m_eBidiOrder = o;} 892 893 bool isMathSelected(UT_sint32 x, UT_sint32 y, PT_DocPosition & pos) const; 894 // -- plugins 895 bool isMathLoaded(void) const; 896 bool isGrammarLoaded(void) const; 897 // -- 898 899 UT_uint32 getNumHorizPages(void) const; ////////////////////////////////// 900 void calculateNumHorizPages(void); 901 UT_uint32 getMaxHeight(UT_uint32 iRow) const; 902 UT_uint32 getWidthPrevPagesInRow(UT_uint32 iPageNumber) const; 903 UT_uint32 getWidthPagesInRow(fp_Page *page) const; 904 UT_uint32 getHorizPageSpacing(void) const; 905 bool rtlPages(void) const; 906 907 protected: 908 void _updateDatesBeforeSave(bool bOverwriteCreated); 909 void _saveAndNotifyPieceTableChange(void); 910 void _restorePieceTableState(void); 911 912 void _draw(UT_sint32, UT_sint32, UT_sint32, UT_sint32, bool bDirtyRunsOnly, bool bClip=false); 913 914 void _drawBetweenPositions(PT_DocPosition left, PT_DocPosition right); 915 bool _clearBetweenPositions(PT_DocPosition left, PT_DocPosition right, bool bFullLineHeightRect); 916 bool _drawOrClearBetweenPositions(PT_DocPosition iPos1, PT_DocPosition iPos2, bool bClear, bool bFullLineHeight); 917 bool _ensureInsertionPointOnScreen(); 918 void _moveInsPtNextPrevPage(bool bNext); 919 void _moveInsPtNextPrevScreen(bool bNext, bool bClearSelection); 920 void _moveInsPtNextPrevLine(bool bNext); 921 fp_Line * _getNextLineInDoc(fp_Container * pCon) const; 922 fp_Page * _getCurrentPage(void) const; 923 void _moveInsPtNthPage(UT_sint32 n); 924 void _moveInsPtToPage(fp_Page *page); 925 void _insertSectionBreak(void); 926 927 PT_DocPosition _getDocPosFromPoint(PT_DocPosition iPoint, FV_DocPos dp, bool bKeepLooking=true) const; 928 PT_DocPosition _getDocPos(FV_DocPos dp, bool bKeepLooking=true) const; 929 void _findPositionCoords(PT_DocPosition pos, 930 bool b, 931 UT_sint32& x, 932 UT_sint32& y, 933 UT_sint32& x2, //these are needed for BiDi split carret 934 UT_sint32& y2, 935 936 UT_uint32& height, 937 bool& bDirection, 938 fl_BlockLayout** ppBlock, 939 fp_Run** ppRun)const; 940 941 fl_BlockLayout* _findBlockAtPosition(PT_DocPosition pos) const; 942 943 fp_Page* _getPageForXY(UT_sint32 xPos, 944 UT_sint32 yPos, 945 UT_sint32& xClick, 946 UT_sint32& yClick) const; 947 bool _insertField(const char* szName, 948 const gchar ** extra_attrs = NULL, 949 const gchar ** extra_props = NULL); 950 void _moveToSelectionEnd(bool bForward); 951 void _eraseSelection(void); 952 void _clearSelection(bool bRedraw = true); 953 void _resetSelection(void); 954 void _setSelectionAnchor(void); 955 void _deleteSelection(PP_AttrProp *p_AttrProp_Before = NULL, 956 bool bNoUpdate = false, 957 bool bCaretLeft = false); 958 bool _insertFormatPair(const gchar * szName, const gchar * properties[]); 959 void _updateInsertionPoint(); 960 void _fixInsertionPointCoords(bool bIgnoreAll = false); 961 void _fixInsertionPointCoords(fv_CaretProps * pCP) const; 962 void _fixAllInsertionPointCoords(void) const; 963 964 void _drawSelection(); 965 void _extSel(UT_uint32 iOldPoint); 966 void _extSelToPos(PT_DocPosition pos); 967 UT_Error _insertGraphic(FG_Graphic*, const char*); 968 UT_Error _insertGraphic(FG_Graphic*, const char*,PT_DocPosition pos); 969 970 UT_UCSChar * _lookupSuggestion(fl_BlockLayout* pBL, const fl_PartOfBlockPtr& pPOB, UT_sint32 ndx); 971 972 static void _autoScroll(UT_Worker * pTimer); 973 static void _actuallyScroll(UT_Worker * pTimer); 974 975 // localize handling of insertion point logic 976 void _setPoint(PT_DocPosition pt, bool bEOL = false); 977 void _setPoint(fv_CaretProps * pCP, PT_DocPosition pt, UT_sint32 iLen) const; 978 UT_uint32 _getDataCount(UT_uint32 pt1, UT_uint32 pt2) const; 979 bool _charMotion(bool bForward,UT_uint32 countChars, bool bSkipCannotContainPoint = true); 980 void _doPaste(bool bUseClipboard, bool bHonorFormatting = true); 981 void _clearIfAtFmtMark(PT_DocPosition dpos); 982 983 #ifdef ENABLE_SPELL 984 void _checkPendingWordForSpell(void); 985 #endif 986 987 bool _isSpaceBefore(PT_DocPosition pos) const; 988 void _removeThisHdrFtr(fl_HdrFtrSectionLayout * pHdrFtr); 989 void _cmdEditHdrFtr(HdrFtrType hfType); 990 991 UT_Error _deleteBookmark(const char* szName, bool bSignal, PT_DocPosition * pos1 = NULL, PT_DocPosition * pos2 = NULL); 992 UT_Error _deleteHyperlink(PT_DocPosition &i, bool bSignal); 993 994 UT_Error _deleteXMLID( const std::string& xmlid, bool bSignal, PT_DocPosition& posStart, PT_DocPosition& posEnd ); 995 UT_Error _deleteXMLID( const std::string& xmlid, bool bSignal ); 996 fp_HyperlinkRun * _getHyperlinkInRange(PT_DocPosition &posStart, 997 PT_DocPosition &posEnd); 998 bool _charInsert(const UT_UCSChar * text, UT_uint32 count, bool bForce = false); 999 1000 void _adjustDeletePosition(UT_uint32 &iDocPos, UT_uint32 &iCount); 1001 1002 1003 void incremenetBubbleBlockerCount(); 1004 void decremenetBubbleBlockerCount(); 1005 bool _changeCellTo(PT_DocPosition posTable,UT_sint32 rowOld, 1006 UT_sint32 colOld, UT_sint32 left, UT_sint32 right, 1007 UT_sint32 top, UT_sint32 bot); 1008 bool _insertCellAt(PT_DocPosition posCell, UT_sint32 left, UT_sint32 right, UT_sint32 top, 1009 UT_sint32 bot, const gchar ** attrsBlock, const gchar ** propsBlock); 1010 bool _changeCellAttach(PT_DocPosition posCell, UT_sint32 left, UT_sint32 right, 1011 UT_sint32 top, UT_sint32 bot); 1012 1013 1014 private: 1015 1016 UT_uint32 m_iNumHorizPages; ///////////////////////////////////////////////// 1017 UT_uint32 m_getNumHorizPagesCachedWindowWidth; 1018 bool m_autoNumHorizPages; 1019 UT_uint32 m_horizPageSpacing; 1020 1021 PT_DocPosition m_iInsPoint; 1022 UT_sint32 m_xPoint; 1023 UT_sint32 m_yPoint; 1024 //the followingare BiDi specific, but need to be in place because of the 1025 //change to the signature of findPointCoords 1026 UT_sint32 m_xPoint2; 1027 UT_sint32 m_yPoint2; 1028 bool m_bPointDirection; 1029 bool m_bDefaultDirectionRtl; 1030 bool m_bUseHebrewContextGlyphs; 1031 UT_uint32 m_iPointHeight; 1032 UT_sint32 m_xPointSticky; // used only for _moveInsPtNextPrevLine() 1033 1034 bool m_bPointVisible; 1035 bool m_bPointEOL; 1036 FL_DocLayout* m_pLayout; 1037 PD_Document* m_pDoc; 1038 GR_Graphics* m_pG; 1039 void* m_pParentData; 1040 1041 // autoscroll stuff 1042 UT_Timer * m_pAutoScrollTimer; 1043 UT_sint32 m_xLastMouse; 1044 UT_sint32 m_yLastMouse; 1045 1046 bool m_bCursorIsOn; 1047 bool m_bEraseSaysStopBlinking; 1048 bool m_bCursorBlink; 1049 1050 bool m_bdontSpellCheckRightNow; 1051 fv_ChangeState m_chg; 1052 1053 // find and replace stuff 1054 bool m_wrappedEnd; 1055 PT_DocPosition m_startPosition; 1056 1057 bool m_doneFind; 1058 1059 bool m_bEditHdrFtr; 1060 fl_HdrFtrShadow * m_pEditShadow; 1061 PT_DocPosition m_iSavedPosition; 1062 bool m_bNeedSavedPosition; 1063 PT_DocPosition _BlockOffsetToPos(fl_BlockLayout * block, PT_DocPosition offset) const; 1064 1065 fl_BlockLayout * _findGetCurrentBlock(void) const; 1066 PT_DocPosition _findGetCurrentOffset(void) const; 1067 UT_UCSChar * _findGetNextBlockBuffer(fl_BlockLayout ** block, PT_DocPosition *offset); 1068 UT_UCSChar * _findGetPrevBlockBuffer(fl_BlockLayout ** block, PT_DocPosition *offset, UT_sint32& endIndex); 1069 1070 bool m_bReverseFind; 1071 bool m_bWholeWord; 1072 bool m_bMatchCase; 1073 UT_UCSChar * m_sFind; 1074 UT_UCSChar * m_sReplace; 1075 1076 UT_sint32 _findBlockSearchRegexp(const UT_UCSChar * haystack, const UT_UCSChar * needle); 1077 1078 // prefs listener - to change cursor blink on/off (and possibly others) 1079 static void _prefsListener( XAP_Prefs *, UT_StringPtrMap *, void *); 1080 1081 bool m_bShowPara; 1082 ViewMode m_viewMode; 1083 PreViewMode m_previewMode; 1084 bool m_bDontUpdateScreenOnGeneralUpdate; 1085 //#TF had to change the whole logic of storing PT state, since 1086 //the earlier implementation did not work with nested calls to 1087 //_saveAndNotifyPieceTableChange(); 1088 UT_uint32 m_iPieceTableState; 1089 1090 UT_sint32 m_iMouseX; 1091 UT_sint32 m_iMouseY; 1092 1093 UT_uint32 m_iViewRevision; 1094 1095 bool m_bWarnedThatRestartNeeded; 1096 1097 // properties for image selection 1098 UT_Rect m_selImageRect; 1099 GR_Graphics::Cursor m_imageSelCursor; 1100 UT_sint32 m_ixResizeOrigin; 1101 UT_sint32 m_iyResizeOrigin; 1102 bool m_bIsResizingImage; 1103 UT_Rect m_curImageSel; 1104 #if XAP_DONTUSE_XOR 1105 GR_Image* m_curImageSelCache; 1106 #endif 1107 // properties for image dragging 1108 bool m_bIsDraggingImage; 1109 fp_Run * m_pDraggedImageRun; 1110 UT_Rect m_dragImageRect; 1111 UT_sint32 m_ixDragOrigin; 1112 UT_sint32 m_iyDragOrigin; 1113 1114 // default color values 1115 UT_RGBColor m_colorShowPara; 1116 UT_RGBColor m_colorSpellSquiggle; 1117 UT_RGBColor m_colorGrammarSquiggle; 1118 UT_RGBColor m_colorMargin; 1119 UT_RGBColor m_colorFieldOffset; 1120 UT_RGBColor m_colorImage; 1121 UT_RGBColor m_colorImageResize; 1122 UT_RGBColor m_colorHyperLink; 1123 UT_RGBColor m_colorRevisions[10]; 1124 UT_RGBColor m_colorHdrFtr; 1125 UT_RGBColor m_colorColumnLine; 1126 UT_RGBColor m_colorAnnotations[10]; 1127 UT_RGBColor m_colorRDFAnchors[10]; 1128 1129 UT_uint32 m_countDisable; // cursor disable count 1130 bool m_bDragTableLine; 1131 EV_EditMouseContext m_prevMouseContext; 1132 AP_TopRuler * m_pTopRuler; 1133 AP_LeftRuler * m_pLeftRuler; 1134 bool m_bInFootnote; 1135 1136 FV_Caret_Listener * m_caretListener; 1137 bool m_bgColorInitted; 1138 PT_DocPosition m_iLowDrawPoint; 1139 PT_DocPosition m_iHighDrawPoint; 1140 mutable fv_PropCache m_CharProps; 1141 mutable fv_PropCache m_BlockProps; 1142 mutable fv_PropCache m_SecProps; 1143 AV_ListenerId m_CaretListID; 1144 #ifdef TOOLKIT_GTK_ALL 1145 FV_UnixFrameEdit m_FrameEdit; 1146 #else 1147 FV_FrameEdit m_FrameEdit; 1148 #endif 1149 #ifdef TOOLKIT_GTK_ALL 1150 FV_UnixVisualDrag m_VisualDragText; 1151 #else 1152 FV_VisualDragText m_VisualDragText; 1153 #endif 1154 FV_Selection m_Selection; 1155 bool m_bShowRevisions; 1156 1157 FV_BIDI_Order m_eBidiOrder; 1158 UT_uint32 m_iFreePass; 1159 bool m_bDontNotifyListeners; 1160 UT_ByteBuf * m_pLocalBuf; 1161 UT_sint32 m_iGrabCell; 1162 #ifdef TOOLKIT_GTK_ALL 1163 FV_UnixVisualInlineImage m_InlineImage; 1164 #else 1165 FV_VisualInlineImage m_InlineImage; 1166 #endif 1167 bool m_bInsertAtTablePending; 1168 PT_DocPosition m_iPosAtTable; 1169 UT_GenericVector<fv_CaretProps *> m_vecCarets; 1170 UT_UTF8String m_sDocUUID; 1171 bool m_bAnnotationPreviewActive; 1172 UT_uint32 m_iAnnPviewID; 1173 bool m_bAllowSmartQuoteReplacement; // Enable/disable replacing of quote with smart quote 1174 // This allows temporarily disabling smart quotes to allow inserting ANSI quote. 1175 int m_bubbleBlockerCount; 1176 UT_sint32 m_iOldPageCount; 1177 1178 #if defined(TOOLKIT_GTK_ALL) && !defined(TOOLKIT_GTK2) 1179 FV_UnixSelectionHandles m_SelectionHandles; 1180 #else 1181 FV_SelectionHandles m_SelectionHandles; 1182 #endif 1183 1184 public: 1185 bool registerDoubleBufferingObject(FV_ViewDoubleBuffering *obj); 1186 bool unregisterDoubleBufferingObject(FV_ViewDoubleBuffering *obj); 1187 private: 1188 FV_ViewDoubleBuffering *m_pViewDoubleBufferingObject; 1189 }; 1190 1191 #endif /* FV_VIEW_H */ 1192