1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
21 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
24 #include <editeng/unolingu.hxx>
25 #include <sfx2/request.hxx>
26 #include <svx/obj3d.hxx>
27 #include <svx/fmview.hxx>
28 #include <editeng/outliner.hxx>
29 #include <svx/svxids.hrc>
30 #include <svx/svdograf.hxx>
31 #include <svx/svdoole2.hxx>
32 #include <svx/svdundo.hxx>
34 #include <vcl/settings.hxx>
35 #include <vcl/msgbox.hxx>
37 #include <sfx2/dispatch.hxx>
38 #include <sfx2/app.hxx>
39 #include <svx/svdpagv.hxx>
40 #include <sfx2/docfile.hxx>
41 #include <svx/svdoutl.hxx>
42 #include <svx/sdr/contact/displayinfo.hxx>
44 #include <svx/svdetc.hxx>
45 #include <editeng/editstat.hxx>
47 #include <svx/dialogs.hrc>
48 #include <sfx2/viewfrm.hxx>
49 #include <sfx2/sidebar/EnumContext.hxx>
50 #include <svx/svdopage.hxx>
51 #include <toolkit/helper/vclunohelper.hxx>
52 #include <svx/xlndsit.hxx>
53 #include <svx/xlineit0.hxx>
54 #include <svx/xlnclit.hxx>
55 #include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
56 #include <vcl/virdev.hxx>
59 #include "strings.hrc"
62 #include "drawdoc.hxx"
63 #include "DrawDocShell.hxx"
67 #include "sdresid.hxx"
68 #include "DrawViewShell.hxx"
70 #include "fuinsfil.hxx"
71 #include "slideshow.hxx"
72 #include "stlpool.hxx"
73 #include "FrameView.hxx"
74 #include "ViewClipboard.hxx"
75 #include "undo/undomanager.hxx"
76 #include <svx/sdr/contact/viewobjectcontact.hxx>
77 #include <svx/sdr/contact/viewcontact.hxx>
78 #include <svx/svdotable.hxx>
79 #include "EventMultiplexer.hxx"
80 #include "ViewShellBase.hxx"
81 #include "ViewShellManager.hxx"
83 #include <basegfx/polygon/b2dpolygontools.hxx>
84 #include <basegfx/color/bcolor.hxx>
85 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
86 #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
87 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
88 #include <svx/sdr/contact/objectcontact.hxx>
89 #include <svx/sdr/table/tablecontroller.hxx>
90 #include <basegfx/matrix/b2dhommatrix.hxx>
91 #include <drawinglayer/primitive2d/textprimitive2d.hxx>
92 #include <svx/unoapi.hxx>
93 #include <basegfx/matrix/b2dhommatrixtools.hxx>
94 #include "DrawController.hxx"
97 #include <boost/scoped_ptr.hpp>
99 using namespace com::sun::star
;
100 using namespace com::sun::star::uno
;
101 using namespace sdr::table
;
104 TYPEINIT1(View
, FmFormView
);
106 View::View(SdDrawDocument
& rDrawDoc
, OutputDevice
* pOutDev
,
107 ViewShell
* pViewShell
)
108 : FmFormView(&rDrawDoc
, pOutDev
),
110 mpDocSh(rDrawDoc
.GetDocSh()),
111 mpViewSh(pViewShell
),
112 mpDragSrcMarkList(NULL
),
113 mpDropMarkerObj(NULL
),
115 mnDragSrcPgNum(SDRPAGE_NOTFOUND
),
116 mnAction(DND_ACTION_NONE
),
118 mbIsDropAllowed(true),
120 mpClipboard (new ViewClipboard (*this))
122 // #i73602# Use default from the configuration
123 SetBufferedOverlayAllowed(getOptionsDrawinglayer().IsOverlayBuffer_DrawImpress());
125 // #i74769#, #i75172# Use default from the configuration
126 SetBufferedOutputAllowed(getOptionsDrawinglayer().IsPaintBuffer_DrawImpress());
128 EnableExtendedKeyInputDispatcher(false);
129 EnableExtendedMouseEventDispatcher(false);
130 EnableExtendedCommandEventDispatcher(false);
132 SetUseIncompatiblePathCreateInterface(false);
133 SetMarkHdlWhenTextEdit(true);
134 EnableTextEditOnObjectsWithoutTextIfTextTool(true);
136 SetMinMoveDistancePixel(2);
137 SetHitTolerancePixel(2);
138 SetMeasureLayer(SD_RESSTR(STR_LAYER_MEASURELINES
));
140 // Timer for delayed drop (has to be for MAC)
141 maDropErrorIdle
.SetIdleHdl( LINK(this, View
, DropErrorHdl
) );
142 maDropErrorIdle
.SetPriority(SchedulerPriority::MEDIUM
);
143 maDropInsertFileIdle
.SetIdleHdl( LINK(this, View
, DropInsertFileHdl
) );
144 maDropInsertFileIdle
.SetPriority(SchedulerPriority::MEDIUM
);
147 void View::ImplClearDrawDropMarker()
158 maSmartTags
.Dispose();
160 // release content of selection clipboard, if we own the content
161 UpdateSelectionClipboard( true );
163 maDropErrorIdle
.Stop();
164 maDropInsertFileIdle
.Stop();
166 ImplClearDrawDropMarker();
168 while(PaintWindowCount())
170 // remove all registered OutDevs
171 DeleteWindowFromPaintView(GetFirstOutputDevice() /*GetWin(0)*/);
175 class ViewRedirector
: public sdr::contact::ViewObjectContactRedirector
179 virtual ~ViewRedirector();
181 // all default implementations just call the same methods at the original. To do something
182 // different, override the method and at least do what the method does.
183 virtual drawinglayer::primitive2d::Primitive2DSequence
createRedirectedPrimitive2DSequence(
184 const sdr::contact::ViewObjectContact
& rOriginal
,
185 const sdr::contact::DisplayInfo
& rDisplayInfo
) SAL_OVERRIDE
;
188 ViewRedirector::ViewRedirector()
192 ViewRedirector::~ViewRedirector()
196 drawinglayer::primitive2d::Primitive2DSequence
ViewRedirector::createRedirectedPrimitive2DSequence(
197 const sdr::contact::ViewObjectContact
& rOriginal
,
198 const sdr::contact::DisplayInfo
& rDisplayInfo
)
200 SdrObject
* pObject
= rOriginal
.GetViewContact().TryToGetSdrObject();
201 drawinglayer::primitive2d::Primitive2DSequence xRetval
;
203 if(pObject
&& pObject
->GetPage())
205 const bool bDoCreateGeometry(pObject
->GetPage()->checkVisibility( rOriginal
, rDisplayInfo
, true ));
207 if(!bDoCreateGeometry
&& !(( pObject
->GetObjInventor() == SdrInventor
) && ( pObject
->GetObjIdentifier() == OBJ_PAGE
)) )
210 PresObjKind
eKind(PRESOBJ_NONE
);
211 const bool bSubContentProcessing(rDisplayInfo
.GetSubContentActive());
212 const bool bIsMasterPageObject(pObject
->GetPage()->IsMasterPage());
213 const bool bIsPrinting(rOriginal
.GetObjectContact().isOutputToPrinter());
214 const SdrPageView
* pPageView
= rOriginal
.GetObjectContact().TryToGetSdrPageView();
215 const SdrPage
* pVisualizedPage
= GetSdrPageFromXDrawPage(rOriginal
.GetObjectContact().getViewInformation2D().getVisualizedPage());
216 const SdPage
* pObjectsSdPage
= dynamic_cast< SdPage
* >(pObject
->GetPage());
217 const bool bIsInsidePageObj(pPageView
&& pPageView
->GetPage() != pVisualizedPage
);
219 // check if we need to draw a placeholder border. Never do it for
220 // objects inside a SdrPageObj and never when printing
221 if(!bIsInsidePageObj
&& !bIsPrinting
)
223 bool bCreateOutline(false);
225 if( pObject
->IsEmptyPresObj() && pObject
->ISA(SdrTextObj
) )
227 if( !bSubContentProcessing
|| !pObject
->IsNotVisibleAsMaster() )
229 eKind
= pObjectsSdPage
? pObjectsSdPage
->GetPresObjKind(pObject
) : PRESOBJ_NONE
;
230 bCreateOutline
= true;
233 else if( ( pObject
->GetObjInventor() == SdrInventor
) && ( pObject
->GetObjIdentifier() == OBJ_TEXT
) )
237 eKind
= pObjectsSdPage
->GetPresObjKind(pObject
);
239 if((eKind
== PRESOBJ_FOOTER
) || (eKind
== PRESOBJ_HEADER
) || (eKind
== PRESOBJ_DATETIME
) || (eKind
== PRESOBJ_SLIDENUMBER
) )
241 if( !bSubContentProcessing
)
243 // only draw a boundary for header&footer objects on the masterpage itself
244 bCreateOutline
= true;
249 else if( ( pObject
->GetObjInventor() == SdrInventor
) && ( pObject
->GetObjIdentifier() == OBJ_PAGE
) )
251 // only for handout page, else this frame will be created for each
252 // page preview object in SlideSorter and PagePane
253 if(pObjectsSdPage
&& PK_HANDOUT
== pObjectsSdPage
->GetPageKind())
255 bCreateOutline
= true;
261 // empty presentation objects get a gray frame
262 const svtools::ColorConfig aColorConfig
;
263 const svtools::ColorConfigValue
aColor( aColorConfig
.GetColorValue( svtools::OBJECTBOUNDARIES
) );
265 if( aColor
.bIsVisible
)
267 // get basic object transformation
268 const basegfx::BColor
aRGBColor(Color(aColor
.nColor
).getBColor());
269 basegfx::B2DHomMatrix aObjectMatrix
;
270 basegfx::B2DPolyPolygon aObjectPolyPolygon
;
271 pObject
->TRGetBaseGeometry(aObjectMatrix
, aObjectPolyPolygon
);
273 // create dashed border
275 // create object polygon
276 basegfx::B2DPolygon
aPolygon(basegfx::tools::createUnitPolygon());
277 aPolygon
.transform(aObjectMatrix
);
279 // create line and stroke attribute
280 ::std::vector
< double > aDotDashArray
;
282 aDotDashArray
.push_back(160.0);
283 aDotDashArray
.push_back(80.0);
285 const double fFullDotDashLen(::std::accumulate(aDotDashArray
.begin(), aDotDashArray
.end(), 0.0));
286 const drawinglayer::attribute::LineAttribute
aLine(aRGBColor
);
287 const drawinglayer::attribute::StrokeAttribute
aStroke(aDotDashArray
, fFullDotDashLen
);
289 // create primitive and add
290 const drawinglayer::primitive2d::Primitive2DReference
xRef(new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
294 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval
, xRef
);
297 // now paint the placeholder description, but only when masterpage
298 // is displayed as page directly (MasterPage view)
299 if(!bSubContentProcessing
&& bIsMasterPageObject
)
301 OUString aObjectString
;
307 if(pObjectsSdPage
&& pObjectsSdPage
->GetPageKind() == PK_STANDARD
)
309 static OUString
aTitleAreaStr(SD_RESSTR(STR_PLACEHOLDER_DESCRIPTION_TITLE
));
310 aObjectString
= aTitleAreaStr
;
315 case PRESOBJ_OUTLINE
:
317 static OUString
aOutlineAreaStr(SD_RESSTR(STR_PLACEHOLDER_DESCRIPTION_OUTLINE
));
318 aObjectString
= aOutlineAreaStr
;
323 static OUString
aFooterAreaStr(SD_RESSTR(STR_PLACEHOLDER_DESCRIPTION_FOOTER
));
324 aObjectString
= aFooterAreaStr
;
329 static OUString
aHeaderAreaStr(SD_RESSTR(STR_PLACEHOLDER_DESCRIPTION_HEADER
));
330 aObjectString
= aHeaderAreaStr
;
333 case PRESOBJ_DATETIME
:
335 static OUString
aDateTimeStr(SD_RESSTR(STR_PLACEHOLDER_DESCRIPTION_DATETIME
));
336 aObjectString
= aDateTimeStr
;
341 static OUString
aDateTimeStr(SD_RESSTR(STR_PLACEHOLDER_DESCRIPTION_NOTES
));
342 aObjectString
= aDateTimeStr
;
345 case PRESOBJ_SLIDENUMBER
:
347 if(pObjectsSdPage
&& pObjectsSdPage
->GetPageKind() == PK_STANDARD
)
349 static OUString
aSlideAreaStr(SD_RESSTR(STR_PLACEHOLDER_DESCRIPTION_SLIDE
));
350 aObjectString
= aSlideAreaStr
;
354 static OUString
aNumberAreaStr(SD_RESSTR(STR_PLACEHOLDER_DESCRIPTION_NUMBER
));
355 aObjectString
= aNumberAreaStr
;
365 if( !aObjectString
.isEmpty() )
367 // decompose object matrix to be able to place text correctly
368 basegfx::B2DTuple aScale
;
369 basegfx::B2DTuple aTranslate
;
370 double fRotate
, fShearX
;
371 aObjectMatrix
.decompose(aScale
, aTranslate
, fRotate
, fShearX
);
374 SdrTextObj
* pTextObj
= dynamic_cast< SdrTextObj
* >( pObject
);
375 const SdrTextVertAdjust
eTVA(pTextObj
? pTextObj
->GetTextVerticalAdjust() : SDRTEXTVERTADJUST_CENTER
);
376 vcl::Font aScaledVclFont
;
378 // use a text size factor to get more reliable text sizes from the text layouter
379 // (and from vcl), tipp from HDU
380 static sal_uInt32
nTextSizeFactor(100);
382 // use a factor to get more linear text size calculations
383 aScaledVclFont
.SetHeight( 500 * nTextSizeFactor
);
385 // get basic geometry and get text size
386 drawinglayer::primitive2d::TextLayouterDevice aTextLayouter
;
387 aTextLayouter
.setFont(aScaledVclFont
);
388 const sal_Int32
nTextLength(aObjectString
.getLength());
390 // do not forget to use the factor again to get the width for the 500
391 const double fTextWidth(aTextLayouter
.getTextWidth(aObjectString
, 0, nTextLength
) * (1.0 / nTextSizeFactor
));
392 const double fTextHeight(aTextLayouter
.getTextHeight() * (1.0 / nTextSizeFactor
));
394 // calculate text primitive position. If text is at bottom, use top for
395 // the extra text and vice versa
396 const double fHorDist(125);
397 const double fVerDist(125);
398 const double fPosX((aTranslate
.getX() + aScale
.getX()) - fTextWidth
- fHorDist
);
399 const double fPosY((SDRTEXTVERTADJUST_BOTTOM
== eTVA
)
400 ? aTranslate
.getY() - fVerDist
+ fTextHeight
401 : (aTranslate
.getY() + aScale
.getY()) - fVerDist
);
403 // get font attributes; use normally scaled font
404 const basegfx::BColor
aFontColor(aRGBColor
);
406 basegfx::B2DVector aTextSizeAttribute
;
408 aVclFont
.SetHeight( 500 );
410 const drawinglayer::attribute::FontAttribute
aFontAttribute(
411 drawinglayer::primitive2d::getFontAttributeFromVclFont(
418 const basegfx::B2DHomMatrix
aTextMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
419 aTextSizeAttribute
.getX(), aTextSizeAttribute
.getY(),
424 // create DXTextArray (can be empty one)
425 const ::std::vector
< double > aDXArray
{};
427 // create locale; this may need some more information in the future
428 const ::com::sun::star::lang::Locale aLocale
;
430 // create primitive and add
431 const drawinglayer::primitive2d::Primitive2DReference
xRef(
432 new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
441 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval
, xRef
);
448 if(bDoCreateGeometry
)
450 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(
452 sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
459 // not a SdrObject visualisation (maybe e.g. page) or no page
460 xRetval
= sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal
, rDisplayInfo
);
467 * The event will be forwarded to the View
469 void View::CompleteRedraw(OutputDevice
* pOutDev
, const vcl::Region
& rReg
, sdr::contact::ViewObjectContactRedirector
* pRedirector
/*=0L*/)
472 if (mnLockRedrawSmph
== 0)
474 SdrPageView
* pPgView
= GetSdrPageView();
478 SdPage
* pPage
= static_cast<SdPage
*>( pPgView
->GetPage() );
481 SdrOutliner
& rOutl
= mrDoc
.GetDrawOutliner(NULL
);
482 bool bScreenDisplay(true);
484 if(bScreenDisplay
&& pOutDev
&& OUTDEV_PRINTER
== pOutDev
->GetOutDevType())
486 // #i75566# printing; suppress AutoColor BackgroundColor generation
487 // for visibility reasons by giving GetPageBackgroundColor()
489 bScreenDisplay
= false;
492 if(bScreenDisplay
&& pOutDev
&& pOutDev
->GetPDFWriter())
494 // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see above)
495 bScreenDisplay
= false;
498 // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and
499 // hint value if screen display. Only then the AutoColor mechanisms shall be applied
500 rOutl
.SetBackgroundColor( pPage
->GetPageBackgroundColor(pPgView
, bScreenDisplay
) );
504 ViewRedirector aViewRedirector
;
505 FmFormView::CompleteRedraw(pOutDev
, rReg
, pRedirector
? pRedirector
: &aViewRedirector
);
510 SdViewRedrawRec
* pRec
= new SdViewRedrawRec
;
511 pRec
->mpOut
= pOutDev
;
512 pRec
->aRect
= rReg
.GetBoundRect();
513 maLockedRedraws
.push_back(pRec
);
517 void View::MarkListHasChanged()
519 FmFormView::MarkListHasChanged();
521 if( GetMarkedObjectCount() > 0 )
522 maSmartTags
.deselect();
525 bool View::SetAttributes(const SfxItemSet
& rSet
, bool bReplaceAll
)
527 bool bOk
= FmFormView::SetAttributes(rSet
, bReplaceAll
);
531 bool View::GetAttributes( SfxItemSet
& rTargetSet
, bool bOnlyHardAttr
) const
533 return FmFormView::GetAttributes( rTargetSet
, bOnlyHardAttr
);
537 * Is a presentation object selected?
539 bool View::IsPresObjSelected(bool bOnPage
, bool bOnMasterPage
, bool bCheckPresObjListOnly
, bool bCheckLayoutOnly
) const
541 SdrMarkList
* pMarkList
;
543 if (mnDragSrcPgNum
!= SDRPAGE_NOTFOUND
&&
544 mnDragSrcPgNum
!= GetSdrPageView()->GetPage()->GetPageNum())
546 /* Drag&Drop is in progress
547 Source and destination page are different:
548 we use the saved mark list */
549 pMarkList
= mpDragSrcMarkList
;
553 // We use the current mark list
554 pMarkList
= new SdrMarkList(GetMarkedObjectList());
560 bool bSelected
= false;
561 bool bMasterPage
= false;
563 for (size_t nMark
= pMarkList
->GetMarkCount(); nMark
&& !bSelected
; )
566 // Backwards through mark list
567 pMark
= pMarkList
->GetMark(nMark
);
568 SdrObject
* pObj
= pMark
->GetMarkedSdrObj();
570 if ( pObj
&& ( bCheckPresObjListOnly
|| pObj
->IsEmptyPresObj() || pObj
->GetUserCall() ) )
572 pPage
= static_cast<SdPage
*>( pObj
->GetPage() );
573 bMasterPage
= pPage
&& pPage
->IsMasterPage();
575 if ( (bMasterPage
&& bOnMasterPage
) || (!bMasterPage
&& bOnPage
) )
577 if ( pPage
&& pPage
->IsPresObj(pObj
) )
579 if( bCheckLayoutOnly
)
581 PresObjKind eKind
= pPage
->GetPresObjKind(pObj
);
583 if((eKind
!= PRESOBJ_FOOTER
) && (eKind
!= PRESOBJ_HEADER
) && (eKind
!= PRESOBJ_DATETIME
) && (eKind
!= PRESOBJ_SLIDENUMBER
) )
595 if (pMarkList
!= mpDragSrcMarkList
)
603 void View::SelectAll()
607 OutlinerView
* pOLV
= GetTextEditOutlinerView();
608 const ::Outliner
* pOutliner
= GetTextEditOutliner();
609 pOLV
->SelectRange( 0, pOutliner
->GetParagraphCount() );
617 void View::ModelHasChanged()
619 // First, notify SdrView
620 FmFormView::ModelHasChanged();
623 bool View::SetStyleSheet(SfxStyleSheet
* pStyleSheet
, bool bDontRemoveHardAttr
)
625 // forward to SdrView
626 return FmFormView::SetStyleSheet(pStyleSheet
, bDontRemoveHardAttr
);
632 static void SetSpellOptions( const SdDrawDocument
& rDoc
, EEControlBits
& rCntrl
)
634 bool bOnlineSpell
= rDoc
.GetOnlineSpell();
637 rCntrl
|= EEControlBits::ONLINESPELLING
;
639 rCntrl
&= ~EEControlBits::ONLINESPELLING
;
642 void OutlinerMasterViewFilter::Start(SdrOutliner
*pOutl
)
645 OutlinerView
* pOutlView
= m_pOutl
->GetView(0);
646 m_bReadOnly
= pOutlView
->IsReadOnly();
647 pOutlView
->SetReadOnly(true);
650 void OutlinerMasterViewFilter::End()
654 OutlinerView
* pOutlView
= m_pOutl
->GetView(0);
655 pOutlView
->SetReadOnly(m_bReadOnly
);
660 bool View::SdrBeginTextEdit(
661 SdrObject
* pObj
, SdrPageView
* pPV
, vcl::Window
* pWin
,
663 SdrOutliner
* pOutl
, OutlinerView
* pGivenOutlinerView
,
664 bool bDontDeleteOutliner
, bool bOnlyOneView
, bool bGrabFocus
)
666 SdrPage
* pPage
= pObj
? pObj
->GetPage() : NULL
;
667 bool bMasterPage
= pPage
&& pPage
->IsMasterPage();
669 GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
670 sd::tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT
, (void*)pObj
);
672 if( pOutl
==NULL
&& pObj
)
673 pOutl
= SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT
, *pObj
->GetModel());
675 // make draw&impress specific initialisations
678 pOutl
->SetStyleSheetPool(static_cast<SfxStyleSheetPool
*>( mrDoc
.GetStyleSheetPool() ));
679 pOutl
->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule
, CalcFieldValueHdl
));
680 EEControlBits nCntrl
= pOutl
->GetControlWord();
681 nCntrl
|= EEControlBits::ALLOWBIGOBJS
;
682 nCntrl
|= EEControlBits::MARKFIELDS
;
683 nCntrl
|= EEControlBits::AUTOCORRECT
;
685 nCntrl
&= ~EEControlBits::ULSPACESUMMATION
;
686 if ( mrDoc
.IsSummationOfParagraphs() )
687 nCntrl
|= EEControlBits::ULSPACESUMMATION
;
689 SetSpellOptions( mrDoc
, nCntrl
);
691 pOutl
->SetControlWord(nCntrl
);
693 Reference
< linguistic2::XSpellChecker1
> xSpellChecker( LinguMgr::GetSpellChecker() );
694 if ( xSpellChecker
.is() )
695 pOutl
->SetSpeller( xSpellChecker
);
697 Reference
< linguistic2::XHyphenator
> xHyphenator( LinguMgr::GetHyphenator() );
698 if( xHyphenator
.is() )
699 pOutl
->SetHyphenator( xHyphenator
);
701 pOutl
->SetDefaultLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
704 bool bReturn
= FmFormView::SdrBeginTextEdit(
705 pObj
, pPV
, pWin
, bIsNewObj
, pOutl
,
706 pGivenOutlinerView
, bDontDeleteOutliner
,
707 bOnlyOneView
, bGrabFocus
);
711 mpViewSh
->GetViewShellBase().GetDrawController().FireSelectionChangeListener();
716 ::Outliner
* pOL
= GetTextEditOutliner();
718 if( pObj
&& pObj
->GetPage() )
721 if( pObj
->GetObjInventor() == SdrInventor
&& pObj
->GetObjIdentifier() == OBJ_TABLE
)
723 aBackground
= GetTextEditBackgroundColor(*this);
727 aBackground
= pObj
->GetPage()->GetPageBackgroundColor(pPV
);
730 pOL
->SetBackgroundColor( aBackground
);
735 pOL
->SetParaInsertedHdl(LINK(this, View
, OnParagraphInsertedHdl
));
736 pOL
->SetParaRemovingHdl(LINK(this, View
, OnParagraphRemovingHdl
));
740 if (bMasterPage
&& bReturn
&& pOutl
)
742 const SdrTextObj
* pTextObj
= pOutl
->GetTextObj();
743 const SdPage
* pSdPage
= pTextObj
? static_cast<const SdPage
*>(pTextObj
->GetPage()) : NULL
;
744 const PresObjKind eKind
= pSdPage
? pSdPage
->GetPresObjKind(const_cast<SdrTextObj
*>(pTextObj
)) : PRESOBJ_NONE
;
748 case PRESOBJ_OUTLINE
:
750 maMasterViewFilter
.Start(pOutl
);
760 /** ends current text editing */
761 SdrEndTextEditKind
View::SdrEndTextEdit(bool bDontDeleteReally
)
763 maMasterViewFilter
.End();
765 SdrObjectWeakRef
xObj( GetTextEditObject() );
767 bool bDefaultTextRestored
= RestoreDefaultText( dynamic_cast< SdrTextObj
* >( GetTextEditObject() ) );
769 SdrEndTextEditKind eKind
= FmFormView::SdrEndTextEdit(bDontDeleteReally
);
771 if( bDefaultTextRestored
)
773 if( xObj
.is() && !xObj
->IsEmptyPresObj() )
775 xObj
->SetEmptyPresObj( true );
779 eKind
= SDRENDTEXTEDIT_UNCHANGED
;
782 else if( xObj
.is() && xObj
->IsEmptyPresObj() )
784 SdrTextObj
* pObj
= dynamic_cast< SdrTextObj
* >( xObj
.get() );
785 if( pObj
&& pObj
->HasText() )
787 SdrPage
* pPage
= pObj
->GetPage();
788 if( !pPage
|| !pPage
->IsMasterPage() )
789 pObj
->SetEmptyPresObj( false );
793 GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
794 sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT
,
801 mpViewSh
->GetViewShellBase().GetDrawController().FireSelectionChangeListener();
804 SdPage
* pPage
= dynamic_cast< SdPage
* >( xObj
->GetPage() );
806 pPage
->onEndTextEdit( xObj
.get() );
812 /** restores the default text if the given text object is currently in edit mode and
813 no text has been entered already. Is only useful just before text edit ends. */
814 bool View::RestoreDefaultText( SdrTextObj
* pTextObj
)
816 bool bRestored
= false;
818 if( pTextObj
&& (pTextObj
== GetTextEditObject()) )
820 if( !pTextObj
->HasText() )
822 SdPage
* pPage
= dynamic_cast< SdPage
* >( pTextObj
->GetPage() );
826 bRestored
= pPage
->RestoreDefaultText( pTextObj
);
829 SdrOutliner
* pOutliner
= GetTextEditOutliner();
830 pTextObj
->SetTextEditOutliner( pOutliner
);
831 OutlinerParaObject
* pParaObj
= pTextObj
->GetOutlinerParaObject();
833 pOutliner
->SetText(*pParaObj
);
843 * Sets the original size of the marked objects.
845 void View::SetMarkedOriginalSize()
847 SdrUndoGroup
* pUndoGroup
= new SdrUndoGroup(mrDoc
);
848 const size_t nCount
= GetMarkedObjectCount();
851 for( size_t i
= 0; i
< nCount
; ++i
)
853 SdrObject
* pObj
= GetMarkedObjectByIndex(i
);
855 if( pObj
->GetObjInventor() == SdrInventor
)
857 if( pObj
->GetObjIdentifier() == OBJ_OLE2
)
859 uno::Reference
< embed::XEmbeddedObject
> xObj
= static_cast<SdrOle2Obj
*>(pObj
)->GetObjRef();
862 // TODO/LEAN: working with VisualArea can switch object to running state
864 sal_Int64 nAspect
= static_cast<SdrOle2Obj
*>(pObj
)->GetAspect();
867 if ( nAspect
== embed::Aspects::MSOLE_ICON
)
869 MapMode
aMap100( MAP_100TH_MM
);
870 aOleSize
= static_cast<SdrOle2Obj
*>(pObj
)->GetOrigObjSize( &aMap100
);
875 MapUnit aUnit
= VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj
->getMapUnit( nAspect
) );
878 awt::Size aSz
= xObj
->getVisualAreaSize( nAspect
);
879 aOleSize
= OutputDevice::LogicToLogic( Size( aSz
.Width
, aSz
.Height
), aUnit
, MAP_100TH_MM
);
882 catch( embed::NoVisualAreaSizeException
& )
888 Rectangle
aDrawRect( pObj
->GetLogicRect() );
890 pUndoGroup
->AddAction( mrDoc
.GetSdrUndoFactory().CreateUndoGeoObject( *pObj
) );
891 pObj
->Resize( aDrawRect
.TopLeft(), Fraction( aOleSize
.Width(), aDrawRect
.GetWidth() ),
892 Fraction( aOleSize
.Height(), aDrawRect
.GetHeight() ) );
896 else if( pObj
->GetObjIdentifier() == OBJ_GRAF
)
898 const MapMode
aMap100( MAP_100TH_MM
);
901 if ( static_cast< SdrGrafObj
* >( pObj
)->GetGrafPrefMapMode().GetMapUnit() == MAP_PIXEL
)
902 aSize
= Application::GetDefaultDevice()->PixelToLogic( static_cast< SdrGrafObj
* >( pObj
)->GetGrafPrefSize(), aMap100
);
905 aSize
= OutputDevice::LogicToLogic( static_cast< SdrGrafObj
* >( pObj
)->GetGrafPrefSize(),
906 static_cast< SdrGrafObj
* >( pObj
)->GetGrafPrefMapMode(),
910 pUndoGroup
->AddAction( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj
) );
911 Rectangle
aRect( pObj
->GetLogicRect() );
912 aRect
.SetSize( aSize
);
913 pObj
->SetLogicRect( aRect
);
922 pUndoGroup
->SetComment(SD_RESSTR(STR_UNDO_ORIGINALSIZE
));
923 mpDocSh
->GetUndoManager()->AddUndoAction(pUndoGroup
);
930 * Connect OLE object to client.
932 void View::DoConnect(SdrOle2Obj
* pObj
)
936 uno::Reference
< embed::XEmbeddedObject
> xObj( pObj
->GetObjRef() );
939 ::sd::Window
* pWindow
= mpViewSh
->GetActiveWindow();
940 SfxInPlaceClient
* pSdClient
= mpViewSh
-> GetViewShellBase().FindIPClient( xObj
, pWindow
);
943 pSdClient
= new Client(pObj
, mpViewSh
, pWindow
);
944 Rectangle aRect
= pObj
->GetLogicRect();
946 // TODO/LEAN: working with visual area can switch object to running state
947 Size aDrawSize
= aRect
.GetSize();
950 MapMode
aMapMode( mrDoc
.GetScaleUnit() );
951 Size aObjAreaSize
= pObj
->GetOrigObjSize( &aMapMode
);
953 Fraction
aScaleWidth (aDrawSize
.Width(), aObjAreaSize
.Width() );
954 Fraction
aScaleHeight(aDrawSize
.Height(), aObjAreaSize
.Height() );
955 aScaleWidth
.ReduceInaccurate(10); // compatible to SdrOle2Obj
956 aScaleHeight
.ReduceInaccurate(10);
957 pSdClient
->SetSizeScale(aScaleWidth
, aScaleHeight
);
959 // visible area is only changed in-place!
960 // the object area must be set after the scaling, since it triggers resize
961 aRect
.SetSize(aObjAreaSize
);
962 pSdClient
->SetObjArea(aRect
);
969 bool View::IsMorphingAllowed() const
971 const SdrMarkList
& rMarkList
= GetMarkedObjectList();
974 if ( rMarkList
.GetMarkCount() == 2 )
976 const SdrObject
* pObj1
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
977 const SdrObject
* pObj2
= rMarkList
.GetMark( 1 )->GetMarkedSdrObj();
978 const sal_uInt16 nKind1
= pObj1
->GetObjIdentifier();
979 const sal_uInt16 nKind2
= pObj2
->GetObjIdentifier();
981 if ( ( nKind1
!= OBJ_TEXT
&& nKind2
!= OBJ_TEXT
) &&
982 ( nKind1
!= OBJ_TITLETEXT
&& nKind2
!= OBJ_TITLETEXT
) &&
983 ( nKind1
!= OBJ_OUTLINETEXT
&& nKind2
!= OBJ_OUTLINETEXT
) &&
984 ( nKind1
!= OBJ_GRUP
&& nKind2
!= OBJ_GRUP
) &&
985 ( nKind1
!= OBJ_LINE
&& nKind2
!= OBJ_LINE
) &&
986 ( nKind1
!= OBJ_PLIN
&& nKind2
!= OBJ_PLIN
) &&
987 ( nKind1
!= OBJ_PATHLINE
&& nKind2
!= OBJ_PATHLINE
) &&
988 ( nKind1
!= OBJ_FREELINE
&& nKind2
!= OBJ_FREELINE
) &&
989 ( nKind1
!= OBJ_PATHPLIN
&& nKind2
!= OBJ_PATHPLIN
) &&
990 ( nKind1
!= OBJ_MEASURE
&& nKind2
!= OBJ_MEASURE
) &&
991 ( nKind1
!= OBJ_EDGE
&& nKind2
!= OBJ_EDGE
) &&
992 ( nKind1
!= OBJ_GRAF
&& nKind2
!= OBJ_GRAF
) &&
993 ( nKind1
!= OBJ_OLE2
&& nKind2
!= OBJ_OLE2
) &&
994 ( nKind1
!= OBJ_CAPTION
&& nKind2
!= OBJ_CAPTION
) &&
995 !pObj1
->ISA( E3dObject
) && !pObj2
->ISA( E3dObject
) )
997 SfxItemSet
aSet1( mrDoc
.GetPool(), XATTR_FILLSTYLE
, XATTR_FILLSTYLE
);
998 SfxItemSet
aSet2( mrDoc
.GetPool(), XATTR_FILLSTYLE
, XATTR_FILLSTYLE
);
1000 aSet1
.Put(pObj1
->GetMergedItemSet());
1001 aSet2
.Put(pObj2
->GetMergedItemSet());
1003 const drawing::FillStyle eFillStyle1
= static_cast<const XFillStyleItem
&>( aSet1
.Get( XATTR_FILLSTYLE
) ).GetValue();
1004 const drawing::FillStyle eFillStyle2
= static_cast<const XFillStyleItem
&>( aSet2
.Get( XATTR_FILLSTYLE
) ).GetValue();
1006 if( ( eFillStyle1
== drawing::FillStyle_NONE
|| eFillStyle1
== drawing::FillStyle_SOLID
) &&
1007 ( eFillStyle2
== drawing::FillStyle_NONE
|| eFillStyle2
== drawing::FillStyle_SOLID
) )
1015 bool View::IsVectorizeAllowed() const
1017 const SdrMarkList
& rMarkList
= GetMarkedObjectList();
1020 if( rMarkList
.GetMarkCount() == 1 )
1022 const SdrGrafObj
* pObj
= dynamic_cast< const SdrGrafObj
* >(rMarkList
.GetMark( 0 )->GetMarkedSdrObj());
1026 if(GRAPHIC_BITMAP
== pObj
->GetGraphicType() && !pObj
->isEmbeddedSvg())
1036 void View::onAccessibilityOptionsChanged()
1040 ::sd::Window
* pWindow
= mpViewSh
->GetActiveWindow();
1043 const StyleSettings
& rStyleSettings
= pWindow
->GetSettings().GetStyleSettings();
1045 sal_uInt16 nOutputSlot
, nPreviewSlot
;
1047 SvtAccessibilityOptions
& aAccOptions
= getAccessibilityOptions();
1049 if( mpViewSh
->GetViewFrame() && mpViewSh
->GetViewFrame()->GetDispatcher() )
1051 if( rStyleSettings
.GetHighContrastMode() )
1053 nOutputSlot
= SID_OUTPUT_QUALITY_CONTRAST
;
1057 nOutputSlot
= SID_OUTPUT_QUALITY_COLOR
;
1060 if( rStyleSettings
.GetHighContrastMode() && aAccOptions
.GetIsForPagePreviews() )
1062 nPreviewSlot
= SID_PREVIEW_QUALITY_CONTRAST
;
1066 nPreviewSlot
= SID_PREVIEW_QUALITY_COLOR
;
1069 mpViewSh
->GetViewFrame()->GetDispatcher()->Execute( nOutputSlot
, SfxCallMode::ASYNCHRON
);
1070 mpViewSh
->GetViewFrame()->GetDispatcher()->Execute( nPreviewSlot
, SfxCallMode::ASYNCHRON
);
1073 mpViewSh
->Invalidate();
1078 IMPL_LINK( View
, OnParagraphInsertedHdl
, ::Outliner
*, pOutliner
)
1080 Paragraph
* pPara
= pOutliner
->GetHdlParagraph();
1081 SdrObject
* pObj
= GetTextEditObject();
1085 SdPage
* pPage
= dynamic_cast< SdPage
* >( pObj
->GetPage() );
1087 pPage
->onParagraphInserted( pOutliner
, pPara
, pObj
);
1093 * Handler for the deletion of the pages (paragraphs).
1095 IMPL_LINK( View
, OnParagraphRemovingHdl
, ::Outliner
*, pOutliner
)
1097 Paragraph
* pPara
= pOutliner
->GetHdlParagraph();
1098 SdrObject
* pObj
= GetTextEditObject();
1102 SdPage
* pPage
= dynamic_cast< SdPage
* >( pObj
->GetPage() );
1104 pPage
->onParagraphRemoving( pOutliner
, pPara
, pObj
);
1109 bool View::isRecordingUndo() const
1111 if( mrDoc
.IsUndoEnabled() )
1113 sd::UndoManager
* pUndoManager
= mrDoc
.GetUndoManager();
1114 return pUndoManager
&& pUndoManager
->IsInListAction();
1122 void View::AddCustomHdl()
1124 maSmartTags
.addCustomHandles( maHdlList
);
1127 void View::updateHandles()
1132 SdrViewContext
View::GetContext() const
1134 SdrViewContext eContext
= SDRCONTEXT_STANDARD
;
1135 if( maSmartTags
.getContext( eContext
) )
1138 return FmFormView::GetContext();
1141 bool View::HasMarkablePoints() const
1143 if( maSmartTags
.HasMarkablePoints() )
1146 return FmFormView::HasMarkablePoints();
1149 sal_uLong
View::GetMarkablePointCount() const
1151 sal_uLong nCount
= FmFormView::GetMarkablePointCount();
1152 nCount
+= maSmartTags
.GetMarkablePointCount();
1156 bool View::HasMarkedPoints() const
1158 if( maSmartTags
.HasMarkedPoints() )
1161 return FmFormView::HasMarkedPoints();
1164 sal_uLong
View::GetMarkedPointCount() const
1166 sal_uLong nCount
= FmFormView::GetMarkedPointCount();
1167 nCount
+= maSmartTags
.GetMarkedPointCount();
1171 bool View::IsPointMarkable(const SdrHdl
& rHdl
) const
1173 if( SmartTagSet::IsPointMarkable( rHdl
) )
1176 return FmFormView::IsPointMarkable( rHdl
);
1179 bool View::MarkPoint(SdrHdl
& rHdl
, bool bUnmark
)
1181 if( maSmartTags
.MarkPoint( rHdl
, bUnmark
) )
1184 return FmFormView::MarkPoint( rHdl
, bUnmark
);
1187 bool View::MarkPoints(const Rectangle
* pRect
, bool bUnmark
)
1189 if( maSmartTags
.MarkPoints( pRect
, bUnmark
) )
1192 return FmFormView::MarkPoints( pRect
, bUnmark
);
1195 void View::CheckPossibilities()
1197 FmFormView::CheckPossibilities();
1198 maSmartTags
.CheckPossibilities();
1201 void View::OnBeginPasteOrDrop( PasteOrDropInfos
* /*pInfos*/ )
1205 /** this is called after a paste or drop operation, make sure that the newly inserted paragraphs
1206 get the correct style sheet. */
1207 void View::OnEndPasteOrDrop( PasteOrDropInfos
* pInfos
)
1209 SdrTextObj
* pTextObj
= dynamic_cast< SdrTextObj
* >( GetTextEditObject() );
1210 SdrOutliner
* pOutliner
= GetTextEditOutliner();
1211 if( pOutliner
&& pTextObj
&& pTextObj
->GetPage() )
1213 SdPage
* pPage
= static_cast< SdPage
* >( pTextObj
->GetPage() );
1215 SfxStyleSheet
* pStyleSheet
= 0;
1217 const PresObjKind eKind
= pPage
->GetPresObjKind(pTextObj
);
1218 if( eKind
!= PRESOBJ_NONE
)
1219 pStyleSheet
= pPage
->GetStyleSheetForPresObj(eKind
);
1221 pStyleSheet
= pTextObj
->GetStyleSheet();
1223 if( eKind
== PRESOBJ_OUTLINE
)
1225 // for outline shapes, set the correct outline style sheet for each
1226 // new paragraph, depending on the paragraph depth
1227 SfxStyleSheetBasePool
* pStylePool
= GetDoc().GetStyleSheetPool();
1229 for ( sal_Int32 nPara
= pInfos
->nStartPara
; nPara
<= pInfos
->nEndPara
; nPara
++ )
1231 sal_Int16 nDepth
= pOutliner
->GetDepth( nPara
);
1233 SfxStyleSheet
* pStyle
= 0;
1236 OUString
aStyleSheetName( pStyleSheet
->GetName() );
1237 if (!aStyleSheetName
.isEmpty())
1238 aStyleSheetName
= aStyleSheetName
.copy(0, aStyleSheetName
.getLength() - 1);
1239 aStyleSheetName
+= OUString::number( nDepth
);
1240 pStyle
= static_cast<SfxStyleSheet
*>( pStylePool
->Find( aStyleSheetName
, pStyleSheet
->GetFamily() ) );
1241 DBG_ASSERT( pStyle
, "sd::View::OnEndPasteOrDrop(), Style not found!" );
1245 pStyle
= pStyleSheet
;
1247 pOutliner
->SetStyleSheet( nPara
, pStyle
);
1252 // just put the object style on each new paragraph
1253 for ( sal_Int32 nPara
= pInfos
->nStartPara
; nPara
<= pInfos
->nEndPara
; nPara
++ )
1255 pOutliner
->SetStyleSheet( nPara
, pStyleSheet
);
1261 bool View::ShouldToggleOn(
1262 const bool bBulletOnOffMode
,
1263 const bool bNormalBullet
)
1265 // If setting bullets/numbering by the dialog, always should toggle on.
1266 if (!bBulletOnOffMode
)
1268 SdrModel
* pSdrModel
= GetModel();
1272 bool bToggleOn
= false;
1273 boost::scoped_ptr
<SdrOutliner
> pOutliner(SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT
, *pSdrModel
));
1274 const size_t nMarkCount
= GetMarkedObjectCount();
1275 for (size_t nIndex
= 0; nIndex
< nMarkCount
&& !bToggleOn
; ++nIndex
)
1277 SdrTextObj
* pTextObj
= dynamic_cast< SdrTextObj
* >(GetMarkedObjectByIndex(nIndex
));
1278 if (!pTextObj
|| pTextObj
->IsTextEditActive())
1280 if (pTextObj
->ISA(SdrTableObj
))
1282 SdrTableObj
* pTableObj
= dynamic_cast< SdrTableObj
* >(pTextObj
);
1285 CellPos aStart
, aEnd
;
1286 SvxTableController
* pTableController
= dynamic_cast< SvxTableController
* >(getSelectionController().get());
1287 if (pTableController
)
1289 pTableController
->getSelectedCells(aStart
, aEnd
);
1293 aStart
= SdrTableObj::getFirstCell();
1294 aEnd
= pTableObj
->getLastCell();
1296 sal_Int32 nColCount
= pTableObj
->getColumnCount();
1297 for (sal_Int32 nRow
= aStart
.mnRow
; nRow
<= aEnd
.mnRow
&& !bToggleOn
; nRow
++)
1299 for (sal_Int32 nCol
= aStart
.mnCol
; nCol
<= aEnd
.mnCol
&& !bToggleOn
; nCol
++)
1301 sal_Int32 nCellIndex
= nRow
* nColCount
+ nCol
;
1302 SdrText
* pText
= pTableObj
->getText(nCellIndex
);
1303 if (!pText
|| !pText
->GetOutlinerParaObject())
1305 pOutliner
->SetText(*(pText
->GetOutlinerParaObject()));
1306 sal_Int16 nStatus
= pOutliner
->GetBulletsNumberingStatus();
1307 bToggleOn
= (bNormalBullet
&& nStatus
!= 0) || (!bNormalBullet
&& nStatus
!= 1) || bToggleOn
;
1314 OutlinerParaObject
* pParaObj
= pTextObj
->GetOutlinerParaObject();
1317 pOutliner
->SetText(*pParaObj
);
1318 sal_Int16 nStatus
= pOutliner
->GetBulletsNumberingStatus();
1319 bToggleOn
= (bNormalBullet
&& nStatus
!= 0) || (!bNormalBullet
&& nStatus
!= 1) || bToggleOn
;
1326 void View::ChangeMarkedObjectsBulletsNumbering(
1328 const bool bHandleBullets
,
1329 const SvxNumRule
* pNumRule
,
1330 const bool bSwitchOff
)
1332 SdrModel
* pSdrModel
= GetModel();
1333 vcl::Window
* pWindow
= dynamic_cast< vcl::Window
* >(GetFirstOutputDevice());
1334 if (!pSdrModel
|| !pWindow
)
1337 const bool bUndoEnabled
= pSdrModel
->IsUndoEnabled();
1338 SdrUndoGroup
* pUndoGroup
= bUndoEnabled
? new SdrUndoGroup(*pSdrModel
) : 0;
1340 const bool bToggleOn
=
1342 && ShouldToggleOn( bToggle
, bHandleBullets
);
1344 boost::scoped_ptr
<SdrOutliner
> pOutliner(SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT
, *pSdrModel
));
1345 boost::scoped_ptr
<OutlinerView
> pOutlinerView(new OutlinerView(pOutliner
.get(), pWindow
));
1347 const size_t nMarkCount
= GetMarkedObjectCount();
1348 for (size_t nIndex
= 0; nIndex
< nMarkCount
; ++nIndex
)
1350 SdrTextObj
* pTextObj
= dynamic_cast< SdrTextObj
* >(GetMarkedObjectByIndex(nIndex
));
1351 if (!pTextObj
|| pTextObj
->IsTextEditActive())
1353 if (pTextObj
->ISA(SdrTableObj
))
1355 SdrTableObj
* pTableObj
= dynamic_cast< SdrTableObj
* >(pTextObj
);
1358 CellPos aStart
, aEnd
;
1359 SvxTableController
* pTableController
= dynamic_cast< SvxTableController
* >(getSelectionController().get());
1360 if (pTableController
)
1362 pTableController
->getSelectedCells(aStart
, aEnd
);
1366 aStart
= SdrTableObj::getFirstCell();
1367 aEnd
= pTableObj
->getLastCell();
1369 sal_Int32 nColCount
= pTableObj
->getColumnCount();
1370 for (sal_Int32 nRow
= aStart
.mnRow
; nRow
<= aEnd
.mnRow
; nRow
++)
1372 for (sal_Int32 nCol
= aStart
.mnCol
; nCol
<= aEnd
.mnCol
; nCol
++)
1374 sal_Int32 nCellIndex
= nRow
* nColCount
+ nCol
;
1375 SdrText
* pText
= pTableObj
->getText(nCellIndex
);
1376 if (!pText
|| !pText
->GetOutlinerParaObject())
1379 pOutliner
->SetText(*(pText
->GetOutlinerParaObject()));
1382 SdrUndoObjSetText
* pTxtUndo
= dynamic_cast< SdrUndoObjSetText
* >(pSdrModel
->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj
, nCellIndex
));
1383 pUndoGroup
->AddAction(pTxtUndo
);
1387 pOutlinerView
->SwitchOffBulletsNumbering();
1391 pOutlinerView
->ApplyBulletsNumbering( bHandleBullets
, pNumRule
, bToggle
);
1393 sal_uInt32 nParaCount
= pOutliner
->GetParagraphCount();
1394 pText
->SetOutlinerParaObject(pOutliner
->CreateParaObject(0, (sal_uInt16
)nParaCount
));
1398 // Broadcast the object change event.
1399 if (!pTextObj
->AdjustTextFrameWidthAndHeight())
1401 pTextObj
->SetChanged();
1402 pTextObj
->BroadcastObjectChange();
1407 OutlinerParaObject
* pParaObj
= pTextObj
->GetOutlinerParaObject();
1410 pOutliner
->SetText(*pParaObj
);
1413 SdrUndoObjSetText
* pTxtUndo
= dynamic_cast< SdrUndoObjSetText
* >(pSdrModel
->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj
, 0));
1414 pUndoGroup
->AddAction(pTxtUndo
);
1418 pOutlinerView
->SwitchOffBulletsNumbering();
1422 pOutlinerView
->ApplyBulletsNumbering( bHandleBullets
, pNumRule
, bToggle
);
1424 sal_uInt32 nParaCount
= pOutliner
->GetParagraphCount();
1425 pTextObj
->SetOutlinerParaObject(pOutliner
->CreateParaObject(0, (sal_uInt16
)nParaCount
));
1430 if ( bUndoEnabled
&& pUndoGroup
->GetActionCount() > 0 )
1432 pSdrModel
->BegUndo();
1433 pSdrModel
->AddUndo(pUndoGroup
);
1434 pSdrModel
->EndUndo();
1440 } // end of namespace sd
1442 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */