LCOV - code coverage report
Current view: top level - svx/inc/svx - svdview.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 5 0.0 %
Date: 2012-08-25 Functions: 0 5 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _SVDVIEW_HXX
      30                 :            : #define _SVDVIEW_HXX
      31                 :            : 
      32                 :            : // HACK to avoid too deep includes and to have some
      33                 :            : // levels free in svdmark itself (MS compiler include depth limit)
      34                 :            : #include <svx/svdhdl.hxx>
      35                 :            : #include <tools/weakbase.hxx>
      36                 :            : #include <svtools/accessibilityoptions.hxx>
      37                 :            : #include "svx/svxdllapi.h"
      38                 :            : #include <svx/svdcrtv.hxx>
      39                 :            : #include <unotools/options.hxx>
      40                 :            : 
      41                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      42                 :            : //
      43                 :            : //  Klassenhierarchie der View:
      44                 :            : //         SfxListener
      45                 :            : //         SdrPaintView    PntV   Action            ModChg   Attr   Notify
      46                 :            : //         SdrSnapView     SnpV   Action
      47                 :            : //
      48                 :            : //         SdrMarkView     MrkV   Action   MrkChg   ModChg          Notify
      49                 :            : //
      50                 :            : //         SdrEditView     EdtV            MrkChg   ModChg   Attr
      51                 :            : //         SdrPolyEditView PoEV
      52                 :            : //         SdrGlueEditView GlEV
      53                 :            : //         SdrObjEditView  EdxV   Action            ModChg   Attr   Notify
      54                 :            : //
      55                 :            : //         SdrExchangeView XcgV
      56                 :            : //         SdrDragView     DrgV   Action
      57                 :            : //
      58                 :            : //         SdrCreateView   CrtV   Action
      59                 :            : //         SdrView         View
      60                 :            : //
      61                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      62                 :            : 
      63                 :            : //************************************************************
      64                 :            : //   Vorausdeklarationen
      65                 :            : //************************************************************
      66                 :            : 
      67                 :            : class SvxURLField;
      68                 :            : 
      69                 :            : //************************************************************
      70                 :            : //   Defines
      71                 :            : //************************************************************
      72                 :            : 
      73                 :            : enum SdrViewContext {SDRCONTEXT_STANDARD,
      74                 :            :                      SDRCONTEXT_POINTEDIT,
      75                 :            :                      SDRCONTEXT_GLUEPOINTEDIT,
      76                 :            :                      SDRCONTEXT_GRAPHIC,
      77                 :            :                      SDRCONTEXT_MEDIA,
      78                 :            :                      SDRCONTEXT_TABLE};
      79                 :            : 
      80                 :            : enum SdrEventKind  {SDREVENT_NONE,
      81                 :            :                     SDREVENT_TEXTEDIT,
      82                 :            :                     SDREVENT_MOVACTION,
      83                 :            :                     SDREVENT_ENDACTION,
      84                 :            :                     SDREVENT_BCKACTION,
      85                 :            :                     SDREVENT_BRKACTION,
      86                 :            :                     SDREVENT_ENDCREATE,
      87                 :            :                     SDREVENT_ENDDRAG,
      88                 :            :                     SDREVENT_MARKOBJ,
      89                 :            :                     SDREVENT_MARKPOINT,
      90                 :            :                     SDREVENT_MARKGLUEPOINT,
      91                 :            :                     SDREVENT_BEGMARK,
      92                 :            :                     SDREVENT_BEGINSOBJPOINT,
      93                 :            :                     SDREVENT_ENDINSOBJPOINT,
      94                 :            :                     SDREVENT_BEGINSGLUEPOINT,
      95                 :            :                     SDREVENT_BEGDRAGHELPLINE,
      96                 :            :                     SDREVENT_BEGDRAGOBJ,
      97                 :            :                     SDREVENT_BEGCREATEOBJ,
      98                 :            :                     SDREVENT_BEGMACROOBJ,
      99                 :            :                     SDREVENT_BEGTEXTEDIT,
     100                 :            :                     SDREVENT_ENDMARK,
     101                 :            :                     SDREVENT_BRKMARK,
     102                 :            :                     SDREVENT_EXECUTEURL};
     103                 :            : 
     104                 :            : #define SDRMOUSEBUTTONDOWN 1
     105                 :            : #define SDRMOUSEMOVE       2
     106                 :            : #define SDRMOUSEBUTTONUP   3
     107                 :            : 
     108                 :            : //************************************************************
     109                 :            : //   Hilfsklasse SdrViewEvent
     110                 :            : //************************************************************
     111                 :            : 
     112                 :            : struct SVX_DLLPUBLIC SdrViewEvent
     113                 :            : {
     114                 :            :     SdrHdl*                     pHdl;
     115                 :            :     SdrObject*                  pObj;
     116                 :            :     SdrObject*                  pRootObj;        // Dieses Markieren bei SdrBeginTextEdit
     117                 :            :     SdrPageView*                pPV;
     118                 :            :     const SvxURLField*          pURLField;
     119                 :            : 
     120                 :            :     Point                       aLogicPos;
     121                 :            :     SdrHitKind                  eHit;
     122                 :            :     SdrEventKind                eEvent;
     123                 :            :     SdrHdlKind                  eHdlKind;
     124                 :            :     SdrCreateCmd                eEndCreateCmd;   // auch fuer EndInsPoint
     125                 :            : 
     126                 :            :     sal_uInt16                      nMouseClicks;
     127                 :            :     sal_uInt16                      nMouseMode;
     128                 :            :     sal_uInt16                      nMouseCode;
     129                 :            :     sal_uInt16                      nHlplIdx;
     130                 :            :     sal_uInt16                      nGlueId;
     131                 :            : 
     132                 :            :     unsigned                    bMouseDown : 1;
     133                 :            :     unsigned                    bMouseUp : 1;
     134                 :            :     unsigned                    bDoubleHdlSize : 1;  // Doppelte Handlegroesse wg. TextEdit
     135                 :            :     unsigned                    bIsAction : 1;       // Action ist aktiv
     136                 :            :     unsigned                    bIsTextEdit : 1;     // TextEdit laeuft zur Zeit
     137                 :            :     unsigned                    bTextEditHit : 1;    // offene OutlinerView getroffen
     138                 :            :     unsigned                    bAddMark : 1;
     139                 :            :     unsigned                    bUnmark : 1;
     140                 :            :     unsigned                    bPrevNextMark : 1;
     141                 :            :     unsigned                    bMarkPrev : 1;
     142                 :            :     unsigned                    bInsPointNewObj : 1;
     143                 :            :     unsigned                    bDragWithCopy : 1;
     144                 :            :     unsigned                    bCaptureMouse : 1;
     145                 :            :     unsigned                    bReleaseMouse : 1;
     146                 :            : 
     147                 :            : public:
     148                 :            :     SdrViewEvent();
     149                 :            :     ~SdrViewEvent();
     150                 :            : 
     151                 :            :     // nEventKind ist SDRMOUSEBUTTONDOWN, SDRMOUSEMOVE oder SDRMOUSEBUTTONUP
     152                 :            :     void SetMouseEvent(const MouseEvent& rMEvt, sal_uInt16 nEventKind);
     153                 :            : };
     154                 :            : 
     155                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     156                 :            : // helper class for all D&D overlays
     157                 :            : 
     158                 :            : class SVX_DLLPUBLIC SdrDropMarkerOverlay
     159                 :            : {
     160                 :            :     // The OverlayObjects
     161                 :            :     ::sdr::overlay::OverlayObjectList               maObjects;
     162                 :            : 
     163                 :            :     void ImplCreateOverlays(const SdrView& rView, const basegfx::B2DPolyPolygon& rPolyPolygon);
     164                 :            : 
     165                 :            : public:
     166                 :            :     SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject);
     167                 :            :     SdrDropMarkerOverlay(const SdrView& rView, const Rectangle& rRectangle);
     168                 :            :     SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd);
     169                 :            :     ~SdrDropMarkerOverlay();
     170                 :            : };
     171                 :            : 
     172                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     173                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     174                 :            : //
     175                 :            : //  @@ @@ @@ @@@@@ @@   @@
     176                 :            : //  @@ @@ @@ @@    @@   @@
     177                 :            : //  @@ @@ @@ @@    @@ @ @@
     178                 :            : //  @@@@@ @@ @@@@  @@@@@@@
     179                 :            : //   @@@  @@ @@    @@@@@@@
     180                 :            : //   @@@  @@ @@    @@@ @@@
     181                 :            : //    @   @@ @@@@@ @@   @@
     182                 :            : //
     183                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     184                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     185                 :            : 
     186                 :            : class SVX_DLLPUBLIC SdrView: public SdrCreateView, public tools::WeakBase< SdrView >
     187                 :            : {
     188                 :            :     friend class                SdrPageView;
     189                 :            : 
     190                 :            :     unsigned                    bNoExtendedMouseDispatcher : 1;
     191                 :            :     unsigned                    bNoExtendedKeyDispatcher : 1;
     192                 :            :     unsigned                    bNoExtendedCommandDispatcher : 1;
     193                 :            :     unsigned                    bTextEditOnObjectsWithoutTextIfTextTool : 1;
     194                 :            :     unsigned                    mbMasterPagePaintCaching : 1;
     195                 :            : 
     196                 :            : protected:
     197                 :            :     SvtAccessibilityOptions maAccessibilityOptions;
     198                 :            : 
     199                 :            : public:
     200                 :            :     TYPEINFO();
     201                 :            :     explicit SdrView(SdrModel* pModel1, OutputDevice* pOut = 0L);
     202                 :            :     virtual ~SdrView();
     203                 :            : 
     204                 :            :     // Default sind alle Dispatcher aktiviert. Will die App z.B. fuer
     205                 :            :     // Sonderbehandlungen im MouseDispatcher eingreifen, so muss sie
     206                 :            :     // den erweiterten MouseDispather mit unten stehender Methode deaktivieren
     207                 :            :     // und selbst nachimplementieren. Beispiel fuer MouseButtonDown:
     208                 :            :     //      SdrViewEvent aVEvt;
     209                 :            :     //      SdrHitKind eHit=pSdrView->PickAnything(rMEvt,SDRMOUSEBUTTONDOWN,aVEvt);
     210                 :            :     //      ... hier Applikationsspezifischer Eingriff ...
     211                 :            :     //      pSdrView->DoMouseEvent(aVEvt);
     212                 :            :     //      SetPointer(GetPreferedPointer(...))
     213                 :            :     //      CaptureMouse(...)
     214                 :          0 :     void EnableExtendedMouseEventDispatcher(sal_Bool bOn) { bNoExtendedMouseDispatcher = !bOn; }
     215                 :          0 :     sal_Bool IsExtendedMouseEventDispatcherEnabled() const { return bNoExtendedMouseDispatcher; }
     216                 :            : 
     217                 :            :     void EnableExtendedKeyInputDispatcher(sal_Bool bOn) { bNoExtendedKeyDispatcher=!bOn; }
     218                 :          0 :     sal_Bool IsExtendedKeyInputDispatcherEnabled() const { return bNoExtendedKeyDispatcher; }
     219                 :            : 
     220                 :            :     void EnableExtendedCommandEventDispatcher(sal_Bool bOn) { bNoExtendedCommandDispatcher=!bOn; }
     221                 :            :     sal_Bool IsExtendedCommandEventDispatcherEnabled() const { return bNoExtendedCommandDispatcher; }
     222                 :            : 
     223                 :            :     void EnableTextEditOnObjectsWithoutTextIfTextTool(sal_Bool bOn) { bTextEditOnObjectsWithoutTextIfTextTool=bOn; }
     224                 :            :     sal_Bool IsEnableTextEditOnObjectsWithoutTextIfTextToolEnabled() const { return bTextEditOnObjectsWithoutTextIfTextTool; }
     225                 :            : 
     226                 :            :     void SetMasterPagePaintCaching(sal_Bool bOn);
     227                 :          0 :     sal_Bool IsMasterPagePaintCaching() const { return mbMasterPagePaintCaching; }
     228                 :            : 
     229                 :            :     sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
     230                 :            :     virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
     231                 :            :     virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
     232                 :            :     virtual sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
     233                 :            :     virtual sal_Bool Command(const CommandEvent& rCEvt, Window* pWin);
     234                 :            : 
     235                 :            :     virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
     236                 :            : 
     237                 :          0 :     sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll=sal_False) { return SdrCreateView::SetAttributes(rSet,bReplaceAll); }
     238                 :            :     sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr=sal_False) { return SdrCreateView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr); }
     239                 :            : 
     240                 :            :     /* new interface src537 */
     241                 :            :     sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
     242                 :            : 
     243                 :            :     SfxStyleSheet* GetStyleSheet() const;
     244                 :            : 
     245                 :            :     // unvollstaendige Implementation:
     246                 :            :     // Das OutputDevice ist notwendig, damit ich die HandleSize ermitteln kann.
     247                 :            :     // Bei NULL wird das 1. angemeldete Win verwendet.
     248                 :            :     Pointer GetPreferedPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nModifier=0, sal_Bool bLeftDown=sal_False) const;
     249                 :            :     SdrHitKind PickAnything(const MouseEvent& rMEvt, sal_uInt16 nMouseDownOrMoveOrUp, SdrViewEvent& rVEvt) const;
     250                 :            :     SdrHitKind PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) const;
     251                 :            :     sal_Bool DoMouseEvent(const SdrViewEvent& rVEvt);
     252                 :            :     virtual SdrViewContext GetContext() const;
     253                 :            : 
     254                 :            :     // Die Methoden beruecksichtigen den jeweiligen Kontex:
     255                 :            :     // - Einfaches Zeichnen
     256                 :            :     // - Punktbearbeitungs-Mode
     257                 :            :     // - Klebepunkt-Editmode
     258                 :            :     // - TextEdit
     259                 :            :     // - ... to be continued
     260                 :            :     void MarkAll();
     261                 :            :     void UnmarkAll();
     262                 :            : 
     263                 :            :     const Rectangle& GetMarkedRect() const;
     264                 :            : 
     265                 :            :     virtual void DeleteMarked();
     266                 :            : 
     267                 :            :     // Markieren von Objekten, Polygonpunkten oder Klebepunkten (je nach View-
     268                 :            :     // Kontext) durch Aufziehen eines Selektionsrahmens.
     269                 :            :     //   bAddMark=TRUE: zur bestehenden Selektion hinzumarkieren (->Shift)
     270                 :            :     //   bUnmark=TRUE: Bereits selektierte Objekte/Punkte/Klebepunkte die innerhalb
     271                 :            :     //                 des aufgezogenen Rahmens liegen werden deselektiert.
     272                 :            :     sal_Bool BegMark(const Point& rPnt, sal_Bool bAddMark=sal_False, sal_Bool bUnmark=sal_False);
     273                 :            : 
     274                 :            :     // Folgende Actions sind moeglich:
     275                 :            :     //   - ObjectCreating
     276                 :            :     //   - ObjectMarking
     277                 :            :     //   - Object-specific dragging
     278                 :            :     //   - General dragging
     279                 :            :     // und mehr...
     280                 :            :     String GetStatusText();
     281                 :            : 
     282                 :            :     SvtAccessibilityOptions& getAccessibilityOptions();
     283                 :            : 
     284                 :            :     virtual void onAccessibilityOptionsChanged();
     285                 :            : };
     286                 :            : 
     287                 :            : #endif //_SVDVIEW_HXX
     288                 :            : 
     289                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     290                 :            : //
     291                 :            : // Die App macht sich zunaechst ein SdrModel.
     292                 :            : // Anschliessend oeffnet sie ein Win und erzeugt dann eine SdrView.
     293                 :            : // An der SdrView meldet sie dann mit der Methode ShowSdrPage() eine Seite an.
     294                 :            : // Eine SdrView kann in beliebig vielen Fenstern gleichzeitig angezeigt werden.
     295                 :            : // Intern:
     296                 :            : // Eine SdrView kann beliebig viele Seiten gleichzeitig anzeigen. Seiten
     297                 :            : // werden an- und abgemeldet mit ShowSdrPage()/HideSdrPage(). Fuer jede angemeldete
     298                 :            : // Seite wird eine SdrPageView-Instanz im Container aPages angelegt. Bei
     299                 :            : // gleichzeitiger Anzeige mehrerer Seiten ist darauf zu achten, dass der Offset-
     300                 :            : // Parameter von ShowSdrPage() der Seitengroesse angepasst ist, da sich sonst die
     301                 :            : // Seiten ueberlappen koennten.
     302                 :            : //
     303                 :            : // Elementare Methoden:
     304                 :            : // ~~~~~~~~~~~~~~~~~~~~
     305                 :            : //   Einfache Events:
     306                 :            : //   ~~~~~~~~~~~~~~~~
     307                 :            : //     sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
     308                 :            : //     sal_Bool MouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
     309                 :            : //     sal_Bool MouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
     310                 :            : //     sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
     311                 :            : //     sal_Bool Command(const CommandEvent& rCEvt, Window* pWin);
     312                 :            : //
     313                 :            : //   Exchange (Clipboard derzeit noch ohne SdrPrivateData):
     314                 :            : //   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     315                 :            : //     sal_Bool Cut(sal_uIntPtr nFormat=SDR_ANYFORMAT);
     316                 :            : //     sal_Bool Yank(sal_uIntPtr nFormat=SDR_ANYFORMAT);
     317                 :            : //     sal_Bool Paste(Window* pWin=NULL, sal_uIntPtr nFormat=SDR_ANYFORMAT);
     318                 :            : //
     319                 :            : //   SfxItems:
     320                 :            : //   ~~~~~~~~~
     321                 :            : //     sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
     322                 :            : //     sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
     323                 :            : //     SfxStyleSheet* GetStyleSheet() const;
     324                 :            : //     sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
     325                 :            : //
     326                 :            : //   Sonstiges:
     327                 :            : //   ~~~~~~~~~~
     328                 :            : //     Pointer GetPreferedPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nTol=0) const;
     329                 :            : //     String  GetStatusText();
     330                 :            : //
     331                 :            : ///////////////////////////////////////////////////////////////////////////////////////////////// */
     332                 :            : 
     333                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10