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
10c45d927aSAndrew Rist *
11c45d927aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12c45d927aSAndrew Rist *
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.
19c45d927aSAndrew Rist *
20c45d927aSAndrew Rist *************************************************************/
21c45d927aSAndrew Rist
22c45d927aSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #ifndef SD_VIEW_HXX
25cdf0e10cSrcweir #define SD_VIEW_HXX
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "pres.hxx"
28cdf0e10cSrcweir #include <tools/gen.hxx>
29cdf0e10cSrcweir #include <svtools/transfer.hxx>
30cdf0e10cSrcweir #include <svx/fmview.hxx>
31cdf0e10cSrcweir #include <svx/svdmark.hxx>
32cdf0e10cSrcweir //#ifndef _SVDVMARK_HXX //autogen
33cdf0e10cSrcweir //#include <svx/svdvmark.hxx>
34cdf0e10cSrcweir //#endif
35cdf0e10cSrcweir #include <svx/svdpage.hxx>
36cdf0e10cSrcweir #include "fupoor.hxx"
37cdf0e10cSrcweir
38cdf0e10cSrcweir #include "smarttag.hxx"
39766ce4d0SZheng Fan #include <editeng/numitem.hxx>
40cdf0e10cSrcweir
41cdf0e10cSrcweir class SdDrawDocument;
42cdf0e10cSrcweir class SdrOle2Obj;
43cdf0e10cSrcweir class SdrGrafObj;
44cdf0e10cSrcweir class SdrMediaObj;
45cdf0e10cSrcweir class OutputDevice;
46cdf0e10cSrcweir class VirtualDevice;
47cdf0e10cSrcweir class ImageMap;
48cdf0e10cSrcweir class Point;
49cdf0e10cSrcweir class Graphic;
50cdf0e10cSrcweir class SdrOutliner;
51cdf0e10cSrcweir class TransferableDataHelper;
52cdf0e10cSrcweir struct StyleRequestData;
53cdf0e10cSrcweir class Outliner;
54cdf0e10cSrcweir
55cdf0e10cSrcweir namespace sd {
56cdf0e10cSrcweir
57cdf0e10cSrcweir class DrawDocShell;
58cdf0e10cSrcweir struct SdNavigatorDropEvent;
59cdf0e10cSrcweir class ViewShell;
60cdf0e10cSrcweir class Window;
61cdf0e10cSrcweir class ViewClipboard;
62cdf0e10cSrcweir
63cdf0e10cSrcweir // -------------------
64cdf0e10cSrcweir // - SdViewRedrawRec -
65cdf0e10cSrcweir // -------------------
66cdf0e10cSrcweir
67cdf0e10cSrcweir struct SdViewRedrawRec
68cdf0e10cSrcweir {
69cdf0e10cSrcweir OutputDevice* mpOut;
70cdf0e10cSrcweir Rectangle aRect;
71cdf0e10cSrcweir };
72cdf0e10cSrcweir
73cdf0e10cSrcweir
74cdf0e10cSrcweir class View : public FmFormView
75cdf0e10cSrcweir {
76cdf0e10cSrcweir public:
77cdf0e10cSrcweir TYPEINFO();
78cdf0e10cSrcweir
79cdf0e10cSrcweir View (
80cdf0e10cSrcweir SdDrawDocument* pDrawDoc,
81cdf0e10cSrcweir OutputDevice* pOutDev,
82cdf0e10cSrcweir ViewShell* pViewSh=NULL);
83cdf0e10cSrcweir virtual ~View (void);
84cdf0e10cSrcweir
85cdf0e10cSrcweir void CompleteRedraw( OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L);
86cdf0e10cSrcweir
87cdf0e10cSrcweir virtual sal_Bool GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False ) const;
88cdf0e10cSrcweir virtual sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll = sal_False);
89cdf0e10cSrcweir virtual void MarkListHasChanged();
90cdf0e10cSrcweir virtual void ModelHasChanged();
91cdf0e10cSrcweir virtual void SelectAll();
92cdf0e10cSrcweir virtual void DoCut(::Window* pWindow=NULL);
93cdf0e10cSrcweir virtual void DoCopy(::Window* pWindow=NULL);
94cdf0e10cSrcweir virtual void DoPaste(::Window* pWindow=NULL);
95cdf0e10cSrcweir virtual void DoConnect(SdrOle2Obj* pOleObj);
96cdf0e10cSrcweir virtual sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr = sal_False);
97cdf0e10cSrcweir virtual void StartDrag( const Point& rStartPos, ::Window* pWindow );
98cdf0e10cSrcweir virtual void DragFinished( sal_Int8 nDropAction );
99cdf0e10cSrcweir virtual sal_Int8 AcceptDrop (
100cdf0e10cSrcweir const AcceptDropEvent& rEvt,
101cdf0e10cSrcweir DropTargetHelper& rTargetHelper,
102cdf0e10cSrcweir ::sd::Window* pTargetWindow = NULL,
103cdf0e10cSrcweir sal_uInt16 nPage = SDRPAGE_NOTFOUND,
104cdf0e10cSrcweir sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
105cdf0e10cSrcweir virtual sal_Int8 ExecuteDrop (
106cdf0e10cSrcweir const ExecuteDropEvent& rEvt,
107cdf0e10cSrcweir DropTargetHelper& rTargetHelper,
108cdf0e10cSrcweir ::sd::Window* pTargetWindow = NULL,
109cdf0e10cSrcweir sal_uInt16 nPage = SDRPAGE_NOTFOUND,
110cdf0e10cSrcweir sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
111cdf0e10cSrcweir
112cdf0e10cSrcweir ::com::sun::star::uno::Reference<
113cdf0e10cSrcweir ::com::sun::star::datatransfer::XTransferable>
114cdf0e10cSrcweir CreateClipboardDataObject (::sd::View*, ::Window& rWindow);
115cdf0e10cSrcweir ::com::sun::star::uno::Reference<
116cdf0e10cSrcweir ::com::sun::star::datatransfer::XTransferable>
117cdf0e10cSrcweir CreateDragDataObject (::sd::View*, ::Window& rWindow,
118cdf0e10cSrcweir const Point& rDragPos);
119cdf0e10cSrcweir ::com::sun::star::uno::Reference<
120cdf0e10cSrcweir ::com::sun::star::datatransfer::XTransferable>
121cdf0e10cSrcweir CreateSelectionDataObject (::sd::View*, ::Window& rWindow);
122cdf0e10cSrcweir
123cdf0e10cSrcweir void UpdateSelectionClipboard( sal_Bool bForceDeselect );
124cdf0e10cSrcweir
125cdf0e10cSrcweir inline DrawDocShell* GetDocSh (void) const;
126cdf0e10cSrcweir inline SdDrawDocument* GetDoc (void) const;
127cdf0e10cSrcweir inline ViewShell* GetViewShell (void) const;
128cdf0e10cSrcweir
129cdf0e10cSrcweir virtual sal_Bool SdrBeginTextEdit(SdrObject* pObj, SdrPageView* pPV = 0L, ::Window* pWin = 0L, sal_Bool bIsNewObj = sal_False,
130cdf0e10cSrcweir SdrOutliner* pGivenOutliner = 0L, OutlinerView* pGivenOutlinerView = 0L,
131cdf0e10cSrcweir sal_Bool bDontDeleteOutliner = sal_False, sal_Bool bOnlyOneView = sal_False, sal_Bool bGrabFocus = sal_True);
132cdf0e10cSrcweir
133cdf0e10cSrcweir virtual SdrEndTextEditKind SdrEndTextEdit(sal_Bool bDontDeleteReally = sal_False);
134cdf0e10cSrcweir
135cdf0e10cSrcweir bool RestoreDefaultText( SdrTextObj* pTextObj );
136cdf0e10cSrcweir
137cdf0e10cSrcweir sal_Bool InsertData( const TransferableDataHelper& rDataHelper,
138cdf0e10cSrcweir const Point& rPos, sal_Int8& rDnDAction, sal_Bool bDrag,
139cdf0e10cSrcweir sal_uLong nFormat = 0, sal_uInt16 nPage = SDRPAGE_NOTFOUND, sal_uInt16 nLayer = SDRLAYER_NOTFOUND );
140cdf0e10cSrcweir /** gets the metafile from the given transferable helper and insert it as a graphic shape.
141cdf0e10cSrcweir @param bOptimize if set to true, the metafile is analyzed and if only one bitmap action is
142cdf0e10cSrcweir present, then is is inserted as a single graphic.
143cdf0e10cSrcweir */
144cdf0e10cSrcweir bool InsertMetaFile( TransferableDataHelper& rDataHelper,
145cdf0e10cSrcweir const Point& rInsertPos,
146cdf0e10cSrcweir ImageMap* pImageMap, bool bOptimize );
147cdf0e10cSrcweir
148cdf0e10cSrcweir SdrGrafObj* InsertGraphic( const Graphic& rGraphic,
149cdf0e10cSrcweir sal_Int8& rAction, const Point& rPos,
150cdf0e10cSrcweir SdrObject* pSelectedObj, ImageMap* pImageMap );
151cdf0e10cSrcweir SdrMediaObj* InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAction,
152cdf0e10cSrcweir const Point& rPos, const Size& rSize );
153cdf0e10cSrcweir
154cdf0e10cSrcweir bool PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nPasteOptions );
155cdf0e10cSrcweir
156cdf0e10cSrcweir sal_Bool IsPresObjSelected(sal_Bool bOnPage=sal_True, sal_Bool bOnMasterPage=sal_True, sal_Bool bCheckPresObjListOnly=sal_False, sal_Bool bCheckLayoutOnly=sal_False) const;
157cdf0e10cSrcweir
158cdf0e10cSrcweir void SetMarkedOriginalSize();
159cdf0e10cSrcweir
160cdf0e10cSrcweir void LockRedraw(sal_Bool bLock);
161cdf0e10cSrcweir
162cdf0e10cSrcweir sal_Bool IsMorphingAllowed() const;
163cdf0e10cSrcweir sal_Bool IsVectorizeAllowed() const;
164cdf0e10cSrcweir
165cdf0e10cSrcweir virtual SfxStyleSheet* GetStyleSheet() const;
166cdf0e10cSrcweir
167cdf0e10cSrcweir sal_Bool GetExchangeList( List*& rpExchangeList, List* pBookmarkList, sal_uInt16 nType );
168cdf0e10cSrcweir
169cdf0e10cSrcweir virtual void onAccessibilityOptionsChanged();
170cdf0e10cSrcweir
171cdf0e10cSrcweir virtual SdrModel* GetMarkedObjModel() const;
172cdf0e10cSrcweir virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
173cdf0e10cSrcweir using SdrExchangeView::Paste;
174cdf0e10cSrcweir
175cdf0e10cSrcweir /** returns true if we have an undo manager and there is an open list undo action */
176cdf0e10cSrcweir bool isRecordingUndo() const;
177cdf0e10cSrcweir
178cdf0e10cSrcweir virtual void AddCustomHdl();
179cdf0e10cSrcweir
getSmartTags()180cdf0e10cSrcweir SmartTagSet& getSmartTags() { return maSmartTags; }
181cdf0e10cSrcweir void selectSmartTag( const SmartTagReference& xTag );
182cdf0e10cSrcweir void updateHandles();
183cdf0e10cSrcweir
184cdf0e10cSrcweir virtual SdrViewContext GetContext() const;
185cdf0e10cSrcweir virtual sal_Bool HasMarkablePoints() const;
186cdf0e10cSrcweir virtual sal_uLong GetMarkablePointCount() const;
187cdf0e10cSrcweir virtual sal_Bool HasMarkedPoints() const;
188cdf0e10cSrcweir virtual sal_uLong GetMarkedPointCount() const;
189cdf0e10cSrcweir virtual sal_Bool IsPointMarkable(const SdrHdl& rHdl) const;
190cdf0e10cSrcweir virtual sal_Bool MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark=sal_False);
191cdf0e10cSrcweir virtual void CheckPossibilities();
192cdf0e10cSrcweir virtual sal_Bool MarkPoints(const ::Rectangle* pRect, sal_Bool bUnmark);
193cdf0e10cSrcweir using SdrMarkView::MarkPoints;
194*af89ca6eSOliver-Rainer Wittmann
195*af89ca6eSOliver-Rainer Wittmann bool ShouldToggleOn(
196*af89ca6eSOliver-Rainer Wittmann const bool bBulletOnOffMode,
197*af89ca6eSOliver-Rainer Wittmann const bool bNormalBullet);
198*af89ca6eSOliver-Rainer Wittmann
199*af89ca6eSOliver-Rainer Wittmann /** change the bullets/numbering of the marked objects
200*af89ca6eSOliver-Rainer Wittmann
201*af89ca6eSOliver-Rainer Wittmann @param bToggle
202*af89ca6eSOliver-Rainer Wittmann true: just toggle the current bullets/numbering on --> off resp. off --> on
203*af89ca6eSOliver-Rainer Wittmann
204*af89ca6eSOliver-Rainer Wittmann @param bHandleBullets
205*af89ca6eSOliver-Rainer Wittmann true: handle bullets
206*af89ca6eSOliver-Rainer Wittmann false: handle numbering
207*af89ca6eSOliver-Rainer Wittmann
208*af89ca6eSOliver-Rainer Wittmann @param pNumRule
209*af89ca6eSOliver-Rainer Wittmann numbering rule which needs to be applied. can be 0.
210*af89ca6eSOliver-Rainer Wittmann
211*af89ca6eSOliver-Rainer Wittmann @param bSwitchOff
212*af89ca6eSOliver-Rainer Wittmann true: switch off bullets/numbering
213*af89ca6eSOliver-Rainer Wittmann */
214*af89ca6eSOliver-Rainer Wittmann void ChangeMarkedObjectsBulletsNumbering(
215*af89ca6eSOliver-Rainer Wittmann const bool bToggle,
216*af89ca6eSOliver-Rainer Wittmann const bool bHandleBullets,
217*af89ca6eSOliver-Rainer Wittmann const SvxNumRule* pNumRule,
218*af89ca6eSOliver-Rainer Wittmann const bool bSwitchOff);
219cdf0e10cSrcweir
SetPossibilitiesDirty()220cdf0e10cSrcweir void SetPossibilitiesDirty() { bPossibilitiesDirty = true; }
SetMoveAllowed(bool bSet)221cdf0e10cSrcweir void SetMoveAllowed( bool bSet ) { bMoveAllowed = bSet; }
SetMoveProtected(bool bSet)222cdf0e10cSrcweir void SetMoveProtected( bool bSet ) { bMoveProtect = bSet; }
SetResizeFreeAllowed(bool bSet)223cdf0e10cSrcweir void SetResizeFreeAllowed( bool bSet ) { bResizeFreeAllowed = bSet; }
SetResizePropAllowed(bool bSet)224cdf0e10cSrcweir void SetResizePropAllowed( bool bSet ) { bResizePropAllowed = bSet; }
SetResizeProtected(bool bSet)225cdf0e10cSrcweir void SetResizeProtected( bool bSet ) { bResizeProtect = bSet; }
226cdf0e10cSrcweir
SetMarkedPointsSmoothPossible(bool bSet)227cdf0e10cSrcweir void SetMarkedPointsSmoothPossible( bool bSet ) { bSetMarkedPointsSmoothPossible = bSet; }
SetMarkedSegmentsKindPossible(bool bSet)228cdf0e10cSrcweir void SetMarkedSegmentsKindPossible( bool bSet ) { bSetMarkedSegmentsKindPossible = bSet; }
229cdf0e10cSrcweir
230cdf0e10cSrcweir SdrObject* GetEmptyPresentationObject( PresObjKind eKind );
231cdf0e10cSrcweir protected:
232cdf0e10cSrcweir DECL_LINK( OnParagraphInsertedHdl, ::Outliner * );
233cdf0e10cSrcweir DECL_LINK( OnParagraphRemovingHdl, ::Outliner * );
234cdf0e10cSrcweir
235cdf0e10cSrcweir virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos );
236cdf0e10cSrcweir virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos );
237cdf0e10cSrcweir
238cdf0e10cSrcweir SdDrawDocument* mpDoc;
239cdf0e10cSrcweir DrawDocShell* mpDocSh;
240cdf0e10cSrcweir ViewShell* mpViewSh;
241cdf0e10cSrcweir SdrMarkList* mpDragSrcMarkList;
242cdf0e10cSrcweir SdrObject* mpDropMarkerObj;
243cdf0e10cSrcweir SdrDropMarkerOverlay* mpDropMarker;
244cdf0e10cSrcweir sal_uInt16 mnDragSrcPgNum;
245cdf0e10cSrcweir Point maDropPos;
246cdf0e10cSrcweir ::std::vector< String > maDropFileVector;
247cdf0e10cSrcweir sal_Int8 mnAction;
248cdf0e10cSrcweir Timer maDropErrorTimer;
249cdf0e10cSrcweir Timer maDropInsertFileTimer;
250cdf0e10cSrcweir sal_uInt16 mnLockRedrawSmph;
251cdf0e10cSrcweir List* mpLockedRedraws;
252cdf0e10cSrcweir bool mbIsDropAllowed;
253cdf0e10cSrcweir
254cdf0e10cSrcweir DECL_LINK( DropErrorHdl, Timer* );
255cdf0e10cSrcweir DECL_LINK( DropInsertFileHdl, Timer* );
256cdf0e10cSrcweir DECL_LINK( ExecuteNavigatorDrop, SdNavigatorDropEvent* pSdNavigatorDropEvent );
257cdf0e10cSrcweir
258cdf0e10cSrcweir void ImplClearDrawDropMarker();
259cdf0e10cSrcweir
260cdf0e10cSrcweir SmartTagSet maSmartTags;
261cdf0e10cSrcweir
262cdf0e10cSrcweir private:
263cdf0e10cSrcweir ::std::auto_ptr<ViewClipboard> mpClipboard;
264cdf0e10cSrcweir };
265cdf0e10cSrcweir
266cdf0e10cSrcweir
GetDocSh(void) const267cdf0e10cSrcweir DrawDocShell* View::GetDocSh (void) const
268cdf0e10cSrcweir {
269cdf0e10cSrcweir return mpDocSh;
270cdf0e10cSrcweir }
GetDoc(void) const271cdf0e10cSrcweir SdDrawDocument* View::GetDoc (void) const
272cdf0e10cSrcweir {
273cdf0e10cSrcweir return mpDoc;
274cdf0e10cSrcweir }
275cdf0e10cSrcweir
GetViewShell(void) const276cdf0e10cSrcweir ViewShell* View::GetViewShell (void) const
277cdf0e10cSrcweir {
278cdf0e10cSrcweir return mpViewSh;
279cdf0e10cSrcweir }
280cdf0e10cSrcweir
281cdf0e10cSrcweir } // end of namespace sd
282cdf0e10cSrcweir
283cdf0e10cSrcweir #endif
284