xref: /aoo41x/main/sd/source/ui/view/drviews4.cxx (revision 4d7c9de0)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
105b190011SAndrew Rist  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
195b190011SAndrew Rist  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "DrawViewShell.hxx"
30cdf0e10cSrcweir #include <vcl/msgbox.hxx>
31cdf0e10cSrcweir #include <svl/urlbmk.hxx>
32cdf0e10cSrcweir #include <svx/svdpagv.hxx>
33cdf0e10cSrcweir #include <svx/svdundo.hxx>
34cdf0e10cSrcweir #include <svx/fmglob.hxx>
35cdf0e10cSrcweir #include <editeng/eeitem.hxx>
36cdf0e10cSrcweir #ifndef _FLDITEM_HXX
37cdf0e10cSrcweir #include <editeng/flditem.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _SVXIDS_HRC
40cdf0e10cSrcweir #include <svx/svxids.hrc>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #include <svx/ruler.hxx>
43cdf0e10cSrcweir #ifndef _GLOBL3D_HXX
44cdf0e10cSrcweir #include <svx/globl3d.hxx>
45cdf0e10cSrcweir #endif
46cdf0e10cSrcweir #include <editeng/outliner.hxx>
47cdf0e10cSrcweir #ifndef _SFX_CLIENTSH_HXX
48cdf0e10cSrcweir #include <sfx2/ipclient.hxx>
49cdf0e10cSrcweir #endif
50cdf0e10cSrcweir #include <sfx2/request.hxx>
51cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
52cdf0e10cSrcweir #include <svx/svdopath.hxx>
53cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
54cdf0e10cSrcweir #include <editeng/editview.hxx>
55cdf0e10cSrcweir #include <vcl/cursor.hxx>
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 
58cdf0e10cSrcweir #include "app.hrc"
59cdf0e10cSrcweir #include "glob.hrc"
60cdf0e10cSrcweir #include "strings.hrc"
61cdf0e10cSrcweir #include "res_bmp.hrc"
62cdf0e10cSrcweir #include "DrawDocShell.hxx"
63cdf0e10cSrcweir #include "drawdoc.hxx"
64cdf0e10cSrcweir #include "Window.hxx"
65cdf0e10cSrcweir #include "fupoor.hxx"
66cdf0e10cSrcweir #include "fusnapln.hxx"
67cdf0e10cSrcweir #include "app.hxx"
68cdf0e10cSrcweir #include "Ruler.hxx"
69cdf0e10cSrcweir #include "sdresid.hxx"
70cdf0e10cSrcweir #include "GraphicViewShell.hxx"
71cdf0e10cSrcweir #include "sdpage.hxx"
72cdf0e10cSrcweir #include "slideshow.hxx"
73cdf0e10cSrcweir #include "anminfo.hxx"
74cdf0e10cSrcweir #include "sdpopup.hxx"
75cdf0e10cSrcweir #include "drawview.hxx"
76cdf0e10cSrcweir #include <svx/bmpmask.hxx>
77cdf0e10cSrcweir #include "LayerTabBar.hxx"
78cdf0e10cSrcweir 
79cdf0e10cSrcweir // #97016# IV
80cdf0e10cSrcweir #include <svx/svditer.hxx>
81cdf0e10cSrcweir 
82*0deba7fbSSteve Yin #include <navigatr.hxx>
83cdf0e10cSrcweir namespace sd {
84cdf0e10cSrcweir 
85cdf0e10cSrcweir #define PIPETTE_RANGE 0
86cdf0e10cSrcweir 
87cdf0e10cSrcweir #ifdef _MSC_VER
88cdf0e10cSrcweir #pragma optimize ( "", off )
89cdf0e10cSrcweir #endif
90cdf0e10cSrcweir 
91cdf0e10cSrcweir using namespace ::com::sun::star::uno;
92cdf0e10cSrcweir using namespace ::com::sun::star::drawing;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir /*************************************************************************
95cdf0e10cSrcweir |*
96cdf0e10cSrcweir |* aktuelle Seite loeschen
97cdf0e10cSrcweir |*
98cdf0e10cSrcweir \************************************************************************/
99cdf0e10cSrcweir 
DeleteActualPage()100cdf0e10cSrcweir void DrawViewShell::DeleteActualPage()
101cdf0e10cSrcweir {
102cdf0e10cSrcweir 	sal_uInt16			nPage = maTabControl.GetCurPageId() - 1;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	mpDrawView->SdrEndTextEdit();
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	try
107cdf0e10cSrcweir 	{
108cdf0e10cSrcweir 	    Reference<XDrawPagesSupplier> xDrawPagesSupplier( GetDoc()->getUnoModel(), UNO_QUERY_THROW );
109cdf0e10cSrcweir 	    Reference<XDrawPages> xPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
110cdf0e10cSrcweir 		Reference< XDrawPage > xPage( xPages->getByIndex( nPage ), UNO_QUERY_THROW );
111cdf0e10cSrcweir 		xPages->remove( xPage );
112cdf0e10cSrcweir 	}
113cdf0e10cSrcweir 	catch( Exception& )
114cdf0e10cSrcweir 	{
115cdf0e10cSrcweir 		DBG_ERROR("SelectionManager::DeleteSelectedMasterPages(), exception caught!");
116cdf0e10cSrcweir 	}
117cdf0e10cSrcweir }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir /*************************************************************************
120cdf0e10cSrcweir |*
121cdf0e10cSrcweir |* aktuelle Ebene loeschen
122cdf0e10cSrcweir |*
123cdf0e10cSrcweir \************************************************************************/
124cdf0e10cSrcweir 
DeleteActualLayer()125cdf0e10cSrcweir void DrawViewShell::DeleteActualLayer()
126cdf0e10cSrcweir {
127cdf0e10cSrcweir 	SdrLayerAdmin& rAdmin = GetDoc()->GetLayerAdmin();
128cdf0e10cSrcweir 	const String&  rName  = GetLayerTabControl()->GetPageText(GetLayerTabControl()->GetCurPageId());
129cdf0e10cSrcweir 	String         aString(SdResId(STR_ASK_DELETE_LAYER));
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 	// Platzhalter ersetzen
132cdf0e10cSrcweir 	sal_uInt16 nPos = aString.Search(sal_Unicode('$'));
133cdf0e10cSrcweir 	aString.Erase(nPos, 1);
134cdf0e10cSrcweir 	aString.Insert(rName, nPos);
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	if (QueryBox(GetActiveWindow(), WB_YES_NO, aString).Execute() == RET_YES)
137cdf0e10cSrcweir 	{
138cdf0e10cSrcweir 		const SdrLayer* pLayer = rAdmin.GetLayer(rName, sal_False);
139cdf0e10cSrcweir 		mpDrawView->DeleteLayer( pLayer->GetName() );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 		// damit TabBar und Window neu gezeichnet werden;
142cdf0e10cSrcweir 		// sollte spaeter wie beim Aendern der Layerfolge durch einen
143cdf0e10cSrcweir 		// Hint von Joe angestossen werden
144cdf0e10cSrcweir 		// ( View::Notify() --> ViewShell::ResetActualLayer() )
145cdf0e10cSrcweir 
146cdf0e10cSrcweir         mbIsLayerModeActive = false; 	// damit ChangeEditMode() ueberhaupt was tut
147cdf0e10cSrcweir 		ChangeEditMode(GetEditMode(), true);
148cdf0e10cSrcweir 	}
149cdf0e10cSrcweir }
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 
152cdf0e10cSrcweir /*************************************************************************
153cdf0e10cSrcweir |*
154cdf0e10cSrcweir |* Keyboard event
155cdf0e10cSrcweir |*
156cdf0e10cSrcweir \************************************************************************/
157cdf0e10cSrcweir 
KeyInput(const KeyEvent & rKEvt,::sd::Window * pWin)158cdf0e10cSrcweir sal_Bool DrawViewShell::KeyInput (const KeyEvent& rKEvt, ::sd::Window* pWin)
159cdf0e10cSrcweir {
160cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 	if ( !IsInputLocked() || ( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE ) )
163cdf0e10cSrcweir 	{
164cdf0e10cSrcweir 		// #97016# IV
165cdf0e10cSrcweir 		if(KEY_RETURN == rKEvt.GetKeyCode().GetCode()
166cdf0e10cSrcweir 			&& rKEvt.GetKeyCode().IsMod1()
167cdf0e10cSrcweir 			&& GetView()->IsTextEdit())
168cdf0e10cSrcweir 		{
169cdf0e10cSrcweir 			// this should be used for cursor travelling.
170cdf0e10cSrcweir 			SdPage* pActualPage = GetActualPage();
171cdf0e10cSrcweir 			const SdrMarkList& rMarkList = GetView()->GetMarkedObjectList();
172cdf0e10cSrcweir 			SdrTextObj* pCandidate = 0L;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 			if(pActualPage && 1 == rMarkList.GetMarkCount())
175cdf0e10cSrcweir 			{
176cdf0e10cSrcweir 				SdrMark* pMark = rMarkList.GetMark(0);
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 				// remember which object was the text in edit mode
179cdf0e10cSrcweir 				SdrObject* pOldObj = pMark->GetMarkedSdrObj();
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 				// end text edit now
182cdf0e10cSrcweir 				GetView()->SdrEndTextEdit();
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 				// look for a new candidate, a successor of pOldObj
185cdf0e10cSrcweir 				SdrObjListIter aIter(*pActualPage, IM_DEEPNOGROUPS);
186cdf0e10cSrcweir 				sal_Bool bDidVisitOldObject(sal_False);
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 				while(aIter.IsMore() && !pCandidate)
189cdf0e10cSrcweir 				{
190cdf0e10cSrcweir 					SdrObject* pObj = aIter.Next();
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 					if(pObj && pObj->ISA(SdrTextObj))
193cdf0e10cSrcweir 					{
194cdf0e10cSrcweir 						sal_uInt32 nInv(pObj->GetObjInventor());
195cdf0e10cSrcweir 						sal_uInt16 nKnd(pObj->GetObjIdentifier());
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 						if(SdrInventor == nInv &&
198cdf0e10cSrcweir 							(OBJ_TITLETEXT == nKnd || OBJ_OUTLINETEXT == nKnd || OBJ_TEXT == nKnd)
199cdf0e10cSrcweir 							&& bDidVisitOldObject)
200cdf0e10cSrcweir 						{
201cdf0e10cSrcweir 							pCandidate = (SdrTextObj*)pObj;
202cdf0e10cSrcweir 						}
203cdf0e10cSrcweir 
204cdf0e10cSrcweir 						if(pObj == pOldObj)
205cdf0e10cSrcweir 						{
206cdf0e10cSrcweir 							bDidVisitOldObject = sal_True;
207cdf0e10cSrcweir 						}
208cdf0e10cSrcweir 					}
209cdf0e10cSrcweir 				}
210cdf0e10cSrcweir 			}
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 			if(pCandidate)
213cdf0e10cSrcweir 			{
214cdf0e10cSrcweir 				// set the new candidate to text edit mode
215cdf0e10cSrcweir 				GetView()->UnMarkAll();
216cdf0e10cSrcweir 				GetView()->MarkObj(pCandidate, GetView()->GetSdrPageView());
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 				GetViewFrame()->GetDispatcher()->Execute(
219cdf0e10cSrcweir 					SID_ATTR_CHAR, SFX_CALLMODE_ASYNCHRON);
220cdf0e10cSrcweir 			}
221cdf0e10cSrcweir 			else
222cdf0e10cSrcweir 			{
223cdf0e10cSrcweir 				// insert a new page with the same page layout
224cdf0e10cSrcweir 				GetViewFrame()->GetDispatcher()->Execute(
225cdf0e10cSrcweir 					SID_INSERTPAGE_QUICK, SFX_CALLMODE_ASYNCHRON);
226cdf0e10cSrcweir 			}
227cdf0e10cSrcweir 		}
228cdf0e10cSrcweir 		else
229cdf0e10cSrcweir 		{
230cdf0e10cSrcweir 			bRet = ViewShell::KeyInput(rKEvt, pWin);
231*0deba7fbSSteve Yin     		//Solution: If object is marked , the corresponding entry is set true ,
232*0deba7fbSSteve Yin     		//else the corresponding entry is set false .
233*0deba7fbSSteve Yin        	    if(KEY_TAB == rKEvt.GetKeyCode().GetCode())
234*0deba7fbSSteve Yin        	    {
235*0deba7fbSSteve Yin    			   FreshNavigatrTree();
236*0deba7fbSSteve Yin        	    }
237cdf0e10cSrcweir 		}
238cdf0e10cSrcweir 	}
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 	return bRet;
241cdf0e10cSrcweir }
242cdf0e10cSrcweir 
243cdf0e10cSrcweir /*************************************************************************
244cdf0e10cSrcweir |*
245cdf0e10cSrcweir |* Vom Lineal ausgehenden Drag (Hilflinien, Ursprung) beginnen
246cdf0e10cSrcweir |*
247cdf0e10cSrcweir \************************************************************************/
248cdf0e10cSrcweir 
StartRulerDrag(const Ruler & rRuler,const MouseEvent & rMEvt)249cdf0e10cSrcweir void DrawViewShell::StartRulerDrag (
250cdf0e10cSrcweir     const Ruler& rRuler,
251cdf0e10cSrcweir     const MouseEvent& rMEvt)
252cdf0e10cSrcweir {
253cdf0e10cSrcweir     GetActiveWindow()->CaptureMouse();
254cdf0e10cSrcweir 
255cdf0e10cSrcweir 	Point aWPos = GetActiveWindow()->PixelToLogic(GetActiveWindow()->GetPointerPosPixel());
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 	if ( rRuler.GetExtraRect().IsInside(rMEvt.GetPosPixel()) )
258cdf0e10cSrcweir 	{
259cdf0e10cSrcweir 		mpDrawView->BegSetPageOrg(aWPos);
260cdf0e10cSrcweir         mbIsRulerDrag = sal_True;
261cdf0e10cSrcweir 	}
262cdf0e10cSrcweir 	else
263cdf0e10cSrcweir 	{
264cdf0e10cSrcweir         // #i34536# if no guide-lines are visible yet, that show them
265cdf0e10cSrcweir         if( ! mpDrawView->IsHlplVisible())
266cdf0e10cSrcweir             mpDrawView->SetHlplVisible( sal_True );
267cdf0e10cSrcweir 
268cdf0e10cSrcweir         SdrHelpLineKind eKind;
269cdf0e10cSrcweir 
270cdf0e10cSrcweir         if ( rMEvt.IsMod1() )
271cdf0e10cSrcweir             eKind = SDRHELPLINE_POINT;
272cdf0e10cSrcweir         else if ( rRuler.IsHorizontal() )
273cdf0e10cSrcweir             eKind = SDRHELPLINE_HORIZONTAL;
274cdf0e10cSrcweir         else
275cdf0e10cSrcweir             eKind = SDRHELPLINE_VERTICAL;
276cdf0e10cSrcweir 
277cdf0e10cSrcweir         mpDrawView->BegDragHelpLine(aWPos, eKind);
278cdf0e10cSrcweir         mbIsRulerDrag = sal_True;
279cdf0e10cSrcweir 	}
280cdf0e10cSrcweir }
281*0deba7fbSSteve Yin //Solution: If object is marked , the corresponding entry is set true ,
282*0deba7fbSSteve Yin //else the corresponding entry is set false .
FreshNavigatrEntry()283*0deba7fbSSteve Yin void DrawViewShell::FreshNavigatrEntry()
284*0deba7fbSSteve Yin {
285*0deba7fbSSteve Yin 		sal_uInt16 nId = SID_NAVIGATOR;
286*0deba7fbSSteve Yin 		SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
287*0deba7fbSSteve Yin 		if( pWindow )
288*0deba7fbSSteve Yin 		{
289*0deba7fbSSteve Yin 			SdNavigatorWin* pNavWin = (SdNavigatorWin*)( pWindow->GetContextWindow( SD_MOD() ) );
290*0deba7fbSSteve Yin 			if( pNavWin )
291*0deba7fbSSteve Yin 				pNavWin->FreshEntry();
292*0deba7fbSSteve Yin 		}
293*0deba7fbSSteve Yin }
294cdf0e10cSrcweir 
FreshNavigatrTree()295*0deba7fbSSteve Yin void DrawViewShell::FreshNavigatrTree()
296*0deba7fbSSteve Yin {
297*0deba7fbSSteve Yin 		sal_uInt16 nId = SID_NAVIGATOR;
298*0deba7fbSSteve Yin 		SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
299*0deba7fbSSteve Yin 		if( pWindow )
300*0deba7fbSSteve Yin 		{
301*0deba7fbSSteve Yin 			SdNavigatorWin* pNavWin = (SdNavigatorWin*)( pWindow->GetContextWindow( SD_MOD() ) );
302*0deba7fbSSteve Yin 			if( pNavWin )
303*0deba7fbSSteve Yin 				pNavWin->FreshTree( GetDoc() );
304*0deba7fbSSteve Yin 		}
305*0deba7fbSSteve Yin }
306cdf0e10cSrcweir /*************************************************************************
307cdf0e10cSrcweir |*
308cdf0e10cSrcweir |* MouseButtonDown event
309cdf0e10cSrcweir |*
310cdf0e10cSrcweir \************************************************************************/
311cdf0e10cSrcweir 
MouseButtonDown(const MouseEvent & rMEvt,::sd::Window * pWin)312cdf0e10cSrcweir void DrawViewShell::MouseButtonDown(const MouseEvent& rMEvt,
313cdf0e10cSrcweir     ::sd::Window* pWin)
314cdf0e10cSrcweir {
315cdf0e10cSrcweir     // We have to check if a context menu is shown and we have an UI
316cdf0e10cSrcweir     // active inplace client. In that case we have to ignore the mouse
317cdf0e10cSrcweir     // button down event. Otherwise we would crash (context menu has been
318cdf0e10cSrcweir     // opened by inplace client and we would deactivate the inplace client,
319cdf0e10cSrcweir     // the contex menu is closed by VCL asynchronously which in the end
320cdf0e10cSrcweir     // would work on deleted objects or the context menu has no parent anymore)
321cdf0e10cSrcweir     // See #126086# and #128122#
322cdf0e10cSrcweir     SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient();
323cdf0e10cSrcweir     sal_Bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() );
324cdf0e10cSrcweir 
325cdf0e10cSrcweir     if ( bIsOleActive && PopupMenu::IsInExecute() )
326cdf0e10cSrcweir         return;
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 	if ( !IsInputLocked() )
329cdf0e10cSrcweir 	{
330cdf0e10cSrcweir 		ViewShell::MouseButtonDown(rMEvt, pWin);
331cdf0e10cSrcweir 
332*0deba7fbSSteve Yin 		//Solution: If object is marked , the corresponding entry is set true ,
333*0deba7fbSSteve Yin 		//else the corresponding entry is set false .
334*0deba7fbSSteve Yin               FreshNavigatrTree();
335cdf0e10cSrcweir 		if ( mbPipette )
336cdf0e10cSrcweir 			( (SvxBmpMask*) GetViewFrame()->GetChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )->PipetteClicked();
337cdf0e10cSrcweir 	}
338cdf0e10cSrcweir }
339cdf0e10cSrcweir 
340cdf0e10cSrcweir /*************************************************************************
341cdf0e10cSrcweir |*
342cdf0e10cSrcweir |* MouseMove event
343cdf0e10cSrcweir |*
344cdf0e10cSrcweir \************************************************************************/
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 
MouseMove(const MouseEvent & rMEvt,::sd::Window * pWin)347cdf0e10cSrcweir void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
348cdf0e10cSrcweir {
349cdf0e10cSrcweir 	if ( !IsInputLocked() )
350cdf0e10cSrcweir 	{
351cdf0e10cSrcweir 		if ( mpDrawView->IsAction() )
352cdf0e10cSrcweir 		{
353cdf0e10cSrcweir 			Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel());
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 			if ( !aOutputArea.IsInside(rMEvt.GetPosPixel()) )
356cdf0e10cSrcweir 			{
357cdf0e10cSrcweir 				sal_Bool bInsideOtherWindow = sal_False;
358cdf0e10cSrcweir 
359cdf0e10cSrcweir                 if (mpContentWindow.get() != NULL)
360cdf0e10cSrcweir                 {
361cdf0e10cSrcweir                     aOutputArea = Rectangle(Point(0,0),
362cdf0e10cSrcweir                         mpContentWindow->GetOutputSizePixel());
363cdf0e10cSrcweir 
364cdf0e10cSrcweir                     Point aPos = mpContentWindow->GetPointerPosPixel();
365cdf0e10cSrcweir                     if ( aOutputArea.IsInside(aPos) )
366cdf0e10cSrcweir                         bInsideOtherWindow = sal_True;
367cdf0e10cSrcweir                 }
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 				if (! GetActiveWindow()->HasFocus ())
370cdf0e10cSrcweir 				{
371cdf0e10cSrcweir 					GetActiveWindow()->ReleaseMouse ();
372cdf0e10cSrcweir 					mpDrawView->BrkAction ();
373cdf0e10cSrcweir 					return;
374cdf0e10cSrcweir 				}
375cdf0e10cSrcweir 				else if ( bInsideOtherWindow )
376cdf0e10cSrcweir 				{
377cdf0e10cSrcweir 					GetActiveWindow()->ReleaseMouse();
378cdf0e10cSrcweir 					pWin->CaptureMouse ();
379cdf0e10cSrcweir 				}
380cdf0e10cSrcweir 			}
381cdf0e10cSrcweir 			else if ( pWin != GetActiveWindow() )
382cdf0e10cSrcweir 				 pWin->CaptureMouse();
383cdf0e10cSrcweir 		}
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 		// #109585#
386cdf0e10cSrcweir 		// Since the next MouseMove may execute a IsSolidDraggingNow() in
387cdf0e10cSrcweir 		// SdrCreateView::MovCreateObj and there the ApplicationBackgroundColor
388cdf0e10cSrcweir 		// is needed it is necessary to set it here.
389cdf0e10cSrcweir 		if(mpDrawView!=NULL && GetDoc()!=NULL)
390cdf0e10cSrcweir 		{
391cdf0e10cSrcweir 			svtools::ColorConfig aColorConfig;
392cdf0e10cSrcweir 			Color aFillColor;
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 			if(DOCUMENT_TYPE_IMPRESS == GetDoc()->GetDocumentType())
395cdf0e10cSrcweir 			{
396cdf0e10cSrcweir 				aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
397cdf0e10cSrcweir 			}
398cdf0e10cSrcweir 			else
399cdf0e10cSrcweir 			{
400cdf0e10cSrcweir 				aFillColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
401cdf0e10cSrcweir 			}
402cdf0e10cSrcweir 
403cdf0e10cSrcweir 			mpDrawView->SetApplicationBackgroundColor(aFillColor);
404cdf0e10cSrcweir 		}
405cdf0e10cSrcweir 
406cdf0e10cSrcweir 		ViewShell::MouseMove(rMEvt, pWin);
407cdf0e10cSrcweir 
408cdf0e10cSrcweir 		if( !mbMousePosFreezed )
409cdf0e10cSrcweir 			maMousePos = rMEvt.GetPosPixel();
410cdf0e10cSrcweir 
411cdf0e10cSrcweir 		Rectangle aRect;
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 		if ( mbIsRulerDrag )
414cdf0e10cSrcweir 		{
415cdf0e10cSrcweir 			Point aLogPos = GetActiveWindow()->PixelToLogic(maMousePos);
416cdf0e10cSrcweir 			mpDrawView->MovAction(aLogPos);
417cdf0e10cSrcweir 		}
418cdf0e10cSrcweir 
419cdf0e10cSrcweir 		if ( mpDrawView->IsAction() )
420cdf0e10cSrcweir 		{
421cdf0e10cSrcweir 			mpDrawView->TakeActionRect(aRect);
422cdf0e10cSrcweir 			aRect = GetActiveWindow()->LogicToPixel(aRect);
423cdf0e10cSrcweir 		}
424cdf0e10cSrcweir 		else
425cdf0e10cSrcweir 		{
426cdf0e10cSrcweir 			aRect = Rectangle(maMousePos, maMousePos);
427cdf0e10cSrcweir 		}
428cdf0e10cSrcweir 
429cdf0e10cSrcweir 		ShowMousePosInfo(aRect, pWin);
430cdf0e10cSrcweir 
431cdf0e10cSrcweir 		if ( mbPipette && GetViewFrame()->HasChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() ) )
432cdf0e10cSrcweir 		{
433cdf0e10cSrcweir 			const long		nStartX = maMousePos.X() - PIPETTE_RANGE;
434cdf0e10cSrcweir 			const long		nEndX = maMousePos.X() + PIPETTE_RANGE;
435cdf0e10cSrcweir 			const long		nStartY = maMousePos.Y() - PIPETTE_RANGE;
436cdf0e10cSrcweir 			const long		nEndY = maMousePos.Y() + PIPETTE_RANGE;
437cdf0e10cSrcweir 			long			nRed = 0;
438cdf0e10cSrcweir 			long			nGreen = 0;
439cdf0e10cSrcweir 			long			nBlue = 0;
440cdf0e10cSrcweir 			const double	fDiv = ( ( PIPETTE_RANGE << 1 ) + 1 ) * ( ( PIPETTE_RANGE << 1 ) + 1 );
441cdf0e10cSrcweir 
442cdf0e10cSrcweir 			for ( long nY = nStartY; nY <= nEndY; nY++ )
443cdf0e10cSrcweir 			{
444cdf0e10cSrcweir 				for( long nX = nStartX; nX <= nEndX; nX++ )
445cdf0e10cSrcweir 				{
446cdf0e10cSrcweir 					const Color aCol( pWin->GetPixel( pWin->PixelToLogic( Point( nX, nY ) ) ) );
447cdf0e10cSrcweir 
448cdf0e10cSrcweir 					nRed += aCol.GetRed();
449cdf0e10cSrcweir 					nGreen += aCol.GetGreen();
450cdf0e10cSrcweir 					nBlue += aCol.GetBlue();
451cdf0e10cSrcweir 				}
452cdf0e10cSrcweir 			}
453cdf0e10cSrcweir 
454cdf0e10cSrcweir 			( (SvxBmpMask*) GetViewFrame()->GetChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )->
455cdf0e10cSrcweir 				SetColor( Color( (sal_uInt8) ( nRed / fDiv + .5 ),
456cdf0e10cSrcweir 								 (sal_uInt8) ( nGreen / fDiv + .5 ),
457cdf0e10cSrcweir 								 (sal_uInt8) ( nBlue / fDiv + .5 ) ) );
458cdf0e10cSrcweir 		}
459cdf0e10cSrcweir 	}
460cdf0e10cSrcweir }
461cdf0e10cSrcweir 
462cdf0e10cSrcweir 
463cdf0e10cSrcweir /*************************************************************************
464cdf0e10cSrcweir |*
465cdf0e10cSrcweir |* MouseButtonUp event
466cdf0e10cSrcweir |*
467cdf0e10cSrcweir \************************************************************************/
468cdf0e10cSrcweir 
MouseButtonUp(const MouseEvent & rMEvt,::sd::Window * pWin)469cdf0e10cSrcweir void DrawViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
470cdf0e10cSrcweir {
471cdf0e10cSrcweir 	if ( !IsInputLocked() )
472cdf0e10cSrcweir 	{
473cdf0e10cSrcweir 		FASTBOOL bIsSetPageOrg = mpDrawView->IsSetPageOrg();
474cdf0e10cSrcweir 
475cdf0e10cSrcweir 		if (mbIsRulerDrag)
476cdf0e10cSrcweir 		{
477cdf0e10cSrcweir 			Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel());
478cdf0e10cSrcweir 
479cdf0e10cSrcweir 			if (aOutputArea.IsInside(rMEvt.GetPosPixel()))
480cdf0e10cSrcweir 			{
481cdf0e10cSrcweir 				mpDrawView->EndAction();
482cdf0e10cSrcweir 
483cdf0e10cSrcweir 				if (bIsSetPageOrg)
484cdf0e10cSrcweir 					GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET);
485cdf0e10cSrcweir 			}
486cdf0e10cSrcweir 			else if (rMEvt.IsLeft() && bIsSetPageOrg)
487cdf0e10cSrcweir 			{
488cdf0e10cSrcweir 				mpDrawView->BrkAction();
489cdf0e10cSrcweir 				SdPage* pPage = (SdPage*) mpDrawView->GetSdrPageView()->GetPage();
490cdf0e10cSrcweir 				Point aOrg(pPage->GetLftBorder(), pPage->GetUppBorder());
491cdf0e10cSrcweir 				mpDrawView->GetSdrPageView()->SetPageOrigin(aOrg);
492cdf0e10cSrcweir 				GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET);
493cdf0e10cSrcweir 			}
494cdf0e10cSrcweir 			else
495cdf0e10cSrcweir 			{
496cdf0e10cSrcweir 				mpDrawView->BrkAction();
497cdf0e10cSrcweir 			}
498cdf0e10cSrcweir 
499cdf0e10cSrcweir 			GetActiveWindow()->ReleaseMouse();
500cdf0e10cSrcweir 			mbIsRulerDrag = sal_False;
501cdf0e10cSrcweir 		}
502cdf0e10cSrcweir 		else
503cdf0e10cSrcweir     		ViewShell::MouseButtonUp(rMEvt, pWin);
504*0deba7fbSSteve Yin 		//Solution: If object is marked , the corresponding entry is set true ,
505*0deba7fbSSteve Yin 		//else the corresponding entry is set false .
506*0deba7fbSSteve Yin 		FreshNavigatrTree();
507cdf0e10cSrcweir 	}
508cdf0e10cSrcweir }
509cdf0e10cSrcweir 
510cdf0e10cSrcweir /*************************************************************************
511cdf0e10cSrcweir |*
512cdf0e10cSrcweir |* Command event
513cdf0e10cSrcweir |*
514cdf0e10cSrcweir \************************************************************************/
515cdf0e10cSrcweir 
Command(const CommandEvent & rCEvt,::sd::Window * pWin)516cdf0e10cSrcweir void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
517cdf0e10cSrcweir {
518cdf0e10cSrcweir     // The command event is send to the window after a possible context
519cdf0e10cSrcweir     // menu from an inplace client is closed. Now we have the chance to
520cdf0e10cSrcweir     // deactivate the inplace client without any problem regarding parent
521cdf0e10cSrcweir     // windows and code on the stack.
522cdf0e10cSrcweir     // For more information, see #126086# and #128122#
523cdf0e10cSrcweir     SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient();
524cdf0e10cSrcweir     sal_Bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() );
525cdf0e10cSrcweir     if ( bIsOleActive && ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ))
526cdf0e10cSrcweir     {
527cdf0e10cSrcweir         // Deactivate OLE object
528cdf0e10cSrcweir         mpDrawView->UnmarkAll();
529cdf0e10cSrcweir         SelectionHasChanged();
530cdf0e10cSrcweir         return;
531cdf0e10cSrcweir     }
532cdf0e10cSrcweir 
533cdf0e10cSrcweir     if ( !IsInputLocked() )
534cdf0e10cSrcweir 	{
535cdf0e10cSrcweir 	    if( GetView() &&GetView()->getSmartTags().Command(rCEvt) )
536cdf0e10cSrcweir 	        return;
537cdf0e10cSrcweir 
538cdf0e10cSrcweir 		const bool bNativeShow (SlideShow::IsRunning(GetViewShellBase()));
539cdf0e10cSrcweir 
540cdf0e10cSrcweir         if( rCEvt.GetCommand() == COMMAND_PASTESELECTION && !bNativeShow )
541cdf0e10cSrcweir         {
542cdf0e10cSrcweir 			TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSelection( GetActiveWindow() ) );
543cdf0e10cSrcweir 
544cdf0e10cSrcweir 			if( aDataHelper.GetTransferable().is() )
545cdf0e10cSrcweir 			{
546cdf0e10cSrcweir             	Point       aPos;
547cdf0e10cSrcweir                 sal_Int8    nDnDAction = DND_ACTION_COPY;
548cdf0e10cSrcweir 
549cdf0e10cSrcweir 		        if( GetActiveWindow() )
550cdf0e10cSrcweir 			        aPos = GetActiveWindow()->PixelToLogic( rCEvt.GetMousePosPixel() );
551cdf0e10cSrcweir 
552cdf0e10cSrcweir 				if( !mpDrawView->InsertData( aDataHelper, aPos, nDnDAction, sal_False ) )
553cdf0e10cSrcweir 				{
554cdf0e10cSrcweir 					INetBookmark	aINetBookmark( aEmptyStr, aEmptyStr );
555cdf0e10cSrcweir 
556cdf0e10cSrcweir 					if( ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
557cdf0e10cSrcweir 						  aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) ||
558cdf0e10cSrcweir 						( aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) &&
559cdf0e10cSrcweir 						  aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, aINetBookmark ) ) ||
560cdf0e10cSrcweir 						( aDataHelper.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) &&
561cdf0e10cSrcweir 						  aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, aINetBookmark ) ) )
562cdf0e10cSrcweir 					{
563cdf0e10cSrcweir 						InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL );
564cdf0e10cSrcweir 					}
565cdf0e10cSrcweir 				}
566cdf0e10cSrcweir 			}
567cdf0e10cSrcweir         }
568cdf0e10cSrcweir         else if( rCEvt.GetCommand() == COMMAND_CONTEXTMENU && !bNativeShow &&
569cdf0e10cSrcweir 			     pWin != NULL && !mpDrawView->IsAction() && !SD_MOD()->GetWaterCan() )
570cdf0e10cSrcweir 		{
571cdf0e10cSrcweir 			sal_uInt16 nSdResId = 0;          // ResourceID fuer Popup-Menue
572cdf0e10cSrcweir 			sal_Bool bGraphicShell = this->ISA(GraphicViewShell);
573cdf0e10cSrcweir 
574cdf0e10cSrcweir 			// Ist ein Fangobjekt unter dem Mauszeiger?
575cdf0e10cSrcweir 			SdrPageView* pPV;
576cdf0e10cSrcweir 			Point	aMPos = pWin->PixelToLogic( maMousePos );
577cdf0e10cSrcweir 			sal_uInt16	nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic(
578cdf0e10cSrcweir                 Size(FuPoor::HITPIX, 0 ) ).Width();
579cdf0e10cSrcweir 			sal_uInt16	nHelpLine;
580cdf0e10cSrcweir 			// fuer Klebepunkt
581cdf0e10cSrcweir 			SdrObject*	pObj = NULL;
582cdf0e10cSrcweir 			sal_uInt16		nPickId = 0;
583cdf0e10cSrcweir 			// fuer Feldbefehl
584cdf0e10cSrcweir 			OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
585cdf0e10cSrcweir 			const SvxFieldItem* pFldItem = NULL;
586cdf0e10cSrcweir 			if( pOLV )
587cdf0e10cSrcweir 				pFldItem = pOLV->GetFieldAtSelection();
588cdf0e10cSrcweir 				//pFldItem = pOLV->GetFieldUnderMousePointer();
589cdf0e10cSrcweir 
590cdf0e10cSrcweir 			// Hilfslinie
591cdf0e10cSrcweir 			if ( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) )
592cdf0e10cSrcweir 			{
593cdf0e10cSrcweir 				nSdResId = RID_DRAW_SNAPOBJECT_POPUP;
594cdf0e10cSrcweir                 ShowSnapLineContextMenu(*pPV, nHelpLine, rCEvt.GetMousePosPixel());
595cdf0e10cSrcweir                 return;
596cdf0e10cSrcweir 			}
597cdf0e10cSrcweir 			// Klebepunkt unter dem Mauszeiger markiert?
598cdf0e10cSrcweir 			else if( mpDrawView->PickGluePoint( aMPos, pObj, nPickId, pPV ) &&
599cdf0e10cSrcweir 					 mpDrawView->IsGluePointMarked( pObj, nPickId ) )
600cdf0e10cSrcweir 			{
601cdf0e10cSrcweir 				nSdResId = RID_DRAW_GLUEPOINT_POPUP;
602cdf0e10cSrcweir 			}
603cdf0e10cSrcweir 			// Feldbefehl ?
604cdf0e10cSrcweir 			else if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
605cdf0e10cSrcweir 								 pFldItem->GetField()->ISA( SvxExtTimeField ) ||
606cdf0e10cSrcweir 								 pFldItem->GetField()->ISA( SvxExtFileField ) ||
607cdf0e10cSrcweir 								 pFldItem->GetField()->ISA( SvxAuthorField ) ) )
608cdf0e10cSrcweir 			{
609cdf0e10cSrcweir                 LanguageType eLanguage( LANGUAGE_SYSTEM );
610cdf0e10cSrcweir 
611cdf0e10cSrcweir                 // #101743# Format popup with outliner language, if possible
612cdf0e10cSrcweir                 if( pOLV->GetOutliner() )
613cdf0e10cSrcweir                 {
614cdf0e10cSrcweir                     ESelection aSelection( pOLV->GetSelection() );
615cdf0e10cSrcweir                     eLanguage = pOLV->GetOutliner()->GetLanguage( aSelection.nStartPara, aSelection.nStartPos );
616cdf0e10cSrcweir                 }
617cdf0e10cSrcweir 
618cdf0e10cSrcweir                 SdFieldPopup aFieldPopup( pFldItem->GetField(), eLanguage );
619cdf0e10cSrcweir 
620cdf0e10cSrcweir 				if ( rCEvt.IsMouseEvent() )
621cdf0e10cSrcweir 					aMPos = rCEvt.GetMousePosPixel();
622cdf0e10cSrcweir 				else
623cdf0e10cSrcweir 					aMPos = Point( 20, 20 );
624cdf0e10cSrcweir 				aFieldPopup.Execute( pWin, aMPos );
625cdf0e10cSrcweir 
626cdf0e10cSrcweir 				SvxFieldData* pField = aFieldPopup.GetField();
627cdf0e10cSrcweir 				if( pField )
628cdf0e10cSrcweir 				{
629cdf0e10cSrcweir                     SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
630cdf0e10cSrcweir 					//pOLV->DeleteSelected(); <-- fehlt leider !
631cdf0e10cSrcweir 					// Feld selektieren, so dass es beim Insert geloescht wird
632cdf0e10cSrcweir 					ESelection aSel = pOLV->GetSelection();
633cdf0e10cSrcweir 					sal_Bool bSel = sal_True;
634cdf0e10cSrcweir 					if( aSel.nStartPos == aSel.nEndPos )
635cdf0e10cSrcweir 					{
636cdf0e10cSrcweir 						bSel = sal_False;
637cdf0e10cSrcweir 						aSel.nEndPos++;
638cdf0e10cSrcweir 					}
639cdf0e10cSrcweir 					pOLV->SetSelection( aSel );
640cdf0e10cSrcweir 
641cdf0e10cSrcweir 					pOLV->InsertField( aFieldItem );
642cdf0e10cSrcweir 
643cdf0e10cSrcweir 					// Selektion wird wieder in den Ursprungszustand gebracht
644cdf0e10cSrcweir 					if( !bSel )
645cdf0e10cSrcweir 						aSel.nEndPos--;
646cdf0e10cSrcweir 					pOLV->SetSelection( aSel );
647cdf0e10cSrcweir 
648cdf0e10cSrcweir 					delete pField;
649cdf0e10cSrcweir 				}
650cdf0e10cSrcweir 			}
651cdf0e10cSrcweir 			else
652cdf0e10cSrcweir 			{
653cdf0e10cSrcweir 				// ist etwas selektiert?
654cdf0e10cSrcweir 				if (mpDrawView->AreObjectsMarked() &&
655cdf0e10cSrcweir 					mpDrawView->GetMarkedObjectList().GetMarkCount() == 1 )
656cdf0e10cSrcweir 				{
657cdf0e10cSrcweir 					pObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
658cdf0e10cSrcweir 					if( HasCurrentFunction(SID_BEZIER_EDIT)	&& (dynamic_cast< SdrPathObj * >( pObj ) != 0 ) )
659cdf0e10cSrcweir 					{
660cdf0e10cSrcweir 						nSdResId = RID_BEZIER_POPUP;
661cdf0e10cSrcweir 					}
662cdf0e10cSrcweir 					else
663cdf0e10cSrcweir 					{
664cdf0e10cSrcweir 						if( mpDrawView->GetTextEditObject() )
665cdf0e10cSrcweir 						{
666cdf0e10cSrcweir 							OutlinerView* pOutlinerView = mpDrawView->GetTextEditOutlinerView();
667cdf0e10cSrcweir 							Point aPos(rCEvt.GetMousePosPixel());
668cdf0e10cSrcweir 
669cdf0e10cSrcweir 							if ( pOutlinerView )
670cdf0e10cSrcweir 							{
671cdf0e10cSrcweir 								if( (  rCEvt.IsMouseEvent() && pOutlinerView->IsWrongSpelledWordAtPos(aPos) ) ||
672cdf0e10cSrcweir 								    ( !rCEvt.IsMouseEvent() && pOutlinerView->IsCursorAtWrongSpelledWord() ) )
673cdf0e10cSrcweir 								{
674cdf0e10cSrcweir 									// #91457# Popup for Online-Spelling now handled by DrawDocShell
675cdf0e10cSrcweir 									// Link aLink = LINK(GetDoc(), SdDrawDocument, OnlineSpellCallback);
676cdf0e10cSrcweir 									Link aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback);
677cdf0e10cSrcweir 
678cdf0e10cSrcweir 									if( !rCEvt.IsMouseEvent() )
679cdf0e10cSrcweir 									{
680cdf0e10cSrcweir 										aPos = GetActiveWindow()->LogicToPixel( pOutlinerView->GetEditView().GetCursor()->GetPos() );
681cdf0e10cSrcweir 									}
682cdf0e10cSrcweir                                     // While showing the spell context menu
683cdf0e10cSrcweir                                     // we lock the input so that another
684cdf0e10cSrcweir                                     // context menu can not be opened during
685cdf0e10cSrcweir                                     // that time (crash #i43235#).  In order
686cdf0e10cSrcweir                                     // to not lock the UI completely we
687cdf0e10cSrcweir                                     // first release the mouse.
688cdf0e10cSrcweir                                     GetActiveWindow()->ReleaseMouse();
689cdf0e10cSrcweir                                     LockInput();
690cdf0e10cSrcweir 									pOutlinerView->ExecuteSpellPopup(aPos, &aLink);
691cdf0e10cSrcweir                                     UnlockInput();
692cdf0e10cSrcweir 								}
693cdf0e10cSrcweir 								else
694cdf0e10cSrcweir 								{
695cdf0e10cSrcweir 								    if( (pObj->GetObjInventor() == SdrInventor) && (pObj->GetObjIdentifier() == OBJ_TABLE) )
696cdf0e10cSrcweir 								    {
697cdf0e10cSrcweir 								        nSdResId = RID_DRAW_TABLEOBJ_INSIDE_POPUP;
698cdf0e10cSrcweir 								    }
699cdf0e10cSrcweir 								    else
700cdf0e10cSrcweir 								    {
701cdf0e10cSrcweir 								        nSdResId = RID_DRAW_TEXTOBJ_INSIDE_POPUP;
702cdf0e10cSrcweir 								    }
703cdf0e10cSrcweir 								}
704cdf0e10cSrcweir 							}
705cdf0e10cSrcweir 						}
706cdf0e10cSrcweir 						else
707cdf0e10cSrcweir 						{
708cdf0e10cSrcweir 							sal_uInt32 nInv = pObj->GetObjInventor();
709cdf0e10cSrcweir 							sal_uInt16 nId = pObj->GetObjIdentifier();
710cdf0e10cSrcweir 
711cdf0e10cSrcweir 							if (nInv == SdrInventor)
712cdf0e10cSrcweir 							{
713cdf0e10cSrcweir 								switch ( nId )
714cdf0e10cSrcweir 								{
715cdf0e10cSrcweir 									case OBJ_CAPTION:
716cdf0e10cSrcweir 									case OBJ_TITLETEXT:
717cdf0e10cSrcweir 									case OBJ_OUTLINETEXT:
718cdf0e10cSrcweir 									case OBJ_TEXT:
719cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_TEXTOBJ_POPUP :
720cdf0e10cSrcweir 																	RID_DRAW_TEXTOBJ_POPUP;
721cdf0e10cSrcweir 										break;
722cdf0e10cSrcweir 
723cdf0e10cSrcweir 									case OBJ_PATHLINE:
724cdf0e10cSrcweir 									case OBJ_PLIN:
725cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_POLYLINEOBJ_POPUP :
726cdf0e10cSrcweir 																	RID_DRAW_POLYLINEOBJ_POPUP;
727cdf0e10cSrcweir 										break;
728cdf0e10cSrcweir 
729cdf0e10cSrcweir 									case OBJ_FREELINE:
730cdf0e10cSrcweir 									case OBJ_EDGE:		// Connector
731cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_EDGEOBJ_POPUP :
732cdf0e10cSrcweir 																	RID_DRAW_EDGEOBJ_POPUP;
733cdf0e10cSrcweir 										break;
734cdf0e10cSrcweir 
735cdf0e10cSrcweir 									case OBJ_LINE:
736cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_LINEOBJ_POPUP :
737cdf0e10cSrcweir 																	RID_DRAW_LINEOBJ_POPUP;
738cdf0e10cSrcweir 										break;
739cdf0e10cSrcweir 
740cdf0e10cSrcweir 									case OBJ_MEASURE:
741cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_MEASUREOBJ_POPUP :
742cdf0e10cSrcweir 																	RID_DRAW_MEASUREOBJ_POPUP;
743cdf0e10cSrcweir 										break;
744cdf0e10cSrcweir 
745cdf0e10cSrcweir 									case OBJ_RECT:
746cdf0e10cSrcweir 									case OBJ_CIRC:
747cdf0e10cSrcweir 									case OBJ_FREEFILL:
748cdf0e10cSrcweir 									case OBJ_PATHFILL:
749cdf0e10cSrcweir 									case OBJ_POLY:
750cdf0e10cSrcweir 									case OBJ_SECT:
751cdf0e10cSrcweir 									case OBJ_CARC:
752cdf0e10cSrcweir 									case OBJ_CCUT:
753cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_GEOMOBJ_POPUP :
754cdf0e10cSrcweir 																	RID_DRAW_GEOMOBJ_POPUP;
755cdf0e10cSrcweir 										break;
756cdf0e10cSrcweir 
757cdf0e10cSrcweir 									case OBJ_CUSTOMSHAPE:
758cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_CUSTOMSHAPE_POPUP :
759cdf0e10cSrcweir 																	RID_DRAW_CUSTOMSHAPE_POPUP;
760cdf0e10cSrcweir 										break;
761cdf0e10cSrcweir 
762cdf0e10cSrcweir 									case OBJ_GRUP:
763cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_GROUPOBJ_POPUP :
764cdf0e10cSrcweir 																	RID_DRAW_GROUPOBJ_POPUP;
765cdf0e10cSrcweir 										break;
766cdf0e10cSrcweir 
767cdf0e10cSrcweir 									case OBJ_GRAF:
768cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_GRAPHIC_POPUP :
769cdf0e10cSrcweir 																	RID_DRAW_GRAPHIC_POPUP;
770cdf0e10cSrcweir 										break;
771cdf0e10cSrcweir 
772cdf0e10cSrcweir 									case OBJ_OLE2:
773cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_OLE2_POPUP :
774cdf0e10cSrcweir 																	RID_DRAW_OLE2_POPUP;
775cdf0e10cSrcweir 										break;
776cdf0e10cSrcweir 									case OBJ_MEDIA:
777cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_MEDIA_POPUP :
778cdf0e10cSrcweir 																	RID_DRAW_MEDIA_POPUP;
779cdf0e10cSrcweir 										break;
780cdf0e10cSrcweir 									case OBJ_TABLE:
781cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_TABLE_POPUP :
782cdf0e10cSrcweir 																	RID_DRAW_TABLE_POPUP;
783cdf0e10cSrcweir 										break;
784cdf0e10cSrcweir 								}
785cdf0e10cSrcweir 							}
786cdf0e10cSrcweir 							else if( nInv == E3dInventor /*&& nId == E3D_POLYSCENE_ID*/)
787cdf0e10cSrcweir 							{
788cdf0e10cSrcweir 								if( nId == E3D_POLYSCENE_ID || nId == E3D_SCENE_ID )
789cdf0e10cSrcweir 								{
790cdf0e10cSrcweir 									if( !mpDrawView->IsGroupEntered() )
791cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_3DSCENE_POPUP :
792cdf0e10cSrcweir 																RID_DRAW_3DSCENE_POPUP;
793cdf0e10cSrcweir 									else
794cdf0e10cSrcweir 										nSdResId = bGraphicShell ? RID_GRAPHIC_3DSCENE2_POPUP :
795cdf0e10cSrcweir 																RID_DRAW_3DSCENE2_POPUP;
796cdf0e10cSrcweir 								}
797cdf0e10cSrcweir 								else
798cdf0e10cSrcweir 									nSdResId = bGraphicShell ? RID_GRAPHIC_3DOBJ_POPUP :
799cdf0e10cSrcweir 																RID_DRAW_3DOBJ_POPUP;
800cdf0e10cSrcweir 							}
801cdf0e10cSrcweir 							else if( nInv == FmFormInventor )
802cdf0e10cSrcweir 							{
803cdf0e10cSrcweir 								nSdResId = RID_FORM_CONTROL_POPUP;
804cdf0e10cSrcweir 							}
805cdf0e10cSrcweir 						}
806cdf0e10cSrcweir 					}
807cdf0e10cSrcweir 				}
808cdf0e10cSrcweir 
809cdf0e10cSrcweir 				// Mehrfachselektion
810cdf0e10cSrcweir 				else if (mpDrawView->AreObjectsMarked() &&
811cdf0e10cSrcweir 					mpDrawView->GetMarkedObjectList().GetMarkCount() > 1 )
812cdf0e10cSrcweir 				{
813cdf0e10cSrcweir 					nSdResId = bGraphicShell ? RID_GRAPHIC_MULTISELECTION_POPUP :
814cdf0e10cSrcweir 												RID_DRAW_MULTISELECTION_POPUP;
815cdf0e10cSrcweir 				}
816cdf0e10cSrcweir 
817cdf0e10cSrcweir 				// nichts selektiert
818cdf0e10cSrcweir 				else
819cdf0e10cSrcweir 				{
820cdf0e10cSrcweir 					nSdResId = bGraphicShell ? RID_GRAPHIC_NOSEL_POPUP :
821cdf0e10cSrcweir 												RID_DRAW_NOSEL_POPUP;
822cdf0e10cSrcweir 				}
823cdf0e10cSrcweir 			}
824cdf0e10cSrcweir 			// Popup-Menue anzeigen
825cdf0e10cSrcweir 			if (nSdResId)
826cdf0e10cSrcweir 			{
827cdf0e10cSrcweir 				GetActiveWindow()->ReleaseMouse();
828cdf0e10cSrcweir 
829cdf0e10cSrcweir                 if(rCEvt.IsMouseEvent())
830cdf0e10cSrcweir 				    GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(nSdResId));
831cdf0e10cSrcweir                 else
832cdf0e10cSrcweir                 {
833cdf0e10cSrcweir                     //#106326# don't open contextmenu at mouse position if not opened via mouse
834cdf0e10cSrcweir 
835cdf0e10cSrcweir                     //middle of the window if nothing is marked
836cdf0e10cSrcweir                     Point aMenuPos(GetActiveWindow()->GetSizePixel().Width()/2
837cdf0e10cSrcweir                             ,GetActiveWindow()->GetSizePixel().Height()/2);
838cdf0e10cSrcweir 
839cdf0e10cSrcweir                     //middle of the bounding rect if something is marked
840cdf0e10cSrcweir                     if( mpDrawView->AreObjectsMarked() && mpDrawView->GetMarkedObjectList().GetMarkCount() >= 1 )
841cdf0e10cSrcweir                     {
842cdf0e10cSrcweir                         Rectangle aMarkRect;
843cdf0e10cSrcweir                         mpDrawView->GetMarkedObjectList().TakeBoundRect(NULL,aMarkRect);
844cdf0e10cSrcweir                         aMenuPos = GetActiveWindow()->LogicToPixel( aMarkRect.Center() );
845cdf0e10cSrcweir 
846cdf0e10cSrcweir                         //move the point into the visible window area
847cdf0e10cSrcweir                         if( aMenuPos.X() < 0 )
848cdf0e10cSrcweir                             aMenuPos.X() = 0;
849cdf0e10cSrcweir                         if( aMenuPos.Y() < 0 )
850cdf0e10cSrcweir                             aMenuPos.Y() = 0;
851cdf0e10cSrcweir                         if( aMenuPos.X() > GetActiveWindow()->GetSizePixel().Width() )
852cdf0e10cSrcweir                             aMenuPos.X() = GetActiveWindow()->GetSizePixel().Width();
853cdf0e10cSrcweir                         if( aMenuPos.Y() > GetActiveWindow()->GetSizePixel().Height() )
854cdf0e10cSrcweir                             aMenuPos.Y() = GetActiveWindow()->GetSizePixel().Height();
855cdf0e10cSrcweir                     }
856cdf0e10cSrcweir 
857cdf0e10cSrcweir                     //open context menu at that point
858cdf0e10cSrcweir                     GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(nSdResId),GetActiveWindow(),&aMenuPos);
859cdf0e10cSrcweir                 }
860cdf0e10cSrcweir 				mbMousePosFreezed = sal_False;
861cdf0e10cSrcweir 			}
862cdf0e10cSrcweir 		}
863cdf0e10cSrcweir 		else
864cdf0e10cSrcweir 		{
865cdf0e10cSrcweir 			ViewShell::Command(rCEvt, pWin);
866cdf0e10cSrcweir 		}
867cdf0e10cSrcweir 	}
868cdf0e10cSrcweir }
869cdf0e10cSrcweir 
870cdf0e10cSrcweir /*************************************************************************
871cdf0e10cSrcweir |*
872cdf0e10cSrcweir |* Linealmarkierungen anzeigen
873cdf0e10cSrcweir |*
874cdf0e10cSrcweir \************************************************************************/
875cdf0e10cSrcweir 
ShowMousePosInfo(const Rectangle & rRect,::sd::Window * pWin)876cdf0e10cSrcweir void DrawViewShell::ShowMousePosInfo(const Rectangle& rRect,
877cdf0e10cSrcweir     ::sd::Window* pWin)
878cdf0e10cSrcweir {
879cdf0e10cSrcweir 	if (mbHasRulers && pWin )
880cdf0e10cSrcweir 	{
881cdf0e10cSrcweir 		RulerLine	pHLines[2];
882cdf0e10cSrcweir 		RulerLine	pVLines[2];
883cdf0e10cSrcweir 		long        nHOffs = 0L;
884cdf0e10cSrcweir 		long        nVOffs = 0L;
885cdf0e10cSrcweir 		sal_uInt16		nCnt;
886cdf0e10cSrcweir 
887cdf0e10cSrcweir         if (mpHorizontalRuler.get() != NULL)
888cdf0e10cSrcweir             mpHorizontalRuler->SetLines();
889cdf0e10cSrcweir 
890cdf0e10cSrcweir         if (mpVerticalRuler.get() != NULL)
891cdf0e10cSrcweir             mpVerticalRuler->SetLines();
892cdf0e10cSrcweir 
893cdf0e10cSrcweir 		if (mpHorizontalRuler.get() != NULL)
894cdf0e10cSrcweir 		{
895cdf0e10cSrcweir 			nHOffs = mpHorizontalRuler->GetNullOffset() +
896cdf0e10cSrcweir 					 mpHorizontalRuler->GetPageOffset();
897cdf0e10cSrcweir 		}
898cdf0e10cSrcweir 
899cdf0e10cSrcweir 		if (mpVerticalRuler.get() != NULL)
900cdf0e10cSrcweir 		{
901cdf0e10cSrcweir 			nVOffs = mpVerticalRuler->GetNullOffset() +
902cdf0e10cSrcweir 					 mpVerticalRuler->GetPageOffset();
903cdf0e10cSrcweir 		}
904cdf0e10cSrcweir 
905cdf0e10cSrcweir 		nCnt = 1;
906cdf0e10cSrcweir 		pHLines[0].nPos = rRect.Left() - nHOffs;
907cdf0e10cSrcweir 		pVLines[0].nPos = rRect.Top()  - nVOffs;
908cdf0e10cSrcweir 		pHLines[0].nStyle = 0;
909cdf0e10cSrcweir 		pVLines[0].nStyle = 0;
910cdf0e10cSrcweir 
911cdf0e10cSrcweir 		if ( rRect.Right() != rRect.Left() || rRect.Bottom() != rRect.Top() )
912cdf0e10cSrcweir 		{
913cdf0e10cSrcweir 			pHLines[1].nPos = rRect.Right()  - nHOffs;
914cdf0e10cSrcweir 			pVLines[1].nPos = rRect.Bottom() - nVOffs;
915cdf0e10cSrcweir 			pHLines[1].nStyle = 0;
916cdf0e10cSrcweir 			pVLines[1].nStyle = 0;
917cdf0e10cSrcweir 			nCnt++;
918cdf0e10cSrcweir 		}
919cdf0e10cSrcweir 
920cdf0e10cSrcweir 		if (mpHorizontalRuler.get() != NULL)
921cdf0e10cSrcweir 			mpHorizontalRuler->SetLines(nCnt, pHLines);
922cdf0e10cSrcweir 		if (mpVerticalRuler.get() != NULL)
923cdf0e10cSrcweir 			mpVerticalRuler->SetLines(nCnt, pVLines);
924cdf0e10cSrcweir 	}
925cdf0e10cSrcweir 
926cdf0e10cSrcweir 	// StatusBar Koordinatenanzeige
927cdf0e10cSrcweir     OSL_ASSERT (GetViewShell()!=NULL);
928cdf0e10cSrcweir     if ( !GetViewShell()->GetUIActiveClient() )
929cdf0e10cSrcweir 	{
930cdf0e10cSrcweir 		SfxItemSet aSet(GetPool(), SID_CONTEXT, SID_CONTEXT,
931cdf0e10cSrcweir 								   SID_ATTR_POSITION, SID_ATTR_POSITION,
932cdf0e10cSrcweir 								   SID_ATTR_SIZE, SID_ATTR_SIZE,
933cdf0e10cSrcweir 								   0L);
934cdf0e10cSrcweir 
935cdf0e10cSrcweir //		  GetStatusBarState(aSet);	nicht performant bei gedrueckter Modifiertaste!!
936cdf0e10cSrcweir 
937cdf0e10cSrcweir 		aSet.Put( SfxStringItem( SID_CONTEXT, mpDrawView->GetStatusText() ) );
938cdf0e10cSrcweir 
939cdf0e10cSrcweir 		SfxBindings& rBindings = GetViewFrame()->GetBindings();
940cdf0e10cSrcweir 		rBindings.SetState(aSet);
941cdf0e10cSrcweir 		rBindings.Invalidate(SID_CONTEXT);
942cdf0e10cSrcweir 		rBindings.Invalidate(SID_ATTR_POSITION);
943cdf0e10cSrcweir 		rBindings.Invalidate(SID_ATTR_SIZE);
944cdf0e10cSrcweir     }
945cdf0e10cSrcweir }
946cdf0e10cSrcweir 
947cdf0e10cSrcweir /*************************************************************************
948cdf0e10cSrcweir |*
949cdf0e10cSrcweir |*
950cdf0e10cSrcweir |*
951cdf0e10cSrcweir \************************************************************************/
952cdf0e10cSrcweir 
LockInput()953cdf0e10cSrcweir void DrawViewShell::LockInput()
954cdf0e10cSrcweir {
955cdf0e10cSrcweir 	mnLockCount++;
956cdf0e10cSrcweir }
957cdf0e10cSrcweir 
958cdf0e10cSrcweir /*************************************************************************
959cdf0e10cSrcweir |*
960cdf0e10cSrcweir |*
961cdf0e10cSrcweir |*
962cdf0e10cSrcweir \************************************************************************/
963cdf0e10cSrcweir 
UnlockInput()964cdf0e10cSrcweir void DrawViewShell::UnlockInput()
965cdf0e10cSrcweir {
966cdf0e10cSrcweir 	DBG_ASSERT( mnLockCount, "Input for this shell is not locked!" );
967cdf0e10cSrcweir 	if ( mnLockCount )
968cdf0e10cSrcweir 		mnLockCount--;
969cdf0e10cSrcweir }
970cdf0e10cSrcweir 
971cdf0e10cSrcweir 
972cdf0e10cSrcweir 
973cdf0e10cSrcweir 
ShowSnapLineContextMenu(SdrPageView & rPageView,const sal_uInt16 nSnapLineIndex,const Point & rMouseLocation)974cdf0e10cSrcweir void DrawViewShell::ShowSnapLineContextMenu (
975cdf0e10cSrcweir     SdrPageView& rPageView,
976cdf0e10cSrcweir     const sal_uInt16 nSnapLineIndex,
977cdf0e10cSrcweir     const Point& rMouseLocation)
978cdf0e10cSrcweir {
979cdf0e10cSrcweir     const SdrHelpLine& rHelpLine (rPageView.GetHelpLines()[nSnapLineIndex]);
980cdf0e10cSrcweir     ::boost::scoped_ptr<PopupMenu> pMenu (new PopupMenu ());
981cdf0e10cSrcweir 
982cdf0e10cSrcweir     if (rHelpLine.GetKind() == SDRHELPLINE_POINT)
983cdf0e10cSrcweir     {
984cdf0e10cSrcweir         pMenu->InsertItem(
985cdf0e10cSrcweir             SID_SET_SNAPITEM,
986cdf0e10cSrcweir             String(SdResId(STR_POPUP_EDIT_SNAPPOINT)));
987cdf0e10cSrcweir         pMenu->InsertSeparator();
988cdf0e10cSrcweir         pMenu->InsertItem(
989cdf0e10cSrcweir             SID_DELETE_SNAPITEM,
990cdf0e10cSrcweir             String(SdResId(STR_POPUP_DELETE_SNAPPOINT)));
991cdf0e10cSrcweir     }
992cdf0e10cSrcweir     else
993cdf0e10cSrcweir     {
994cdf0e10cSrcweir         pMenu->InsertItem(
995cdf0e10cSrcweir             SID_SET_SNAPITEM,
996cdf0e10cSrcweir             String(SdResId(STR_POPUP_EDIT_SNAPLINE)));
997cdf0e10cSrcweir         pMenu->InsertSeparator();
998cdf0e10cSrcweir         pMenu->InsertItem(
999cdf0e10cSrcweir             SID_DELETE_SNAPITEM,
1000cdf0e10cSrcweir             String(SdResId(STR_POPUP_DELETE_SNAPLINE)));
1001cdf0e10cSrcweir     }
1002cdf0e10cSrcweir 
1003cdf0e10cSrcweir     pMenu->RemoveDisabledEntries(sal_False, sal_False);
1004cdf0e10cSrcweir 
1005cdf0e10cSrcweir     const sal_uInt16 nResult = pMenu->Execute(
1006cdf0e10cSrcweir         GetActiveWindow(),
1007cdf0e10cSrcweir         Rectangle(rMouseLocation, Size(10,10)),
1008cdf0e10cSrcweir         POPUPMENU_EXECUTE_DOWN);
1009cdf0e10cSrcweir     switch (nResult)
1010cdf0e10cSrcweir     {
1011cdf0e10cSrcweir         case SID_SET_SNAPITEM:
1012cdf0e10cSrcweir         {
1013cdf0e10cSrcweir             SfxUInt32Item aHelpLineItem (ID_VAL_INDEX, nSnapLineIndex);
1014cdf0e10cSrcweir             const SfxPoolItem* aArguments[] = {&aHelpLineItem, NULL};
1015cdf0e10cSrcweir             GetViewFrame()->GetDispatcher()->Execute(
1016cdf0e10cSrcweir                 SID_SET_SNAPITEM,
1017cdf0e10cSrcweir                 SFX_CALLMODE_SLOT,
1018cdf0e10cSrcweir                 aArguments);
1019cdf0e10cSrcweir         }
1020cdf0e10cSrcweir         break;
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir         case SID_DELETE_SNAPITEM:
1023cdf0e10cSrcweir         {
1024cdf0e10cSrcweir             rPageView.DeleteHelpLine(nSnapLineIndex);
1025cdf0e10cSrcweir         }
1026cdf0e10cSrcweir         break;
1027cdf0e10cSrcweir 
1028cdf0e10cSrcweir         default:
1029cdf0e10cSrcweir             break;
1030cdf0e10cSrcweir     }
1031cdf0e10cSrcweir }
1032cdf0e10cSrcweir 
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir 
1035cdf0e10cSrcweir 
1036cdf0e10cSrcweir #ifdef _MSC_VER
1037cdf0e10cSrcweir #pragma optimize ( "", on )
1038cdf0e10cSrcweir #endif
1039cdf0e10cSrcweir 
1040cdf0e10cSrcweir } // end of namespace sd
1041