1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef SD_OUTLINE_VIEW_HXX 29*cdf0e10cSrcweir #define SD_OUTLINE_VIEW_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <vcl/image.hxx> 32*cdf0e10cSrcweir #include <editeng/lrspitem.hxx> 33*cdf0e10cSrcweir #include "View.hxx" 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir class SdPage; 36*cdf0e10cSrcweir class SdrPage; 37*cdf0e10cSrcweir class EditStatus; 38*cdf0e10cSrcweir class Paragraph; 39*cdf0e10cSrcweir class SdrTextObj; 40*cdf0e10cSrcweir class Outliner; 41*cdf0e10cSrcweir class SfxProgress; 42*cdf0e10cSrcweir struct PaintFirstLineInfo; 43*cdf0e10cSrcweir struct PasteOrDropInfos; 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir namespace sd { namespace tools { 46*cdf0e10cSrcweir class EventMultiplexerEvent; 47*cdf0e10cSrcweir } } 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir namespace sd { 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir class DrawDocShell; 52*cdf0e10cSrcweir class OutlineViewShell; 53*cdf0e10cSrcweir class OutlineViewModelChangeGuard; 54*cdf0e10cSrcweir class DrawDocShell; 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir static const int MAX_OUTLINERVIEWS = 4; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir /************************************************************************* 59*cdf0e10cSrcweir |* 60*cdf0e10cSrcweir |* Ableitung von ::sd::View fuer den Outline-Modus 61*cdf0e10cSrcweir |* 62*cdf0e10cSrcweir \************************************************************************/ 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir class OutlineView 65*cdf0e10cSrcweir : public ::sd::View 66*cdf0e10cSrcweir { 67*cdf0e10cSrcweir friend class OutlineViewModelChangeGuard; 68*cdf0e10cSrcweir public: 69*cdf0e10cSrcweir OutlineView (DrawDocShell* pDocSh, 70*cdf0e10cSrcweir ::Window* pWindow, 71*cdf0e10cSrcweir OutlineViewShell* pOutlineViewSh); 72*cdf0e10cSrcweir ~OutlineView (void); 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir /** This method is called by the view shell that owns the view to tell 75*cdf0e10cSrcweir the view that it can safely connect to the application. 76*cdf0e10cSrcweir This method must not be called before the view shell is on the shell 77*cdf0e10cSrcweir stack. 78*cdf0e10cSrcweir */ 79*cdf0e10cSrcweir void ConnectToApplication (void); 80*cdf0e10cSrcweir void DisconnectFromApplication (void); 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir TYPEINFO(); 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir SdrTextObj* GetTitleTextObject(SdrPage* pPage); 85*cdf0e10cSrcweir SdrTextObj* GetOutlineTextObject(SdrPage* pPage); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir SdrTextObj* CreateTitleTextObject(SdPage* pPage); 88*cdf0e10cSrcweir SdrTextObj* CreateOutlineTextObject(SdPage* pPage); 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir virtual void AddWindowToPaintView(OutputDevice* pWin); 91*cdf0e10cSrcweir virtual void DeleteWindowFromPaintView(OutputDevice* pWin); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir OutlinerView* GetViewByWindow (::Window* pWin) const; 94*cdf0e10cSrcweir SdrOutliner* GetOutliner() { return(mpOutliner) ; } 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir Paragraph* GetPrevTitle(const Paragraph* pPara); 97*cdf0e10cSrcweir Paragraph* GetNextTitle(const Paragraph* pPara); 98*cdf0e10cSrcweir SdPage* GetActualPage(); 99*cdf0e10cSrcweir SdPage* GetPageForParagraph( Paragraph* pPara ); 100*cdf0e10cSrcweir Paragraph* GetParagraphForPage( ::Outliner* pOutl, SdPage* pPage ); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir /** selects the paragraph for the given page at the outliner view*/ 103*cdf0e10cSrcweir void SetActualPage( SdPage* pActual ); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir virtual void Paint (const Rectangle& rRect, ::sd::Window* pWin); 106*cdf0e10cSrcweir virtual void AdjustPosSizePixel( 107*cdf0e10cSrcweir const Point &rPos, 108*cdf0e10cSrcweir const Size &rSize, 109*cdf0e10cSrcweir ::sd::Window* pWindow); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir // Callbacks fuer LINKs 112*cdf0e10cSrcweir DECL_LINK( ParagraphInsertedHdl, Outliner * ); 113*cdf0e10cSrcweir DECL_LINK( ParagraphRemovingHdl, Outliner * ); 114*cdf0e10cSrcweir DECL_LINK( DepthChangedHdl, Outliner * ); 115*cdf0e10cSrcweir DECL_LINK( StatusEventHdl, EditStatus * ); 116*cdf0e10cSrcweir DECL_LINK( BeginMovingHdl, Outliner * ); 117*cdf0e10cSrcweir DECL_LINK( EndMovingHdl, Outliner * ); 118*cdf0e10cSrcweir DECL_LINK( RemovingPagesHdl, OutlinerView * ); 119*cdf0e10cSrcweir DECL_LINK( IndentingPagesHdl, OutlinerView * ); 120*cdf0e10cSrcweir DECL_LINK( BeginDropHdl, void * ); 121*cdf0e10cSrcweir DECL_LINK( EndDropHdl, void * ); 122*cdf0e10cSrcweir DECL_LINK( PaintingFirstLineHdl, PaintFirstLineInfo* ); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir sal_uLong GetPaperWidth() const { return 2*21000; } // DIN A4 Breite 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir sal_Bool PrepareClose(sal_Bool bUI = sal_True); 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir virtual sal_Bool GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False ) const; 129*cdf0e10cSrcweir virtual sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll = sal_False); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir // virtual sal_Bool HasMarkedObjUnused() const; 132*cdf0e10cSrcweir void FillOutliner(); 133*cdf0e10cSrcweir void SetLinks(); 134*cdf0e10cSrcweir void ResetLinks() const; 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir SfxStyleSheet* GetStyleSheet() const; 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir void SetSelectedPages(); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir virtual sal_Int8 AcceptDrop ( 141*cdf0e10cSrcweir const AcceptDropEvent& rEvt, 142*cdf0e10cSrcweir DropTargetHelper& rTargetHelper, 143*cdf0e10cSrcweir ::sd::Window* pTargetWindow = NULL, 144*cdf0e10cSrcweir sal_uInt16 nPage = SDRPAGE_NOTFOUND, 145*cdf0e10cSrcweir sal_uInt16 nLayer = SDRPAGE_NOTFOUND); 146*cdf0e10cSrcweir virtual sal_Int8 ExecuteDrop ( 147*cdf0e10cSrcweir const ExecuteDropEvent& rEvt, 148*cdf0e10cSrcweir DropTargetHelper& rTargetHelper, 149*cdf0e10cSrcweir ::sd::Window* pTargetWindow = NULL, 150*cdf0e10cSrcweir sal_uInt16 nPage = SDRPAGE_NOTFOUND, 151*cdf0e10cSrcweir sal_uInt16 nLayer = SDRPAGE_NOTFOUND); 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir // #97766# Re-implement GetScriptType for this view to get correct results 155*cdf0e10cSrcweir virtual sal_uInt16 GetScriptType() const; 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir /** After this method has been called with <TRUE/> following changes of 158*cdf0e10cSrcweir the current page are ignored in that the corresponding text is not 159*cdf0e10cSrcweir selected. 160*cdf0e10cSrcweir This is used to supress unwanted side effects between selection and 161*cdf0e10cSrcweir cursor position. 162*cdf0e10cSrcweir */ 163*cdf0e10cSrcweir void IgnoreCurrentPageChanges (bool bIgnore); 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir #if 0 166*cdf0e10cSrcweir sal_Int32 GetPageNumberWidthPixel(); 167*cdf0e10cSrcweir #endif 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir void InvalidateSlideNumberArea(); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir /** creates and inserts an empty slide for the given paragraph. */ 172*cdf0e10cSrcweir SdPage* InsertSlideForParagraph( Paragraph* pPara ); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir void UpdateParagraph( sal_uInt16 nPara ); 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir protected: 177*cdf0e10cSrcweir virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos ); 178*cdf0e10cSrcweir virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos ); 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir private: 181*cdf0e10cSrcweir /** call this method before you do anything that can modify the outliner 182*cdf0e10cSrcweir and or the drawing document model. It will create needed undo actions */ 183*cdf0e10cSrcweir void BeginModelChange(); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir /** call this method after BeginModelChange(), when all possible model 186*cdf0e10cSrcweir changes are done. */ 187*cdf0e10cSrcweir void EndModelChange(); 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir /** merge edit engine undo actions if possible */ 190*cdf0e10cSrcweir void TryToMergeUndoActions(); 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir /** updates all changes in the outliner model to the draw model */ 193*cdf0e10cSrcweir void UpdateDocument(); 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir OutlineViewShell* mpOutlineViewShell; 196*cdf0e10cSrcweir SdrOutliner* mpOutliner; 197*cdf0e10cSrcweir OutlinerView* mpOutlinerView[MAX_OUTLINERVIEWS]; 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir List* mpOldParaOrder; 200*cdf0e10cSrcweir List* mpSelectedParas; 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir sal_uInt16 mnPagesToProcess; // fuer die Fortschrittsanzeige 203*cdf0e10cSrcweir sal_uInt16 mnPagesProcessed; 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir sal_Bool mbFirstPaint; 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir SfxProgress* mpProgress; 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir /** stores the last used high contrast mode. 210*cdf0e10cSrcweir this is changed in onUpdateStyleSettings() 211*cdf0e10cSrcweir */ 212*cdf0e10cSrcweir bool mbHighContrastMode; 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir /** stores the last used document color. 215*cdf0e10cSrcweir this is changed in onUpdateStyleSettings() 216*cdf0e10cSrcweir */ 217*cdf0e10cSrcweir Color maDocColor; 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir /** updates the high contrast settings and document color if they changed. 220*cdf0e10cSrcweir @param bForceUpdate forces the method to set all style settings 221*cdf0e10cSrcweir */ 222*cdf0e10cSrcweir void onUpdateStyleSettings( bool bForceUpdate = false ); 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir /** this link is called from the vcl applicaten when the stylesettings 225*cdf0e10cSrcweir change. Its only purpose is to call onUpdateStyleSettings() then. 226*cdf0e10cSrcweir */ 227*cdf0e10cSrcweir DECL_LINK( AppEventListenerHdl, void * ); 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir DECL_LINK(EventMultiplexerListener, sd::tools::EventMultiplexerEvent*); 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir /** holds a model guard during drag and drop between BeginMovingHdl and EndMovingHdl */ 232*cdf0e10cSrcweir std::auto_ptr< OutlineViewModelChangeGuard > maDragAndDropModelGuard; 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir Font maPageNumberFont; 235*cdf0e10cSrcweir sal_Int32 mnPageNumberWidthPixel; 236*cdf0e10cSrcweir Font maBulletFont; 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir SvxLRSpaceItem maLRSpaceItem; 239*cdf0e10cSrcweir Image maSlideImage; 240*cdf0e10cSrcweir }; 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir // calls IgnoreCurrentPageChangesLevel with true in ctor and with false in dtor 243*cdf0e10cSrcweir class OutlineViewPageChangesGuard 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir public: 246*cdf0e10cSrcweir OutlineViewPageChangesGuard( OutlineView* pView ); 247*cdf0e10cSrcweir ~OutlineViewPageChangesGuard(); 248*cdf0e10cSrcweir private: 249*cdf0e10cSrcweir OutlineView* mpView; 250*cdf0e10cSrcweir }; 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir // calls BeginModelChange() on c'tor and EndModelChange() on d'tor 253*cdf0e10cSrcweir class OutlineViewModelChangeGuard 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir public: 256*cdf0e10cSrcweir OutlineViewModelChangeGuard( OutlineView& rView ); 257*cdf0e10cSrcweir ~OutlineViewModelChangeGuard(); 258*cdf0e10cSrcweir private: 259*cdf0e10cSrcweir OutlineView& mrView; 260*cdf0e10cSrcweir }; 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir } // end of namespace sd 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir #endif 265