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