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