xref: /AOO41X/main/sd/source/ui/view/sdview.cxx (revision f120fe4110718eecb5f5933a421104aa4582f505)
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
10cdf0e10cSrcweir  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
27cdf0e10cSrcweir #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "View.hxx"
30cdf0e10cSrcweir #include <editeng/unolingu.hxx>
31cdf0e10cSrcweir #include <sfx2/request.hxx>
32cdf0e10cSrcweir #include <svx/obj3d.hxx>
33cdf0e10cSrcweir #include <svx/fmview.hxx>
34cdf0e10cSrcweir #include <editeng/outliner.hxx>
35cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC
36cdf0e10cSrcweir #include <svx/svxids.hrc>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #include <svx/svdograf.hxx>
39cdf0e10cSrcweir #include <svx/svdoole2.hxx>
40cdf0e10cSrcweir #include <svx/svdundo.hxx>
41cdf0e10cSrcweir #include <vcl/msgbox.hxx>
42cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
43cdf0e10cSrcweir #include <sfx2/app.hxx>
44cdf0e10cSrcweir #include <svx/svdpagv.hxx>
45cdf0e10cSrcweir #include <sfx2/docfile.hxx>
46cdf0e10cSrcweir #include <svx/svdoutl.hxx>
47cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #include <svx/svdetc.hxx>
50cdf0e10cSrcweir #include <editeng/editstat.hxx>
51cdf0e10cSrcweir 
52cdf0e10cSrcweir #include <svx/dialogs.hrc>
53cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
54*f120fe41SAndre Fischer #include <sfx2/sidebar/EnumContext.hxx>
55cdf0e10cSrcweir #include <svx/svdopage.hxx>
56cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
57cdf0e10cSrcweir #include <svx/xlndsit.hxx>
58cdf0e10cSrcweir #include <svx/xlineit0.hxx>
59cdf0e10cSrcweir #include <svx/xlnclit.hxx>
6095a18594SAndre Fischer #include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
61cdf0e10cSrcweir #include <vcl/virdev.hxx>
62cdf0e10cSrcweir 
63cdf0e10cSrcweir #include "app.hrc"
64cdf0e10cSrcweir #include "strings.hrc"
65cdf0e10cSrcweir #include "Window.hxx"
66cdf0e10cSrcweir #include "Client.hxx"
67cdf0e10cSrcweir #include "drawdoc.hxx"
68cdf0e10cSrcweir #include "DrawDocShell.hxx"
69cdf0e10cSrcweir #include "app.hxx"
70cdf0e10cSrcweir #include "sdpage.hxx"
71cdf0e10cSrcweir #include "glob.hrc"
72cdf0e10cSrcweir #include "sdresid.hxx"
73cdf0e10cSrcweir #include "DrawViewShell.hxx"
74cdf0e10cSrcweir #include "futext.hxx"
75cdf0e10cSrcweir #include "fuinsfil.hxx"
76cdf0e10cSrcweir #include "slideshow.hxx"
77cdf0e10cSrcweir #include "stlpool.hxx"
78cdf0e10cSrcweir #include "FrameView.hxx"
79cdf0e10cSrcweir #include "ViewClipboard.hxx"
80cdf0e10cSrcweir #include "undo/undomanager.hxx"
81cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontact.hxx>
82cdf0e10cSrcweir #include <svx/sdr/contact/viewcontact.hxx>
83cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx>
84cdf0e10cSrcweir #include "EventMultiplexer.hxx"
85cdf0e10cSrcweir #include "ViewShellBase.hxx"
86cdf0e10cSrcweir #include "ViewShellManager.hxx"
87cdf0e10cSrcweir 
88cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
89cdf0e10cSrcweir #include <basegfx/color/bcolor.hxx>
90cdf0e10cSrcweir #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
91cdf0e10cSrcweir #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
92cdf0e10cSrcweir #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
93cdf0e10cSrcweir #include <svx/sdr/contact/objectcontact.hxx>
94cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
95cdf0e10cSrcweir #include <drawinglayer/primitive2d/textprimitive2d.hxx>
96cdf0e10cSrcweir #include <svx/unoapi.hxx>
97cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrixtools.hxx>
98cdf0e10cSrcweir 
99cdf0e10cSrcweir #include <numeric>
100cdf0e10cSrcweir 
101cdf0e10cSrcweir using namespace com::sun::star;
102cdf0e10cSrcweir using namespace com::sun::star::uno;
103cdf0e10cSrcweir namespace sd {
104cdf0e10cSrcweir 
105cdf0e10cSrcweir #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
106cdf0e10cSrcweir #define SO2_DECL_SVINPLACEOBJECT_DEFINED
107cdf0e10cSrcweir SO2_DECL_REF(SvInPlaceObject)
108cdf0e10cSrcweir #endif
109cdf0e10cSrcweir 
110cdf0e10cSrcweir TYPEINIT1(View, FmFormView);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir /*************************************************************************
113cdf0e10cSrcweir |*
114cdf0e10cSrcweir |* Ctor
115cdf0e10cSrcweir |*
116cdf0e10cSrcweir \************************************************************************/
117cdf0e10cSrcweir 
118cdf0e10cSrcweir View::View(SdDrawDocument* pDrawDoc, OutputDevice* pOutDev,
119cdf0e10cSrcweir 			   ViewShell* pViewShell)
120cdf0e10cSrcweir   : FmFormView(pDrawDoc, pOutDev),
121cdf0e10cSrcweir 	mpDoc(pDrawDoc),
122cdf0e10cSrcweir 	mpDocSh( pDrawDoc->GetDocSh() ),
123cdf0e10cSrcweir 	mpViewSh(pViewShell),
124cdf0e10cSrcweir 	mpDragSrcMarkList(NULL),
125cdf0e10cSrcweir 	mpDropMarkerObj(NULL),
126cdf0e10cSrcweir 	mpDropMarker(NULL),
127cdf0e10cSrcweir 	mnDragSrcPgNum(SDRPAGE_NOTFOUND),
128cdf0e10cSrcweir 	mnAction(DND_ACTION_NONE),
129cdf0e10cSrcweir 	mnLockRedrawSmph(0),
130cdf0e10cSrcweir 	mpLockedRedraws(NULL),
131cdf0e10cSrcweir 	mbIsDropAllowed(sal_True),
132cdf0e10cSrcweir 	maSmartTags(*this),
133cdf0e10cSrcweir     mpClipboard (new ViewClipboard (*this))
134cdf0e10cSrcweir {
135cdf0e10cSrcweir 	// #i73602# Use default from the configuration
136cdf0e10cSrcweir 	SetBufferedOverlayAllowed(getOptionsDrawinglayer().IsOverlayBuffer_DrawImpress());
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 	// #i74769#, #i75172# Use default from the configuration
139cdf0e10cSrcweir 	SetBufferedOutputAllowed(getOptionsDrawinglayer().IsPaintBuffer_DrawImpress());
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 	EnableExtendedKeyInputDispatcher(sal_False);
142cdf0e10cSrcweir 	EnableExtendedMouseEventDispatcher(sal_False);
143cdf0e10cSrcweir 	EnableExtendedCommandEventDispatcher(sal_False);
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	SetUseIncompatiblePathCreateInterface(sal_False);
146cdf0e10cSrcweir 	SetMarkHdlWhenTextEdit(sal_True);
147cdf0e10cSrcweir 	EnableTextEditOnObjectsWithoutTextIfTextTool(sal_True);
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	SetMinMoveDistancePixel(2);
150cdf0e10cSrcweir 	SetHitTolerancePixel(2);
151cdf0e10cSrcweir 	SetMeasureLayer(String(SdResId(STR_LAYER_MEASURELINES)));
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 	// Timer fuer verzoegertes Drop (muss fuer MAC sein)
154cdf0e10cSrcweir 	maDropErrorTimer.SetTimeoutHdl( LINK(this, View, DropErrorHdl) );
155cdf0e10cSrcweir 	maDropErrorTimer.SetTimeout(50);
156cdf0e10cSrcweir 	maDropInsertFileTimer.SetTimeoutHdl( LINK(this, View, DropInsertFileHdl) );
157cdf0e10cSrcweir 	maDropInsertFileTimer.SetTimeout(50);
158cdf0e10cSrcweir }
159cdf0e10cSrcweir 
160cdf0e10cSrcweir void View::ImplClearDrawDropMarker()
161cdf0e10cSrcweir {
162cdf0e10cSrcweir 	if(mpDropMarker)
163cdf0e10cSrcweir 	{
164cdf0e10cSrcweir 		delete mpDropMarker;
165cdf0e10cSrcweir 		mpDropMarker = 0L;
166cdf0e10cSrcweir 	}
167cdf0e10cSrcweir }
168cdf0e10cSrcweir 
169cdf0e10cSrcweir /*************************************************************************
170cdf0e10cSrcweir |*
171cdf0e10cSrcweir |* Dtor
172cdf0e10cSrcweir |*
173cdf0e10cSrcweir \************************************************************************/
174cdf0e10cSrcweir 
175cdf0e10cSrcweir View::~View()
176cdf0e10cSrcweir {
177cdf0e10cSrcweir 	maSmartTags.Dispose();
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 	// release content of selection clipboard, if we own the content
180cdf0e10cSrcweir     UpdateSelectionClipboard( sal_True );
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 	maDropErrorTimer.Stop();
183cdf0e10cSrcweir 	maDropInsertFileTimer.Stop();
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 	ImplClearDrawDropMarker();
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 	while(PaintWindowCount())
188cdf0e10cSrcweir 	{
189cdf0e10cSrcweir 		// Alle angemeldeten OutDevs entfernen
190cdf0e10cSrcweir 		DeleteWindowFromPaintView(GetFirstOutputDevice() /*GetWin(0)*/);
191cdf0e10cSrcweir 	}
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 	// gespeicherte Redraws loeschen
194cdf0e10cSrcweir 	if (mpLockedRedraws)
195cdf0e10cSrcweir 	{
196cdf0e10cSrcweir 		SdViewRedrawRec* pRec = (SdViewRedrawRec*)mpLockedRedraws->First();
197cdf0e10cSrcweir 		while (pRec)
198cdf0e10cSrcweir 		{
199cdf0e10cSrcweir 			delete pRec;
200cdf0e10cSrcweir 			pRec = (SdViewRedrawRec*)mpLockedRedraws->Next();
201cdf0e10cSrcweir 		}
202cdf0e10cSrcweir 		delete mpLockedRedraws;
203cdf0e10cSrcweir 	}
204cdf0e10cSrcweir }
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 
207cdf0e10cSrcweir class ViewRedirector : public ::sdr::contact::ViewObjectContactRedirector
208cdf0e10cSrcweir {
209cdf0e10cSrcweir public:
210cdf0e10cSrcweir 	ViewRedirector();
211cdf0e10cSrcweir 	virtual ~ViewRedirector();
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 	// all default implementations just call the same methods at the original. To do something
214cdf0e10cSrcweir 	// different, overload the method and at least do what the method does.
215cdf0e10cSrcweir 	virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
216cdf0e10cSrcweir 		const sdr::contact::ViewObjectContact& rOriginal,
217cdf0e10cSrcweir 		const sdr::contact::DisplayInfo& rDisplayInfo);
218cdf0e10cSrcweir };
219cdf0e10cSrcweir 
220cdf0e10cSrcweir ViewRedirector::ViewRedirector()
221cdf0e10cSrcweir {
222cdf0e10cSrcweir }
223cdf0e10cSrcweir 
224cdf0e10cSrcweir ViewRedirector::~ViewRedirector()
225cdf0e10cSrcweir {
226cdf0e10cSrcweir }
227cdf0e10cSrcweir 
228cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence ViewRedirector::createRedirectedPrimitive2DSequence(
229cdf0e10cSrcweir 	const sdr::contact::ViewObjectContact& rOriginal,
230cdf0e10cSrcweir 	const sdr::contact::DisplayInfo& rDisplayInfo)
231cdf0e10cSrcweir {
232cdf0e10cSrcweir 	SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
233cdf0e10cSrcweir 	drawinglayer::primitive2d::Primitive2DSequence xRetval;
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 	if(pObject && pObject->GetPage())
236cdf0e10cSrcweir 	{
237cdf0e10cSrcweir 		const bool bDoCreateGeometry(pObject->GetPage()->checkVisibility( rOriginal, rDisplayInfo, true ));
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 		if(!bDoCreateGeometry && !(( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_PAGE )) )
240cdf0e10cSrcweir 			return xRetval;
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 		PresObjKind eKind(PRESOBJ_NONE);
243cdf0e10cSrcweir 		const bool bSubContentProcessing(rDisplayInfo.GetSubContentActive());
244cdf0e10cSrcweir 		const bool bIsMasterPageObject(pObject->GetPage()->IsMasterPage());
245cdf0e10cSrcweir 		const bool bIsPrinting(rOriginal.GetObjectContact().isOutputToPrinter());
246cdf0e10cSrcweir 		const SdrPageView* pPageView = rOriginal.GetObjectContact().TryToGetSdrPageView();
247cdf0e10cSrcweir         const SdrPage* pVisualizedPage = GetSdrPageFromXDrawPage(rOriginal.GetObjectContact().getViewInformation2D().getVisualizedPage());
248cdf0e10cSrcweir 		const SdPage* pObjectsSdPage = dynamic_cast< SdPage* >(pObject->GetPage());
249cdf0e10cSrcweir 		const bool bIsInsidePageObj(pPageView && pPageView->GetPage() != pVisualizedPage);
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 		// check if we need to draw a placeholder border. Never do it for
252cdf0e10cSrcweir 		// objects inside a SdrPageObj and never when printing
253cdf0e10cSrcweir 		if(!bIsInsidePageObj && !bIsPrinting)
254cdf0e10cSrcweir 		{
255cdf0e10cSrcweir 			bool bCreateOutline(false);
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 			if( pObject->IsEmptyPresObj() && pObject->ISA(SdrTextObj) )
258cdf0e10cSrcweir 			{
259cdf0e10cSrcweir 				if( !bSubContentProcessing || !pObject->IsNotVisibleAsMaster() )
260cdf0e10cSrcweir 				{
261cdf0e10cSrcweir 					eKind = pObjectsSdPage ? pObjectsSdPage->GetPresObjKind(pObject) : PRESOBJ_NONE;
262cdf0e10cSrcweir 					bCreateOutline = true;
263cdf0e10cSrcweir 				}
264cdf0e10cSrcweir 			}
265cdf0e10cSrcweir 			else if( ( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_TEXT ) )
266cdf0e10cSrcweir 			{
267cdf0e10cSrcweir 				if( pObjectsSdPage )
268cdf0e10cSrcweir 				{
269cdf0e10cSrcweir 					eKind = pObjectsSdPage->GetPresObjKind(pObject);
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 					if((eKind == PRESOBJ_FOOTER) || (eKind == PRESOBJ_HEADER) || (eKind == PRESOBJ_DATETIME) || (eKind == PRESOBJ_SLIDENUMBER) )
272cdf0e10cSrcweir 					{
273cdf0e10cSrcweir 						if( !bSubContentProcessing )
274cdf0e10cSrcweir 						{
275cdf0e10cSrcweir 							// only draw a boundary for header&footer objects on the masterpage itself
276cdf0e10cSrcweir 							bCreateOutline = true;
277cdf0e10cSrcweir 						}
278cdf0e10cSrcweir 					}
279cdf0e10cSrcweir 				}
280cdf0e10cSrcweir 			}
281cdf0e10cSrcweir 			else if( ( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_PAGE ) )
282cdf0e10cSrcweir 			{
283cdf0e10cSrcweir 				// only for handout page, else this frame will be created for each
284cdf0e10cSrcweir 				// page preview object in SlideSorter and PagePane
285cdf0e10cSrcweir 				if(pObjectsSdPage && PK_HANDOUT == pObjectsSdPage->GetPageKind())
286cdf0e10cSrcweir 				{
287cdf0e10cSrcweir 					bCreateOutline = true;
288cdf0e10cSrcweir 				}
289cdf0e10cSrcweir 			}
290cdf0e10cSrcweir 
291cdf0e10cSrcweir 			if(bCreateOutline)
292cdf0e10cSrcweir 			{
293cdf0e10cSrcweir 				// empty presentation objects get a gray frame
294cdf0e10cSrcweir 				const svtools::ColorConfig aColorConfig;
295cdf0e10cSrcweir 				const svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( svtools::OBJECTBOUNDARIES ) );
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 				if( aColor.bIsVisible )
298cdf0e10cSrcweir 				{
299cdf0e10cSrcweir 					// get basic object transformation
300cdf0e10cSrcweir 					const basegfx::BColor aRGBColor(Color(aColor.nColor).getBColor());
301cdf0e10cSrcweir 					basegfx::B2DHomMatrix aObjectMatrix;
302cdf0e10cSrcweir 					basegfx::B2DPolyPolygon aObjectPolyPolygon;
303cdf0e10cSrcweir 					pObject->TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon);
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 					// create dashed border
306cdf0e10cSrcweir 					{
307cdf0e10cSrcweir 						// create object polygon
308cdf0e10cSrcweir 						basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon());
309cdf0e10cSrcweir 						aPolygon.transform(aObjectMatrix);
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 						// create line and stroke attribute
312cdf0e10cSrcweir 						::std::vector< double > aDotDashArray;
313cdf0e10cSrcweir 
314cdf0e10cSrcweir 						aDotDashArray.push_back(160.0);
315cdf0e10cSrcweir 						aDotDashArray.push_back(80.0);
316cdf0e10cSrcweir 
317cdf0e10cSrcweir 						const double fFullDotDashLen(::std::accumulate(aDotDashArray.begin(), aDotDashArray.end(), 0.0));
318cdf0e10cSrcweir 						const drawinglayer::attribute::LineAttribute aLine(aRGBColor);
319cdf0e10cSrcweir 						const drawinglayer::attribute::StrokeAttribute aStroke(aDotDashArray, fFullDotDashLen);
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 						// create primitive and add
322cdf0e10cSrcweir 						const drawinglayer::primitive2d::Primitive2DReference xRef(new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
323cdf0e10cSrcweir 							aPolygon,
324cdf0e10cSrcweir 							aLine,
325cdf0e10cSrcweir 							aStroke));
326cdf0e10cSrcweir 						drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xRef);
327cdf0e10cSrcweir 					}
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 					// now paint the placeholder description, but only when masterpage
330cdf0e10cSrcweir 					// is displayed as page directly (MasterPage view)
331cdf0e10cSrcweir 					if(!bSubContentProcessing && bIsMasterPageObject)
332cdf0e10cSrcweir 					{
333cdf0e10cSrcweir 						String aObjectString;
334cdf0e10cSrcweir 
335cdf0e10cSrcweir 						switch( eKind )
336cdf0e10cSrcweir 						{
337cdf0e10cSrcweir 							case PRESOBJ_TITLE:
338cdf0e10cSrcweir 							{
339cdf0e10cSrcweir 								if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PK_STANDARD)
340cdf0e10cSrcweir 								{
341cdf0e10cSrcweir 									static String aTitleAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_TITLE ) );
342cdf0e10cSrcweir 									aObjectString = aTitleAreaStr;
343cdf0e10cSrcweir 								}
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 								break;
346cdf0e10cSrcweir 							}
347cdf0e10cSrcweir 							case PRESOBJ_OUTLINE:
348cdf0e10cSrcweir 							{
349cdf0e10cSrcweir 								static String aOutlineAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_OUTLINE ) );
350cdf0e10cSrcweir 								aObjectString = aOutlineAreaStr;
351cdf0e10cSrcweir 								break;
352cdf0e10cSrcweir 							}
353cdf0e10cSrcweir 							case PRESOBJ_FOOTER:
354cdf0e10cSrcweir 							{
355cdf0e10cSrcweir 								static String aFooterAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_FOOTER ) );
356cdf0e10cSrcweir 								aObjectString = aFooterAreaStr;
357cdf0e10cSrcweir 								break;
358cdf0e10cSrcweir 							}
359cdf0e10cSrcweir 							case PRESOBJ_HEADER:
360cdf0e10cSrcweir 							{
361cdf0e10cSrcweir 								static String aHeaderAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_HEADER ) );
362cdf0e10cSrcweir 								aObjectString = aHeaderAreaStr;
363cdf0e10cSrcweir 								break;
364cdf0e10cSrcweir 							}
365cdf0e10cSrcweir 							case PRESOBJ_DATETIME:
366cdf0e10cSrcweir 							{
367cdf0e10cSrcweir 								static String aDateTimeStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_DATETIME ) );
368cdf0e10cSrcweir 								aObjectString = aDateTimeStr;
369cdf0e10cSrcweir 								break;
370cdf0e10cSrcweir 							}
371cdf0e10cSrcweir 							case PRESOBJ_NOTES:
372cdf0e10cSrcweir 							{
373cdf0e10cSrcweir 								static String aDateTimeStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_NOTES ) );
374cdf0e10cSrcweir 								aObjectString = aDateTimeStr;
375cdf0e10cSrcweir 								break;
376cdf0e10cSrcweir 							}
377cdf0e10cSrcweir 							case PRESOBJ_SLIDENUMBER:
378cdf0e10cSrcweir 							{
379cdf0e10cSrcweir 								if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PK_STANDARD)
380cdf0e10cSrcweir 								{
381cdf0e10cSrcweir 									static String aSlideAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_SLIDE ) );
382cdf0e10cSrcweir 									aObjectString = aSlideAreaStr;
383cdf0e10cSrcweir 								}
384cdf0e10cSrcweir 								else
385cdf0e10cSrcweir 								{
386cdf0e10cSrcweir 									static String aNumberAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_NUMBER ) );
387cdf0e10cSrcweir 									aObjectString = aNumberAreaStr;
388cdf0e10cSrcweir 								}
389cdf0e10cSrcweir 								break;
390cdf0e10cSrcweir 							}
391cdf0e10cSrcweir 							default:
392cdf0e10cSrcweir 							{
393cdf0e10cSrcweir 								break;
394cdf0e10cSrcweir 							}
395cdf0e10cSrcweir 						}
396cdf0e10cSrcweir 
397cdf0e10cSrcweir 						if( aObjectString.Len() )
398cdf0e10cSrcweir 						{
399cdf0e10cSrcweir 							// decompose object matrix to be able to place text correctly
400cdf0e10cSrcweir 							basegfx::B2DTuple aScale;
401cdf0e10cSrcweir 							basegfx::B2DTuple aTranslate;
402cdf0e10cSrcweir 							double fRotate, fShearX;
403cdf0e10cSrcweir 							aObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 							// create font
406cdf0e10cSrcweir 							SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObject );
407cdf0e10cSrcweir 							const SdrTextVertAdjust eTVA(pTextObj ? pTextObj->GetTextVerticalAdjust() : SDRTEXTVERTADJUST_CENTER);
408cdf0e10cSrcweir 							Font aScaledVclFont;
409cdf0e10cSrcweir 
410cdf0e10cSrcweir 							// use a text size factor to get more reliable text sizes from the text layouter
411cdf0e10cSrcweir 							// (and from vcl), tipp from HDU
412cdf0e10cSrcweir 							static sal_uInt32 nTextSizeFactor(100);
413cdf0e10cSrcweir 
414cdf0e10cSrcweir 							// use a factor to get more linear text size calculations
415cdf0e10cSrcweir 							aScaledVclFont.SetHeight( 500 * nTextSizeFactor );
416cdf0e10cSrcweir 
417cdf0e10cSrcweir 							// get basic geometry and get text size
418cdf0e10cSrcweir 							drawinglayer::primitive2d::TextLayouterDevice aTextLayouter;
419cdf0e10cSrcweir 							aTextLayouter.setFont(aScaledVclFont);
420cdf0e10cSrcweir 							const xub_StrLen nTextLength(aObjectString.Len());
421cdf0e10cSrcweir 
422cdf0e10cSrcweir 							// do not forget to use the factor again to get the width for the 500
423cdf0e10cSrcweir 							const double fTextWidth(aTextLayouter.getTextWidth(aObjectString, 0, nTextLength) * (1.0 / nTextSizeFactor));
424cdf0e10cSrcweir 							const double fTextHeight(aTextLayouter.getTextHeight() * (1.0 / nTextSizeFactor));
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 							// calculate text primitive position. If text is at bottom, use top for
427cdf0e10cSrcweir 							// the extra text and vice versa
428cdf0e10cSrcweir 							const double fHorDist(125);
429cdf0e10cSrcweir 							const double fVerDist(125);
430cdf0e10cSrcweir 							const double fPosX((aTranslate.getX() + aScale.getX()) - fTextWidth - fHorDist);
431cdf0e10cSrcweir 							const double fPosY((SDRTEXTVERTADJUST_BOTTOM == eTVA)
432cdf0e10cSrcweir 								? aTranslate.getY() - fVerDist + fTextHeight
433cdf0e10cSrcweir 								: (aTranslate.getY() + aScale.getY()) - fVerDist);
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 							// get font attributes; use normally scaled font
436cdf0e10cSrcweir 							const basegfx::BColor aFontColor(aRGBColor);
437cdf0e10cSrcweir 							Font aVclFont;
438cdf0e10cSrcweir 							basegfx::B2DVector aTextSizeAttribute;
439cdf0e10cSrcweir 
440cdf0e10cSrcweir 							aVclFont.SetHeight( 500 );
441cdf0e10cSrcweir 
442cdf0e10cSrcweir 							const drawinglayer::attribute::FontAttribute aFontAttribute(
443cdf0e10cSrcweir                                 drawinglayer::primitive2d::getFontAttributeFromVclFont(
444cdf0e10cSrcweir 								    aTextSizeAttribute,
445cdf0e10cSrcweir 								    aVclFont,
446cdf0e10cSrcweir 								    false,
447cdf0e10cSrcweir 								    false));
448cdf0e10cSrcweir 
449cdf0e10cSrcweir 							// fill text matrix
450cdf0e10cSrcweir 							const basegfx::B2DHomMatrix aTextMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
451cdf0e10cSrcweir 								aTextSizeAttribute.getX(), aTextSizeAttribute.getY(),
452cdf0e10cSrcweir 								fShearX,
453cdf0e10cSrcweir                                 fRotate,
454cdf0e10cSrcweir                                 fPosX, fPosY));
455cdf0e10cSrcweir 
456cdf0e10cSrcweir 							// create DXTextArray (can be empty one)
457cdf0e10cSrcweir 							const ::std::vector< double > aDXArray;
458cdf0e10cSrcweir 
459cdf0e10cSrcweir 							// create locale; this may need some more information in the future
460cdf0e10cSrcweir 							const ::com::sun::star::lang::Locale aLocale;
461cdf0e10cSrcweir 
462cdf0e10cSrcweir 							// create primitive and add
463cdf0e10cSrcweir 							const drawinglayer::primitive2d::Primitive2DReference xRef(
464cdf0e10cSrcweir                                 new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
465cdf0e10cSrcweir 								    aTextMatrix,
466cdf0e10cSrcweir 								    aObjectString,
467cdf0e10cSrcweir 								    0,
468cdf0e10cSrcweir 								    nTextLength,
469cdf0e10cSrcweir 								    aDXArray,
470cdf0e10cSrcweir 								    aFontAttribute,
471cdf0e10cSrcweir 								    aLocale,
472cdf0e10cSrcweir 								    aFontColor));
473cdf0e10cSrcweir 							drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xRef);
474cdf0e10cSrcweir 						}
475cdf0e10cSrcweir 					}
476cdf0e10cSrcweir 				}
477cdf0e10cSrcweir 			}
478cdf0e10cSrcweir 		}
479cdf0e10cSrcweir 
480cdf0e10cSrcweir 		if(bDoCreateGeometry)
481cdf0e10cSrcweir 		{
482cdf0e10cSrcweir 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(
483cdf0e10cSrcweir 				xRetval,
484cdf0e10cSrcweir 				sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
485cdf0e10cSrcweir 					rOriginal,
486cdf0e10cSrcweir 					rDisplayInfo));
487cdf0e10cSrcweir 		}
488cdf0e10cSrcweir 	}
489cdf0e10cSrcweir 	else
490cdf0e10cSrcweir 	{
491cdf0e10cSrcweir 		// not a SdrObject visualisation (maybe e.g. page) or no page
492cdf0e10cSrcweir 		xRetval = sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
493cdf0e10cSrcweir 	}
494cdf0e10cSrcweir 
495cdf0e10cSrcweir 	return xRetval;
496cdf0e10cSrcweir }
497cdf0e10cSrcweir 
498cdf0e10cSrcweir /*************************************************************************
499cdf0e10cSrcweir |*
500cdf0e10cSrcweir |* Paint-Methode: das Ereignis wird an die View weitergeleitet
501cdf0e10cSrcweir |*
502cdf0e10cSrcweir \************************************************************************/
503cdf0e10cSrcweir 
504cdf0e10cSrcweir void View::CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0L*/)
505cdf0e10cSrcweir {
506cdf0e10cSrcweir 	// ausfuehren ??
507cdf0e10cSrcweir 	if (mnLockRedrawSmph == 0)
508cdf0e10cSrcweir 	{
509cdf0e10cSrcweir 		SdrPageView* pPgView = GetSdrPageView();
510cdf0e10cSrcweir 
511cdf0e10cSrcweir 		if (pPgView)
512cdf0e10cSrcweir 		{
513cdf0e10cSrcweir 			SdPage* pPage = (SdPage*) pPgView->GetPage();
514cdf0e10cSrcweir 			if( pPage )
515cdf0e10cSrcweir 			{
516cdf0e10cSrcweir 				SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL);
517cdf0e10cSrcweir                 bool bScreenDisplay(true);
518cdf0e10cSrcweir 
519cdf0e10cSrcweir                 if(bScreenDisplay && pOutDev && OUTDEV_PRINTER == pOutDev->GetOutDevType())
520cdf0e10cSrcweir                 {
521cdf0e10cSrcweir                     // #i75566# printing; suppress AutoColor BackgroundColor generation
522cdf0e10cSrcweir                     // for visibility reasons by giving GetPageBackgroundColor()
523cdf0e10cSrcweir                     // the needed hint
524cdf0e10cSrcweir                     bScreenDisplay = false;
525cdf0e10cSrcweir                 }
526cdf0e10cSrcweir 
527cdf0e10cSrcweir                 if(bScreenDisplay && pOutDev && pOutDev->GetPDFWriter())
528cdf0e10cSrcweir                 {
529cdf0e10cSrcweir                     // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see above)
530cdf0e10cSrcweir                     bScreenDisplay = false;
531cdf0e10cSrcweir                 }
532cdf0e10cSrcweir 
533cdf0e10cSrcweir                 // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and
534cdf0e10cSrcweir                 // hint value if screen display. Only then the AutoColor mechanisms shall be applied
535cdf0e10cSrcweir 				rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pPgView, bScreenDisplay) );
536cdf0e10cSrcweir 			}
537cdf0e10cSrcweir 		}
538cdf0e10cSrcweir 
539cdf0e10cSrcweir 		ViewRedirector aViewRedirector;
540cdf0e10cSrcweir 		FmFormView::CompleteRedraw(pOutDev, rReg, pRedirector ? pRedirector : &aViewRedirector);
541cdf0e10cSrcweir 	}
542cdf0e10cSrcweir 	// oder speichern?
543cdf0e10cSrcweir 	else
544cdf0e10cSrcweir 	{
545cdf0e10cSrcweir 		if (!mpLockedRedraws)
546cdf0e10cSrcweir 			mpLockedRedraws = new List;
547cdf0e10cSrcweir 
548cdf0e10cSrcweir 		SdViewRedrawRec* pRec = new SdViewRedrawRec;
549cdf0e10cSrcweir 		pRec->mpOut	= pOutDev;
550cdf0e10cSrcweir 		pRec->aRect = rReg.GetBoundRect();
551cdf0e10cSrcweir 		mpLockedRedraws->Insert(pRec, LIST_APPEND);
552cdf0e10cSrcweir 	}
553cdf0e10cSrcweir }
554cdf0e10cSrcweir 
555cdf0e10cSrcweir 
556cdf0e10cSrcweir /*************************************************************************
557cdf0e10cSrcweir |*
558cdf0e10cSrcweir |* Selektion hat sich geaendert
559cdf0e10cSrcweir |*
560cdf0e10cSrcweir \************************************************************************/
561cdf0e10cSrcweir 
562cdf0e10cSrcweir void View::MarkListHasChanged()
563cdf0e10cSrcweir {
564cdf0e10cSrcweir 	FmFormView::MarkListHasChanged();
565cdf0e10cSrcweir 
566cdf0e10cSrcweir 	if( GetMarkedObjectCount() > 0 )
567cdf0e10cSrcweir 		maSmartTags.deselect();
568cdf0e10cSrcweir }
569cdf0e10cSrcweir 
570cdf0e10cSrcweir 
571cdf0e10cSrcweir /*************************************************************************
572cdf0e10cSrcweir |*
573cdf0e10cSrcweir |* Attribute setzen
574cdf0e10cSrcweir |*
575cdf0e10cSrcweir \************************************************************************/
576cdf0e10cSrcweir 
577cdf0e10cSrcweir sal_Bool View::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
578cdf0e10cSrcweir {
579cdf0e10cSrcweir 	sal_Bool bOk = FmFormView::SetAttributes(rSet, bReplaceAll);
580cdf0e10cSrcweir 	return (bOk);
581cdf0e10cSrcweir }
582cdf0e10cSrcweir 
583cdf0e10cSrcweir 
584cdf0e10cSrcweir /*************************************************************************
585cdf0e10cSrcweir |*
586cdf0e10cSrcweir |* Attribute holen
587cdf0e10cSrcweir |*
588cdf0e10cSrcweir \************************************************************************/
589cdf0e10cSrcweir 
590cdf0e10cSrcweir sal_Bool View::GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr ) const
591cdf0e10cSrcweir {
592cdf0e10cSrcweir 	return( FmFormView::GetAttributes( rTargetSet, bOnlyHardAttr ) );
593cdf0e10cSrcweir }
594cdf0e10cSrcweir 
595cdf0e10cSrcweir 
596cdf0e10cSrcweir /*************************************************************************
597cdf0e10cSrcweir |*
598cdf0e10cSrcweir |* Ist ein Praesentationsobjekt selektiert?
599cdf0e10cSrcweir |*
600cdf0e10cSrcweir \************************************************************************/
601cdf0e10cSrcweir 
602cdf0e10cSrcweir sal_Bool View::IsPresObjSelected(sal_Bool bOnPage, sal_Bool bOnMasterPage, sal_Bool bCheckPresObjListOnly, sal_Bool bCheckLayoutOnly) const
603cdf0e10cSrcweir {
604cdf0e10cSrcweir 	/**************************************************************************
605cdf0e10cSrcweir 	* Ist ein Presentationsobjekt selektiert?
606cdf0e10cSrcweir 	**************************************************************************/
607cdf0e10cSrcweir 	SdrMarkList* pMarkList;
608cdf0e10cSrcweir 
609cdf0e10cSrcweir 	if (mnDragSrcPgNum != SDRPAGE_NOTFOUND &&
610cdf0e10cSrcweir 		mnDragSrcPgNum != GetSdrPageView()->GetPage()->GetPageNum())
611cdf0e10cSrcweir 	{
612cdf0e10cSrcweir 		// Es laeuft gerade Drag&Drop
613cdf0e10cSrcweir 		// Source- und Destination-Page unterschiedlich:
614cdf0e10cSrcweir 		// es wird die gemerkte MarkList verwendet
615cdf0e10cSrcweir 		pMarkList = mpDragSrcMarkList;
616cdf0e10cSrcweir 	}
617cdf0e10cSrcweir 	else
618cdf0e10cSrcweir 	{
619cdf0e10cSrcweir 		// Es wird die aktuelle MarkList verwendet
620cdf0e10cSrcweir 		pMarkList = new SdrMarkList(GetMarkedObjectList());
621cdf0e10cSrcweir 	}
622cdf0e10cSrcweir 
623cdf0e10cSrcweir 	SdrMark* pMark;
624cdf0e10cSrcweir 	SdPage* pPage;
625cdf0e10cSrcweir 	SdrObject* pObj;
626cdf0e10cSrcweir 
627cdf0e10cSrcweir 	sal_Bool bSelected = sal_False;
628cdf0e10cSrcweir 	sal_Bool bMasterPage = sal_False;
629cdf0e10cSrcweir 	long nMark;
630cdf0e10cSrcweir 	long nMarkMax = long(pMarkList->GetMarkCount()) - 1;
631cdf0e10cSrcweir 
632cdf0e10cSrcweir 	for (nMark = nMarkMax; (nMark >= 0) && !bSelected; nMark--)
633cdf0e10cSrcweir 	{
634cdf0e10cSrcweir 		// Rueckwaerts durch die Marklist
635cdf0e10cSrcweir 		pMark = pMarkList->GetMark(nMark);
636cdf0e10cSrcweir 		pObj = pMark->GetMarkedSdrObj();
637cdf0e10cSrcweir 
638cdf0e10cSrcweir 		if ( pObj && ( bCheckPresObjListOnly || pObj->IsEmptyPresObj() || pObj->GetUserCall() ) )
639cdf0e10cSrcweir 		{
640cdf0e10cSrcweir 			pPage = (SdPage*) pObj->GetPage();
641cdf0e10cSrcweir 			bMasterPage = pPage->IsMasterPage();
642cdf0e10cSrcweir 
643cdf0e10cSrcweir 			if ( (bMasterPage && bOnMasterPage) || (!bMasterPage && bOnPage) )
644cdf0e10cSrcweir 			{
645cdf0e10cSrcweir 				if ( pPage && pPage->IsPresObj(pObj) )
646cdf0e10cSrcweir 				{
647cdf0e10cSrcweir 					if( bCheckLayoutOnly )
648cdf0e10cSrcweir 					{
649cdf0e10cSrcweir 						PresObjKind eKind = pPage->GetPresObjKind(pObj);
650cdf0e10cSrcweir 
651cdf0e10cSrcweir 						if((eKind != PRESOBJ_FOOTER) && (eKind != PRESOBJ_HEADER) && (eKind != PRESOBJ_DATETIME) && (eKind != PRESOBJ_SLIDENUMBER) )
652cdf0e10cSrcweir 							bSelected = sal_True;
653cdf0e10cSrcweir 					}
654cdf0e10cSrcweir 					else
655cdf0e10cSrcweir 					{
656cdf0e10cSrcweir 						bSelected = sal_True;
657cdf0e10cSrcweir 					}
658cdf0e10cSrcweir 				}
659cdf0e10cSrcweir 			}
660cdf0e10cSrcweir 		}
661cdf0e10cSrcweir 	}
662cdf0e10cSrcweir 
663cdf0e10cSrcweir 	if (pMarkList != mpDragSrcMarkList)
664cdf0e10cSrcweir 	{
665cdf0e10cSrcweir 	   delete pMarkList;
666cdf0e10cSrcweir 	}
667cdf0e10cSrcweir 
668cdf0e10cSrcweir 	return (bSelected);
669cdf0e10cSrcweir }
670cdf0e10cSrcweir 
671cdf0e10cSrcweir /*************************************************************************
672cdf0e10cSrcweir |*
673cdf0e10cSrcweir |* Alles selektieren
674cdf0e10cSrcweir |*
675cdf0e10cSrcweir \************************************************************************/
676cdf0e10cSrcweir 
677cdf0e10cSrcweir void View::SelectAll()
678cdf0e10cSrcweir {
679cdf0e10cSrcweir 	if ( IsTextEdit() )
680cdf0e10cSrcweir 	{
681cdf0e10cSrcweir 		OutlinerView* pOLV = GetTextEditOutlinerView();
682cdf0e10cSrcweir 		const ::Outliner* pOutliner = GetTextEditOutliner();
683cdf0e10cSrcweir 		pOLV->SelectRange( 0, (sal_uInt16) pOutliner->GetParagraphCount() );
684cdf0e10cSrcweir 	}
685cdf0e10cSrcweir 	else
686cdf0e10cSrcweir 	{
687cdf0e10cSrcweir 		MarkAll();
688cdf0e10cSrcweir 	}
689cdf0e10cSrcweir }
690cdf0e10cSrcweir 
691cdf0e10cSrcweir 
692cdf0e10cSrcweir /*************************************************************************
693cdf0e10cSrcweir |*
694cdf0e10cSrcweir |* Dokument hat sich geaendert
695cdf0e10cSrcweir |*
696cdf0e10cSrcweir \************************************************************************/
697cdf0e10cSrcweir 
698cdf0e10cSrcweir void View::ModelHasChanged()
699cdf0e10cSrcweir {
700cdf0e10cSrcweir 	// Erst SdrView benachrichtigen
701cdf0e10cSrcweir 	FmFormView::ModelHasChanged();
702cdf0e10cSrcweir }
703cdf0e10cSrcweir 
704cdf0e10cSrcweir /*************************************************************************
705cdf0e10cSrcweir |*
706cdf0e10cSrcweir |* StyleSheet setzen
707cdf0e10cSrcweir |*
708cdf0e10cSrcweir \************************************************************************/
709cdf0e10cSrcweir 
710cdf0e10cSrcweir sal_Bool View::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
711cdf0e10cSrcweir {
712cdf0e10cSrcweir 	// weiter an SdrView
713cdf0e10cSrcweir 	return FmFormView::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
714cdf0e10cSrcweir }
715cdf0e10cSrcweir 
716cdf0e10cSrcweir 
717cdf0e10cSrcweir /*************************************************************************
718cdf0e10cSrcweir |*
719cdf0e10cSrcweir |* Texteingabe beginnen
720cdf0e10cSrcweir |*
721cdf0e10cSrcweir \************************************************************************/
722cdf0e10cSrcweir 
723cdf0e10cSrcweir static void SetSpellOptions( SdDrawDocument* pDoc, sal_uLong& rCntrl )
724cdf0e10cSrcweir {
725cdf0e10cSrcweir 	sal_Bool bOnlineSpell = pDoc->GetOnlineSpell();
726cdf0e10cSrcweir 
727cdf0e10cSrcweir 	if( bOnlineSpell )
728cdf0e10cSrcweir 		rCntrl |= EE_CNTRL_ONLINESPELLING;
729cdf0e10cSrcweir 	else
730cdf0e10cSrcweir 		rCntrl &= ~EE_CNTRL_ONLINESPELLING;
731cdf0e10cSrcweir }
732cdf0e10cSrcweir 
733cdf0e10cSrcweir sal_Bool View::SdrBeginTextEdit(
734cdf0e10cSrcweir 	SdrObject* pObj, SdrPageView* pPV, ::Window* pWin,
735cdf0e10cSrcweir 	sal_Bool bIsNewObj,
736cdf0e10cSrcweir 	SdrOutliner* pOutl, OutlinerView* pGivenOutlinerView,
737cdf0e10cSrcweir     sal_Bool bDontDeleteOutliner, sal_Bool bOnlyOneView, sal_Bool bGrabFocus )
738cdf0e10cSrcweir {
739cdf0e10cSrcweir 	GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
740cdf0e10cSrcweir         sd::tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT, (void*)pObj );
741cdf0e10cSrcweir 
742cdf0e10cSrcweir 	if( pOutl==NULL && pObj )
743cdf0e10cSrcweir 		pOutl = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, pObj->GetModel() );
744cdf0e10cSrcweir 
745cdf0e10cSrcweir 	// make draw&impress specific initialisations
746cdf0e10cSrcweir 	if( pOutl )
747cdf0e10cSrcweir 	{
748cdf0e10cSrcweir 		pOutl->SetStyleSheetPool((SfxStyleSheetPool*) mpDoc->GetStyleSheetPool());
749cdf0e10cSrcweir 		pOutl->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl));
750cdf0e10cSrcweir 		sal_uLong nCntrl = pOutl->GetControlWord();
751cdf0e10cSrcweir 		nCntrl |= EE_CNTRL_ALLOWBIGOBJS;
752cdf0e10cSrcweir 		nCntrl |= EE_CNTRL_URLSFXEXECUTE;
753cdf0e10cSrcweir 		nCntrl |= EE_CNTRL_MARKFIELDS;
754cdf0e10cSrcweir 		nCntrl |= EE_CNTRL_AUTOCORRECT;
755cdf0e10cSrcweir 
756cdf0e10cSrcweir 		nCntrl &= ~EE_CNTRL_ULSPACESUMMATION;
757cdf0e10cSrcweir 		if ( mpDoc->IsSummationOfParagraphs() )
758cdf0e10cSrcweir 		    nCntrl |= EE_CNTRL_ULSPACESUMMATION;
759cdf0e10cSrcweir 
760cdf0e10cSrcweir 		SetSpellOptions( mpDoc, nCntrl );
761cdf0e10cSrcweir 
762cdf0e10cSrcweir 		pOutl->SetControlWord(nCntrl);
763cdf0e10cSrcweir 
764cdf0e10cSrcweir 		Reference< linguistic2::XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
765cdf0e10cSrcweir         if ( xSpellChecker.is() )
766cdf0e10cSrcweir             pOutl->SetSpeller( xSpellChecker );
767cdf0e10cSrcweir 
768cdf0e10cSrcweir 		Reference< linguistic2::XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
769cdf0e10cSrcweir         if( xHyphenator.is() )
770cdf0e10cSrcweir             pOutl->SetHyphenator( xHyphenator );
771cdf0e10cSrcweir 
772cdf0e10cSrcweir 		pOutl->SetDefaultLanguage( Application::GetSettings().GetLanguage() );
773cdf0e10cSrcweir 	}
774cdf0e10cSrcweir 
775cdf0e10cSrcweir 	sal_Bool bReturn = FmFormView::SdrBeginTextEdit(
776cdf0e10cSrcweir 		pObj, pPV, pWin, bIsNewObj, pOutl,
777cdf0e10cSrcweir 		pGivenOutlinerView, bDontDeleteOutliner,
778cdf0e10cSrcweir 		bOnlyOneView, bGrabFocus);
779cdf0e10cSrcweir 
78095a18594SAndre Fischer     ContextChangeEventMultiplexer::NotifyContextChange(
781*f120fe41SAndre Fischer         &GetViewShell()->GetViewShellBase(),
782*f120fe41SAndre Fischer         ::sfx2::sidebar::EnumContext::Context_DrawText);
78395a18594SAndre Fischer 
784cdf0e10cSrcweir 	if (bReturn)
785cdf0e10cSrcweir 	{
786cdf0e10cSrcweir 		::Outliner* pOL = GetTextEditOutliner();
787cdf0e10cSrcweir 
788cdf0e10cSrcweir 		if( pObj && pObj->GetPage() )
789cdf0e10cSrcweir 		{
790cdf0e10cSrcweir 			Color aBackground;
791cdf0e10cSrcweir 			if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_TABLE )
792cdf0e10cSrcweir 			{
793cdf0e10cSrcweir 				aBackground = GetTextEditBackgroundColor(*this);
794cdf0e10cSrcweir 			}
795cdf0e10cSrcweir 			else
796cdf0e10cSrcweir 			{
797cdf0e10cSrcweir 				aBackground = pObj->GetPage()->GetPageBackgroundColor(pPV);
798cdf0e10cSrcweir 			}
79902c50d82SAndre Fischer             if (pOL != NULL)
800cdf0e10cSrcweir                 pOL->SetBackgroundColor( aBackground  );
801cdf0e10cSrcweir 		}
802cdf0e10cSrcweir 
80302c50d82SAndre Fischer         if (pOL != NULL)
80402c50d82SAndre Fischer         {
805cdf0e10cSrcweir             pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl));
806cdf0e10cSrcweir             pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl));
807cdf0e10cSrcweir         }
80802c50d82SAndre Fischer 	}
809cdf0e10cSrcweir 
810cdf0e10cSrcweir 	return(bReturn);
811cdf0e10cSrcweir }
812cdf0e10cSrcweir 
813cdf0e10cSrcweir /** ends current text editing */
814cdf0e10cSrcweir SdrEndTextEditKind View::SdrEndTextEdit(sal_Bool bDontDeleteReally )
815cdf0e10cSrcweir {
816cdf0e10cSrcweir 	SdrObjectWeakRef xObj( GetTextEditObject() );
817cdf0e10cSrcweir 
818cdf0e10cSrcweir 	sal_Bool bDefaultTextRestored = RestoreDefaultText( dynamic_cast< SdrTextObj* >( GetTextEditObject() ) );
819cdf0e10cSrcweir 
820cdf0e10cSrcweir 	SdrEndTextEditKind eKind = FmFormView::SdrEndTextEdit(bDontDeleteReally);
821cdf0e10cSrcweir 
822cdf0e10cSrcweir 	if( bDefaultTextRestored )
823cdf0e10cSrcweir 	{
824cdf0e10cSrcweir 		if( xObj.is() && !xObj->IsEmptyPresObj() )
825cdf0e10cSrcweir 		{
826cdf0e10cSrcweir 			xObj->SetEmptyPresObj( sal_True );
827cdf0e10cSrcweir 		}
828cdf0e10cSrcweir 		else
829cdf0e10cSrcweir 		{
830cdf0e10cSrcweir 			eKind = SDRENDTEXTEDIT_UNCHANGED;
831cdf0e10cSrcweir 		}
832cdf0e10cSrcweir 	}
833cdf0e10cSrcweir 	else if( xObj.is() && xObj->IsEmptyPresObj() )
834cdf0e10cSrcweir 	{
835cdf0e10cSrcweir 		SdrTextObj* pObj = dynamic_cast< SdrTextObj* >( xObj.get() );
836cdf0e10cSrcweir 		if( pObj && pObj->HasText() )
837cdf0e10cSrcweir 		{
838cdf0e10cSrcweir 			SdrPage* pPage = pObj->GetPage();
839cdf0e10cSrcweir 			if( !pPage || !pPage->IsMasterPage() )
840cdf0e10cSrcweir 				pObj->SetEmptyPresObj( sal_False );
841cdf0e10cSrcweir 		}
842cdf0e10cSrcweir 	}
843cdf0e10cSrcweir 
84495a18594SAndre Fischer 	GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
84595a18594SAndre Fischer         sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT,
84695a18594SAndre Fischer         (void*)xObj.get() );
847cdf0e10cSrcweir 
848cdf0e10cSrcweir 	if( xObj.is() )
849cdf0e10cSrcweir 	{
850*f120fe41SAndre Fischer         ContextChangeEventMultiplexer::NotifyContextChange(
851*f120fe41SAndre Fischer             &GetViewShell()->GetViewShellBase(),
852*f120fe41SAndre Fischer             ::sfx2::sidebar::EnumContext::Context_Default);
853*f120fe41SAndre Fischer 
854cdf0e10cSrcweir         SdPage* pPage = dynamic_cast< SdPage* >( xObj->GetPage() );
855cdf0e10cSrcweir 		if( pPage )
856cdf0e10cSrcweir 			pPage->onEndTextEdit( xObj.get() );
857cdf0e10cSrcweir 	}
858cdf0e10cSrcweir 
859cdf0e10cSrcweir 	return(eKind);
860cdf0e10cSrcweir }
861cdf0e10cSrcweir 
862cdf0e10cSrcweir // --------------------------------------------------------------------
863cdf0e10cSrcweir 
864cdf0e10cSrcweir /** restores the default text if the given text object is currently in edit mode and
865cdf0e10cSrcweir 	no text has been entered already. Is only usefull just before text edit ends. */
866cdf0e10cSrcweir bool View::RestoreDefaultText( SdrTextObj* pTextObj )
867cdf0e10cSrcweir {
868cdf0e10cSrcweir 	bool bRestored = false;
869cdf0e10cSrcweir 
870cdf0e10cSrcweir 	if( pTextObj && (pTextObj == GetTextEditObject()) )
871cdf0e10cSrcweir 	{
872cdf0e10cSrcweir 		if( !pTextObj->HasText() )
873cdf0e10cSrcweir 		{
874cdf0e10cSrcweir 			SdPage* pPage = dynamic_cast< SdPage* >( pTextObj->GetPage() );
875cdf0e10cSrcweir 
876cdf0e10cSrcweir 			if(pPage)
877cdf0e10cSrcweir 			{
878cdf0e10cSrcweir 				bRestored = pPage->RestoreDefaultText( pTextObj );
879cdf0e10cSrcweir 				if( bRestored )
880cdf0e10cSrcweir 				{
881cdf0e10cSrcweir 					SdrOutliner* pOutliner = GetTextEditOutliner();
882cdf0e10cSrcweir 					pTextObj->SetTextEditOutliner( pOutliner );
883cdf0e10cSrcweir 					OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
884cdf0e10cSrcweir 					if (pOutliner)
885cdf0e10cSrcweir 						pOutliner->SetText(*pParaObj);
886cdf0e10cSrcweir 				}
887cdf0e10cSrcweir 			}
888cdf0e10cSrcweir 		}
889cdf0e10cSrcweir 	}
890cdf0e10cSrcweir 
891cdf0e10cSrcweir 	return bRestored;
892cdf0e10cSrcweir }
893cdf0e10cSrcweir 
894cdf0e10cSrcweir /*************************************************************************
895cdf0e10cSrcweir |*
896cdf0e10cSrcweir |* Originalgroesse der markierten Objekte setzen
897cdf0e10cSrcweir |*
898cdf0e10cSrcweir \************************************************************************/
899cdf0e10cSrcweir 
900cdf0e10cSrcweir void View::SetMarkedOriginalSize()
901cdf0e10cSrcweir {
902cdf0e10cSrcweir 	SdrUndoGroup*   pUndoGroup = new SdrUndoGroup(*mpDoc);
903cdf0e10cSrcweir 	sal_uLong           nCount = GetMarkedObjectCount();
904cdf0e10cSrcweir 	sal_Bool            bOK = sal_False;
905cdf0e10cSrcweir 
906cdf0e10cSrcweir 	for( sal_uInt32 i = 0; i < nCount; i++ )
907cdf0e10cSrcweir 	{
908cdf0e10cSrcweir 		SdrObject* pObj = GetMarkedObjectByIndex(i);
909cdf0e10cSrcweir 
910cdf0e10cSrcweir 		if( pObj->GetObjInventor() == SdrInventor )
911cdf0e10cSrcweir 		{
912cdf0e10cSrcweir 			if( pObj->GetObjIdentifier() == OBJ_OLE2 )
913cdf0e10cSrcweir 			{
914cdf0e10cSrcweir                 uno::Reference < embed::XEmbeddedObject > xObj = ((SdrOle2Obj*)pObj)->GetObjRef();
915cdf0e10cSrcweir                 if( xObj.is() )
916cdf0e10cSrcweir 				{
917cdf0e10cSrcweir                     // TODO/LEAN: working with VisualArea can switch object to running state
918cdf0e10cSrcweir 
919cdf0e10cSrcweir                    	sal_Int64 nAspect = ((SdrOle2Obj*)pObj)->GetAspect();
920cdf0e10cSrcweir 					Size aOleSize;
921cdf0e10cSrcweir 
922cdf0e10cSrcweir 					if ( nAspect == embed::Aspects::MSOLE_ICON )
923cdf0e10cSrcweir 					{
924cdf0e10cSrcweir 						MapMode aMap100( MAP_100TH_MM );
925cdf0e10cSrcweir                     	aOleSize = ((SdrOle2Obj*)pObj)->GetOrigObjSize( &aMap100 );
926cdf0e10cSrcweir                     	bOK = sal_True;
927cdf0e10cSrcweir 					}
928cdf0e10cSrcweir 					else
929cdf0e10cSrcweir 					{
930cdf0e10cSrcweir                     	MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
931cdf0e10cSrcweir 						try
932cdf0e10cSrcweir 						{
933cdf0e10cSrcweir                     		awt::Size aSz = xObj->getVisualAreaSize( nAspect );
934cdf0e10cSrcweir                     		aOleSize = OutputDevice::LogicToLogic( Size( aSz.Width, aSz.Height ), aUnit, MAP_100TH_MM );
935cdf0e10cSrcweir                     		bOK = sal_True;
936cdf0e10cSrcweir 						}
937cdf0e10cSrcweir 						catch( embed::NoVisualAreaSizeException& )
938cdf0e10cSrcweir 						{}
939cdf0e10cSrcweir 					}
940cdf0e10cSrcweir 
941cdf0e10cSrcweir 					if ( bOK )
942cdf0e10cSrcweir 					{
943cdf0e10cSrcweir 						Rectangle   aDrawRect( pObj->GetLogicRect() );
944cdf0e10cSrcweir 
945cdf0e10cSrcweir 						pUndoGroup->AddAction( mpDoc->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
946cdf0e10cSrcweir 						pObj->Resize( aDrawRect.TopLeft(), Fraction( aOleSize.Width(), aDrawRect.GetWidth() ),
947cdf0e10cSrcweir 													   	Fraction( aOleSize.Height(), aDrawRect.GetHeight() ) );
948cdf0e10cSrcweir 					}
949cdf0e10cSrcweir                 }
950cdf0e10cSrcweir 			}
951cdf0e10cSrcweir 			else if( pObj->GetObjIdentifier() == OBJ_GRAF )
952cdf0e10cSrcweir 			{
953cdf0e10cSrcweir 				const MapMode   aMap100( MAP_100TH_MM );
954cdf0e10cSrcweir 				Size            aSize;
955cdf0e10cSrcweir 
956cdf0e10cSrcweir 			    if ( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefMapMode().GetMapUnit() == MAP_PIXEL )
957cdf0e10cSrcweir 				    aSize = Application::GetDefaultDevice()->PixelToLogic( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefSize(), aMap100 );
958cdf0e10cSrcweir 			    else
959cdf0e10cSrcweir 			    {
960cdf0e10cSrcweir 				    aSize = OutputDevice::LogicToLogic( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefSize(),
961cdf0e10cSrcweir 														static_cast< SdrGrafObj* >( pObj )->GetGrafPrefMapMode(),
962cdf0e10cSrcweir 														aMap100 );
963cdf0e10cSrcweir 				}
964cdf0e10cSrcweir 
965cdf0e10cSrcweir 				pUndoGroup->AddAction( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj ) );
966cdf0e10cSrcweir 				Rectangle aRect( pObj->GetLogicRect() );
967cdf0e10cSrcweir 				aRect.SetSize( aSize );
968cdf0e10cSrcweir 				pObj->SetLogicRect( aRect );
969cdf0e10cSrcweir 
970cdf0e10cSrcweir 				bOK = sal_True;
971cdf0e10cSrcweir 			}
972cdf0e10cSrcweir 		}
973cdf0e10cSrcweir 	}
974cdf0e10cSrcweir 
975cdf0e10cSrcweir 	if( bOK )
976cdf0e10cSrcweir 	{
977cdf0e10cSrcweir 		pUndoGroup->SetComment( String(SdResId(STR_UNDO_ORIGINALSIZE)) );
978cdf0e10cSrcweir 		mpDocSh->GetUndoManager()->AddUndoAction(pUndoGroup);
979cdf0e10cSrcweir 	}
980cdf0e10cSrcweir 	else
981cdf0e10cSrcweir 		delete pUndoGroup;
982cdf0e10cSrcweir }
983cdf0e10cSrcweir 
984cdf0e10cSrcweir /*************************************************************************
985cdf0e10cSrcweir |*
986cdf0e10cSrcweir |* OLE-Obj am Client connecten
987cdf0e10cSrcweir |*
988cdf0e10cSrcweir \************************************************************************/
989cdf0e10cSrcweir 
990cdf0e10cSrcweir void View::DoConnect(SdrOle2Obj* pObj)
991cdf0e10cSrcweir {
992cdf0e10cSrcweir 	if (mpViewSh)
993cdf0e10cSrcweir 	{
994cdf0e10cSrcweir         uno::Reference < embed::XEmbeddedObject > xObj( pObj->GetObjRef() );
995cdf0e10cSrcweir         if( xObj.is() )
996cdf0e10cSrcweir 		{
997cdf0e10cSrcweir             ::sd::Window* pWindow = mpViewSh->GetActiveWindow();
998cdf0e10cSrcweir             SfxInPlaceClient* pSdClient = mpViewSh-> GetViewShellBase().FindIPClient( xObj, pWindow );
999cdf0e10cSrcweir             if ( !pSdClient )
1000cdf0e10cSrcweir 			{
1001cdf0e10cSrcweir                 pSdClient = new Client(pObj, mpViewSh, pWindow);
1002cdf0e10cSrcweir 				Rectangle aRect = pObj->GetLogicRect();
1003cdf0e10cSrcweir 				{
1004cdf0e10cSrcweir                     // TODO/LEAN: working with visual area can switch object to running state
1005cdf0e10cSrcweir 					Size aDrawSize = aRect.GetSize();
1006cdf0e10cSrcweir                     awt::Size aSz;
1007cdf0e10cSrcweir 
1008cdf0e10cSrcweir 					MapMode aMapMode( mpDoc->GetScaleUnit() );
1009cdf0e10cSrcweir                     Size aObjAreaSize = pObj->GetOrigObjSize( &aMapMode );
1010cdf0e10cSrcweir 
1011cdf0e10cSrcweir 					Fraction aScaleWidth (aDrawSize.Width(),  aObjAreaSize.Width() );
1012cdf0e10cSrcweir 					Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() );
1013cdf0e10cSrcweir 					aScaleWidth.ReduceInaccurate(10);		// kompatibel zum SdrOle2Obj
1014cdf0e10cSrcweir 					aScaleHeight.ReduceInaccurate(10);
1015cdf0e10cSrcweir                     pSdClient->SetSizeScale(aScaleWidth, aScaleHeight);
1016cdf0e10cSrcweir 
1017cdf0e10cSrcweir 					// sichtbarer Ausschnitt wird nur inplace veraendert!
1018cdf0e10cSrcweir 					// the object area must be set after the scaling, since it triggers resize
1019cdf0e10cSrcweir 					aRect.SetSize(aObjAreaSize);
1020cdf0e10cSrcweir                     pSdClient->SetObjArea(aRect);
1021cdf0e10cSrcweir 				}
1022cdf0e10cSrcweir 			}
1023cdf0e10cSrcweir         }
1024cdf0e10cSrcweir 	}
1025cdf0e10cSrcweir }
1026cdf0e10cSrcweir 
1027cdf0e10cSrcweir /*************************************************************************
1028cdf0e10cSrcweir |*
1029cdf0e10cSrcweir |*
1030cdf0e10cSrcweir |*
1031cdf0e10cSrcweir \************************************************************************/
1032cdf0e10cSrcweir 
1033cdf0e10cSrcweir sal_Bool View::IsMorphingAllowed() const
1034cdf0e10cSrcweir {
1035cdf0e10cSrcweir 	const SdrMarkList&	rMarkList = GetMarkedObjectList();
1036cdf0e10cSrcweir 	sal_Bool				bRet = sal_False;
1037cdf0e10cSrcweir 
1038cdf0e10cSrcweir 	if ( rMarkList.GetMarkCount() == 2 )
1039cdf0e10cSrcweir 	{
1040cdf0e10cSrcweir 		const SdrObject*	pObj1 = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
1041cdf0e10cSrcweir 		const SdrObject*	pObj2 = rMarkList.GetMark( 1 )->GetMarkedSdrObj();
1042cdf0e10cSrcweir 		const sal_uInt16		nKind1 = pObj1->GetObjIdentifier();
1043cdf0e10cSrcweir 		const sal_uInt16		nKind2 = pObj2->GetObjIdentifier();
1044cdf0e10cSrcweir 
1045cdf0e10cSrcweir 		if ( ( nKind1 != OBJ_TEXT && nKind2 != OBJ_TEXT ) &&
1046cdf0e10cSrcweir 			 ( nKind1 != OBJ_TITLETEXT && nKind2 != OBJ_TITLETEXT ) &&
1047cdf0e10cSrcweir 			 ( nKind1 != OBJ_OUTLINETEXT && nKind2 != OBJ_OUTLINETEXT ) &&
1048cdf0e10cSrcweir 			 ( nKind1 != OBJ_GRUP && nKind2 != OBJ_GRUP ) &&
1049cdf0e10cSrcweir 			 ( nKind1 != OBJ_LINE && nKind2 != OBJ_LINE ) &&
1050cdf0e10cSrcweir 			 ( nKind1 != OBJ_PLIN && nKind2 != OBJ_PLIN ) &&
1051cdf0e10cSrcweir 			 ( nKind1 != OBJ_PATHLINE && nKind2 != OBJ_PATHLINE ) &&
1052cdf0e10cSrcweir 			 ( nKind1 != OBJ_FREELINE && nKind2 != OBJ_FREELINE ) &&
1053cdf0e10cSrcweir 			 ( nKind1 != OBJ_PATHPLIN && nKind2 != OBJ_PATHPLIN ) &&
1054cdf0e10cSrcweir 			 ( nKind1 != OBJ_MEASURE && nKind2 != OBJ_MEASURE ) &&
1055cdf0e10cSrcweir 			 ( nKind1 != OBJ_EDGE && nKind2 != OBJ_EDGE ) &&
1056cdf0e10cSrcweir 			 ( nKind1 != OBJ_GRAF && nKind2 != OBJ_GRAF ) &&
1057cdf0e10cSrcweir 			 ( nKind1 != OBJ_OLE2 && nKind2 != OBJ_OLE2 ) &&
1058cdf0e10cSrcweir 			 ( nKind1 != OBJ_CAPTION && nKind2 !=  OBJ_CAPTION ) &&
1059cdf0e10cSrcweir 			 !pObj1->ISA( E3dObject) && !pObj2->ISA( E3dObject) )
1060cdf0e10cSrcweir 		{
1061cdf0e10cSrcweir 			SfxItemSet		aSet1( mpDoc->GetPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE );
1062cdf0e10cSrcweir 			SfxItemSet		aSet2( mpDoc->GetPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE );
1063cdf0e10cSrcweir 
1064cdf0e10cSrcweir 			aSet1.Put(pObj1->GetMergedItemSet());
1065cdf0e10cSrcweir 			aSet2.Put(pObj2->GetMergedItemSet());
1066cdf0e10cSrcweir 
1067cdf0e10cSrcweir 			const XFillStyle	eFillStyle1 = ( (const XFillStyleItem&) aSet1.Get( XATTR_FILLSTYLE ) ).GetValue();
1068cdf0e10cSrcweir 			const XFillStyle	eFillStyle2 = ( (const XFillStyleItem&) aSet2.Get( XATTR_FILLSTYLE ) ).GetValue();
1069cdf0e10cSrcweir 
1070cdf0e10cSrcweir 			if( ( eFillStyle1 == XFILL_NONE || eFillStyle1 == XFILL_SOLID ) &&
1071cdf0e10cSrcweir 				( eFillStyle2 == XFILL_NONE || eFillStyle2 == XFILL_SOLID ) )
1072cdf0e10cSrcweir 				bRet = sal_True;
1073cdf0e10cSrcweir 		}
1074cdf0e10cSrcweir 	}
1075cdf0e10cSrcweir 
1076cdf0e10cSrcweir 	return bRet;
1077cdf0e10cSrcweir }
1078cdf0e10cSrcweir 
1079cdf0e10cSrcweir /*************************************************************************
1080cdf0e10cSrcweir |*
1081cdf0e10cSrcweir |*
1082cdf0e10cSrcweir |*
1083cdf0e10cSrcweir \************************************************************************/
1084cdf0e10cSrcweir 
1085cdf0e10cSrcweir sal_Bool View::IsVectorizeAllowed() const
1086cdf0e10cSrcweir {
1087cdf0e10cSrcweir 	const SdrMarkList&	rMarkList = GetMarkedObjectList();
1088cdf0e10cSrcweir 	sal_Bool				bRet = sal_False;
1089cdf0e10cSrcweir 
1090cdf0e10cSrcweir 	if( rMarkList.GetMarkCount() == 1 )
1091cdf0e10cSrcweir 	{
1092ddde725dSArmin Le Grand 		const SdrGrafObj* pObj = dynamic_cast< const SdrGrafObj* >(rMarkList.GetMark( 0 )->GetMarkedSdrObj());
1093cdf0e10cSrcweir 
1094ddde725dSArmin Le Grand         if(pObj)
1095ddde725dSArmin Le Grand         {
1096ddde725dSArmin Le Grand             if(GRAPHIC_BITMAP == pObj->GetGraphicType() && !pObj->isEmbeddedSvg())
1097ddde725dSArmin Le Grand             {
1098cdf0e10cSrcweir                 bRet = sal_True;
1099cdf0e10cSrcweir             }
1100ddde725dSArmin Le Grand         }
1101ddde725dSArmin Le Grand 	}
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir 	return bRet;
1104cdf0e10cSrcweir }
1105cdf0e10cSrcweir 
1106cdf0e10cSrcweir void View::onAccessibilityOptionsChanged()
1107cdf0e10cSrcweir {
1108cdf0e10cSrcweir 	if( mpViewSh )
1109cdf0e10cSrcweir 	{
1110cdf0e10cSrcweir 		::sd::Window* pWindow = mpViewSh->GetActiveWindow();
1111cdf0e10cSrcweir 		if( pWindow )
1112cdf0e10cSrcweir 		{
1113cdf0e10cSrcweir 			const StyleSettings& rStyleSettings = pWindow->GetSettings().GetStyleSettings();
1114cdf0e10cSrcweir 
1115cdf0e10cSrcweir 			sal_uInt16 nOutputSlot, nPreviewSlot;
1116cdf0e10cSrcweir 
1117cdf0e10cSrcweir 			SvtAccessibilityOptions& aAccOptions = getAccessibilityOptions();
1118cdf0e10cSrcweir 
1119cdf0e10cSrcweir 			if( mpViewSh->GetViewFrame() && mpViewSh->GetViewFrame()->GetDispatcher() )
1120cdf0e10cSrcweir 			{
1121cdf0e10cSrcweir 				if( rStyleSettings.GetHighContrastMode() )
1122cdf0e10cSrcweir 				{
1123cdf0e10cSrcweir 					nOutputSlot = SID_OUTPUT_QUALITY_CONTRAST;
1124cdf0e10cSrcweir 				}
1125cdf0e10cSrcweir 				else
1126cdf0e10cSrcweir 				{
1127cdf0e10cSrcweir 					nOutputSlot = SID_OUTPUT_QUALITY_COLOR;
1128cdf0e10cSrcweir 				}
1129cdf0e10cSrcweir 
1130cdf0e10cSrcweir 				if( rStyleSettings.GetHighContrastMode() && aAccOptions.GetIsForPagePreviews() )
1131cdf0e10cSrcweir 				{
1132cdf0e10cSrcweir 					nPreviewSlot = SID_PREVIEW_QUALITY_CONTRAST;
1133cdf0e10cSrcweir 				}
1134cdf0e10cSrcweir 				else
1135cdf0e10cSrcweir 				{
1136cdf0e10cSrcweir 					nPreviewSlot = SID_PREVIEW_QUALITY_COLOR;
1137cdf0e10cSrcweir 				}
1138cdf0e10cSrcweir 
1139cdf0e10cSrcweir 				mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nOutputSlot, SFX_CALLMODE_ASYNCHRON );
1140cdf0e10cSrcweir 				mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nPreviewSlot, SFX_CALLMODE_ASYNCHRON );
1141cdf0e10cSrcweir 			}
1142cdf0e10cSrcweir 
1143cdf0e10cSrcweir 			mpViewSh->Invalidate();
1144cdf0e10cSrcweir 		}
1145cdf0e10cSrcweir 	}
1146cdf0e10cSrcweir }
1147cdf0e10cSrcweir 
1148cdf0e10cSrcweir IMPL_LINK( View, OnParagraphInsertedHdl, ::Outliner *, pOutliner )
1149cdf0e10cSrcweir {
1150cdf0e10cSrcweir 	Paragraph* pPara = pOutliner->GetHdlParagraph();
1151cdf0e10cSrcweir 	SdrObject* pObj = GetTextEditObject();
1152cdf0e10cSrcweir 
1153cdf0e10cSrcweir 	if( pPara && pObj )
1154cdf0e10cSrcweir 	{
1155cdf0e10cSrcweir 		SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
1156cdf0e10cSrcweir 		if( pPage )
1157cdf0e10cSrcweir 			pPage->onParagraphInserted( pOutliner, pPara, pObj );
1158cdf0e10cSrcweir 	}
1159cdf0e10cSrcweir 	return 0;
1160cdf0e10cSrcweir }
1161cdf0e10cSrcweir 
1162cdf0e10cSrcweir /*************************************************************************
1163cdf0e10cSrcweir |*
1164cdf0e10cSrcweir |* Handler fuer das Loeschen von Seiten (Absaetzen)
1165cdf0e10cSrcweir |*
1166cdf0e10cSrcweir \************************************************************************/
1167cdf0e10cSrcweir 
1168cdf0e10cSrcweir IMPL_LINK( View, OnParagraphRemovingHdl, ::Outliner *, pOutliner )
1169cdf0e10cSrcweir {
1170cdf0e10cSrcweir 	Paragraph* pPara = pOutliner->GetHdlParagraph();
1171cdf0e10cSrcweir 	SdrObject* pObj = GetTextEditObject();
1172cdf0e10cSrcweir 
1173cdf0e10cSrcweir 	if( pPara && pObj )
1174cdf0e10cSrcweir 	{
1175cdf0e10cSrcweir 		SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
1176cdf0e10cSrcweir 		if( pPage )
1177cdf0e10cSrcweir 			pPage->onParagraphRemoving( pOutliner, pPara, pObj );
1178cdf0e10cSrcweir 	}
1179cdf0e10cSrcweir 	return 0;
1180cdf0e10cSrcweir }
1181cdf0e10cSrcweir 
1182cdf0e10cSrcweir bool View::isRecordingUndo() const
1183cdf0e10cSrcweir {
1184cdf0e10cSrcweir 	if( mpDoc && mpDoc->IsUndoEnabled() )
1185cdf0e10cSrcweir 	{
1186cdf0e10cSrcweir 		sd::UndoManager* pUndoManager = mpDoc ? mpDoc->GetUndoManager() : 0;
1187cdf0e10cSrcweir 		return pUndoManager && pUndoManager->IsInListAction();
1188cdf0e10cSrcweir 	}
1189cdf0e10cSrcweir 	else
1190cdf0e10cSrcweir 	{
1191cdf0e10cSrcweir 		return false;
1192cdf0e10cSrcweir 	}
1193cdf0e10cSrcweir }
1194cdf0e10cSrcweir 
1195cdf0e10cSrcweir void View::AddCustomHdl()
1196cdf0e10cSrcweir {
1197cdf0e10cSrcweir 	maSmartTags.addCustomHandles( aHdl );
1198cdf0e10cSrcweir }
1199cdf0e10cSrcweir 
1200cdf0e10cSrcweir void View::updateHandles()
1201cdf0e10cSrcweir {
1202cdf0e10cSrcweir 	AdjustMarkHdl();
1203cdf0e10cSrcweir }
1204cdf0e10cSrcweir 
1205cdf0e10cSrcweir SdrViewContext View::GetContext() const
1206cdf0e10cSrcweir {
1207cdf0e10cSrcweir 	SdrViewContext eContext = SDRCONTEXT_STANDARD;
1208cdf0e10cSrcweir 	if( maSmartTags.getContext( eContext ) )
1209cdf0e10cSrcweir 		return eContext;
1210cdf0e10cSrcweir 	else
1211cdf0e10cSrcweir 		return FmFormView::GetContext();
1212cdf0e10cSrcweir }
1213cdf0e10cSrcweir 
1214cdf0e10cSrcweir sal_Bool View::HasMarkablePoints() const
1215cdf0e10cSrcweir {
1216cdf0e10cSrcweir 	if( maSmartTags.HasMarkablePoints() )
1217cdf0e10cSrcweir 		return true;
1218cdf0e10cSrcweir 	else
1219cdf0e10cSrcweir 		return FmFormView::HasMarkablePoints();
1220cdf0e10cSrcweir }
1221cdf0e10cSrcweir 
1222cdf0e10cSrcweir sal_uLong View::GetMarkablePointCount() const
1223cdf0e10cSrcweir {
1224cdf0e10cSrcweir 	sal_uLong nCount = FmFormView::GetMarkablePointCount();
1225cdf0e10cSrcweir 	nCount += maSmartTags.GetMarkablePointCount();
1226cdf0e10cSrcweir 	return nCount;
1227cdf0e10cSrcweir }
1228cdf0e10cSrcweir 
1229cdf0e10cSrcweir sal_Bool View::HasMarkedPoints() const
1230cdf0e10cSrcweir {
1231cdf0e10cSrcweir 	if( maSmartTags.HasMarkedPoints() )
1232cdf0e10cSrcweir 		return true;
1233cdf0e10cSrcweir 	else
1234cdf0e10cSrcweir 		return FmFormView::HasMarkedPoints();
1235cdf0e10cSrcweir }
1236cdf0e10cSrcweir 
1237cdf0e10cSrcweir sal_uLong View::GetMarkedPointCount() const
1238cdf0e10cSrcweir {
1239cdf0e10cSrcweir 	sal_uLong nCount = FmFormView::GetMarkedPointCount();
1240cdf0e10cSrcweir 	nCount += maSmartTags.GetMarkedPointCount();
1241cdf0e10cSrcweir 	return nCount;
1242cdf0e10cSrcweir }
1243cdf0e10cSrcweir 
1244cdf0e10cSrcweir sal_Bool View::IsPointMarkable(const SdrHdl& rHdl) const
1245cdf0e10cSrcweir {
1246cdf0e10cSrcweir 	if( maSmartTags.IsPointMarkable( rHdl ) )
1247cdf0e10cSrcweir 		return true;
1248cdf0e10cSrcweir 	else
1249cdf0e10cSrcweir 		return FmFormView::IsPointMarkable( rHdl );
1250cdf0e10cSrcweir }
1251cdf0e10cSrcweir 
1252cdf0e10cSrcweir sal_Bool View::MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark )
1253cdf0e10cSrcweir {
1254cdf0e10cSrcweir 	if( maSmartTags.MarkPoint( rHdl, bUnmark ) )
1255cdf0e10cSrcweir 		return true;
1256cdf0e10cSrcweir 	else
1257cdf0e10cSrcweir 		return FmFormView::MarkPoint( rHdl, bUnmark );
1258cdf0e10cSrcweir }
1259cdf0e10cSrcweir 
1260cdf0e10cSrcweir sal_Bool View::MarkPoints(const Rectangle* pRect, sal_Bool bUnmark)
1261cdf0e10cSrcweir {
1262cdf0e10cSrcweir 	if( maSmartTags.MarkPoints( pRect, bUnmark ) )
1263cdf0e10cSrcweir 		return true;
1264cdf0e10cSrcweir 	else
1265cdf0e10cSrcweir 		return FmFormView::MarkPoints( pRect, bUnmark );
1266cdf0e10cSrcweir }
1267cdf0e10cSrcweir 
1268cdf0e10cSrcweir void View::CheckPossibilities()
1269cdf0e10cSrcweir {
1270cdf0e10cSrcweir 	FmFormView::CheckPossibilities();
1271cdf0e10cSrcweir 	maSmartTags.CheckPossibilities();
1272cdf0e10cSrcweir }
1273cdf0e10cSrcweir 
1274cdf0e10cSrcweir void View::OnBeginPasteOrDrop( PasteOrDropInfos* /*pInfos*/ )
1275cdf0e10cSrcweir {
1276cdf0e10cSrcweir }
1277cdf0e10cSrcweir 
1278cdf0e10cSrcweir /** this is called after a paste or drop operation, make sure that the newly inserted paragraphs
1279cdf0e10cSrcweir 	get the correct style sheet. */
1280cdf0e10cSrcweir void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfos )
1281cdf0e10cSrcweir {
1282cdf0e10cSrcweir 	SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( GetTextEditObject() );
1283cdf0e10cSrcweir 	SdrOutliner* pOutliner = GetTextEditOutliner();
1284cdf0e10cSrcweir 	if( pOutliner && pTextObj && pTextObj->GetPage() )
1285cdf0e10cSrcweir 	{
1286cdf0e10cSrcweir 		SdPage* pPage = static_cast< SdPage* >( pTextObj->GetPage() );
1287cdf0e10cSrcweir 
1288cdf0e10cSrcweir 		SfxStyleSheet* pStyleSheet = 0;
1289cdf0e10cSrcweir 
1290cdf0e10cSrcweir 		const PresObjKind eKind = pPage->GetPresObjKind(pTextObj);
1291cdf0e10cSrcweir 		if( eKind != PRESOBJ_NONE )
1292cdf0e10cSrcweir 			pStyleSheet = pPage->GetStyleSheetForPresObj(eKind);
1293cdf0e10cSrcweir 		else
1294cdf0e10cSrcweir 			pStyleSheet = pTextObj->GetStyleSheet();
1295cdf0e10cSrcweir 
1296cdf0e10cSrcweir 		if( eKind == PRESOBJ_OUTLINE )
1297cdf0e10cSrcweir 		{
1298cdf0e10cSrcweir 			// for outline shapes, set the correct outline style sheet for each
1299cdf0e10cSrcweir 			// new paragraph, depending on the paragraph depth
1300cdf0e10cSrcweir 			SfxStyleSheetBasePool* pStylePool = GetDoc()->GetStyleSheetPool();
1301cdf0e10cSrcweir 
1302cdf0e10cSrcweir 			for ( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ )
1303cdf0e10cSrcweir 			{
1304cdf0e10cSrcweir 				sal_Int16 nDepth = pOutliner->GetDepth( nPara );
1305cdf0e10cSrcweir 
1306cdf0e10cSrcweir 				SfxStyleSheet* pStyle = 0;
1307cdf0e10cSrcweir 				if( nDepth > 0 )
1308cdf0e10cSrcweir 				{
1309cdf0e10cSrcweir 					String aStyleSheetName( pStyleSheet->GetName() );
1310cdf0e10cSrcweir 					aStyleSheetName.Erase( aStyleSheetName.Len() - 1, 1 );
1311cdf0e10cSrcweir 					aStyleSheetName += String::CreateFromInt32( nDepth );
1312cdf0e10cSrcweir 					pStyle = static_cast<SfxStyleSheet*>( pStylePool->Find( aStyleSheetName, pStyleSheet->GetFamily() ) );
1313cdf0e10cSrcweir 					DBG_ASSERT( pStyle, "sd::View::OnEndPasteOrDrop(), Style not found!" );
1314cdf0e10cSrcweir 				}
1315cdf0e10cSrcweir 
1316cdf0e10cSrcweir 				if( !pStyle )
1317cdf0e10cSrcweir 					pStyle = pStyleSheet;
1318cdf0e10cSrcweir 
1319cdf0e10cSrcweir 				pOutliner->SetStyleSheet( nPara, pStyle );
1320cdf0e10cSrcweir 			}
1321cdf0e10cSrcweir 		}
1322cdf0e10cSrcweir 		else
1323cdf0e10cSrcweir 		{
1324cdf0e10cSrcweir 			// just put the object style on each new paragraph
1325cdf0e10cSrcweir 			for ( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ )
1326cdf0e10cSrcweir 			{
1327cdf0e10cSrcweir 				pOutliner->SetStyleSheet( nPara, pStyleSheet );
1328cdf0e10cSrcweir 			}
1329cdf0e10cSrcweir 		}
1330cdf0e10cSrcweir 	}
1331cdf0e10cSrcweir }
1332cdf0e10cSrcweir 
1333cdf0e10cSrcweir } // end of namespace sd
1334