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 <config_features.h>
22 #include <avmedia/mediaplayer.hxx>
24 #include <basic/sberrors.hxx>
25 #include <basic/sbstar.hxx>
27 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
28 #include <com/sun/star/drawing/XDrawPages.hpp>
29 #include <com/sun/star/lang/XInitialization.hpp>
30 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
31 #include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
32 #include <com/sun/star/frame/XDispatchProvider.hpp>
33 #include <com/sun/star/util/URLTransformer.hpp>
34 #include <com/sun/star/util/XURLTransformer.hpp>
35 #include <com/sun/star/scanner/XScannerManager2.hpp>
36 #include <com/sun/star/document/XDocumentProperties.hpp>
38 #include <comphelper/processfactory.hxx>
39 #include <comphelper/propertysequence.hxx>
40 #include <comphelper/scopeguard.hxx>
41 #include <comphelper/lok.hxx>
43 #include <editeng/contouritem.hxx>
44 #include <editeng/editdata.hxx>
45 #include <editeng/eeitem.hxx>
46 #include <editeng/flditem.hxx>
47 #include <editeng/section.hxx>
48 #include <editeng/editobj.hxx>
49 #include <editeng/CustomPropertyField.hxx>
50 #include <editeng/urlfieldhelper.hxx>
52 #include <sal/log.hxx>
54 #include <sfx2/bindings.hxx>
55 #include <sfx2/dispatch.hxx>
56 #include <sfx2/docfile.hxx>
57 #include <sfx2/msgpool.hxx>
58 #include <sfx2/msg.hxx>
59 #include <sfx2/request.hxx>
60 #include <sfx2/viewfrm.hxx>
61 #include <sfx2/zoomitem.hxx>
63 #include <svx/compressgraphicdialog.hxx>
64 #include <svx/ClassificationDialog.hxx>
65 #include <svx/ClassificationCommon.hxx>
66 #include <svx/bmpmask.hxx>
67 #include <svx/extedit.hxx>
68 #include <svx/extrusionbar.hxx>
69 #include <svx/f3dchild.hxx>
70 #include <svx/fontwork.hxx>
71 #include <svx/fontworkbar.hxx>
72 #include <svx/graphichelper.hxx>
73 #include <svx/hlnkitem.hxx>
74 #include <svx/imapdlg.hxx>
75 #include <svx/sdtagitm.hxx>
76 #include <svx/svdograf.hxx>
77 #include <svx/svdoole2.hxx>
78 #include <svx/svdpagv.hxx>
79 #include <svx/svdundo.hxx>
80 #include <svx/svxdlg.hxx>
81 #include <svx/svxids.hrc>
82 #include <svx/sdtfsitm.hxx>
83 #include <svx/sdmetitm.hxx>
84 #include <svx/zoomslideritem.hxx>
85 #include <svx/xflclit.hxx>
86 #include <svx/xlnwtit.hxx>
87 #include <svx/chrtitem.hxx>
88 #include <svx/xlnclit.hxx>
89 #include <svx/xflgrit.hxx>
90 #include <svx/xfillit0.hxx>
92 #include <comphelper/diagnose_ex.hxx>
93 #include <tools/UnitConversion.hxx>
95 #include <unotools/useroptions.hxx>
97 #include <vcl/abstdlg.hxx>
98 #include <vcl/graph.hxx>
99 #include <vcl/svapp.hxx>
100 #include <vcl/unohelp2.hxx>
101 #include <vcl/weld.hxx>
103 #include <editeng/cmapitem.hxx>
104 #include <editeng/escapementitem.hxx>
105 #include <editeng/kernitem.hxx>
106 #include <editeng/wghtitem.hxx>
107 #include <editeng/postitem.hxx>
108 #include <editeng/udlnitem.hxx>
109 #include <editeng/crossedoutitem.hxx>
110 #include <editeng/shdditem.hxx>
111 #include <editeng/numitem.hxx>
112 #include <svx/svdobj.hxx>
113 #include <svx/SvxColorChildWindow.hxx>
114 #include <editeng/outlobj.hxx>
115 #include <editeng/flstitem.hxx>
116 #include <editeng/fontitem.hxx>
117 #include <editeng/fhgtitem.hxx>
118 #include <editeng/colritem.hxx>
120 #include <svl/poolitem.hxx>
121 #include <svl/style.hxx>
122 #include <svl/whiter.hxx>
125 #include <strings.hrc>
127 #include <AnimationChildWindow.hxx>
128 #include <DrawDocShell.hxx>
129 #include <DrawViewShell.hxx>
130 #include <LayerTabBar.hxx>
131 #include <Outliner.hxx>
132 #include <ViewShellHint.hxx>
133 #include <ViewShellImplementation.hxx>
134 #include <Window.hxx>
135 #include <drawdoc.hxx>
136 #include <drawview.hxx>
137 #include <fuarea.hxx>
138 #include <fubullet.hxx>
139 #include <fuchar.hxx>
140 #include <fucushow.hxx>
141 #include <fuconnct.hxx>
142 #include <fucopy.hxx>
143 #include <fudspord.hxx>
144 #include <fuexecuteinteraction.hxx>
145 #include <fuexpand.hxx>
146 #include <fuinsert.hxx>
147 #include <fuinsfil.hxx>
148 #include <fuline.hxx>
149 #include <fulinend.hxx>
150 #include <fulink.hxx>
151 #include <fumeasur.hxx>
152 #include <fumorph.hxx>
153 #include <fuoaprms.hxx>
154 #include <fuolbull.hxx>
155 #include <fupage.hxx>
156 #include <fuparagr.hxx>
157 #include <fuprlout.hxx>
158 #include <fuscale.hxx>
160 #include <fusldlg.hxx>
161 #include <fusnapln.hxx>
162 #include <fusumry.hxx>
163 #include <futempl.hxx>
164 #include <futhes.hxx>
165 #include <futransf.hxx>
166 #include <futxtatt.hxx>
167 #include <fuvect.hxx>
168 #include <futext.hxx>
170 #include <sdabstdlg.hxx>
171 #include <sdattr.hxx>
172 #include <sdpage.hxx>
173 #include <sdresid.hxx>
174 #include <unokywds.hxx>
175 #include <slideshow.hxx>
176 #include <stlsheet.hxx>
177 #include <undolayer.hxx>
178 #include <sfx2/sidebar/Sidebar.hxx>
179 #include <sfx2/classificationhelper.hxx>
181 #include <model/SlsPageDescriptor.hxx>
182 #include <model/SlsPageEnumerationProvider.hxx>
183 #include <SlideSorter.hxx>
184 #include <view/SlideSorterView.hxx>
185 #include <SlideSorterViewShell.hxx>
186 #include <controller/SlideSorterController.hxx>
187 #include <controller/SlsPageSelector.hxx>
188 #include <tools/GraphicSizeCheck.hxx>
190 #include <theme/ThemeColorChanger.hxx>
191 #include <svx/dialog/ThemeDialog.hxx>
192 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
194 #include <ViewShellBase.hxx>
197 #include <sfx2/newstyle.hxx>
198 #include <SelectLayerDlg.hxx>
199 #include <unomodel.hxx>
201 using namespace ::com::sun::star
;
202 using namespace ::com::sun::star::uno
;
204 #define MIN_ACTIONS_FOR_DIALOG 5000 ///< if there are more meta objects, we show a dialog during the break up
210 const SvxFieldItem
* findField(editeng::Section
const & rSection
)
212 for (SfxPoolItem
const * pPool
: rSection
.maAttributes
)
214 if (pPool
->Which() == EE_FEATURE_FIELD
)
215 return static_cast<const SvxFieldItem
*>(pPool
);
220 bool hasCustomPropertyField(std::vector
<editeng::Section
> const & aSections
, std::u16string_view rName
)
222 for (editeng::Section
const & rSection
: aSections
)
224 const SvxFieldItem
* pFieldItem
= findField(rSection
);
227 const editeng::CustomPropertyField
* pCustomPropertyField
= dynamic_cast<const editeng::CustomPropertyField
*>(pFieldItem
->GetField());
228 if (pCustomPropertyField
&& pCustomPropertyField
->GetName() == rName
)
235 OUString
getWeightString(SfxItemSet
const & rItemSet
)
237 OUString sWeightString
= u
"NORMAL"_ustr
;
239 if (const SfxPoolItem
* pItem
= rItemSet
.GetItem(EE_CHAR_WEIGHT
, false))
241 const SvxWeightItem
* pWeightItem
= dynamic_cast<const SvxWeightItem
*>(pItem
);
242 if (pWeightItem
&& pWeightItem
->GetWeight() == WEIGHT_BOLD
)
243 sWeightString
= "BOLD";
245 return sWeightString
;
248 class ClassificationCommon
251 sd::DrawViewShell
& m_rDrawViewShell
;
252 uno::Reference
<document::XDocumentProperties
> m_xDocumentProperties
;
253 uno::Reference
<beans::XPropertyContainer
> m_xPropertyContainer
;
254 sfx::ClassificationKeyCreator m_aKeyCreator
;
256 ClassificationCommon(sd::DrawViewShell
& rDrawViewShell
, const css::uno::Reference
<css::document::XDocumentProperties
>& rDocProps
)
257 : m_rDrawViewShell(rDrawViewShell
)
258 , m_xDocumentProperties(rDocProps
)
259 , m_xPropertyContainer(m_xDocumentProperties
->getUserDefinedProperties())
260 , m_aKeyCreator(SfxClassificationHelper::getPolicyType())
264 class ClassificationCollector
: public ClassificationCommon
267 std::vector
<svx::ClassificationResult
> m_aResults
;
269 void iterateSectionsAndCollect(std::vector
<editeng::Section
> const & rSections
, EditTextObject
const & rEditText
)
271 sal_Int32 nCurrentParagraph
= -1;
274 for (editeng::Section
const & rSection
: rSections
)
276 // Insert new paragraph if needed
277 while (nCurrentParagraph
< rSection
.mnParagraph
)
280 // Get Weight of current paragraph
281 OUString sWeightProperty
= getWeightString(rEditText
.GetParaAttribs(nCurrentParagraph
));
282 // Insert new paragraph into collection
283 m_aResults
.emplace_back(svx::ClassificationType::PARAGRAPH
, sWeightProperty
, sBlank
, sBlank
);
286 const SvxFieldItem
* pFieldItem
= findField(rSection
);
287 const editeng::CustomPropertyField
* pCustomPropertyField
= pFieldItem
?
288 dynamic_cast<const editeng::CustomPropertyField
*>(pFieldItem
->GetField()) :
290 if (pCustomPropertyField
)
292 const OUString
& aKey
= pCustomPropertyField
->GetName();
293 if (m_aKeyCreator
.isMarkingTextKey(aKey
))
295 m_aResults
.emplace_back(svx::ClassificationType::TEXT
,
296 svx::classification::getProperty(m_xPropertyContainer
, aKey
),
299 else if (m_aKeyCreator
.isCategoryNameKey(aKey
) || m_aKeyCreator
.isCategoryIdentifierKey(aKey
))
301 m_aResults
.emplace_back(svx::ClassificationType::CATEGORY
,
302 svx::classification::getProperty(m_xPropertyContainer
, aKey
),
305 else if (m_aKeyCreator
.isMarkingKey(aKey
))
307 m_aResults
.emplace_back(svx::ClassificationType::MARKING
,
308 svx::classification::getProperty(m_xPropertyContainer
, aKey
),
311 else if (m_aKeyCreator
.isIntellectualPropertyPartKey(aKey
))
313 m_aResults
.emplace_back(svx::ClassificationType::INTELLECTUAL_PROPERTY_PART
,
314 svx::classification::getProperty(m_xPropertyContainer
, aKey
),
322 ClassificationCollector(sd::DrawViewShell
& rDrawViewShell
, const css::uno::Reference
<css::document::XDocumentProperties
>& rDocProps
)
323 : ClassificationCommon(rDrawViewShell
, rDocProps
)
326 std::vector
<svx::ClassificationResult
> const & getResults() const
333 // Set to MASTER mode
334 EditMode eOldMode
= m_rDrawViewShell
.GetEditMode();
335 if (eOldMode
!= EditMode::MasterPage
)
336 m_rDrawViewShell
.ChangeEditMode(EditMode::MasterPage
, false);
338 // Scoped guard to revert to the previous mode
339 comphelper::ScopeGuard
const aGuard([this, eOldMode
] () {
340 m_rDrawViewShell
.ChangeEditMode(eOldMode
, false);
343 const sal_uInt16 nCount
= m_rDrawViewShell
.GetDoc()->GetMasterSdPageCount(PageKind::Standard
);
345 for (sal_uInt16 nPageIndex
= 0; nPageIndex
< nCount
; ++nPageIndex
)
347 SdPage
* pMasterPage
= m_rDrawViewShell
.GetDoc()->GetMasterSdPage(nPageIndex
, PageKind::Standard
);
348 for (const rtl::Reference
<SdrObject
>& pObject
: *pMasterPage
)
350 SdrRectObj
* pRectObject
= dynamic_cast<SdrRectObj
*>(pObject
.get());
351 if (pRectObject
&& pRectObject
->GetTextKind() == SdrObjKind::Text
)
353 OutlinerParaObject
* pOutlinerParagraphObject
= pRectObject
->GetOutlinerParaObject();
354 if (pOutlinerParagraphObject
)
356 const EditTextObject
& rEditText
= pOutlinerParagraphObject
->GetTextObject();
357 std::vector
<editeng::Section
> aSections
;
358 rEditText
.GetAllSections(aSections
);
360 // Search for a custom property field that has the classification category identifier key
361 if (hasCustomPropertyField(aSections
, m_aKeyCreator
.makeCategoryNameKey()))
363 iterateSectionsAndCollect(aSections
, rEditText
);
373 class ClassificationInserter
: public ClassificationCommon
376 /// Delete the previous existing classification object(s) - if they exist
377 void deleteExistingObjects()
379 OUString sKey
= m_aKeyCreator
.makeCategoryNameKey();
381 const sal_uInt16 nCount
= m_rDrawViewShell
.GetDoc()->GetMasterSdPageCount(PageKind::Standard
);
383 for (sal_uInt16 nPageIndex
= 0; nPageIndex
< nCount
; ++nPageIndex
)
385 SdPage
* pMasterPage
= m_rDrawViewShell
.GetDoc()->GetMasterSdPage(nPageIndex
, PageKind::Standard
);
386 for (const rtl::Reference
<SdrObject
>& pObject
: *pMasterPage
)
388 SdrRectObj
* pRectObject
= dynamic_cast<SdrRectObj
*>(pObject
.get());
389 if (pRectObject
&& pRectObject
->GetTextKind() == SdrObjKind::Text
)
391 OutlinerParaObject
* pOutlinerParagraphObject
= pRectObject
->GetOutlinerParaObject();
392 if (pOutlinerParagraphObject
)
394 const EditTextObject
& rEditText
= pOutlinerParagraphObject
->GetTextObject();
395 std::vector
<editeng::Section
> aSections
;
396 rEditText
.GetAllSections(aSections
);
398 if (hasCustomPropertyField(aSections
, sKey
))
400 pMasterPage
->RemoveObject(pRectObject
->GetOrdNum());
408 void fillTheOutliner(Outliner
* pOutliner
, std::vector
<svx::ClassificationResult
> const & rResults
)
410 sal_Int32 nParagraph
= -1;
411 for (svx::ClassificationResult
const & rResult
: rResults
)
414 ESelection
aPosition(nParagraph
, EE_TEXTPOS_MAX
);
416 switch (rResult
.meType
)
418 case svx::ClassificationType::TEXT
:
420 OUString sKey
= m_aKeyCreator
.makeNumberedTextKey();
421 svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer
, sKey
, rResult
.msName
);
422 pOutliner
->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey
, rResult
.msName
), EE_FEATURE_FIELD
), aPosition
);
426 case svx::ClassificationType::CATEGORY
:
428 OUString sKey
= m_aKeyCreator
.makeCategoryNameKey();
429 pOutliner
->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey
, rResult
.msName
), EE_FEATURE_FIELD
), aPosition
);
433 case svx::ClassificationType::MARKING
:
435 OUString sKey
= m_aKeyCreator
.makeNumberedMarkingKey();
436 svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer
, sKey
, rResult
.msName
);
437 pOutliner
->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey
, rResult
.msName
), EE_FEATURE_FIELD
), aPosition
);
441 case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART
:
443 OUString sKey
= m_aKeyCreator
.makeNumberedIntellectualPropertyPartKey();
444 svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer
, sKey
, rResult
.msName
);
445 pOutliner
->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey
, rResult
.msName
), EE_FEATURE_FIELD
), aPosition
);
449 case svx::ClassificationType::PARAGRAPH
:
452 pOutliner
->Insert(u
""_ustr
);
454 SfxItemSetFixed
<EE_ITEMS_START
, EE_ITEMS_END
> aItemSet(m_rDrawViewShell
.GetDoc()->GetPool());
456 if (rResult
.msName
== "BOLD")
457 aItemSet
.Put(SvxWeightItem(WEIGHT_BOLD
, EE_CHAR_WEIGHT
));
459 aItemSet
.Put(SvxWeightItem(WEIGHT_NORMAL
, EE_CHAR_WEIGHT
));
461 SvxNumRule
aDefaultNumRule(SvxNumRuleFlags::NONE
, 0, false);
462 aItemSet
.Put(SvxNumBulletItem(std::move(aDefaultNumRule
), EE_PARA_NUMBULLET
));
464 pOutliner
->SetParaAttribs(nParagraph
, aItemSet
);
475 ClassificationInserter(sd::DrawViewShell
& rDrawViewShell
, const css::uno::Reference
<css::document::XDocumentProperties
>& rDocProps
)
476 : ClassificationCommon(rDrawViewShell
, rDocProps
)
480 void insert(std::vector
<svx::ClassificationResult
> const & rResults
)
482 // Set to MASTER mode
483 EditMode eOldMode
= m_rDrawViewShell
.GetEditMode();
484 if (eOldMode
!= EditMode::MasterPage
)
485 m_rDrawViewShell
.ChangeEditMode(EditMode::MasterPage
, false);
487 // Scoped guard to revert the mode
488 comphelper::ScopeGuard
const aGuard([this, eOldMode
] () {
489 m_rDrawViewShell
.ChangeEditMode(eOldMode
, false);
492 // Delete the previous existing object - if exists
493 deleteExistingObjects();
496 svx::classification::removeAllProperties(m_xPropertyContainer
);
498 SfxClassificationHelper
aHelper(m_xDocumentProperties
);
500 // Apply properties from the BA policy
501 for (svx::ClassificationResult
const & rResult
: rResults
)
503 if (rResult
.meType
== svx::ClassificationType::CATEGORY
)
504 aHelper
.SetBACName(rResult
.msName
, SfxClassificationHelper::getPolicyType());
507 // Insert full text as document property
508 svx::classification::insertFullTextualRepresentationAsDocumentProperty(m_xPropertyContainer
, m_aKeyCreator
, rResults
);
510 // Create the outliner from the
511 Outliner
* pOutliner
= m_rDrawViewShell
.GetDoc()->GetInternalOutliner();
512 OutlinerMode eOutlinerMode
= pOutliner
->GetOutlinerMode();
514 comphelper::ScopeGuard
const aOutlinerGuard([pOutliner
, eOutlinerMode
] () {
515 pOutliner
->Init(eOutlinerMode
);
518 pOutliner
->Init(OutlinerMode::TextObject
);
520 // Fill the outliner with the text from classification result
521 fillTheOutliner(pOutliner
, rResults
);
523 // Calculate to outliner text size
524 pOutliner
->UpdateFields();
525 pOutliner
->SetUpdateLayout(true);
526 Size
aTextSize(pOutliner
->CalcTextSize());
527 pOutliner
->SetUpdateLayout(false);
529 // Create objects, apply the outliner and add them (objects) to all master pages
530 const sal_uInt16 nCount
= m_rDrawViewShell
.GetDoc()->GetMasterSdPageCount(PageKind::Standard
);
532 for (sal_uInt16 nPageIndex
= 0; nPageIndex
< nCount
; ++nPageIndex
)
534 SdPage
* pMasterPage
= m_rDrawViewShell
.GetDoc()->GetMasterSdPage(nPageIndex
, PageKind::Standard
);
538 rtl::Reference
<SdrRectObj
> pObject
= new SdrRectObj(
539 *m_rDrawViewShell
.GetDoc(), // TTTT should be reference
541 pObject
->SetMergedItem(makeSdrTextAutoGrowWidthItem(true));
542 pObject
->SetOutlinerParaObject(pOutliner
->CreateParaObject());
543 pMasterPage
->InsertObject(pObject
.get());
545 // Calculate position
546 ::tools::Rectangle
aRectangle(Point(), pMasterPage
->GetSize());
547 Point
aPosition(aRectangle
.Center().X(), aRectangle
.Bottom());
549 aPosition
.AdjustX( -(aTextSize
.Width() / 2) );
550 aPosition
.AdjustY( -(aTextSize
.Height()) );
552 pObject
->SetLogicRect(::tools::Rectangle(aPosition
, aTextSize
));
557 void lcl_convertStringArguments(const std::unique_ptr
<SfxItemSet
>& pArgs
)
559 const SfxPoolItem
* pItem
= nullptr;
561 if (SfxItemState::SET
== pArgs
->GetItemState(SID_ATTR_LINE_WIDTH_ARG
, false, &pItem
))
563 double fValue
= static_cast<const SvxDoubleItem
*>(pItem
)->GetValue();
564 // FIXME: different units...
566 int nValue
= fValue
* nPow
;
568 XLineWidthItem
aItem(nValue
);
571 if (SfxItemState::SET
== pArgs
->GetItemState(SID_FILL_GRADIENT_JSON
, false, &pItem
))
573 const SfxStringItem
* pJSON
= static_cast<const SfxStringItem
*>(pItem
);
576 basegfx::BGradient aGradient
= basegfx::BGradient::fromJSON(pJSON
->GetValue());
577 XFillGradientItem
aItem(aGradient
);
585 * SfxRequests for temporary actions
588 void DrawViewShell::FuTemporary(SfxRequest
& rReq
)
590 // during a native slide show nothing gets executed!
591 if(SlideShow::IsRunning( GetViewShellBase() )
592 && !SlideShow::IsInteractiveSlideshow( &GetViewShellBase() ) // IASS
593 && (rReq
.GetSlot() != SID_NAVIGATOR
))
596 DBG_ASSERT( mpDrawView
, "sd::DrawViewShell::FuTemporary(), no draw view!" );
602 DeactivateCurrentFunction();
604 sal_uInt16 nSId
= rReq
.GetSlot();
605 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
609 case SID_OUTLINE_TEXT_AUTOFIT
:
611 SfxUndoManager
* pUndoManager
= GetDocSh()->GetUndoManager();
612 if( rMarkList
.GetMarkCount() == 1 )
614 pUndoManager
->EnterListAction(u
""_ustr
, u
""_ustr
, 0, GetViewShellBase().GetViewShellId());
615 mpDrawView
->BegUndo();
617 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
618 bool bSet
= pObj
->GetMergedItemSet().GetItem
<SdrTextFitToSizeTypeItem
>(SDRATTR_TEXT_FITTOSIZE
)->GetValue() != drawing::TextFitToSizeType_NONE
;
620 mpDrawView
->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj
));
624 //If we are turning on AutoFit we have to turn these off if already on
625 if (pObj
->GetMergedItemSet().GetItem
<SdrOnOffItem
>(SDRATTR_TEXT_AUTOGROWHEIGHT
)->GetValue())
626 pObj
->SetMergedItem(makeSdrTextAutoGrowHeightItem(false));
627 if (pObj
->GetMergedItemSet().GetItem
<SdrOnOffItem
>(SDRATTR_TEXT_AUTOGROWWIDTH
)->GetValue())
628 pObj
->SetMergedItem(makeSdrTextAutoGrowWidthItem(false));
631 pObj
->SetMergedItem(SdrTextFitToSizeTypeItem(bSet
? drawing::TextFitToSizeType_NONE
: drawing::TextFitToSizeType_AUTOFIT
));
633 mpDrawView
->EndUndo();
634 pUndoManager
->LeaveListAction();
641 // area and line attributes: shall have
642 // an own Execute method (like StateMethode)
643 case SID_ATTR_FILL_STYLE
:
644 case SID_ATTR_FILL_COLOR
:
645 case SID_ATTR_FILL_GRADIENT
:
646 case SID_ATTR_FILL_HATCH
:
647 case SID_ATTR_FILL_BITMAP
:
648 case SID_ATTR_FILL_SHADOW
:
649 case SID_ATTR_SHADOW_COLOR
:
650 case SID_ATTR_SHADOW_TRANSPARENCE
:
651 case SID_ATTR_SHADOW_BLUR
:
652 case SID_ATTR_SHADOW_XDISTANCE
:
653 case SID_ATTR_SHADOW_YDISTANCE
:
654 case SID_ATTR_FILL_USE_SLIDE_BACKGROUND
:
655 case SID_ATTR_FILL_TRANSPARENCE
:
656 case SID_ATTR_FILL_FLOATTRANSPARENCE
:
658 case SID_ATTR_LINE_STYLE
:
659 case SID_ATTR_LINE_DASH
:
660 case SID_ATTR_LINE_WIDTH
:
661 case SID_ATTR_LINE_COLOR
:
662 case SID_ATTR_LINEEND_STYLE
:
663 case SID_ATTR_LINE_START
:
664 case SID_ATTR_LINE_END
:
665 case SID_ATTR_LINE_TRANSPARENCE
:
666 case SID_ATTR_LINE_JOINT
:
667 case SID_ATTR_LINE_CAP
:
669 case SID_ATTR_TEXT_FITTOSIZE
:
673 std::unique_ptr
<SfxItemSet
> pNewArgs
= rReq
.GetArgs()->Clone();
674 if (nSId
== SID_ATTR_FILL_COLOR
)
676 const XFillStyleItem aXFillStyleItem
;
677 pNewArgs
->Put(aXFillStyleItem
);
679 lcl_convertStringArguments(pNewArgs
);
680 mpDrawView
->SetAttributes(*pNewArgs
);
685 switch( rReq
.GetSlot() )
687 case SID_ATTR_FILL_SHADOW
:
688 case SID_ATTR_SHADOW_COLOR
:
689 case SID_ATTR_SHADOW_TRANSPARENCE
:
690 case SID_ATTR_SHADOW_BLUR
:
691 case SID_ATTR_SHADOW_XDISTANCE
:
692 case SID_ATTR_SHADOW_YDISTANCE
:
693 case SID_ATTR_FILL_STYLE
:
694 case SID_ATTR_FILL_COLOR
:
695 case SID_ATTR_FILL_GRADIENT
:
696 case SID_ATTR_FILL_HATCH
:
697 case SID_ATTR_FILL_BITMAP
:
698 case SID_ATTR_FILL_USE_SLIDE_BACKGROUND
:
699 case SID_ATTR_FILL_TRANSPARENCE
:
700 case SID_ATTR_FILL_FLOATTRANSPARENCE
:
701 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA
, SfxCallMode::ASYNCHRON
);
703 case SID_ATTR_LINE_STYLE
:
704 case SID_ATTR_LINE_DASH
:
705 case SID_ATTR_LINE_WIDTH
:
706 case SID_ATTR_LINE_COLOR
:
707 case SID_ATTR_LINE_TRANSPARENCE
:
708 case SID_ATTR_LINE_JOINT
:
709 case SID_ATTR_LINE_CAP
:
710 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE
, SfxCallMode::ASYNCHRON
);
712 case SID_ATTR_TEXT_FITTOSIZE
:
713 GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG
, SfxCallMode::ASYNCHRON
);
721 case SID_HYPHENATION
:
723 const SfxBoolItem
* pItem
= rReq
.GetArg
<SfxBoolItem
>(SID_HYPHENATION
);
727 SfxItemSetFixed
<EE_PARA_HYPHENATE
, EE_PARA_HYPHENATE
> aSet( GetPool() );
728 bool bValue
= pItem
->GetValue();
729 aSet
.Put( SfxBoolItem( EE_PARA_HYPHENATE
, bValue
) );
730 mpDrawView
->SetAttributes( aSet
);
732 else // only for testing purpose
734 OSL_FAIL(" no value for hyphenation!");
735 SfxItemSetFixed
<EE_PARA_HYPHENATE
, EE_PARA_HYPHENATE
> aSet( GetPool() );
736 aSet
.Put( SfxBoolItem( EE_PARA_HYPHENATE
, true ) );
737 mpDrawView
->SetAttributes( aSet
);
745 case SID_INSERTPAGE_QUICK
:
747 SdPage
* pNewPage
= CreateOrDuplicatePage (rReq
, mePageKind
, GetActualPage());
749 if(HasCurrentFunction(SID_BEZIER_EDIT
) )
750 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
751 if (pNewPage
!= nullptr)
752 SwitchPage((pNewPage
->GetPageNum()-1)/2);
757 case SID_DUPLICATE_PAGE
:
759 auto slideSorter
= sd::slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase());
760 SdPage
* pNewPage
= nullptr;
762 DuplicateSelectedSlides(rReq
);
764 pNewPage
= CreateOrDuplicatePage (rReq
, mePageKind
, GetActualPage());
766 if(HasCurrentFunction(SID_BEZIER_EDIT
) )
767 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
768 if(!slideSorter
&& pNewPage
!= nullptr)
769 SwitchPage((pNewPage
->GetPageNum()-1)/2);
774 case SID_INSERT_MASTER_PAGE
:
776 // Use the API to create a new page.
777 rtl::Reference
<SdXImpressDocument
> xMasterPagesSupplier (
778 GetDoc()->getUnoModel());
779 if (xMasterPagesSupplier
.is())
781 Reference
<drawing::XDrawPages
> xMasterPages (
782 xMasterPagesSupplier
->getMasterPages());
783 if (xMasterPages
.is())
785 sal_uInt16 nIndex
= GetCurPagePos() + 1;
786 xMasterPages
->insertNewByIndex (nIndex
);
788 // Create shapes for the default layout.
789 SdPage
* pMasterPage
= GetDoc()->GetMasterSdPage(
790 nIndex
, PageKind::Standard
);
791 pMasterPage
->CreateTitleAndLayout (true,true);
796 if(HasCurrentFunction(SID_BEZIER_EDIT
))
797 GetViewFrame()->GetDispatcher()->Execute(
798 SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
805 if (mePageKind
==PageKind::Standard
|| mePageKind
==PageKind::Notes
||
806 (mePageKind
==PageKind::Handout
&& meEditMode
==EditMode::MasterPage
) )
808 if ( mpDrawView
->IsTextEdit() )
810 mpDrawView
->SdrEndTextEdit();
812 sal_uInt16 nPage
= maTabControl
->GetCurPagePos();
813 mpActualPage
= GetDoc()->GetSdPage(nPage
, mePageKind
);
814 ::sd::ViewShell::mpImpl
->ProcessModifyPageSlot (
825 case SID_ASSIGN_LAYOUT
:
827 if (mePageKind
==PageKind::Standard
|| mePageKind
==PageKind::Notes
|| (mePageKind
==PageKind::Handout
&& meEditMode
==EditMode::MasterPage
))
829 if ( mpDrawView
->IsTextEdit() )
830 mpDrawView
->SdrEndTextEdit();
832 ::sd::ViewShell::mpImpl
->AssignLayout(rReq
, mePageKind
);
840 case SID_RENAME_MASTER_PAGE
:
842 if (mePageKind
==PageKind::Standard
|| mePageKind
==PageKind::Notes
)
844 if ( mpDrawView
->IsTextEdit() )
846 mpDrawView
->SdrEndTextEdit();
849 sal_uInt16 nPage
= maTabControl
->GetCurPagePos();
850 SdPage
* pCurrentPage
= ( GetEditMode() == EditMode::Page
)
851 ? GetDoc()->GetSdPage( nPage
, GetPageKind() )
852 : GetDoc()->GetMasterSdPage( nPage
, GetPageKind() );
854 OUString aTitle
= SdResId(STR_TITLE_RENAMESLIDE
);
855 OUString aDescr
= SdResId(STR_DESC_RENAMESLIDE
);
856 const OUString
& aPageName
= pCurrentPage
->GetName();
860 OUString aName
= rReq
.GetArgs()->GetItem
<const SfxStringItem
>(SID_RENAMEPAGE
)->GetValue();
862 bool bResult
= RenameSlide( maTabControl
->GetPageId(nPage
), aName
);
863 DBG_ASSERT( bResult
, "Couldn't rename slide" );
867 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
868 ScopedVclPtr
<AbstractSvxNameDialog
> aNameDlg(pFact
->CreateSvxNameDialog(GetFrameWeld(), aPageName
, aDescr
));
869 aNameDlg
->SetText( aTitle
);
870 aNameDlg
->SetCheckNameHdl( LINK( this, DrawViewShell
, RenameSlideHdl
) );
871 aNameDlg
->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE
);
873 if( aNameDlg
->Execute() == RET_OK
)
875 OUString aNewName
= aNameDlg
->GetName();
876 if (aNewName
!= aPageName
)
878 bool bResult
= RenameSlide( maTabControl
->GetPageId(nPage
), aNewName
);
879 DBG_ASSERT( bResult
, "Couldn't rename slide" );
889 case SID_RENAMEPAGE_QUICK
:
891 if (mePageKind
==PageKind::Standard
|| mePageKind
==PageKind::Notes
)
893 if ( mpDrawView
->IsTextEdit() )
895 mpDrawView
->SdrEndTextEdit();
898 maTabControl
->StartEditMode( maTabControl
->GetCurPageId() );
906 case SID_PAGESIZE
: // either this (no menu entries or something else!)
908 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
910 if (pArgs
&& pArgs
->Count () == 3)
912 const SfxUInt32Item
* pWidth
= rReq
.GetArg
<SfxUInt32Item
>(ID_VAL_PAGEWIDTH
);
913 const SfxUInt32Item
* pHeight
= rReq
.GetArg
<SfxUInt32Item
>(ID_VAL_PAGEHEIGHT
);
914 const SfxBoolItem
* pScaleAll
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_SCALEOBJECTS
);
916 Size
aSize (pWidth
->GetValue (), pHeight
->GetValue ());
918 SetupPage (aSize
, 0, 0, 0, 0, true, false, pScaleAll
->GetValue ());
922 #if HAVE_FEATURE_SCRIPTING
923 StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS
);
929 case SID_PAGEMARGIN
: // or this (no menu entries or something else!)
931 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
933 if (pArgs
&& pArgs
->Count () == 5)
935 const SfxUInt32Item
* pLeft
= rReq
.GetArg
<SfxUInt32Item
>(ID_VAL_PAGELEFT
);
936 const SfxUInt32Item
* pRight
= rReq
.GetArg
<SfxUInt32Item
>(ID_VAL_PAGERIGHT
);
937 const SfxUInt32Item
* pUpper
= rReq
.GetArg
<SfxUInt32Item
>(ID_VAL_PAGETOP
);
938 const SfxUInt32Item
* pLower
= rReq
.GetArg
<SfxUInt32Item
>(ID_VAL_PAGEBOTTOM
);
939 const SfxBoolItem
* pScaleAll
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_SCALEOBJECTS
);
941 Size
aEmptySize (0, 0);
943 SetupPage (aEmptySize
, pLeft
->GetValue (), pRight
->GetValue (),
944 pUpper
->GetValue (), pLower
->GetValue (),
945 false, true, pScaleAll
->GetValue ());
949 #if HAVE_FEATURE_SCRIPTING
950 StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS
);
956 case SID_ATTR_ZOOMSLIDER
:
958 const SfxItemSet
* pArgs
= rReq
.GetArgs();
960 const SfxUInt16Item
* pScale
= (pArgs
&& pArgs
->Count () == 1) ?
961 rReq
.GetArg(SID_ATTR_ZOOMSLIDER
) : nullptr;
962 if (pScale
&& CHECK_RANGE (5, pScale
->GetValue (), 3000))
964 SetZoom (pScale
->GetValue ());
966 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
967 rBindings
.Invalidate( SID_ATTR_ZOOM
);
968 rBindings
.Invalidate( SID_ZOOM_IN
);
969 rBindings
.Invalidate( SID_ZOOM_OUT
);
970 rBindings
.Invalidate( SID_ATTR_ZOOMSLIDER
);
981 const SfxItemSet
* pArgs
= rReq
.GetArgs();
982 mbZoomOnPage
= false;
986 SvxZoomType eZT
= pArgs
->Get( SID_ATTR_ZOOM
).GetType();
989 case SvxZoomType::PERCENT
:
990 SetZoom( static_cast<::tools::Long
>( pArgs
->Get( SID_ATTR_ZOOM
).GetValue()) );
993 case SvxZoomType::OPTIMAL
:
994 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL
,
995 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
998 case SvxZoomType::PAGEWIDTH
:
999 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH
,
1000 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
1003 case SvxZoomType::WHOLEPAGE
:
1004 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE
,
1005 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
1007 case SvxZoomType::PAGEWIDTH_NOBORDER
:
1008 OSL_FAIL("sd::DrawViewShell::FuTemporary(), SvxZoomType::PAGEWIDTH_NOBORDER not handled!" );
1016 SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1022 case SID_CHANGEBEZIER
:
1023 case SID_CHANGEPOLYGON
:
1024 if ( mpDrawView
->IsTextEdit() )
1026 mpDrawView
->SdrEndTextEdit();
1027 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
1030 if ( mpDrawView
->IsPresObjSelected() )
1032 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1033 VclMessageType::Info
, VclButtonsType::Ok
,
1034 SdResId(STR_ACTION_NOTPOSSIBLE
)));
1039 if( rReq
.GetSlot() == SID_CHANGEBEZIER
)
1041 weld::WaitObject
aWait(GetFrameWeld());
1042 mpDrawView
->ConvertMarkedToPathObj(false);
1046 if( mpDrawView
->IsVectorizeAllowed() )
1048 SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1052 weld::WaitObject
aWait(GetFrameWeld());
1053 mpDrawView
->ConvertMarkedToPolyObj();
1057 Invalidate(SID_CHANGEBEZIER
);
1058 Invalidate(SID_CHANGEPOLYGON
);
1062 if( HasCurrentFunction(SID_BEZIER_EDIT
) )
1063 { // where applicable, activate right edit action
1064 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT
,
1065 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
1070 case SID_CONVERT_TO_CONTOUR
:
1071 if ( mpDrawView
->IsTextEdit() )
1073 mpDrawView
->SdrEndTextEdit();
1074 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
1077 if ( mpDrawView
->IsPresObjSelected() )
1079 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1080 VclMessageType::Info
, VclButtonsType::Ok
,
1081 SdResId(STR_ACTION_NOTPOSSIBLE
)));
1086 weld::WaitObject
aWait(GetFrameWeld());
1087 mpDrawView
->ConvertMarkedToPathObj(true);
1089 Invalidate(SID_CONVERT_TO_CONTOUR
);
1096 case SID_CONVERT_TO_METAFILE
:
1097 case SID_CONVERT_TO_BITMAP
:
1099 // End text edit mode when it is active because the metafile or
1100 // bitmap that will be created does not support it.
1101 if ( mpDrawView
->IsTextEdit() )
1103 mpDrawView
->SdrEndTextEdit();
1104 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
1107 if ( mpDrawView
->IsPresObjSelected(true,true,true) )
1109 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1110 VclMessageType::Info
, VclButtonsType::Ok
,
1111 SdResId(STR_ACTION_NOTPOSSIBLE
)));
1116 weld::WaitObject
aWait(GetFrameWeld());
1118 // create SdrGrafObj from metafile/bitmap
1122 case SID_CONVERT_TO_METAFILE
:
1124 // switch on undo for the next operations
1125 mpDrawView
->BegUndo(SdResId(STR_UNDO_CONVERT_TO_METAFILE
));
1126 GDIMetaFile
aMetaFile(mpDrawView
->GetMarkedObjMetaFile());
1127 aGraphic
= Graphic(aMetaFile
);
1130 case SID_CONVERT_TO_BITMAP
:
1132 // Disable spelling during conversion
1133 bool bOnlineSpell
= GetDoc()->GetOnlineSpell();
1134 GetDoc()->SetOnlineSpell(false);
1136 // switch on undo for the next operations
1137 mpDrawView
->BegUndo(SdResId(STR_UNDO_CONVERT_TO_BITMAP
));
1138 aGraphic
= Graphic(mpDrawView
->GetMarkedObjBitmapEx());
1139 // Restore online spelling
1140 GetDoc()->SetOnlineSpell(bOnlineSpell
);
1145 // create new object
1146 rtl::Reference
<SdrGrafObj
> pGraphicObj
= new SdrGrafObj(
1150 // get some necessary info and ensure it
1151 const size_t nMarkCount(rMarkList
.GetMarkCount());
1152 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
1153 OSL_ENSURE(nMarkCount
, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)");
1154 OSL_ENSURE(pPageView
, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)");
1156 // fit rectangle of new graphic object to selection's mark rect
1157 ::tools::Rectangle aAllMarkedRect
;
1158 rMarkList
.TakeBoundRect(pPageView
, aAllMarkedRect
);
1159 pGraphicObj
->SetLogicRect(aAllMarkedRect
);
1161 // #i71540# to keep the order, it is necessary to replace the lowest object
1162 // of the selection with the new object. This also means that with multi
1163 // selection, all other objects need to be deleted first
1164 SdrMark
* pFirstMark
= rMarkList
.GetMark(0);
1165 SdrObject
* pReplacementCandidate
= pFirstMark
->GetMarkedSdrObj();
1169 // take first object out of selection
1170 mpDrawView
->MarkObj(pReplacementCandidate
, pPageView
, true, true);
1172 // clear remaining selection
1173 mpDrawView
->DeleteMarkedObj();
1176 // #i124816# copy layer from lowest object which gets replaced
1177 pGraphicObj
->SetLayer(pReplacementCandidate
->GetLayer());
1179 // now replace lowest object with new one
1180 mpDrawView
->ReplaceObjectAtView(pReplacementCandidate
, *pPageView
, pGraphicObj
.get());
1183 mpDrawView
->EndUndo();
1192 case SID_REMOVE_HYPERLINK
:
1194 if (mpDrawView
->IsTextEdit())
1196 OutlinerView
* pOutView
= mpDrawView
->GetTextEditOutlinerView();
1198 URLFieldHelper::RemoveURLField(pOutView
->GetEditView());
1205 case SID_SET_DEFAULT
:
1207 std::optional
<SfxItemSet
> pSet
;
1209 if (mpDrawView
->IsTextEdit())
1211 pSet
.emplace( GetPool(), svl::Items
<EE_ITEMS_START
, EE_ITEMS_END
> );
1212 mpDrawView
->SetAttributes( *pSet
, true );
1216 const size_t nCount
= rMarkList
.GetMarkCount();
1218 // For every presentation object a SfxItemSet of hard attributes
1219 // and the UserCall is stored in this list. This is because
1220 // at the following mpDrawView->SetAttributes( *pSet, sal_True )
1221 // they get lost and have to be restored.
1222 std::vector
<std::pair
<std::unique_ptr
<SfxItemSet
>,SdrObjUserCall
*> > aAttrList
;
1223 SdPage
* pPresPage
= static_cast<SdPage
*>( mpDrawView
->GetSdrPageView()->GetPage() );
1225 for ( size_t i
= 0; i
< nCount
; ++i
)
1227 SdrObject
* pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
1229 if( pPresPage
->IsPresObj( pObj
) )
1231 auto pNewSet
= std::make_unique
<SfxItemSetFixed
<SDRATTR_TEXT_MINFRAMEHEIGHT
, SDRATTR_TEXT_AUTOGROWHEIGHT
>>( GetDoc()->GetPool() );
1232 pNewSet
->Put(pObj
->GetMergedItemSet());
1233 aAttrList
.emplace_back(std::move(pNewSet
), pObj
->GetUserCall());
1237 pSet
.emplace( GetPool() );
1238 mpDrawView
->SetAttributes( *pSet
, true );
1242 for ( size_t i
= 0; i
< nCount
; ++i
)
1244 SfxStyleSheet
* pSheet
= nullptr;
1245 SdrObject
* pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
1247 if (pObj
->GetObjIdentifier() == SdrObjKind::TitleText
)
1249 pSheet
= mpActualPage
->GetStyleSheetForPresObj(PresObjKind::Title
);
1251 pObj
->SetStyleSheet(pSheet
, false);
1253 else if(pObj
->GetObjIdentifier() == SdrObjKind::OutlineText
)
1255 for (sal_uInt16 nLevel
= 1; nLevel
< 10; nLevel
++)
1257 pSheet
= mpActualPage
->GetStyleSheetForPresObj( PresObjKind::Outline
);
1258 DBG_ASSERT(pSheet
, "Template for outline object not found");
1261 pObj
->StartListening(*pSheet
);
1264 // text frame listens on StyleSheet of level1
1265 pObj
->NbcSetStyleSheet(pSheet
, false);
1270 if( pPresPage
->IsPresObj( pObj
) )
1272 std::pair
<std::unique_ptr
<SfxItemSet
>,SdrObjUserCall
*> &rAttr
= aAttrList
[j
++];
1274 std::unique_ptr
<SfxItemSet
> & pNewSet(rAttr
.first
);
1275 SdrObjUserCall
* pUserCall
= rAttr
.second
;
1277 if ( pNewSet
&& pNewSet
->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT
) == SfxItemState::SET
)
1279 pObj
->SetMergedItem(pNewSet
->Get(SDRATTR_TEXT_MINFRAMEHEIGHT
));
1282 if ( pNewSet
&& pNewSet
->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT
) == SfxItemState::SET
)
1284 pObj
->SetMergedItem(pNewSet
->Get(SDRATTR_TEXT_AUTOGROWHEIGHT
));
1288 pObj
->SetUserCall( pUserCall
);
1298 case SID_DELETE_SNAPITEM
:
1301 Point aMPos
= GetActiveWindow()->PixelToLogic( maMousePos
);
1302 sal_uInt16 nHitLog
= static_cast<sal_uInt16
>(GetActiveWindow()->PixelToLogic( Size(
1303 FuPoor::HITPIX
, 0 ) ).Width());
1304 sal_uInt16 nHelpLine
;
1306 if( mpDrawView
->PickHelpLine( aMPos
, nHitLog
, *GetActiveWindow()->GetOutDev(), nHelpLine
, pPV
) )
1308 pPV
->DeleteHelpLine( nHelpLine
);
1315 case SID_DELETE_PAGE
:
1316 case SID_DELETE_MASTER_PAGE
:
1322 case SID_DELETE_LAYER
:
1323 DeleteActualLayer();
1328 case SID_ORIGINAL_SIZE
:
1329 mpDrawView
->SetMarkedOriginalSize();
1334 case SID_DRAW_FONTWORK
:
1335 case SID_DRAW_FONTWORK_VERTICAL
:
1337 svx::FontworkBar::execute(*mpView
, rReq
, GetViewFrame()->GetBindings()); // SJ: can be removed (I think)
1343 case SID_SAVE_GRAPHIC
:
1345 if( rMarkList
.GetMarkCount() == 1 )
1347 if (const SdrGrafObj
* pObj
= dynamic_cast<const SdrGrafObj
*>(rMarkList
.GetMark(0)->GetMarkedSdrObj()))
1348 if (pObj
->GetGraphicType() == GraphicType::Bitmap
|| pObj
->GetGraphicType() == GraphicType::GdiMetafile
)
1350 weld::Window
* pFrame
= GetFrameWeld();
1351 GraphicAttr aGraphicAttr
= pObj
->GetGraphicAttr();
1352 short nState
= RET_CANCEL
;
1353 if (aGraphicAttr
!= GraphicAttr()) // the image has been modified
1357 nState
= GraphicHelper::HasToSaveTransformedImage(pFrame
);
1365 if (nState
== RET_YES
)
1367 GraphicHelper::ExportGraphic(pFrame
, pObj
->GetTransformedGraphic(), u
""_ustr
);
1369 else if (nState
== RET_NO
)
1371 const GraphicObject
& aGraphicObject(pObj
->GetGraphicObject());
1372 GraphicHelper::ExportGraphic(pFrame
, aGraphicObject
.GetGraphic(), u
""_ustr
);
1381 case SID_EXTERNAL_EDIT
:
1383 if( rMarkList
.GetMarkCount() == 1 )
1385 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
1386 if( auto pGraphicObj
= dynamic_cast<SdrGrafObj
*>( pObj
) )
1387 if( pGraphicObj
->GetGraphicType() == GraphicType::Bitmap
)
1389 GraphicObject
aGraphicObject( pGraphicObj
->GetGraphicObject() );
1390 m_ExternalEdits
.push_back(
1391 std::make_unique
<SdrExternalToolEdit
>(
1392 mpDrawView
.get(), pGraphicObj
));
1393 m_ExternalEdits
.back()->Edit( &aGraphicObject
);
1401 case SID_COMPRESS_GRAPHIC
:
1403 if( rMarkList
.GetMarkCount() == 1 )
1405 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
1407 if( auto pGraphicObj
= dynamic_cast<SdrGrafObj
*>( pObj
) )
1408 if( pGraphicObj
->GetGraphicType() == GraphicType::Bitmap
)
1410 CompressGraphicsDialog
dialog(GetFrameWeld(), pGraphicObj
, GetViewFrame()->GetBindings() );
1411 if (dialog
.run() == RET_OK
)
1413 rtl::Reference
<SdrGrafObj
> pNewObject
= dialog
.GetCompressedSdrGrafObj();
1414 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
1415 OUString aUndoString
= rMarkList
.GetMarkDescription() + " Compress";
1416 mpDrawView
->BegUndo( aUndoString
);
1417 mpDrawView
->ReplaceObjectAtView( pObj
, *pPageView
, pNewObject
.get() );
1418 mpDrawView
->EndUndo();
1427 case SID_GRAPHIC_SIZE_CHECK
:
1429 sd::GraphicSizeCheckGUIResult
aResult(GetDoc());
1430 svx::GenericCheckDialog
aDialog(GetFrameWeld(), aResult
);
1438 case SID_ATTRIBUTES_LINE
: // BASIC
1440 SetCurrentFunction( FuLine::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1446 case SID_ATTRIBUTES_AREA
: // BASIC
1448 SetCurrentFunction( FuArea::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1454 case SID_ATTR_TRANSFORM
:
1456 SetCurrentFunction( FuTransform::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1457 // tdf#138963 conditions tested for here must be the same as those
1458 // of the early returns from FuTransform::DoExecute
1459 if (rReq
.GetArgs() || rMarkList
.GetMarkCount() == 0)
1461 Invalidate(SID_RULER_OBJECT
);
1466 case SID_MOVE_SHAPE_HANDLE
:
1468 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
1469 if (pArgs
&& pArgs
->Count () >= 3)
1471 const SfxUInt32Item
* handleNumItem
= rReq
.GetArg
<SfxUInt32Item
>(FN_PARAM_1
);
1472 const SfxUInt32Item
* newPosXTwips
= rReq
.GetArg
<SfxUInt32Item
>(FN_PARAM_2
);
1473 const SfxUInt32Item
* newPosYTwips
= rReq
.GetArg
<SfxUInt32Item
>(FN_PARAM_3
);
1474 const SfxInt32Item
* OrdNum
= rReq
.GetArg
<SfxInt32Item
>(FN_PARAM_4
);
1476 const sal_uInt32 handleNum
= handleNumItem
->GetValue();
1477 const ::tools::Long newPosX
= convertTwipToMm100(newPosXTwips
->GetValue());
1478 const ::tools::Long newPosY
= convertTwipToMm100(newPosYTwips
->GetValue());
1480 mpDrawView
->MoveShapeHandle(handleNum
, Point(newPosX
, newPosY
), OrdNum
? OrdNum
->GetValue() : -1);
1485 case SID_CHAR_DLG_EFFECT
:
1486 case SID_CHAR_DLG
: // BASIC
1488 SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1495 SetCurrentFunction( FuParagraph::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1500 case FN_NUM_BULLET_ON
:
1502 // The value (sal_uInt16)0xFFFF means set bullet on/off.
1503 SfxUInt16Item
aItem(FN_SVX_SET_BULLET
, sal_uInt16(0xFFFF));
1504 GetViewFrame()->GetDispatcher()->ExecuteList(FN_SVX_SET_BULLET
,
1505 SfxCallMode::RECORD
, { &aItem
});
1509 case FN_NUM_NUMBERING_ON
:
1511 // The value (sal_uInt16)0xFFFF means set bullet on/off.
1512 SfxUInt16Item
aItem(FN_SVX_SET_NUMBER
, sal_uInt16(0xFFFF));
1513 GetViewFrame()->GetDispatcher()->ExecuteList(FN_SVX_SET_NUMBER
,
1514 SfxCallMode::RECORD
, { &aItem
});
1518 case SID_OUTLINE_BULLET
:
1519 case FN_SVX_SET_BULLET
:
1520 case FN_SVX_SET_NUMBER
:
1522 SetCurrentFunction( FuBulletAndPosition::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1527 case FN_INSERT_SOFT_HYPHEN
:
1528 case FN_INSERT_HARDHYPHEN
:
1529 case FN_INSERT_HARD_SPACE
:
1530 case FN_INSERT_NNBSP
:
1531 case SID_INSERT_RLM
:
1532 case SID_INSERT_LRM
:
1533 case SID_INSERT_WJ
:
1534 case SID_INSERT_ZWSP
:
1537 SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1542 case SID_PRESENTATION_LAYOUT
:
1544 SetCurrentFunction( FuPresentationLayout::Create(this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1549 case SID_PASTE_SPECIAL
:
1551 SetCurrentFunction( FuInsertClipboard::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1557 case SID_CHANGE_PICTURE
:
1558 case SID_INSERT_GRAPHIC
:
1560 SetCurrentFunction( FuInsertGraphic::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
,
1561 nSId
== SID_CHANGE_PICTURE
) );
1567 case SID_INSERT_AVMEDIA
:
1569 SetCurrentFunction( FuInsertAVMedia::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1576 case SID_INSERT_OBJECT
:
1577 case SID_INSERT_FLOATINGFRAME
:
1578 case SID_INSERT_MATH
:
1579 case SID_INSERT_DIAGRAM
:
1580 case SID_ATTR_TABLE
:
1582 SetCurrentFunction( FuInsertOLE::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1583 // Set the selection tool as the old one. This in particular important for the
1584 // zoom function, in which clicking without dragging zooms as well, and that
1585 // makes exiting the object editing mode impossible.
1586 if (dynamic_cast<FuSelection
*>( GetOldFunction().get() ) == nullptr)
1587 SetOldFunction( FuSelection::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1592 case SID_CLASSIFICATION_APPLY
:
1594 const SfxItemSet
* pArgs
= rReq
.GetArgs();
1595 const SfxPoolItem
* pItem
= nullptr;
1596 if (pArgs
&& pArgs
->GetItemState(nSId
, false, &pItem
) == SfxItemState::SET
)
1598 const OUString
& rName
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1599 auto eType
= SfxClassificationPolicyType::IntellectualProperty
;
1600 if (pArgs
->GetItemState(SID_TYPE_NAME
, false, &pItem
) == SfxItemState::SET
)
1602 const OUString
& rType
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1603 eType
= SfxClassificationHelper::stringToPolicyType(rType
);
1605 if (SfxViewFrame
* pViewFrame
= GetViewFrame())
1607 if (SfxObjectShell
* pObjectShell
= pViewFrame
->GetObjectShell())
1609 SfxClassificationHelper
aHelper(pObjectShell
->getDocProperties());
1610 aHelper
.SetBACName(rName
, eType
);
1615 SAL_WARN("sd.ui", "missing parameter for SID_CLASSIFICATION_APPLY");
1622 case SID_CLASSIFICATION_DIALOG
:
1624 if (SfxObjectShell
* pObjShell
= SfxObjectShell::Current())
1626 css::uno::Reference
<css::document::XDocumentProperties
> xDocProps(pObjShell
->getDocProperties());
1627 auto xDialog
= std::make_shared
<svx::ClassificationDialog
>(GetFrameWeld(), xDocProps
, false, [](){} );
1628 ClassificationCollector
aCollector(*this, xDocProps
);
1629 aCollector
.collect();
1631 xDialog
->setupValues(std::vector(aCollector
.getResults()));
1633 if (RET_OK
== xDialog
->run())
1635 ClassificationInserter
aInserter(*this, xDocProps
);
1636 aInserter
.insert(xDialog
->getResult());
1646 case SID_COPYOBJECTS
:
1648 if ( mpDrawView
->IsPresObjSelected(false) )
1650 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1651 VclMessageType::Info
, VclButtonsType::Ok
,
1652 SdResId(STR_ACTION_NOTPOSSIBLE
)));
1657 if ( mpDrawView
->IsTextEdit() )
1659 mpDrawView
->SdrEndTextEdit();
1662 SetCurrentFunction( FuCopy::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1669 case SID_INSERTFILE
: // BASIC
1671 Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START
));
1672 SetCurrentFunction( FuInsertFile::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1673 Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END
));
1679 case SID_SELECT_BACKGROUND
:
1680 case SID_SAVE_BACKGROUND
:
1681 case SID_ATTR_PAGE_SIZE
:
1683 case SID_PAGESETUP
: // BASIC ??
1685 SetCurrentFunction( FuPage::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1687 rReq
.Ignore (); // we generate independent macros !!
1691 case SID_BEFORE_OBJ
:
1692 case SID_BEHIND_OBJ
:
1694 SetCurrentFunction( FuDisplayOrder::Create(this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1696 // finishes itself, no Cancel() needed!
1700 case SID_REVERSE_ORDER
: // BASIC
1702 mpDrawView
->ReverseOrderOfMarked();
1708 case SID_ANIMATION_EFFECTS
:
1710 SetCurrentFunction( FuObjectAnimationParameters::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1715 case SID_EXECUTE_ANIMATION_EFFECT
:
1717 SetCurrentFunction(FuExecuteInteraction::Create(this, GetActiveWindow(),
1718 mpDrawView
.get(), GetDoc(), rReq
));
1723 case SID_LINEEND_POLYGON
:
1725 SetCurrentFunction( FuLineEnd::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1730 case SID_CAPTUREPOINT
:
1731 // negative value to signal call from menu
1732 maMousePos
= Point(-1,-1);
1734 case SID_SET_SNAPITEM
:
1736 SetCurrentFunction( FuSnapLine::Create(this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1741 case SID_MANAGE_LINKS
:
1743 SetCurrentFunction( FuLink::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1751 SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1757 case SID_TEXTATTR_DLG
:
1759 if (mpDrawView
->IsTextEdit())
1760 mpDrawView
->SdrEndTextEdit();
1761 SetCurrentFunction( FuTextAttrDlg::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1767 case SID_MEASURE_DLG
:
1769 SetCurrentFunction( FuMeasureDlg::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1775 case SID_CONNECTION_DLG
:
1777 SetCurrentFunction( FuConnectionDlg::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1783 case SID_CONNECTION_NEW_ROUTING
:
1785 SfxItemSetFixed
<SDRATTR_EDGELINE1DELTA
, SDRATTR_EDGELINE3DELTA
> aDefAttr( GetPool() );
1786 GetView()->SetAttributes( aDefAttr
, true ); // (ReplaceAll)
1793 case SID_TWAIN_SELECT
:
1795 if( mxScannerManager
.is() )
1799 const css::uno::Sequence
< css::scanner::ScannerContext
>
1800 aContexts( mxScannerManager
->getAvailableScanners() );
1802 if( aContexts
.hasElements() )
1804 css::scanner::ScannerContext
aContext( aContexts
.getConstArray()[ 0 ] );
1806 Reference
<lang::XInitialization
> xInit(mxScannerManager
, UNO_QUERY
);
1809 // initialize dialog
1810 weld::Window
* pWindow
= rReq
.GetFrameWeld();
1811 uno::Sequence
<uno::Any
> aSeq(comphelper::InitAnyPropertySequence(
1813 {"ParentWindow", pWindow
? uno::Any(pWindow
->GetXWindow()) : uno::Any(Reference
<awt::XWindow
>())}
1815 xInit
->initialize( aSeq
);
1818 mxScannerManager
->configureScannerAndScan( aContext
, mxScannerListener
);
1831 case SID_TWAIN_TRANSFER
:
1835 if( mxScannerManager
.is() )
1839 const css::uno::Sequence
< css::scanner::ScannerContext
> aContexts( mxScannerManager
->getAvailableScanners() );
1841 if( aContexts
.hasElements() )
1843 mxScannerManager
->startScan( aContexts
.getConstArray()[ 0 ], mxScannerListener
);
1854 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1855 VclMessageType::Info
, VclButtonsType::Ok
,
1857 SdResId(STR_TWAIN_NO_SOURCE
)
1859 SdResId(STR_TWAIN_NO_SOURCE_UNX
)
1867 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
1868 rBindings
.Invalidate( SID_TWAIN_SELECT
);
1869 rBindings
.Invalidate( SID_TWAIN_TRANSFER
);
1877 case SID_POLYGON_MORPHING
:
1879 SetCurrentFunction( FuMorph::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1884 case SID_INSERTLAYER
:
1886 if ( mpDrawView
->IsTextEdit() )
1888 mpDrawView
->SdrEndTextEdit();
1891 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
1892 sal_uInt16 nLayerCnt
= rLayerAdmin
.GetLayerCount();
1893 sal_uInt16 nLayer
= nLayerCnt
- 2 + 1;
1894 OUString aLayerName
= SdResId(STR_LAYER
) + OUString::number(nLayer
);
1895 OUString aLayerTitle
, aLayerDesc
;
1896 bool bIsVisible
= false;
1897 bool bIsLocked
= false;
1898 bool bIsPrintable
= false;
1900 const SfxItemSet
* pArgs
= rReq
.GetArgs();
1904 SfxItemSetFixed
<ATTR_LAYER_START
, ATTR_LAYER_END
> aNewAttr( GetDoc()->GetPool() );
1906 aNewAttr
.Put( makeSdAttrLayerName( aLayerName
) );
1907 aNewAttr
.Put( makeSdAttrLayerTitle() );
1908 aNewAttr
.Put( makeSdAttrLayerDesc() );
1909 aNewAttr
.Put( makeSdAttrLayerVisible() );
1910 aNewAttr
.Put( makeSdAttrLayerPrintable() );
1911 aNewAttr
.Put( makeSdAttrLayerLocked() );
1912 aNewAttr
.Put( makeSdAttrLayerThisPage() );
1914 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
1915 vcl::Window
* pWin
= GetActiveWindow();
1916 ScopedVclPtr
<AbstractSdInsertLayerDlg
> pDlg( pFact
->CreateSdInsertLayerDlg(pWin
? pWin
->GetFrameWeld() : nullptr, aNewAttr
, true, SdResId(STR_INSERTLAYER
)) );
1917 pDlg
->SetHelpId( SdModule::get()->GetSlotPool()->GetSlot( SID_INSERTLAYER
)->GetCommand() );
1919 // test for already existing names
1921 while( bLoop
&& pDlg
->Execute() == RET_OK
)
1923 pDlg
->GetAttr( aNewAttr
);
1924 aLayerName
= aNewAttr
.Get(ATTR_LAYER_NAME
).GetValue ();
1926 if( rLayerAdmin
.GetLayer( aLayerName
)
1927 || aLayerName
.isEmpty()
1928 || LayerTabBar::IsLocalizedNameOfStandardLayer( aLayerName
) )
1930 // name already exists
1931 std::unique_ptr
<weld::MessageDialog
> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
1932 VclMessageType::Warning
, VclButtonsType::Ok
,
1933 SdResId(STR_WARN_NAME_DUPLICATE
)));
1939 if( bLoop
) // was canceled
1941 pDlg
.disposeAndClear();
1948 aLayerTitle
= aNewAttr
.Get(ATTR_LAYER_TITLE
).GetValue();
1949 aLayerDesc
= aNewAttr
.Get(ATTR_LAYER_DESC
).GetValue ();
1950 bIsVisible
= static_cast<const SfxBoolItem
&>( aNewAttr
.Get (ATTR_LAYER_VISIBLE
)).GetValue ();
1951 bIsLocked
= static_cast<const SfxBoolItem
&>( aNewAttr
.Get (ATTR_LAYER_LOCKED
)).GetValue () ;
1952 bIsPrintable
= static_cast<const SfxBoolItem
&>( aNewAttr
.Get (ATTR_LAYER_PRINTABLE
)).GetValue () ;
1955 else if (pArgs
->Count () != 4)
1957 #if HAVE_FEATURE_SCRIPTING
1958 StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS
);
1966 const SfxStringItem
* pLayerName
= rReq
.GetArg
<SfxStringItem
>(ID_VAL_LAYERNAME
);
1967 const SfxBoolItem
* pIsVisible
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_ISVISIBLE
);
1968 const SfxBoolItem
* pIsLocked
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_ISLOCKED
);
1969 const SfxBoolItem
* pIsPrintable
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_ISPRINTABLE
);
1971 aLayerName
= pLayerName
->GetValue ();
1972 bIsVisible
= pIsVisible
->GetValue ();
1973 bIsLocked
= pIsLocked
->GetValue ();
1974 bIsPrintable
= pIsPrintable
->GetValue ();
1977 OUString aPrevLayer
= mpDrawView
->GetActiveLayer();
1979 sal_uInt16 nPrevLayer
= 0;
1980 nLayerCnt
= rLayerAdmin
.GetLayerCount();
1982 for ( nLayer
= 0; nLayer
< nLayerCnt
; nLayer
++ )
1984 pLayer
= rLayerAdmin
.GetLayer(nLayer
);
1985 OUString aName
= pLayer
->GetName();
1987 if ( aPrevLayer
== aName
)
1989 nPrevLayer
= std::max(nLayer
, sal_uInt16(4));
1993 mpDrawView
->InsertNewLayer(aLayerName
, nPrevLayer
+ 1);
1994 pLayer
= rLayerAdmin
.GetLayer(aLayerName
);
1997 pLayer
->SetTitle( aLayerTitle
);
1998 pLayer
->SetDescription( aLayerDesc
);
2001 mpDrawView
->SetLayerVisible( aLayerName
, bIsVisible
);
2002 mpDrawView
->SetLayerLocked( aLayerName
, bIsLocked
);
2003 mpDrawView
->SetLayerPrintable(aLayerName
, bIsPrintable
);
2005 mpDrawView
->SetActiveLayer(aLayerName
);
2009 GetDoc()->SetChanged();
2011 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHLAYER
,
2012 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
2019 case SID_MODIFYLAYER
:
2021 if(!GetLayerTabControl()) // #i87182#
2023 OSL_ENSURE(false, "No LayerTabBar (!)");
2029 if ( mpDrawView
->IsTextEdit() )
2031 mpDrawView
->SdrEndTextEdit();
2034 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
2035 sal_uInt16 nCurPage
= GetLayerTabControl()->GetCurPageId();
2036 OUString aLayerName
= GetLayerTabControl()->GetLayerName(nCurPage
);
2037 SdrLayer
* pLayer
= rLayerAdmin
.GetLayer(aLayerName
);
2039 OUString aLayerTitle
= pLayer
->GetTitle();
2040 OUString aLayerDesc
= pLayer
->GetDescription();
2042 OUString
aOldLayerName(aLayerName
);
2043 OUString
aOldLayerTitle(aLayerTitle
);
2044 OUString
aOldLayerDesc(aLayerDesc
);
2046 bool bIsVisible
, bIsLocked
, bIsPrintable
;
2047 bool bOldIsVisible
= bIsVisible
= mpDrawView
->IsLayerVisible(aLayerName
);
2048 bool bOldIsLocked
= bIsLocked
= mpDrawView
->IsLayerLocked(aLayerName
);
2049 bool bOldIsPrintable
= bIsPrintable
= mpDrawView
->IsLayerPrintable(aLayerName
);
2051 const SfxItemSet
* pArgs
= rReq
.GetArgs();
2052 // is it allowed to delete the layer?
2053 bool bDelete
= !( LayerTabBar::IsRealNameOfStandardLayer(aLayerName
) );
2057 SfxItemSetFixed
<ATTR_LAYER_START
, ATTR_LAYER_END
> aNewAttr( GetDoc()->GetPool() );
2059 aNewAttr
.Put( makeSdAttrLayerName( aLayerName
) );
2060 aNewAttr
.Put( makeSdAttrLayerTitle( aLayerTitle
) );
2061 aNewAttr
.Put( makeSdAttrLayerDesc( aLayerDesc
) );
2062 aNewAttr
.Put( makeSdAttrLayerVisible( bIsVisible
) );
2063 aNewAttr
.Put( makeSdAttrLayerLocked( bIsLocked
) );
2064 aNewAttr
.Put( makeSdAttrLayerPrintable( bIsPrintable
) );
2065 aNewAttr
.Put( makeSdAttrLayerThisPage() );
2067 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
2068 vcl::Window
* pWin
= GetActiveWindow();
2069 ScopedVclPtr
<AbstractSdInsertLayerDlg
> pDlg( pFact
->CreateSdInsertLayerDlg(pWin
? pWin
->GetFrameWeld() : nullptr, aNewAttr
, bDelete
, SdResId(STR_MODIFYLAYER
)) );
2070 pDlg
->SetHelpId( SdModule::get()->GetSlotPool()->GetSlot( SID_MODIFYLAYER
)->GetCommand() );
2072 // test for already existing names
2074 sal_uInt16 nRet
= 0;
2077 nRet
= pDlg
->Execute();
2080 pDlg
->GetAttr( aNewAttr
);
2081 aLayerName
= aNewAttr
.Get(ATTR_LAYER_NAME
).GetValue ();
2084 if( (rLayerAdmin
.GetLayer( aLayerName
) && aLayerName
!= aOldLayerName
)
2085 || LayerTabBar::IsRealNameOfStandardLayer(aLayerName
)
2086 || LayerTabBar::IsLocalizedNameOfStandardLayer(aLayerName
)
2087 || aLayerName
.isEmpty() )
2089 // name already exists
2090 std::unique_ptr
<weld::MessageDialog
> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
2091 VclMessageType::Warning
, VclButtonsType::Ok
,
2092 SdResId(STR_WARN_NAME_DUPLICATE
)));
2099 bLoop
= false; // altering name is already disabled in the dialog itself
2104 aLayerTitle
= aNewAttr
.Get(ATTR_LAYER_TITLE
).GetValue ();
2105 aLayerDesc
= aNewAttr
.Get(ATTR_LAYER_DESC
).GetValue ();
2106 bIsVisible
= static_cast<const SfxBoolItem
&>( aNewAttr
.Get (ATTR_LAYER_VISIBLE
)).GetValue ();
2107 bIsLocked
= static_cast<const SfxBoolItem
&>( aNewAttr
.Get (ATTR_LAYER_LOCKED
)).GetValue ();
2108 bIsPrintable
= static_cast<const SfxBoolItem
&>( aNewAttr
.Get (ATTR_LAYER_PRINTABLE
)).GetValue ();
2112 pDlg
.disposeAndClear();
2118 else if (pArgs
->Count () == 4)
2120 const SfxStringItem
* pLayerName
= rReq
.GetArg
<SfxStringItem
>(ID_VAL_LAYERNAME
);
2121 const SfxBoolItem
* pIsVisible
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_ISVISIBLE
);
2122 const SfxBoolItem
* pIsLocked
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_ISLOCKED
);
2123 const SfxBoolItem
* pIsPrintable
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_ISPRINTABLE
);
2125 aLayerName
= pLayerName
->GetValue ();
2126 bIsVisible
= pIsVisible
->GetValue ();
2127 bIsLocked
= pIsLocked
->GetValue ();
2128 bIsPrintable
= pIsPrintable
->GetValue ();
2132 #if HAVE_FEATURE_SCRIPTING
2133 StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS
);
2140 SfxUndoManager
* pManager
= GetDoc()->GetDocSh()->GetUndoManager();
2141 std::unique_ptr
<SdLayerModifyUndoAction
> pAction( new SdLayerModifyUndoAction(
2159 pManager
->AddUndoAction( std::move(pAction
) );
2161 ModifyLayer( pLayer
, aLayerName
, aLayerTitle
, aLayerDesc
, bIsVisible
, bIsLocked
, bIsPrintable
);
2168 case SID_TOGGLELAYERVISIBILITY
:
2170 // tdf#113439; duplicates LayerTabBar::MouseButtonDown()
2171 sal_uInt16 aTabId
= GetLayerTabControl()->GetCurPageId();
2172 OUString
aName( GetLayerTabControl()->GetLayerName(aTabId
) );
2174 SdrPageView
* pPV
= mpDrawView
->GetSdrPageView();
2175 bool bVisible
= !pPV
->IsLayerVisible(aName
);
2177 pPV
->SetLayerVisible(aName
, bVisible
);
2180 GetDoc()->SetChanged();
2187 case SID_RENAMELAYER
:
2189 if ( mpDrawView
->IsTextEdit() )
2191 mpDrawView
->SdrEndTextEdit();
2194 if(GetLayerTabControl()) // #i87182#
2196 GetLayerTabControl()->StartEditMode(GetLayerTabControl()->GetCurPageId());
2200 OSL_ENSURE(false, "No LayerTabBar (!)");
2208 case SID_EDIT_HYPERLINK
:
2210 // Ensure the field is selected first
2211 OutlinerView
* pOutView
= mpDrawView
->GetTextEditOutlinerView();
2213 pOutView
->SelectFieldAtCursor();
2215 GetViewFrame()->GetDispatcher()->Execute( SID_HYPERLINK_DIALOG
);
2222 case SID_OPEN_HYPERLINK
:
2224 OutlinerView
* pOutView
= mpDrawView
->GetTextEditOutlinerView();
2227 const SvxFieldItem
* pFieldItem
2228 = pOutView
->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true);
2229 const SvxFieldData
* pField
= pFieldItem
? pFieldItem
->GetField() : nullptr;
2230 if( auto pURLField
= dynamic_cast< const SvxURLField
*>( pField
) )
2232 SfxStringItem
aUrl( SID_FILE_NAME
, pURLField
->GetURL() );
2233 SfxStringItem
aTarget( SID_TARGETNAME
, pURLField
->GetTargetFrame() );
2235 OUString aReferName
;
2236 SfxViewFrame
* pFrame
= GetViewFrame();
2237 SfxMedium
* pMed
= pFrame
->GetObjectShell()->GetMedium();
2239 aReferName
= pMed
->GetName();
2241 SfxFrameItem
aFrm( SID_DOCFRAME
, pFrame
);
2242 SfxStringItem
aReferer( SID_REFERER
, aReferName
);
2244 SfxBoolItem
aNewView( SID_OPEN_NEW_VIEW
, false );
2245 SfxBoolItem
aBrowsing( SID_BROWSE
, true );
2247 if (SfxViewFrame
* pViewFrm
= SfxViewFrame::Current())
2249 pViewFrm
->GetDispatcher()->ExecuteList(SID_OPENDOC
,
2250 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
,
2251 { &aUrl
, &aTarget
, &aFrm
, &aReferer
,
2252 &aNewView
, &aBrowsing
});
2261 case SID_COPY_HYPERLINK_LOCATION
:
2263 OutlinerView
* pOutView
= mpDrawView
->GetTextEditOutlinerView();
2266 const SvxFieldItem
* pFieldItem
2267 = pOutView
->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true);
2268 const SvxFieldData
* pField
= pFieldItem
? pFieldItem
->GetField() : nullptr;
2269 if (const SvxURLField
* pURLField
= dynamic_cast<const SvxURLField
*>(pField
))
2271 uno::Reference
<datatransfer::clipboard::XClipboard
> xClipboard
2272 = pOutView
->GetWindow()->GetClipboard();
2274 vcl::unohelper::TextDataObject::CopyStringTo(pURLField
->GetURL(), xClipboard
, SfxViewShell::Current());
2283 case SID_HYPERLINK_SETLINK
:
2285 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
2289 const SvxHyperlinkItem
* pHLItem
=
2290 &pReqArgs
->Get(SID_HYPERLINK_SETLINK
);
2292 if (pHLItem
->GetInsertMode() == HLINK_FIELD
)
2294 InsertURLField(pHLItem
->GetURL(), pHLItem
->GetName(),
2295 pHLItem
->GetTargetFrame());
2297 else if (pHLItem
->GetInsertMode() == HLINK_BUTTON
)
2299 InsertURLButton(pHLItem
->GetURL(), pHLItem
->GetName(),
2300 pHLItem
->GetTargetFrame(), nullptr);
2302 else if (pHLItem
->GetInsertMode() == HLINK_DEFAULT
)
2304 OutlinerView
* pOlView
= mpDrawView
->GetTextEditOutlinerView();
2306 if (pOlView
|| comphelper::LibreOfficeKit::isActive())
2308 InsertURLField(pHLItem
->GetURL(), pHLItem
->GetName(),
2309 pHLItem
->GetTargetFrame());
2313 InsertURLButton(pHLItem
->GetURL(), pHLItem
->GetName(),
2314 pHLItem
->GetTargetFrame(), nullptr);
2324 case SID_HIDE_LAST_LEVEL
:
2327 // fdo#78151 editing a PresObjKind::Outline in a master page ?
2328 ::Outliner
* pOL
= GetOutlinerForMasterPageOutlineTextObj(aSel
);
2331 //we are on the last paragraph
2333 if (aSel
.end
.nPara
== pOL
->GetParagraphCount() - 1)
2335 sal_uInt16 nDepth
= pOL
->GetDepth(aSel
.end
.nPara
);
2336 //there exists a previous numbering level
2337 if (nDepth
!= sal_uInt16(-1) && nDepth
> 0)
2339 Paragraph
* pPara
= pOL
->GetParagraph(aSel
.end
.nPara
);
2340 pOL
->Remove(pPara
, 1);
2349 case SID_SHOW_NEXT_LEVEL
:
2351 const TranslateId STR_PRESOBJ_MPOUTLINE_ARY
[]
2353 STR_PRESOBJ_MPOUTLINE
,
2354 STR_PRESOBJ_MPOUTLLAYER2
,
2355 STR_PRESOBJ_MPOUTLLAYER3
,
2356 STR_PRESOBJ_MPOUTLLAYER4
,
2357 STR_PRESOBJ_MPOUTLLAYER5
,
2358 STR_PRESOBJ_MPOUTLLAYER6
,
2359 STR_PRESOBJ_MPOUTLLAYER7
,
2360 STR_PRESOBJ_MPNOTESTITLE
,
2361 STR_PRESOBJ_MPNOTESTEXT
,
2362 STR_PRESOBJ_NOTESTEXT
2366 // fdo#78151 editing a PresObjKind::Outline in a master page ?
2367 ::Outliner
* pOL
= GetOutlinerForMasterPageOutlineTextObj(aSel
);
2370 //we are on the last paragraph
2372 if (aSel
.end
.nPara
== pOL
->GetParagraphCount() - 1)
2374 sal_uInt16 nDepth
= pOL
->GetDepth(aSel
.end
.nPara
);
2375 //there exists a previous numbering level
2378 sal_uInt16 nNewDepth
= nDepth
+1;
2379 pOL
->Insert(SdResId(STR_PRESOBJ_MPOUTLINE_ARY
[nNewDepth
]), EE_PARA_MAX
, nNewDepth
);
2388 case SID_INSERT_FLD_DATE_FIX
:
2389 case SID_INSERT_FLD_DATE_VAR
:
2390 case SID_INSERT_FLD_TIME_FIX
:
2391 case SID_INSERT_FLD_TIME_VAR
:
2392 case SID_INSERT_FLD_AUTHOR
:
2393 case SID_INSERT_FLD_PAGE
:
2394 case SID_INSERT_FLD_PAGE_TITLE
:
2395 case SID_INSERT_FLD_PAGES
:
2396 case SID_INSERT_FLD_FILE
:
2398 sal_uInt16 nMul
= 1;
2399 std::unique_ptr
<SvxFieldItem
> pFieldItem
;
2403 case SID_INSERT_FLD_DATE_FIX
:
2404 pFieldItem
.reset(new SvxFieldItem(
2405 SvxDateField( Date( Date::SYSTEM
), SvxDateType::Fix
), EE_FEATURE_FIELD
));
2408 case SID_INSERT_FLD_DATE_VAR
:
2409 pFieldItem
.reset(new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD
));
2412 case SID_INSERT_FLD_TIME_FIX
:
2413 pFieldItem
.reset(new SvxFieldItem(
2414 SvxExtTimeField( ::tools::Time( ::tools::Time::SYSTEM
), SvxTimeType::Fix
), EE_FEATURE_FIELD
));
2417 case SID_INSERT_FLD_TIME_VAR
:
2418 pFieldItem
.reset(new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD
));
2421 case SID_INSERT_FLD_AUTHOR
:
2423 SvtUserOptions aUserOptions
;
2424 pFieldItem
.reset(new SvxFieldItem(
2426 aUserOptions
.GetFirstName(), aUserOptions
.GetLastName(), aUserOptions
.GetID() ), EE_FEATURE_FIELD
));
2430 case SID_INSERT_FLD_PAGE
:
2432 pFieldItem
.reset(new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD
));
2437 case SID_INSERT_FLD_PAGE_TITLE
:
2439 pFieldItem
.reset(new SvxFieldItem( SvxPageTitleField(), EE_FEATURE_FIELD
));
2444 case SID_INSERT_FLD_PAGES
:
2446 pFieldItem
.reset(new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD
));
2451 case SID_INSERT_FLD_FILE
:
2454 if( GetDocSh()->HasName() )
2455 aName
= GetDocSh()->GetMedium()->GetName();
2456 pFieldItem
.reset(new SvxFieldItem( SvxExtFileField( aName
), EE_FEATURE_FIELD
));
2461 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
2465 const SvxFieldItem
* pOldFldItem
= pOLV
->GetFieldAtSelection();
2467 if( pOldFldItem
&& ( nullptr != dynamic_cast< const SvxURLField
*>( pOldFldItem
->GetField() ) ||
2468 nullptr != dynamic_cast< const SvxDateField
*>( pOldFldItem
->GetField() ) ||
2469 nullptr != dynamic_cast< const SvxTimeField
*>( pOldFldItem
->GetField() ) ||
2470 nullptr != dynamic_cast< const SvxExtTimeField
*>( pOldFldItem
->GetField() ) ||
2471 nullptr != dynamic_cast< const SvxExtFileField
*>( pOldFldItem
->GetField() ) ||
2472 nullptr != dynamic_cast< const SvxAuthorField
*>( pOldFldItem
->GetField() ) ||
2473 nullptr != dynamic_cast< const SvxPageField
*>( pOldFldItem
->GetField() ) ) )
2475 // select field, then it will be deleted when inserting
2476 ESelection aSel
= pOLV
->GetSelection();
2477 if (aSel
.start
.nIndex
== aSel
.end
.nIndex
)
2479 pOLV
->SetSelection( aSel
);
2483 pOLV
->InsertField( *pFieldItem
);
2487 Outliner
* pOutl
= GetDoc()->GetInternalOutliner();
2488 pOutl
->Init( OutlinerMode::TextObject
);
2489 OutlinerMode nOutlMode
= pOutl
->GetOutlinerMode();
2490 pOutl
->SetStyleSheet( 0, nullptr );
2491 pOutl
->QuickInsertField( *pFieldItem
, ESelection() );
2492 std::optional
<OutlinerParaObject
> pOutlParaObject
= pOutl
->CreateParaObject();
2494 rtl::Reference
<SdrRectObj
> pRectObj
= new SdrRectObj(
2497 pRectObj
->SetMergedItem(makeSdrTextAutoGrowWidthItem(true));
2499 pOutl
->UpdateFields();
2500 pOutl
->SetUpdateLayout( true );
2501 Size
aSize( pOutl
->CalcTextSize() );
2502 aSize
.setWidth( aSize
.Width() * nMul
);
2503 pOutl
->SetUpdateLayout( false );
2506 ::tools::Rectangle
aRect( aPos
, GetActiveWindow()->GetOutputSizePixel() );
2507 aPos
= aRect
.Center();
2508 aPos
= GetActiveWindow()->PixelToLogic(aPos
);
2509 aPos
.AdjustX( -(aSize
.Width() / 2) );
2510 aPos
.AdjustY( -(aSize
.Height() / 2) );
2512 ::tools::Rectangle
aLogicRect(aPos
, aSize
);
2513 pRectObj
->SetLogicRect(aLogicRect
);
2514 pRectObj
->SetOutlinerParaObject( std::move(pOutlParaObject
) );
2515 mpDrawView
->InsertObjectAtView(pRectObj
.get(), *mpDrawView
->GetSdrPageView());
2516 pOutl
->Init( nOutlMode
);
2526 case SID_MODIFY_FIELD
:
2528 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
2532 const SvxFieldItem
* pFldItem
= pOLV
->GetFieldAtSelection();
2534 if( pFldItem
&& (nullptr != dynamic_cast< const SvxDateField
*>( pFldItem
->GetField() ) ||
2535 nullptr != dynamic_cast< const SvxAuthorField
*>( pFldItem
->GetField() ) ||
2536 nullptr != dynamic_cast< const SvxExtFileField
*>( pFldItem
->GetField() ) ||
2537 nullptr != dynamic_cast< const SvxExtTimeField
*>( pFldItem
->GetField() ) ) )
2540 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
2541 vcl::Window
* pWin
= GetActiveWindow();
2542 ScopedVclPtr
<AbstractSdModifyFieldDlg
> pDlg( pFact
->CreateSdModifyFieldDlg(pWin
? pWin
->GetFrameWeld() : nullptr, pFldItem
->GetField(), pOLV
->GetAttribs() ) );
2543 if( pDlg
->Execute() == RET_OK
)
2545 // To make a correct SetAttribs() call at the utlinerView
2546 // it is necessary to split the actions here
2547 std::unique_ptr
<SvxFieldData
> pField(pDlg
->GetField());
2548 ESelection aSel
= pOLV
->GetSelection();
2549 bool bSelectionWasModified(false);
2553 SvxFieldItem
aFieldItem( *pField
, EE_FEATURE_FIELD
);
2555 if (aSel
.start
.nIndex
== aSel
.end
.nIndex
)
2557 bSelectionWasModified
= true;
2559 pOLV
->SetSelection( aSel
);
2562 pOLV
->InsertField( aFieldItem
);
2564 // select again for eventual SetAttribs call
2565 pOLV
->SetSelection( aSel
);
2568 SfxItemSet
aSet( pDlg
->GetItemSet() );
2572 pOLV
->SetAttribs( aSet
);
2574 ::Outliner
* pOutliner
= pOLV
->GetOutliner();
2576 pOutliner
->UpdateFields();
2581 // restore selection to original
2582 if(bSelectionWasModified
)
2585 pOLV
->SetSelection( aSel
);
2597 case SID_OPEN_XML_FILTERSETTINGS
:
2601 css::uno::Reference
< css::ui::dialogs::XExecutableDialog
> xDialog
= css::ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() );
2604 catch( css::uno::RuntimeException
& )
2606 DBG_UNHANDLED_EXCEPTION("sd.view");
2614 case SID_GROUP
: // BASIC
2616 if ( mpDrawView
->IsPresObjSelected( true, true, true ) )
2618 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2619 VclMessageType::Info
, VclButtonsType::Ok
,
2620 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2625 mpDrawView
->GroupMarked();
2632 case SID_UNGROUP
: // BASIC
2634 mpDrawView
->UnGroupMarked();
2640 case SID_NAME_GROUP
:
2642 // only allow for single object selection since the name of an object needs
2644 if(1 == rMarkList
.GetMarkCount())
2647 rtl::Reference
<SdrObject
> pSelected
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
2648 OSL_ENSURE(pSelected
, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
2649 OUString
aName(pSelected
->GetName());
2651 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
2652 VclPtr
<AbstractSvxObjectNameDialog
> pDlg(pFact
->CreateSvxObjectNameDialog(GetFrameWeld(), aName
));
2654 pDlg
->SetCheckNameHdl(LINK(this, DrawViewShell
, NameObjectHdl
));
2656 pDlg
->StartExecuteAsync(
2657 [this, pDlg
, pSelected
] (sal_Int32 nResult
)->void
2659 if (nResult
== RET_OK
)
2661 pSelected
->SetName(pDlg
->GetName());
2663 SdPage
* pPage
= GetActualPage();
2665 pPage
->notifyObjectRenamed(pSelected
.get());
2667 pDlg
->disposeOnce();
2668 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
2669 rBindings
.Invalidate( SID_NAVIGATOR_STATE
, true );
2670 rBindings
.Invalidate( SID_CONTEXT
);
2681 case SID_OBJECT_TITLE_DESCRIPTION
:
2683 if(1 == rMarkList
.GetMarkCount())
2685 rtl::Reference
<SdrObject
> pSelected
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
2686 OSL_ENSURE(pSelected
, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
2687 OUString
aTitle(pSelected
->GetTitle());
2688 OUString
aDescription(pSelected
->GetDescription());
2689 bool isDecorative(pSelected
->IsDecorative());
2691 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
2692 VclPtr
<AbstractSvxObjectTitleDescDialog
> pDlg(pFact
->CreateSvxObjectTitleDescDialog(
2693 GetFrameWeld(), aTitle
, aDescription
, isDecorative
));
2695 pDlg
->StartExecuteAsync(
2696 [this, pDlg
, pSelected
] (sal_Int32 nResult
)->void
2698 if (nResult
== RET_OK
)
2700 pSelected
->SetTitle(pDlg
->GetTitle());
2701 pSelected
->SetDescription(pDlg
->GetDescription());
2702 pSelected
->SetDecorative(pDlg
->IsDecorative());
2704 pDlg
->disposeOnce();
2705 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
2706 rBindings
.Invalidate( SID_NAVIGATOR_STATE
, true );
2707 rBindings
.Invalidate( SID_CONTEXT
);
2719 const size_t nMarkCount
= rMarkList
.GetMarkCount();
2720 if (nMarkCount
>= 1 && mpLayerTabBar
)
2722 SdSelectLayerDlg
aDlg(GetFrameWeld());
2724 weld::TreeView
& rTreeView
= aDlg
.GetTreeView();
2725 auto nPageCount
= mpLayerTabBar
->GetPageCount();
2726 for (auto i
= 0; i
< nPageCount
; i
++)
2727 rTreeView
.append_text(LayerTabBar::convertToLocalizedName(
2728 mpLayerTabBar
->GetLayerName(mpLayerTabBar
->GetPageId(i
))));
2729 rTreeView
.select(0);
2731 if (aDlg
.run() == RET_OK
&& rTreeView
.get_selected_index() != -1)
2733 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
2734 SdrLayerID aSdrLayerId
= rLayerAdmin
.GetLayerID(mpLayerTabBar
->GetLayerName(
2735 mpLayerTabBar
->GetPageId(rTreeView
.get_selected_index())));
2736 for (size_t i
= 0; i
< nMarkCount
; ++i
)
2738 SdrObject
* pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
2739 pObj
->SetLayer(aSdrLayerId
);
2748 case SID_ENTER_GROUP
: // BASIC
2750 mpDrawView
->EnterMarkedGroup();
2756 case SID_LEAVE_GROUP
: // BASIC
2758 mpDrawView
->LeaveOneGroup();
2764 case SID_LEAVE_ALL_GROUPS
: // BASIC
2766 mpDrawView
->LeaveAllGroup();
2772 case SID_TEXT_COMBINE
: // BASIC
2774 // End text edit to avoid conflicts
2775 if(mpDrawView
->IsTextEdit())
2776 mpDrawView
->SdrEndTextEdit();
2778 if ( mpDrawView
->IsPresObjSelected() )
2780 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2781 VclMessageType::Info
, VclButtonsType::Ok
,
2782 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2787 weld::WaitObject
aWait(GetFrameWeld());
2788 mpDrawView
->CombineMarkedTextObjects();
2795 case SID_COMBINE
: // BASIC
2797 // End text edit to avoid conflicts
2798 if(mpDrawView
->IsTextEdit())
2799 mpDrawView
->SdrEndTextEdit();
2801 if ( mpDrawView
->IsPresObjSelected() )
2803 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2804 VclMessageType::Info
, VclButtonsType::Ok
,
2805 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2810 weld::WaitObject
aWait(GetFrameWeld());
2811 mpDrawView
->CombineMarkedObjects(false);
2818 case SID_DISTRIBUTE_HLEFT
:
2819 case SID_DISTRIBUTE_HCENTER
:
2820 case SID_DISTRIBUTE_HDISTANCE
:
2821 case SID_DISTRIBUTE_HRIGHT
:
2822 case SID_DISTRIBUTE_VTOP
:
2823 case SID_DISTRIBUTE_VCENTER
:
2824 case SID_DISTRIBUTE_VDISTANCE
:
2825 case SID_DISTRIBUTE_VBOTTOM
:
2827 if ( mpDrawView
->IsPresObjSelected() )
2829 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2830 VclMessageType::Info
, VclButtonsType::Ok
,
2831 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2836 mpDrawView
->DistributeMarkedObjects(nSId
);
2842 case SID_POLY_MERGE
:
2844 // End text edit to avoid conflicts
2845 if(mpDrawView
->IsTextEdit())
2846 mpDrawView
->SdrEndTextEdit();
2848 if ( mpDrawView
->IsPresObjSelected() )
2850 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2851 VclMessageType::Info
, VclButtonsType::Ok
,
2852 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2857 weld::WaitObject
aWait(GetFrameWeld());
2858 mpDrawView
->MergeMarkedObjects(SdrMergeMode::Merge
);
2865 case SID_POLY_SUBSTRACT
:
2867 // End text edit to avoid conflicts
2868 if(mpDrawView
->IsTextEdit())
2869 mpDrawView
->SdrEndTextEdit();
2871 if ( mpDrawView
->IsPresObjSelected() )
2873 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2874 VclMessageType::Info
, VclButtonsType::Ok
,
2875 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2880 weld::WaitObject
aWait(GetFrameWeld());
2881 mpDrawView
->MergeMarkedObjects(SdrMergeMode::Subtract
);
2888 case SID_POLY_INTERSECT
:
2890 // End text edit to avoid conflicts
2891 if(mpDrawView
->IsTextEdit())
2892 mpDrawView
->SdrEndTextEdit();
2894 if ( mpDrawView
->IsPresObjSelected() )
2896 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2897 VclMessageType::Info
, VclButtonsType::Ok
,
2898 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2903 weld::WaitObject
aWait(GetFrameWeld());
2904 mpDrawView
->MergeMarkedObjects(SdrMergeMode::Intersect
);
2911 case SID_EQUALIZEWIDTH
:
2912 case SID_EQUALIZEHEIGHT
:
2914 // End text edit to avoid conflicts
2915 if(mpDrawView
->IsTextEdit())
2916 mpDrawView
->SdrEndTextEdit();
2918 mpDrawView
->EqualizeMarkedObjects(nSId
== SID_EQUALIZEWIDTH
);
2924 case SID_DISMANTLE
: // BASIC
2926 if ( mpDrawView
->IsDismantlePossible() )
2928 weld::WaitObject
aWait(GetFrameWeld());
2929 mpDrawView
->DismantleMarkedObjects();
2936 case SID_CONNECT
: // BASIC
2938 if ( mpDrawView
->IsPresObjSelected() )
2940 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2941 VclMessageType::Info
, VclButtonsType::Ok
,
2942 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2947 weld::WaitObject
aWait(GetFrameWeld());
2948 mpDrawView
->CombineMarkedObjects();
2955 case SID_BREAK
: // BASIC
2957 if ( mpDrawView
->IsTextEdit() )
2959 mpDrawView
->SdrEndTextEdit();
2962 if ( mpDrawView
->IsBreak3DObjPossible() )
2964 weld::WaitObject
aWait(GetFrameWeld());
2965 mpDrawView
->Break3DObj();
2967 else if ( mpDrawView
->IsDismantlePossible(true) )
2969 weld::WaitObject
aWait(GetFrameWeld());
2970 mpDrawView
->DismantleMarkedObjects(true);
2972 else if ( mpDrawView
->IsImportMtfPossible() )
2974 weld::WaitObject
aWait(GetFrameWeld());
2975 const size_t nCnt
=rMarkList
.GetMarkCount();
2977 // determine the sum of meta objects of all selected meta files
2978 sal_uLong nCount
= 0;
2979 for(size_t nm
=0; nm
<nCnt
; ++nm
)
2981 SdrMark
* pM
=rMarkList
.GetMark(nm
);
2982 SdrObject
* pObj
=pM
->GetMarkedSdrObj();
2983 SdrGrafObj
* pGraf
= dynamic_cast< SdrGrafObj
*>( pObj
);
2984 SdrOle2Obj
* pOle2
= dynamic_cast< SdrOle2Obj
*>( pObj
);
2986 if (pGraf
!= nullptr)
2988 if (pGraf
->HasGDIMetaFile())
2990 nCount
+= pGraf
->GetGraphic().GetGDIMetaFile().GetActionSize();
2992 else if (pGraf
->isEmbeddedVectorGraphicData())
2994 nCount
+= pGraf
->getMetafileFromEmbeddedVectorGraphicData().GetActionSize();
2999 if (const Graphic
* pGraphic
= pOle2
->GetGraphic())
3000 nCount
+= pGraphic
->GetGDIMetaFile().GetActionSize();
3003 // decide with the sum of all meta objects if we should show a dialog
3004 if(nCount
< MIN_ACTIONS_FOR_DIALOG
)
3007 mpDrawView
->DoImportMarkedMtf();
3011 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
3012 ScopedVclPtr
<VclAbstractDialog
> pDlg(pFact
->CreateBreakDlg(GetFrameWeld(), mpDrawView
.get(), GetDocSh(), nCount
, static_cast<sal_uLong
>(nCnt
) ));
3022 case SID_CONVERT_TO_3D
:
3024 if ( mpDrawView
->IsPresObjSelected() )
3026 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
3027 VclMessageType::Info
, VclButtonsType::Ok
,
3028 SdResId(STR_ACTION_NOTPOSSIBLE
)));
3033 if (mpDrawView
->IsConvertTo3DObjPossible())
3035 if (mpDrawView
->IsTextEdit())
3037 mpDrawView
->SdrEndTextEdit();
3040 weld::WaitObject
aWait(GetFrameWeld());
3041 mpDrawView
->ConvertMarkedObjTo3D();
3050 case SID_FRAME_TO_TOP
: // BASIC
3052 mpDrawView
->PutMarkedToTop();
3058 case SID_MOREFRONT
: // BASIC
3059 case SID_FRAME_UP
: // BASIC
3061 mpDrawView
->MovMarkedToTop();
3067 case SID_MOREBACK
: // BASIC
3068 case SID_FRAME_DOWN
: // BASIC
3070 mpDrawView
->MovMarkedToBtm();
3076 case SID_FRAME_TO_BOTTOM
: // BASIC
3078 mpDrawView
->PutMarkedToBtm();
3084 case SID_HORIZONTAL
: // BASIC
3085 case SID_FLIP_HORIZONTAL
:
3087 mpDrawView
->MirrorAllMarkedHorizontal();
3093 case SID_VERTICAL
: // BASIC
3094 case SID_FLIP_VERTICAL
:
3096 mpDrawView
->MirrorAllMarkedVertical();
3102 case SID_OBJECT_ALIGN_LEFT
: // BASIC
3104 mpDrawView
->AlignMarkedObjects(SdrHorAlign::Left
, SdrVertAlign::NONE
);
3110 case SID_OBJECT_ALIGN_CENTER
: // BASIC
3112 mpDrawView
->AlignMarkedObjects(SdrHorAlign::Center
, SdrVertAlign::NONE
);
3118 case SID_OBJECT_ALIGN_RIGHT
: // BASIC
3120 mpDrawView
->AlignMarkedObjects(SdrHorAlign::Right
, SdrVertAlign::NONE
);
3126 case SID_OBJECT_ALIGN_UP
: // BASIC
3128 mpDrawView
->AlignMarkedObjects(SdrHorAlign::NONE
, SdrVertAlign::Top
);
3134 case SID_OBJECT_ALIGN_MIDDLE
: // BASIC
3136 mpDrawView
->AlignMarkedObjects(SdrHorAlign::NONE
, SdrVertAlign::Center
);
3142 case SID_ALIGN_PAGE
:
3144 mpDrawView
->AlignMarkedObjects(SdrHorAlign::Center
, SdrVertAlign::Center
);
3150 case SID_OBJECT_ALIGN_DOWN
: // BASIC
3152 mpDrawView
->AlignMarkedObjects(SdrHorAlign::NONE
, SdrVertAlign::Bottom
);
3158 case SID_SELECTALL
: // BASIC
3160 if( (dynamic_cast<FuSelection
*>( GetOldFunction().get() ) != nullptr) &&
3161 !GetView()->IsFrameDragSingles() && GetView()->HasMarkablePoints())
3163 if ( !mpDrawView
->IsAction() )
3164 mpDrawView
->MarkAllPoints();
3167 mpDrawView
->SelectAll();
3169 FreshNavigatrTree();
3176 case SID_STYLE_NEW
: // BASIC ???
3177 case SID_STYLE_APPLY
:
3178 case SID_STYLE_EDIT
:
3179 case SID_STYLE_DELETE
:
3180 case SID_STYLE_HIDE
:
3181 case SID_STYLE_SHOW
:
3182 case SID_STYLE_FAMILY
:
3183 case SID_STYLE_WATERCAN
:
3184 case SID_STYLE_UPDATE_BY_EXAMPLE
:
3185 case SID_STYLE_NEW_BY_EXAMPLE
:
3188 && (nSId
== SID_STYLE_EDIT
|| nSId
== SID_STYLE_UPDATE_BY_EXAMPLE
3189 || nSId
== SID_STYLE_NEW_BY_EXAMPLE
))
3191 SfxStyleSheet
* pStyleSheet
= mpDrawView
->GetStyleSheet();
3192 if( pStyleSheet
&& pStyleSheet
->GetFamily() == SfxStyleFamily::Page
)
3193 pStyleSheet
= static_cast<SdStyleSheet
*>(pStyleSheet
)->GetPseudoStyleSheet();
3195 if( (pStyleSheet
== nullptr) && GetView()->IsTextEdit() )
3197 GetView()->SdrEndTextEdit();
3199 pStyleSheet
= mpDrawView
->GetStyleSheet();
3200 if(pStyleSheet
&& pStyleSheet
->GetFamily() == SfxStyleFamily::Page
)
3201 pStyleSheet
= static_cast<SdStyleSheet
*>(pStyleSheet
)->GetPseudoStyleSheet();
3204 if( pStyleSheet
== nullptr )
3210 SfxAllItemSet
aSet(GetDoc()->GetPool());
3212 aSet
.Put(SfxUInt16Item(SID_STYLE_FAMILY
,
3213 static_cast<sal_uInt16
>(pStyleSheet
->GetFamily())));
3215 if (nSId
== SID_STYLE_NEW_BY_EXAMPLE
)
3217 weld::Window
* pWindow
= GetViewFrame()->GetFrameWeld();
3218 SfxNewStyleDlg
aDlg(pWindow
, *pStyleSheet
->GetPool(), pStyleSheet
->GetFamily());
3219 auto nResult
= aDlg
.run();
3220 if (nResult
== RET_OK
)
3222 aSet
.Put(SfxStringItem(SID_STYLE_NEW_BY_EXAMPLE
, aDlg
.GetName()));
3223 aSet
.Put(SfxStringItem(SID_STYLE_REFERENCE
, pStyleSheet
->GetName()));
3233 aSet
.Put(SfxStringItem(nSId
, pStyleSheet
->GetName()));
3238 if( rReq
.GetArgs() )
3240 SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
3241 if( rReq
.GetSlot() == SID_STYLE_APPLY
)
3242 GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY
);
3245 else if( rReq
.GetSlot() == SID_STYLE_APPLY
)
3246 GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER
, SfxCallMode::ASYNCHRON
);
3253 sal_uInt16 nId
= SvxIMapDlgChildWindow::GetChildWindowId();
3255 GetViewFrame()->ToggleChildWindow( nId
);
3256 GetViewFrame()->GetBindings().Invalidate( SID_IMAP
);
3258 if ( GetViewFrame()->HasChildWindow( nId
)
3259 && ( ( ViewShell::Implementation::GetImageMapDialog() ) != nullptr ) )
3261 if ( rMarkList
.GetMarkCount() == 1 )
3262 UpdateIMapDlg( rMarkList
.GetMark( 0 )->GetMarkedSdrObj() );
3270 case SID_GRID_FRONT
:
3272 mpDrawView
->SetGridFront( !mpDrawView
->IsGridFront() );
3278 case SID_HELPLINES_FRONT
:
3280 mpDrawView
->SetHlplFront( !mpDrawView
->IsHlplFront() );
3288 if ( rReq
.GetArgs() )
3290 GetViewFrame()->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
3291 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
3292 Get(SID_FONTWORK
)).GetValue());
3296 GetViewFrame()->ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() );
3299 GetViewFrame()->GetBindings().Invalidate(SID_FONTWORK
);
3305 case SID_COLOR_CONTROL
:
3307 if ( rReq
.GetArgs() )
3308 GetViewFrame()->SetChildWindow(SvxColorChildWindow::GetChildWindowId(),
3309 rReq
.GetArgs()->Get(SID_COLOR_CONTROL
).GetValue());
3311 GetViewFrame()->ToggleChildWindow(SvxColorChildWindow::GetChildWindowId() );
3313 GetViewFrame()->GetBindings().Invalidate(SID_COLOR_CONTROL
);
3319 case SID_EXTRUSION_TOGGLE
:
3320 case SID_EXTRUSION_TILT_DOWN
:
3321 case SID_EXTRUSION_TILT_UP
:
3322 case SID_EXTRUSION_TILT_LEFT
:
3323 case SID_EXTRUSION_TILT_RIGHT
:
3324 case SID_EXTRUSION_3D_COLOR
:
3325 case SID_EXTRUSION_DEPTH
:
3326 case SID_EXTRUSION_DIRECTION
:
3327 case SID_EXTRUSION_PROJECTION
:
3328 case SID_EXTRUSION_LIGHTING_DIRECTION
:
3329 case SID_EXTRUSION_LIGHTING_INTENSITY
:
3330 case SID_EXTRUSION_SURFACE
:
3331 case SID_EXTRUSION_DEPTH_FLOATER
:
3332 case SID_EXTRUSION_DIRECTION_FLOATER
:
3333 case SID_EXTRUSION_LIGHTING_FLOATER
:
3334 case SID_EXTRUSION_SURFACE_FLOATER
:
3335 case SID_EXTRUSION_DEPTH_DIALOG
:
3336 svx::ExtrusionBar::execute( mpDrawView
.get(), rReq
, GetViewFrame()->GetBindings() );
3341 case SID_FONTWORK_SHAPE
:
3342 case SID_FONTWORK_SHAPE_TYPE
:
3343 case SID_FONTWORK_ALIGNMENT
:
3344 case SID_FONTWORK_SAME_LETTER_HEIGHTS
:
3345 case SID_FONTWORK_CHARACTER_SPACING
:
3346 case SID_FONTWORK_KERN_CHARACTER_PAIRS
:
3347 case SID_FONTWORK_GALLERY_FLOATER
:
3348 case SID_FONTWORK_CHARACTER_SPACING_FLOATER
:
3349 case SID_FONTWORK_ALIGNMENT_FLOATER
:
3350 case SID_FONTWORK_CHARACTER_SPACING_DIALOG
:
3351 svx::FontworkBar::execute(*mpDrawView
, rReq
, GetViewFrame()->GetBindings());
3358 GetViewFrame()->ToggleChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() );
3359 GetViewFrame()->GetBindings().Invalidate( SID_BMPMASK
);
3368 if (comphelper::LibreOfficeKit::isActive())
3370 GetViewFrame()->ShowChildWindow(SID_SIDEBAR
);
3371 OUString panelId
= u
"SdNavigatorPanel"_ustr
;
3372 ::sfx2::sidebar::Sidebar::TogglePanel(
3373 panelId
, GetViewFrame()->GetFrame().GetFrameInterface());
3378 if ( rReq
.GetArgs() )
3379 GetViewFrame()->SetChildWindow(SID_NAVIGATOR
,
3380 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
3381 Get(SID_NAVIGATOR
)).GetValue());
3383 GetViewFrame()->ToggleChildWindow( SID_NAVIGATOR
);
3385 GetViewFrame()->GetBindings().Invalidate(SID_NAVIGATOR
);
3392 case SID_SLIDE_TRANSITIONS_PANEL
:
3393 case SID_MASTER_SLIDES_PANEL
:
3394 case SID_CUSTOM_ANIMATION_PANEL
:
3397 // First make sure that the sidebar is visible
3398 GetViewFrame()->ShowChildWindow(SID_SIDEBAR
);
3401 if (nSId
== SID_CUSTOM_ANIMATION_PANEL
)
3402 panelId
= "SdCustomAnimationPanel";
3403 else if (nSId
== SID_GALLERY
)
3404 panelId
= "GalleryPanel";
3405 else if (nSId
== SID_SLIDE_TRANSITIONS_PANEL
)
3406 panelId
= "SdSlideTransitionPanel";
3407 else if (nSId
== SID_MASTER_SLIDES_PANEL
)
3408 panelId
= "SdAllMasterPagesPanel";
3410 ::sfx2::sidebar::Sidebar::TogglePanel(
3412 GetViewFrame()->GetFrame().GetFrameInterface());
3419 case SID_ANIMATION_OBJECTS
:
3421 if ( rReq
.GetArgs() )
3422 GetViewFrame()->SetChildWindow(
3423 AnimationChildWindow::GetChildWindowId(),
3424 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
3425 Get(SID_ANIMATION_OBJECTS
)).GetValue());
3427 GetViewFrame()->ToggleChildWindow(
3428 AnimationChildWindow::GetChildWindowId() );
3430 GetViewFrame()->GetBindings().Invalidate(SID_ANIMATION_OBJECTS
);
3438 if ( rReq
.GetArgs() )
3439 GetViewFrame()->SetChildWindow( Svx3DChildWindow::GetChildWindowId(),
3440 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
3441 Get( SID_3D_WIN
)).GetValue());
3443 GetViewFrame()->ToggleChildWindow( Svx3DChildWindow::GetChildWindowId() );
3445 GetViewFrame()->GetBindings().Invalidate( SID_3D_WIN
);
3451 case SID_CONVERT_TO_3D_LATHE_FAST
:
3453 /* The call is enough. The initialization via Start3DCreation and
3454 CreateMirrorPolygons is no longer needed if the parameter
3455 sal_True is provided. Then a tilted rotary body with an axis left
3456 besides the bounding rectangle of the selected objects is drawn
3457 immediately and without user interaction. */
3458 mpDrawView
->SdrEndTextEdit();
3459 if(GetActiveWindow())
3460 GetActiveWindow()->EnterWait();
3461 mpDrawView
->End3DCreation(true);
3464 if(GetActiveWindow())
3465 GetActiveWindow()->LeaveWait();
3469 case SID_PRESENTATION_DLG
:
3471 SetCurrentFunction( FuSlideShowDlg::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
3476 case SID_REMOTE_DLG
:
3478 #ifdef ENABLE_SDREMOTE
3479 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
3480 ScopedVclPtr
<VclAbstractDialog
> pDlg(pFact
->CreateRemoteDialog(GetFrameWeld()));
3486 case SID_CUSTOMSHOW_DLG
:
3488 SetCurrentFunction( FuCustomShowDlg::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
3493 case SID_EXPAND_PAGE
:
3495 SetCurrentFunction( FuExpandPage::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
3500 case SID_SUMMARY_PAGE
:
3502 mpDrawView
->SdrEndTextEdit();
3503 SetCurrentFunction( FuSummaryPage::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
3508 #if HAVE_FEATURE_AVMEDIA
3509 case SID_AVMEDIA_PLAYER
:
3511 GetViewFrame()->ToggleChildWindow( ::avmedia::MediaPlayer::GetChildWindowId() );
3512 GetViewFrame()->GetBindings().Invalidate( SID_AVMEDIA_PLAYER
);
3519 case SID_PRESENTATION_MINIMIZER
:
3521 const Reference
<XComponentContext
>& xContext(::comphelper::getProcessComponentContext());
3522 Reference
<util::XURLTransformer
> xParser(util::URLTransformer::create(xContext
));
3523 Reference
<frame::XDispatchProvider
> xProvider(GetViewShellBase().GetController()->getFrame(), UNO_QUERY
);
3527 aURL
.Complete
= "vnd.com.sun.star.comp.PresentationMinimizer:execute";
3528 xParser
->parseStrict(aURL
);
3529 uno::Reference
<frame::XDispatch
> xDispatch(xProvider
->queryDispatch(aURL
, OUString(), 0));
3532 xDispatch
->dispatch(aURL
, uno::Sequence
< beans::PropertyValue
>());
3540 case SID_DISPLAY_MASTER_BACKGROUND
:
3541 case SID_DISPLAY_MASTER_OBJECTS
:
3543 // Determine current page and toggle visibility of layers
3544 // associated with master page background or master page shapes.
3545 // FIXME: This solution is wrong, because shapes of master pages need
3546 // not be on layer "background" or "backgroundobjects".
3548 SdPage
* pPage
= GetActualPage();
3549 if (pPage
!= nullptr
3550 && GetDoc() != nullptr)
3552 SdrLayerIDSet aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
3553 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
3554 SdrLayerID aLayerId
;
3555 if (nSId
== SID_DISPLAY_MASTER_BACKGROUND
)
3556 aLayerId
= rLayerAdmin
.GetLayerID(sUNO_LayerName_background
);
3558 aLayerId
= rLayerAdmin
.GetLayerID(sUNO_LayerName_background_objects
);
3559 aVisibleLayers
.Set(aLayerId
, !aVisibleLayers
.IsSet(aLayerId
));
3560 pPage
->TRG_SetMasterPageVisibleLayers(aVisibleLayers
);
3563 rReq
.Done(); // Mark task as done to auto-update the state of each buttons tdf#132816
3567 case SID_PHOTOALBUM
:
3569 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
3570 vcl::Window
* pWin
= GetActiveWindow();
3571 ScopedVclPtr
<VclAbstractDialog
> pDlg(pFact
->CreateSdPhotoAlbumDialog(
3572 pWin
? pWin
->GetFrameWeld() : nullptr,
3581 case SID_INSERT_QRCODE
:
3582 case SID_EDIT_QRCODE
:
3584 VclAbstractDialogFactory
* pFact
= VclAbstractDialogFactory::Create();
3585 const uno::Reference
<frame::XModel
> xModel
= GetViewShellBase().GetController()->getModel();
3586 ScopedVclPtr
<AbstractQrCodeGenDialog
> pDlg(pFact
->CreateQrCodeGenDialog(
3587 GetFrameWeld(), xModel
, rReq
.GetSlot() == SID_EDIT_QRCODE
));
3594 case SID_THEME_DIALOG
:
3596 SdrPage
* pMasterPage
= &GetActualPage()->TRG_GetMasterPage();
3597 auto pTheme
= pMasterPage
->getSdrPageProperties().getTheme();
3598 auto pDialog
= std::make_shared
<svx::ThemeDialog
>(GetFrameWeld(), pTheme
.get());
3599 auto* pDocShell
= GetDocSh();
3600 weld::DialogController::runAsync(pDialog
, [pDialog
, pMasterPage
, pDocShell
](sal_uInt32 nResult
)
3602 if (RET_OK
!= nResult
)
3605 auto pColorSet
= pDialog
->getCurrentColorSet();
3608 sd::ThemeColorChanger
aChanger(pMasterPage
, pDocShell
);
3609 aChanger
.apply(pColorSet
);
3618 case SID_ATTR_GLOW_COLOR
:
3619 case SID_ATTR_GLOW_RADIUS
:
3620 case SID_ATTR_GLOW_TRANSPARENCY
:
3621 case SID_ATTR_GLOW_TEXT_COLOR
:
3622 case SID_ATTR_GLOW_TEXT_RADIUS
:
3623 case SID_ATTR_GLOW_TEXT_TRANSPARENCY
:
3624 case SID_ATTR_SOFTEDGE_RADIUS
:
3625 case SID_ATTR_TEXTCOLUMNS_NUMBER
:
3626 case SID_ATTR_TEXTCOLUMNS_SPACING
:
3627 if (const SfxItemSet
* pNewArgs
= rReq
.GetArgs())
3628 mpDrawView
->SetAttributes(*pNewArgs
);
3635 SAL_WARN( "sd.ui", "Slot without function" );
3642 if(HasCurrentFunction())
3644 GetCurrentFunction()->Activate();
3648 void DrawViewShell::ExecChar( SfxRequest
&rReq
)
3650 SdDrawDocument
* pDoc
= GetDoc();
3651 if (!pDoc
|| !mpDrawView
)
3654 SfxItemSet
aEditAttr( pDoc
->GetPool() );
3655 mpDrawView
->GetAttributes( aEditAttr
);
3657 //modified by wj for sym2_1580, if put old itemset into new set,
3658 //when mpDrawView->SetAttributes(aNewAttr) it will invalidate all the item
3659 // and use old attr to update all the attributes
3660 // SfxItemSet aNewAttr( GetPool(),
3661 // EE_ITEMS_START, EE_ITEMS_END );
3662 // aNewAttr.Put( aEditAttr, sal_False );
3663 SfxItemSet
aNewAttr( pDoc
->GetPool() );
3666 sal_uInt16 nSId
= rReq
.GetSlot();
3670 case SID_ATTR_CHAR_FONT
:
3671 if( rReq
.GetArgs() )
3673 const SvxFontItem
* pItem
= rReq
.GetArg
<SvxFontItem
>(SID_ATTR_CHAR_FONT
);
3676 aNewAttr
.Put(*pItem
);
3680 case SID_ATTR_CHAR_FONTHEIGHT
:
3681 if( rReq
.GetArgs() )
3683 const SvxFontHeightItem
* pItem
= rReq
.GetArg
<SvxFontHeightItem
>(SID_ATTR_CHAR_FONTHEIGHT
);
3686 aNewAttr
.Put(*pItem
);
3690 case SID_ATTR_CHAR_WEIGHT
:
3691 if( rReq
.GetArgs() )
3693 const SvxWeightItem
* pItem
= rReq
.GetArg
<SvxWeightItem
>(SID_ATTR_CHAR_WEIGHT
);
3696 aNewAttr
.Put(*pItem
);
3700 case SID_ATTR_CHAR_POSTURE
:
3701 if( rReq
.GetArgs() )
3703 const SvxPostureItem
* pItem
= rReq
.GetArg
<SvxPostureItem
>(SID_ATTR_CHAR_POSTURE
);
3706 aNewAttr
.Put(*pItem
);
3710 case SID_ATTR_CHAR_UNDERLINE
:
3711 if( rReq
.GetArgs() )
3713 const SvxUnderlineItem
* pItem
= rReq
.GetArg
<SvxUnderlineItem
>(SID_ATTR_CHAR_UNDERLINE
);
3716 aNewAttr
.Put(*pItem
);
3720 FontLineStyle eFU
= aEditAttr
.Get( EE_CHAR_UNDERLINE
).GetLineStyle();
3721 aNewAttr
.Put( SvxUnderlineItem( eFU
!= LINESTYLE_NONE
?LINESTYLE_NONE
: LINESTYLE_SINGLE
, EE_CHAR_UNDERLINE
) );
3725 case SID_ATTR_CHAR_OVERLINE
:
3726 if( rReq
.GetArgs() )
3728 const SvxOverlineItem
* pItem
= rReq
.GetArg
<SvxOverlineItem
>(SID_ATTR_CHAR_OVERLINE
);
3731 aNewAttr
.Put(*pItem
);
3735 FontLineStyle eFU
= aEditAttr
.Get( EE_CHAR_OVERLINE
).GetLineStyle();
3736 aNewAttr
.Put( SvxOverlineItem( eFU
!= LINESTYLE_NONE
?LINESTYLE_NONE
: LINESTYLE_SINGLE
, EE_CHAR_OVERLINE
) );
3741 case SID_ULINE_VAL_NONE
:
3743 aNewAttr
.Put(SvxUnderlineItem(LINESTYLE_NONE
, EE_CHAR_UNDERLINE
));
3747 case SID_ULINE_VAL_SINGLE
:
3748 case SID_ULINE_VAL_DOUBLE
:
3749 case SID_ULINE_VAL_DOTTED
:
3751 FontLineStyle eOld
= aEditAttr
.Get(EE_CHAR_UNDERLINE
).GetLineStyle();
3752 FontLineStyle eNew
= eOld
;
3756 case SID_ULINE_VAL_SINGLE
:
3757 eNew
= ( eOld
== LINESTYLE_SINGLE
) ? LINESTYLE_NONE
: LINESTYLE_SINGLE
;
3759 case SID_ULINE_VAL_DOUBLE
:
3760 eNew
= ( eOld
== LINESTYLE_DOUBLE
) ? LINESTYLE_NONE
: LINESTYLE_DOUBLE
;
3762 case SID_ULINE_VAL_DOTTED
:
3763 eNew
= ( eOld
== LINESTYLE_DOTTED
) ? LINESTYLE_NONE
: LINESTYLE_DOTTED
;
3767 SvxUnderlineItem
aUnderline(eNew
, EE_CHAR_UNDERLINE
);
3768 aNewAttr
.Put(aUnderline
);
3772 case SID_ATTR_CHAR_SHADOWED
:
3773 if( rReq
.GetArgs() )
3775 const SvxShadowedItem
* pItem
= rReq
.GetArg
<SvxShadowedItem
>(SID_ATTR_CHAR_SHADOWED
);
3778 aNewAttr
.Put(*pItem
);
3782 case SID_ATTR_CHAR_CONTOUR
:
3783 if( rReq
.GetArgs() )
3785 const SvxContourItem
* pItem
= rReq
.GetArg
<SvxContourItem
>(SID_ATTR_CHAR_CONTOUR
);
3788 aNewAttr
.Put(*pItem
);
3793 case SID_ATTR_CHAR_STRIKEOUT
:
3794 if( rReq
.GetArgs() )
3796 const SvxCrossedOutItem
* pItem
= rReq
.GetArg
<SvxCrossedOutItem
>(SID_ATTR_CHAR_STRIKEOUT
);
3799 aNewAttr
.Put(*pItem
);
3803 case SID_ATTR_CHAR_COLOR
:
3804 if( rReq
.GetArgs() )
3806 const SvxColorItem
* pItem
= rReq
.GetArg
<SvxColorItem
>(SID_ATTR_CHAR_COLOR
);
3809 aNewAttr
.Put(*pItem
);
3813 case SID_ATTR_CHAR_KERNING
:
3814 if( rReq
.GetArgs() )
3816 const SvxKerningItem
* pItem
= rReq
.GetArg
<SvxKerningItem
>(SID_ATTR_CHAR_KERNING
);
3819 aNewAttr
.Put(*pItem
);
3823 case SID_ATTR_CHAR_CASEMAP
:
3824 if( rReq
.GetArgs() )
3826 const SvxCaseMapItem
* pItem
= rReq
.GetArg
<SvxCaseMapItem
>(SID_ATTR_CHAR_CASEMAP
);
3829 aNewAttr
.Put(*pItem
);
3833 case SID_SET_SMALL_CAPS
:
3835 SvxCaseMap eCaseMap
= aEditAttr
.Get(EE_CHAR_CASEMAP
).GetCaseMap();
3836 if (eCaseMap
== SvxCaseMap::SmallCaps
)
3837 eCaseMap
= SvxCaseMap::NotMapped
;
3839 eCaseMap
= SvxCaseMap::SmallCaps
;
3840 SvxCaseMapItem
aItem(eCaseMap
, EE_CHAR_CASEMAP
);
3841 aNewAttr
.Put(aItem
);
3844 case SID_SET_SUB_SCRIPT
:
3846 SvxEscapementItem
aItem( EE_CHAR_ESCAPEMENT
);
3847 SvxEscapement eEsc
= static_cast<SvxEscapement
>(aEditAttr
.Get( EE_CHAR_ESCAPEMENT
).GetEnumValue());
3848 if( eEsc
== SvxEscapement::Subscript
)
3849 aItem
.SetEscapement( SvxEscapement::Off
);
3851 aItem
.SetEscapement( SvxEscapement::Subscript
);
3852 aNewAttr
.Put( aItem
);
3855 case SID_SET_SUPER_SCRIPT
:
3857 SvxEscapementItem
aItem( EE_CHAR_ESCAPEMENT
);
3858 SvxEscapement eEsc
= static_cast<SvxEscapement
>(aEditAttr
.Get( EE_CHAR_ESCAPEMENT
).GetEnumValue());
3859 if( eEsc
== SvxEscapement::Superscript
)
3860 aItem
.SetEscapement( SvxEscapement::Off
);
3862 aItem
.SetEscapement( SvxEscapement::Superscript
);
3863 aNewAttr
.Put( aItem
);
3866 case SID_SHRINK_FONT_SIZE
:
3867 case SID_GROW_FONT_SIZE
:
3869 const SvxFontListItem
* pFonts
= dynamic_cast<const SvxFontListItem
*>(GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST
) );
3870 const FontList
* pFontList
= pFonts
? pFonts
->GetFontList() : nullptr;
3873 FuText::ChangeFontSize( nSId
== SID_GROW_FONT_SIZE
, nullptr, pFontList
, mpView
);
3874 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT
);
3878 case SID_ATTR_CHAR_BACK_COLOR
:
3879 if( rReq
.GetArgs() )
3881 const SvxColorItem
* pItem
= rReq
.GetArg
<SvxColorItem
>(SID_ATTR_CHAR_BACK_COLOR
);
3884 aNewAttr
.Put(*pItem
);
3892 mpDrawView
->SetAttributes(aNewAttr
);
3897 /** This method consists basically of three parts:
3898 1. Process the arguments of the SFX request.
3899 2. Use the model to create a new page or duplicate an existing one.
3900 3. Update the tab control and switch to the new page.
3902 SdPage
* DrawViewShell::CreateOrDuplicatePage (
3903 SfxRequest
& rRequest
,
3906 const sal_Int32 nInsertPosition
)
3908 SdPage
* pNewPage
= nullptr;
3909 if (ePageKind
== PageKind::Standard
&& meEditMode
!= EditMode::MasterPage
)
3911 if ( mpDrawView
->IsTextEdit() )
3913 mpDrawView
->SdrEndTextEdit();
3915 pNewPage
= ViewShell::CreateOrDuplicatePage (rRequest
, ePageKind
, pPage
, nInsertPosition
);
3920 void DrawViewShell::DuplicateSelectedSlides (SfxRequest
& rRequest
)
3922 // Create a list of the pages that are to be duplicated. The process of
3923 // duplication alters the selection.
3924 sal_Int32
nInsertPosition (0);
3925 ::std::vector
<SdPage
*> aPagesToDuplicate
;
3926 sd::slidesorter::SlideSorter
&mrSlideSorter
= sd::slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase())->GetSlideSorter();
3927 sd::slidesorter::model::PageEnumeration
aSelectedPages (
3928 sd::slidesorter::model::PageEnumerationProvider::CreateSelectedPagesEnumeration(mrSlideSorter
.GetModel()));
3929 while (aSelectedPages
.HasMoreElements())
3931 sd::slidesorter::model::SharedPageDescriptor
pDescriptor (aSelectedPages
.GetNextElement());
3932 if (pDescriptor
&& pDescriptor
->GetPage())
3934 aPagesToDuplicate
.push_back(pDescriptor
->GetPage());
3935 nInsertPosition
= pDescriptor
->GetPage()->GetPageNum()+2;
3939 // Duplicate the pages in aPagesToDuplicate and collect the newly
3940 // created pages in aPagesToSelect.
3941 const bool bUndo (aPagesToDuplicate
.size()>1 && mrSlideSorter
.GetView().IsUndoEnabled());
3943 mrSlideSorter
.GetView().BegUndo(SdResId(STR_INSERTPAGE
));
3945 ::std::vector
<SdPage
*> aPagesToSelect
;
3946 for(::std::vector
<SdPage
*>::const_iterator
3947 iPage(aPagesToDuplicate
.begin()),
3948 iEnd(aPagesToDuplicate
.end());
3950 ++iPage
, nInsertPosition
+=2)
3952 aPagesToSelect
.push_back(
3953 mrSlideSorter
.GetViewShell()->CreateOrDuplicatePage(
3954 rRequest
, PageKind::Standard
, *iPage
, nInsertPosition
));
3956 aPagesToDuplicate
.clear();
3959 mrSlideSorter
.GetView().EndUndo();
3961 // Set the selection to the pages in aPagesToSelect.
3962 sd::slidesorter::controller::PageSelector
& rSelector (mrSlideSorter
.GetController().GetPageSelector());
3963 rSelector
.DeselectAllPages();
3964 for (auto const& it
: aPagesToSelect
)
3966 rSelector
.SelectPage(it
);
3970 void DrawViewShell::ExecutePropPanelAttr (SfxRequest
const & rReq
)
3972 if(SlideShow::IsRunning( GetViewShellBase() )
3973 && !SlideShow::IsInteractiveSlideshow( &GetViewShellBase() )) // IASS
3976 SdDrawDocument
* pDoc
= GetDoc();
3977 if (!pDoc
|| !mpDrawView
)
3980 sal_uInt16 nSId
= rReq
.GetSlot();
3981 SfxItemSet
aAttrs( pDoc
->GetPool() );
3985 case SID_TABLE_VERT_NONE
:
3986 case SID_TABLE_VERT_CENTER
:
3987 case SID_TABLE_VERT_BOTTOM
:
3988 SdrTextVertAdjust eTVA
= SDRTEXTVERTADJUST_TOP
;
3989 if (nSId
== SID_TABLE_VERT_CENTER
)
3990 eTVA
= SDRTEXTVERTADJUST_CENTER
;
3991 else if (nSId
== SID_TABLE_VERT_BOTTOM
)
3992 eTVA
= SDRTEXTVERTADJUST_BOTTOM
;
3994 aAttrs
.Put( SdrTextVertAdjustItem(eTVA
) );
3995 mpDrawView
->SetAttributes(aAttrs
);
4001 void DrawViewShell::GetStatePropPanelAttr(SfxItemSet
& rSet
)
4003 SfxWhichIter
aIter( rSet
);
4004 sal_uInt16 nWhich
= aIter
.FirstWhich();
4006 SdDrawDocument
* pDoc
= GetDoc();
4007 if (!pDoc
|| !mpDrawView
)
4010 SfxItemSet
aAttrs( pDoc
->GetPool() );
4011 mpDrawView
->GetAttributes( aAttrs
);
4015 sal_uInt16 nSlotId
= SfxItemPool::IsWhich(nWhich
)
4016 ? GetPool().GetSlotId(nWhich
)
4020 case SID_TABLE_VERT_NONE
:
4021 case SID_TABLE_VERT_CENTER
:
4022 case SID_TABLE_VERT_BOTTOM
:
4023 bool bContour
= false;
4024 SfxItemState eConState
= aAttrs
.GetItemState( SDRATTR_TEXT_CONTOURFRAME
);
4025 if( eConState
!= SfxItemState::INVALID
)
4027 bContour
= aAttrs
.Get( SDRATTR_TEXT_CONTOURFRAME
).GetValue();
4029 if (bContour
) break;
4031 SfxItemState eVState
= aAttrs
.GetItemState( SDRATTR_TEXT_VERTADJUST
);
4032 //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
4034 //if(SfxItemState::INVALID != eVState && SfxItemState::INVALID != eHState)
4035 if(SfxItemState::INVALID
!= eVState
)
4037 SdrTextVertAdjust eTVA
= aAttrs
.Get(SDRATTR_TEXT_VERTADJUST
).GetValue();
4038 bool bSet
= (nSlotId
== SID_TABLE_VERT_NONE
&& eTVA
== SDRTEXTVERTADJUST_TOP
) ||
4039 (nSlotId
== SID_TABLE_VERT_CENTER
&& eTVA
== SDRTEXTVERTADJUST_CENTER
) ||
4040 (nSlotId
== SID_TABLE_VERT_BOTTOM
&& eTVA
== SDRTEXTVERTADJUST_BOTTOM
);
4041 rSet
.Put(SfxBoolItem(nSlotId
, bSet
));
4045 rSet
.Put(SfxBoolItem(nSlotId
, false));
4049 nWhich
= aIter
.NextWhich();
4053 } // end of namespace sd
4055 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */