Files
libreoffice/sw/source/ui/inc/edtwin.hxx

305 lines
12 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by Oliver-Rainer Wittmann sw34bf06: #i117783# - Writer's implementation of XPagePrintable - apply print settings to new printing routines http://svn.apache.org/viewvc?view=revision&revision=1172115 sw34bf06: #o12311627# use <rtl_random> methods to create unique ids for list styles and list ids http://svn.apache.org/viewvc?view=revision&revision=1172112 sw34bf06 #i114725#,#i115828# - method <SwDoc::ClearDoc()> - clear list structures completely http://svn.apache.org/viewvc?view=revision&revision=1172122 i#118572 - remove ui string and help content regarding usage of Java Mail in Writer's Mail Merge as Java Mail is not used. http://svn.apache.org/viewvc?view=revision&revision=1197035 Patches contributed by Mathias Bauer cws mba34issues01: #i117718#: provide filter name in case storage of medium does not allow to detect one http://svn.apache.org/viewvc?view=revision&revision=1172350 cws mba34issues01: #i117721#: directly provide parameters retrieved from SfxMedium http://svn.apache.org/viewvc?view=revision&revision=1172353 gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 cws mba34issues01: #i117723#: convert assertion into trace http://svn.apache.org/viewvc?view=revision&revision=1172355 cws mba34issues01: #i117699#: keep layout alive until swdoc dies http://svn.apache.org/viewvc?view=revision&revision=1172362 cws mba34issues01: #i117943#: missing color attributes in RTF clipboard http://svn.apache.org/viewvc?view=revision&revision=1172363 Patch contributed by Henning Brinkmann imported patch i#103878 http://svn.apache.org/viewvc?view=revision&revision=1172109 Patches contributed by Michael Stahl sw34bf06: #i117955#: WW8 export: disable storing of section breaks in endnotes http://svn.apache.org/viewvc?view=revision&revision=1172119 Patch contributed by imacat Fixed the Asian language work count. http://svn.apache.org/viewvc?view=revision&revision=1241345 Patch contributed by Pedro Giffuni i#20878 - Add comment with BZ issue for reference. http://svn.apache.org/viewvc?view=revision&revision=1244517 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 add writerperfect dependency.
2011-03-31 10:05:04 +02:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 16:15:01 +00:00
#ifndef _EDTWIN_HXX
#define _EDTWIN_HXX
#include <FrameControlsManager.hxx>
#include <svx/svdobj.hxx>
2000-09-18 16:15:01 +00:00
#include <tools/link.hxx>
#include <vcl/timer.hxx>
#include <vcl/window.hxx>
2001-03-23 14:39:59 +00:00
#include <svtools/transfer.hxx>
2000-09-18 16:15:01 +00:00
#include <swevent.hxx>
class SwWrtShell;
class SwView;
class SwRect;
class ViewShell;
class SwAnchorMarker;
class SdrObject;
class SwShadowCursor;
class DataChangedEvent;
class SvxAutoCorrCfg;
class SvxAutoCorrect;
class SwPaM;
2000-09-18 16:15:01 +00:00
struct SwApplyTemplate;
struct QuickHelpData;
class SdrDropMarkerOverlay;
2000-09-18 16:15:01 +00:00
/*--------------------------------------------------------------------
Description: input window
2000-09-18 16:15:01 +00:00
--------------------------------------------------------------------*/
/** Window class for the Writer edit area, this is the one handling mouse
and keyboard events and doing the final painting of the document from
the buffered layout.
To translate the pixel positions from the buffer OutputDevice to the real
pixel positions, use the PixelToLogic methods of this class.
*/
2001-03-23 14:39:59 +00:00
class SwEditWin: public Window,
public DropTargetHelper, public DragSourceHelper
2000-09-18 16:15:01 +00:00
{
friend void ScrollMDI(ViewShell* pVwSh, const SwRect&,
sal_uInt16 nRangeX, sal_uInt16 nRangeY);
friend sal_Bool IsScrollMDI(ViewShell* pVwSh, const SwRect&);
2000-09-18 16:15:01 +00:00
friend void SizeNotify(ViewShell* pVwSh, const Size &);
friend void PageNumNotify( ViewShell* pVwSh,
sal_uInt16 nPhyNum,
sal_uInt16 nVirtNum,
2000-09-18 16:15:01 +00:00
const String& rPg );
static QuickHelpData* pQuickHlpData;
static long nDDStartPosX, nDDStartPosY;
static Color aTextColor; // text color; for the watering can
static bool bTransparentBackColor; // transparent background
static Color aTextBackColor; // text background; for the watering can
2000-09-18 16:15:01 +00:00
/*
* timer and handler for scrolling on when the mousepointer
* stopps outside of EditWin during a drag-operation.
* The selection is increased towards the mouse position
* regularly.
2000-09-18 16:15:01 +00:00
*/
AutoTimer aTimer;
// timer for overlapping KeyInputs (e.g. for tables)
2000-09-18 16:15:01 +00:00
Timer aKeyInputTimer;
// timer for ANY-KeyInut question without a following KeyInputEvent
Timer aKeyInputFlushTimer;
String aInBuffer;
LanguageType eBufferLanguage;
2000-09-18 16:15:01 +00:00
Point aStartPos;
Point aMovePos;
Point aRszMvHdlPt;
Timer aTemplateTimer;
// type/object where the mouse pointer is
2000-09-18 16:15:01 +00:00
SwCallMouseEvent aSaveCallEvent;
SwApplyTemplate *pApplyTempl;
SwAnchorMarker *pAnchorMarker; // for relocating the anchor
2000-09-18 16:15:01 +00:00
SdrDropMarkerOverlay *pUserMarker;
SdrObject *pUserMarkerObj;
SwShadowCursor *pShadCrsr;
Point *pRowColumnSelectionStart; // save position where table row/column selection has been started
2000-09-18 16:15:01 +00:00
SwView &rView;
int aActHitType; // current mouse pointer
2000-09-18 16:15:01 +00:00
sal_uLong m_nDropFormat; // format from the last QueryDrop
sal_uInt16 m_nDropAction; // action from the last QueryDrop
sal_uInt16 m_nDropDestination; // destination from the last QueryDrop
2000-09-18 16:15:01 +00:00
sal_uInt16 eBezierMode;
sal_uInt16 nInsFrmColCount; // column number for interactive frame
SdrObjKind eDrawMode;
sal_Bool bMBPressed : 1,
2000-09-18 16:15:01 +00:00
bInsDraw : 1,
bInsFrm : 1,
bIsInMove : 1,
bIsInDrag : 1, // don't execute StartExecuteDrag twice
bOldIdle : 1, // to stop to idle
bOldIdleSet : 1, // during QeueryDrop
2000-09-18 16:15:01 +00:00
bTblInsDelMode : 1, //
bTblIsInsMode : 1, //
bChainMode : 1, // connect frames
bWasShdwCrsr : 1, // ShadowCrsr was on in MouseButtonDown
bLockInput : 1, // lock while calc panel is active
bIsRowDrag : 1, //selection of rows is used, in combination with pRowColumnSelectionStart
/** #i42732# display status of font size/name depending on either the input language or the
selection position depending on what has changed lately
*/
bUseInputLanguage: 1,
bObjectSelect : 1;
sal_uInt16 nKS_NUMDOWN_Count; // #i23725#
sal_uInt16 nKS_NUMINDENTINC_Count;
SwFrameControlsManager m_aFrameControlsManager;
2000-09-18 16:15:01 +00:00
void LeaveArea(const Point &);
void JustifyAreaTimer();
inline void EnterArea();
void RstMBDownFlags();
void ChangeFly( sal_uInt8 nDir, sal_Bool bWeb = sal_False );
void ChangeDrawing( sal_uInt8 nDir );
2000-09-18 16:15:01 +00:00
sal_Bool EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos);
sal_Bool RulerColumnDrag( const MouseEvent& rMEvt, sal_Bool bVerticalMode);
2000-09-18 16:15:01 +00:00
// helper function for D&D
2000-09-18 16:15:01 +00:00
void DropCleanup();
void CleanupDropUserMarker();
sal_uInt16 GetDropDestination( const Point& rPixPnt,
SdrObject ** ppObj = 0 );
//select the object/cursor at the mouse position of the context menu request
sal_Bool SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos );
2000-09-18 16:15:01 +00:00
/*
* handler for scrolling on when the mousepointer
* stopps outside of EditWin during a drag-operation.
* The selection is regularly increased towards the mouse
* position.
2000-09-18 16:15:01 +00:00
*/
DECL_LINK( TimerHandler, void * );
2000-09-18 16:15:01 +00:00
void StartDDTimer();
void StopDDTimer(SwWrtShell *, const Point &);
DECL_LINK( DDHandler, void * );
2000-09-18 16:15:01 +00:00
// timer for ANY-KeyInut question without a following KeyInputEvent
DECL_LINK( KeyInputFlushHandler, void * );
2000-09-18 16:15:01 +00:00
// timer for overlapping KeyInputs (e.g. for tables)
DECL_LINK( KeyInputTimerHandler, void * );
2000-09-18 16:15:01 +00:00
// timer for ApplyTemplates via mouse (in disguise Drag&Drop)
DECL_LINK( TemplateTimerHdl, void * );
2000-09-18 16:15:01 +00:00
using OutputDevice::GetTextColor;
2000-09-18 16:15:01 +00:00
protected:
virtual void DataChanged( const DataChangedEvent& );
virtual void PrePaint();
2000-09-18 16:15:01 +00:00
virtual void Paint( const Rectangle& rRect );
virtual void KeyInput(const KeyEvent &rKEvt);
virtual void GetFocus();
virtual void LoseFocus();
virtual void MouseMove(const MouseEvent& rMEvt);
virtual void MouseButtonDown(const MouseEvent& rMEvt);
virtual void MouseButtonUp(const MouseEvent& rMEvt);
virtual void RequestHelp(const HelpEvent& rEvt);
virtual void Command( const CommandEvent& rCEvt );
2001-03-23 14:39:59 +00:00
// Drag & Drop Interface
virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
2000-09-18 16:15:01 +00:00
virtual rtl::OUString GetSurroundingText() const;
virtual Selection GetSurroundingTextSelection() const;
void ShowAutoTextCorrectQuickHelp( const String& rWord, SvxAutoCorrCfg* pACfg,
SvxAutoCorrect* pACorr, bool bFromIME = false );
/// Returns true if in header/footer area, or in the header/footer control.
bool IsInHeaderFooter( const Point &rDocPt, FrameControlType &rControl ) const;
bool IsOverHeaderFooterFly( const Point& rDocPos, FrameControlType& rControl, bool& bOverFly, bool& bPageAnchored ) const;
2000-09-18 16:15:01 +00:00
public:
void UpdatePointer(const Point &, sal_uInt16 nButtons = 0);
2000-09-18 16:15:01 +00:00
sal_Bool IsDrawSelMode();
sal_Bool IsDrawAction() { return (bInsDraw); }
void SetDrawAction(sal_Bool bFlag) { bInsDraw = bFlag; }
void SetObjectSelect( sal_Bool bVal ) { bObjectSelect = bVal; }
sal_Bool IsObjectSelect() const { return bObjectSelect; }
inline SdrObjKind GetSdrDrawMode(/*sal_Bool bBuf = sal_False*/) const { return eDrawMode; }
inline void SetSdrDrawMode( SdrObjKind eSdrObjectKind ) { eDrawMode = eSdrObjectKind; SetObjectSelect( sal_False ); }
void StdDrawMode( SdrObjKind eSdrObjectKind, sal_Bool bObjSelect );
sal_Bool IsFrmAction() { return (bInsFrm); }
inline sal_uInt16 GetBezierMode() { return eBezierMode; }
void SetBezierMode(sal_uInt16 eBezMode) { eBezierMode = eBezMode; }
void EnterDrawTextMode(const Point& aDocPos); // turn on DrawTextEditMode
void InsFrm(sal_uInt16 nCols);
2000-09-18 16:15:01 +00:00
void StopInsFrm();
sal_uInt16 GetFrmColCount() const {return nInsFrmColCount;} // column number for interactive frame
2000-09-18 16:15:01 +00:00
void SetChainMode( sal_Bool bOn );
sal_Bool IsChainMode() const { return bChainMode; }
2000-09-18 16:15:01 +00:00
void FlushInBuffer();
sal_Bool IsInputSequenceCheckingRequired( const String &rText, const SwPaM& rCrsr ) const;
2000-09-18 16:15:01 +00:00
void SetApplyTemplate(const SwApplyTemplate &);
SwApplyTemplate* GetApplyTemplate() const { return pApplyTempl; }
void StartExecuteDrag();
2001-03-23 14:39:59 +00:00
void DragFinished();
sal_uInt16 GetDropAction() const { return m_nDropAction; }
sal_uLong GetDropFormat() const { return m_nDropFormat; }
2000-09-18 16:15:01 +00:00
Color GetTextColor() { return aTextColor; }
2000-09-18 16:15:01 +00:00
void SetTextColor(const Color& rCol ) { aTextColor = rCol; }
Color GetTextBackColor()
{ return aTextBackColor; }
void SetTextBackColor(const Color& rCol )
{ aTextBackColor = rCol; }
void SetTextBackColorTransparent(bool bSet)
2000-09-18 16:15:01 +00:00
{ bTransparentBackColor = bSet; }
bool IsTextBackColorTransparent()
2000-09-18 16:15:01 +00:00
{ return bTransparentBackColor; }
void LockKeyInput(sal_Bool bSet){bLockInput = bSet;}
2000-09-18 16:15:01 +00:00
const SwView &GetView() const { return rView; }
SwView &GetView() { return rView; }
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
2002-02-14 09:34:12 +00:00
2000-09-18 16:15:01 +00:00
static inline long GetDDStartPosX() { return nDDStartPosX; }
static inline long GetDDStartPosY() { return nDDStartPosY; }
static void _InitStaticData();
static void _FinitStaticData();
//#i3370# remove quick help to prevent saving of autocorrection suggestions
void StopQuickHelp();
// #i42921# - add parameter <bVerticalMode>
sal_Bool RulerMarginDrag( const MouseEvent& rMEvt,
const bool bVerticalMode );
/** #i42732# display status of font size/name depending on either the input
language or the selection position depending on what has changed lately
*/
void SetUseInputLanguage( sal_Bool bNew );
sal_Bool IsUseInputLanguage() const { return bUseInputLanguage; }
SwFrameControlsManager& GetFrameControlsManager() { return m_aFrameControlsManager; }
2000-09-18 16:15:01 +00:00
SwEditWin(Window *pParent, SwView &);
virtual ~SwEditWin();
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */