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>
91 #include <comphelper/diagnose_ex.hxx>
92 #include <tools/UnitConversion.hxx>
94 #include <unotools/useroptions.hxx>
96 #include <vcl/abstdlg.hxx>
97 #include <vcl/graph.hxx>
98 #include <vcl/svapp.hxx>
99 #include <vcl/unohelp2.hxx>
100 #include <vcl/weld.hxx>
102 #include <editeng/cmapitem.hxx>
103 #include <editeng/escapementitem.hxx>
104 #include <editeng/kernitem.hxx>
105 #include <editeng/wghtitem.hxx>
106 #include <editeng/postitem.hxx>
107 #include <editeng/udlnitem.hxx>
108 #include <editeng/crossedoutitem.hxx>
109 #include <editeng/shdditem.hxx>
110 #include <editeng/numitem.hxx>
111 #include <svx/svdobj.hxx>
112 #include <svx/SvxColorChildWindow.hxx>
113 #include <editeng/outlobj.hxx>
114 #include <editeng/flstitem.hxx>
115 #include <editeng/fontitem.hxx>
116 #include <editeng/fhgtitem.hxx>
117 #include <editeng/colritem.hxx>
119 #include <svl/poolitem.hxx>
120 #include <svl/style.hxx>
121 #include <svl/whiter.hxx>
124 #include <strings.hrc>
126 #include <AnimationChildWindow.hxx>
127 #include <DrawDocShell.hxx>
128 #include <DrawViewShell.hxx>
129 #include <LayerTabBar.hxx>
130 #include <Outliner.hxx>
131 #include <ViewShellHint.hxx>
132 #include <ViewShellImplementation.hxx>
133 #include <Window.hxx>
134 #include <drawdoc.hxx>
135 #include <drawview.hxx>
136 #include <fuarea.hxx>
137 #include <fubullet.hxx>
138 #include <fuchar.hxx>
139 #include <fucushow.hxx>
140 #include <fuconnct.hxx>
141 #include <fucopy.hxx>
142 #include <fudspord.hxx>
143 #include <fuexecuteinteraction.hxx>
144 #include <fuexpand.hxx>
145 #include <fuinsert.hxx>
146 #include <fuinsfil.hxx>
147 #include <fuline.hxx>
148 #include <fulinend.hxx>
149 #include <fulink.hxx>
150 #include <fumeasur.hxx>
151 #include <fumorph.hxx>
152 #include <fuoaprms.hxx>
153 #include <fuolbull.hxx>
154 #include <fupage.hxx>
155 #include <fuparagr.hxx>
156 #include <fuprlout.hxx>
157 #include <fuscale.hxx>
159 #include <fusldlg.hxx>
160 #include <fusnapln.hxx>
161 #include <fusumry.hxx>
162 #include <futempl.hxx>
163 #include <futhes.hxx>
164 #include <futransf.hxx>
165 #include <futxtatt.hxx>
166 #include <fuvect.hxx>
167 #include <futext.hxx>
169 #include <sdabstdlg.hxx>
170 #include <sdattr.hxx>
171 #include <sdpage.hxx>
172 #include <sdresid.hxx>
173 #include <unokywds.hxx>
174 #include <slideshow.hxx>
175 #include <stlsheet.hxx>
176 #include <undolayer.hxx>
177 #include <sfx2/sidebar/Sidebar.hxx>
178 #include <sfx2/classificationhelper.hxx>
180 #include <model/SlsPageDescriptor.hxx>
181 #include <model/SlsPageEnumerationProvider.hxx>
182 #include <SlideSorter.hxx>
183 #include <view/SlideSorterView.hxx>
184 #include <SlideSorterViewShell.hxx>
185 #include <controller/SlideSorterController.hxx>
186 #include <controller/SlsPageSelector.hxx>
187 #include <tools/GraphicSizeCheck.hxx>
189 #include <ViewShellBase.hxx>
192 using namespace ::com::sun::star
;
193 using namespace ::com::sun::star::uno
;
195 #define MIN_ACTIONS_FOR_DIALOG 5000 ///< if there are more meta objects, we show a dialog during the break up
201 const SvxFieldItem
* findField(editeng::Section
const & rSection
)
203 for (SfxPoolItem
const * pPool
: rSection
.maAttributes
)
205 if (pPool
->Which() == EE_FEATURE_FIELD
)
206 return static_cast<const SvxFieldItem
*>(pPool
);
211 bool hasCustomPropertyField(std::vector
<editeng::Section
> const & aSections
, std::u16string_view rName
)
213 for (editeng::Section
const & rSection
: aSections
)
215 const SvxFieldItem
* pFieldItem
= findField(rSection
);
218 const editeng::CustomPropertyField
* pCustomPropertyField
= dynamic_cast<const editeng::CustomPropertyField
*>(pFieldItem
->GetField());
219 if (pCustomPropertyField
&& pCustomPropertyField
->GetName() == rName
)
226 OUString
getWeightString(SfxItemSet
const & rItemSet
)
228 OUString sWeightString
= "NORMAL";
230 if (const SfxPoolItem
* pItem
= rItemSet
.GetItem(EE_CHAR_WEIGHT
, false))
232 const SvxWeightItem
* pWeightItem
= dynamic_cast<const SvxWeightItem
*>(pItem
);
233 if (pWeightItem
&& pWeightItem
->GetWeight() == WEIGHT_BOLD
)
234 sWeightString
= "BOLD";
236 return sWeightString
;
239 class ClassificationCommon
242 sd::DrawViewShell
& m_rDrawViewShell
;
243 uno::Reference
<document::XDocumentProperties
> m_xDocumentProperties
;
244 uno::Reference
<beans::XPropertyContainer
> m_xPropertyContainer
;
245 sfx::ClassificationKeyCreator m_aKeyCreator
;
247 ClassificationCommon(sd::DrawViewShell
& rDrawViewShell
, const css::uno::Reference
<css::document::XDocumentProperties
>& rDocProps
)
248 : m_rDrawViewShell(rDrawViewShell
)
249 , m_xDocumentProperties(rDocProps
)
250 , m_xPropertyContainer(m_xDocumentProperties
->getUserDefinedProperties())
251 , m_aKeyCreator(SfxClassificationHelper::getPolicyType())
255 class ClassificationCollector
: public ClassificationCommon
258 std::vector
<svx::ClassificationResult
> m_aResults
;
260 void iterateSectionsAndCollect(std::vector
<editeng::Section
> const & rSections
, EditTextObject
const & rEditText
)
262 sal_Int32 nCurrentParagraph
= -1;
265 for (editeng::Section
const & rSection
: rSections
)
267 // Insert new paragraph if needed
268 while (nCurrentParagraph
< rSection
.mnParagraph
)
271 // Get Weight of current paragraph
272 OUString sWeightProperty
= getWeightString(rEditText
.GetParaAttribs(nCurrentParagraph
));
273 // Insert new paragraph into collection
274 m_aResults
.push_back({ svx::ClassificationType::PARAGRAPH
, sWeightProperty
, sBlank
, sBlank
});
277 const SvxFieldItem
* pFieldItem
= findField(rSection
);
278 const editeng::CustomPropertyField
* pCustomPropertyField
= pFieldItem
?
279 dynamic_cast<const editeng::CustomPropertyField
*>(pFieldItem
->GetField()) :
281 if (pCustomPropertyField
)
283 const OUString
& aKey
= pCustomPropertyField
->GetName();
284 if (m_aKeyCreator
.isMarkingTextKey(aKey
))
286 OUString aValue
= svx::classification::getProperty(m_xPropertyContainer
, aKey
);
287 m_aResults
.push_back({ svx::ClassificationType::TEXT
, aValue
, sBlank
, sBlank
});
289 else if (m_aKeyCreator
.isCategoryNameKey(aKey
) || m_aKeyCreator
.isCategoryIdentifierKey(aKey
))
291 OUString aValue
= svx::classification::getProperty(m_xPropertyContainer
, aKey
);
292 m_aResults
.push_back({ svx::ClassificationType::CATEGORY
, aValue
, sBlank
, sBlank
});
294 else if (m_aKeyCreator
.isMarkingKey(aKey
))
296 OUString aValue
= svx::classification::getProperty(m_xPropertyContainer
, aKey
);
297 m_aResults
.push_back({ svx::ClassificationType::MARKING
, aValue
, sBlank
, sBlank
});
299 else if (m_aKeyCreator
.isIntellectualPropertyPartKey(aKey
))
301 OUString aValue
= svx::classification::getProperty(m_xPropertyContainer
, aKey
);
302 m_aResults
.push_back({ svx::ClassificationType::INTELLECTUAL_PROPERTY_PART
, aValue
, sBlank
, sBlank
});
309 ClassificationCollector(sd::DrawViewShell
& rDrawViewShell
, const css::uno::Reference
<css::document::XDocumentProperties
>& rDocProps
)
310 : ClassificationCommon(rDrawViewShell
, rDocProps
)
313 std::vector
<svx::ClassificationResult
> const & getResults() const
320 // Set to MASTER mode
321 EditMode eOldMode
= m_rDrawViewShell
.GetEditMode();
322 if (eOldMode
!= EditMode::MasterPage
)
323 m_rDrawViewShell
.ChangeEditMode(EditMode::MasterPage
, false);
325 // Scoped guard to revert to the previous mode
326 comphelper::ScopeGuard
const aGuard([this, eOldMode
] () {
327 m_rDrawViewShell
.ChangeEditMode(eOldMode
, false);
330 const sal_uInt16 nCount
= m_rDrawViewShell
.GetDoc()->GetMasterSdPageCount(PageKind::Standard
);
332 for (sal_uInt16 nPageIndex
= 0; nPageIndex
< nCount
; ++nPageIndex
)
334 SdPage
* pMasterPage
= m_rDrawViewShell
.GetDoc()->GetMasterSdPage(nPageIndex
, PageKind::Standard
);
335 for (size_t nObject
= 0; nObject
< pMasterPage
->GetObjCount(); ++nObject
)
337 SdrObject
* pObject
= pMasterPage
->GetObj(nObject
);
338 SdrRectObj
* pRectObject
= dynamic_cast<SdrRectObj
*>(pObject
);
339 if (pRectObject
&& pRectObject
->GetTextKind() == SdrObjKind::Text
)
341 OutlinerParaObject
* pOutlinerParagraphObject
= pRectObject
->GetOutlinerParaObject();
342 if (pOutlinerParagraphObject
)
344 const EditTextObject
& rEditText
= pOutlinerParagraphObject
->GetTextObject();
345 std::vector
<editeng::Section
> aSections
;
346 rEditText
.GetAllSections(aSections
);
348 // Search for a custom property field that has the classification category identifier key
349 if (hasCustomPropertyField(aSections
, m_aKeyCreator
.makeCategoryNameKey()))
351 iterateSectionsAndCollect(aSections
, rEditText
);
361 class ClassificationInserter
: public ClassificationCommon
364 /// Delete the previous existing classification object(s) - if they exist
365 void deleteExistingObjects()
367 OUString sKey
= m_aKeyCreator
.makeCategoryNameKey();
369 const sal_uInt16 nCount
= m_rDrawViewShell
.GetDoc()->GetMasterSdPageCount(PageKind::Standard
);
371 for (sal_uInt16 nPageIndex
= 0; nPageIndex
< nCount
; ++nPageIndex
)
373 SdPage
* pMasterPage
= m_rDrawViewShell
.GetDoc()->GetMasterSdPage(nPageIndex
, PageKind::Standard
);
374 for (size_t nObject
= 0; nObject
< pMasterPage
->GetObjCount(); ++nObject
)
376 SdrObject
* pObject
= pMasterPage
->GetObj(nObject
);
377 SdrRectObj
* pRectObject
= dynamic_cast<SdrRectObj
*>(pObject
);
378 if (pRectObject
&& pRectObject
->GetTextKind() == SdrObjKind::Text
)
380 OutlinerParaObject
* pOutlinerParagraphObject
= pRectObject
->GetOutlinerParaObject();
381 if (pOutlinerParagraphObject
)
383 const EditTextObject
& rEditText
= pOutlinerParagraphObject
->GetTextObject();
384 std::vector
<editeng::Section
> aSections
;
385 rEditText
.GetAllSections(aSections
);
387 if (hasCustomPropertyField(aSections
, sKey
))
389 pMasterPage
->RemoveObject(pRectObject
->GetOrdNum());
397 void fillTheOutliner(Outliner
* pOutliner
, std::vector
<svx::ClassificationResult
> const & rResults
)
399 sal_Int32 nParagraph
= -1;
400 for (svx::ClassificationResult
const & rResult
: rResults
)
403 ESelection
aPosition(nParagraph
, EE_TEXTPOS_MAX_COUNT
, nParagraph
, EE_TEXTPOS_MAX_COUNT
);
405 switch (rResult
.meType
)
407 case svx::ClassificationType::TEXT
:
409 OUString sKey
= m_aKeyCreator
.makeNumberedTextKey();
410 svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer
, sKey
, rResult
.msName
);
411 pOutliner
->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey
, rResult
.msName
), EE_FEATURE_FIELD
), aPosition
);
415 case svx::ClassificationType::CATEGORY
:
417 OUString sKey
= m_aKeyCreator
.makeCategoryNameKey();
418 pOutliner
->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey
, rResult
.msName
), EE_FEATURE_FIELD
), aPosition
);
422 case svx::ClassificationType::MARKING
:
424 OUString sKey
= m_aKeyCreator
.makeNumberedMarkingKey();
425 svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer
, sKey
, rResult
.msName
);
426 pOutliner
->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey
, rResult
.msName
), EE_FEATURE_FIELD
), aPosition
);
430 case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART
:
432 OUString sKey
= m_aKeyCreator
.makeNumberedIntellectualPropertyPartKey();
433 svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer
, sKey
, rResult
.msName
);
434 pOutliner
->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey
, rResult
.msName
), EE_FEATURE_FIELD
), aPosition
);
438 case svx::ClassificationType::PARAGRAPH
:
441 pOutliner
->Insert("");
443 SfxItemSetFixed
<EE_ITEMS_START
, EE_ITEMS_END
> aItemSet(m_rDrawViewShell
.GetDoc()->GetPool());
445 if (rResult
.msName
== "BOLD")
446 aItemSet
.Put(SvxWeightItem(WEIGHT_BOLD
, EE_CHAR_WEIGHT
));
448 aItemSet
.Put(SvxWeightItem(WEIGHT_NORMAL
, EE_CHAR_WEIGHT
));
450 SvxNumRule
aDefaultNumRule(SvxNumRuleFlags::NONE
, 0, false);
451 aItemSet
.Put(SvxNumBulletItem(std::move(aDefaultNumRule
), EE_PARA_NUMBULLET
));
453 pOutliner
->SetParaAttribs(nParagraph
, aItemSet
);
464 ClassificationInserter(sd::DrawViewShell
& rDrawViewShell
, const css::uno::Reference
<css::document::XDocumentProperties
>& rDocProps
)
465 : ClassificationCommon(rDrawViewShell
, rDocProps
)
469 void insert(std::vector
<svx::ClassificationResult
> const & rResults
)
471 // Set to MASTER mode
472 EditMode eOldMode
= m_rDrawViewShell
.GetEditMode();
473 if (eOldMode
!= EditMode::MasterPage
)
474 m_rDrawViewShell
.ChangeEditMode(EditMode::MasterPage
, false);
476 // Scoped guard to revert the mode
477 comphelper::ScopeGuard
const aGuard([this, eOldMode
] () {
478 m_rDrawViewShell
.ChangeEditMode(eOldMode
, false);
481 // Delete the previous existing object - if exists
482 deleteExistingObjects();
485 svx::classification::removeAllProperties(m_xPropertyContainer
);
487 SfxClassificationHelper
aHelper(m_xDocumentProperties
);
489 // Apply properties from the BA policy
490 for (svx::ClassificationResult
const & rResult
: rResults
)
492 if (rResult
.meType
== svx::ClassificationType::CATEGORY
)
493 aHelper
.SetBACName(rResult
.msName
, SfxClassificationHelper::getPolicyType());
496 // Insert full text as document property
497 svx::classification::insertFullTextualRepresentationAsDocumentProperty(m_xPropertyContainer
, m_aKeyCreator
, rResults
);
499 // Create the outliner from the
500 Outliner
* pOutliner
= m_rDrawViewShell
.GetDoc()->GetInternalOutliner();
501 OutlinerMode eOutlinerMode
= pOutliner
->GetOutlinerMode();
503 comphelper::ScopeGuard
const aOutlinerGuard([pOutliner
, eOutlinerMode
] () {
504 pOutliner
->Init(eOutlinerMode
);
507 pOutliner
->Init(OutlinerMode::TextObject
);
509 // Fill the outliner with the text from classification result
510 fillTheOutliner(pOutliner
, rResults
);
512 // Calculate to outliner text size
513 pOutliner
->UpdateFields();
514 pOutliner
->SetUpdateLayout(true);
515 Size
aTextSize(pOutliner
->CalcTextSize());
516 pOutliner
->SetUpdateLayout(false);
518 // Create objects, apply the outliner and add them (objects) to all master pages
519 const sal_uInt16 nCount
= m_rDrawViewShell
.GetDoc()->GetMasterSdPageCount(PageKind::Standard
);
521 for (sal_uInt16 nPageIndex
= 0; nPageIndex
< nCount
; ++nPageIndex
)
523 SdPage
* pMasterPage
= m_rDrawViewShell
.GetDoc()->GetMasterSdPage(nPageIndex
, PageKind::Standard
);
527 rtl::Reference
<SdrRectObj
> pObject
= new SdrRectObj(
528 *m_rDrawViewShell
.GetDoc(), // TTTT should be reference
530 pObject
->SetMergedItem(makeSdrTextAutoGrowWidthItem(true));
531 pObject
->SetOutlinerParaObject(pOutliner
->CreateParaObject());
532 pMasterPage
->InsertObject(pObject
.get());
534 // Calculate position
535 ::tools::Rectangle
aRectangle(Point(), pMasterPage
->GetSize());
536 Point
aPosition(aRectangle
.Center().X(), aRectangle
.Bottom());
538 aPosition
.AdjustX( -(aTextSize
.Width() / 2) );
539 aPosition
.AdjustY( -(aTextSize
.Height()) );
541 pObject
->SetLogicRect(::tools::Rectangle(aPosition
, aTextSize
));
546 void lcl_convertStringArguments(sal_uInt16 nSlot
, const std::unique_ptr
<SfxItemSet
>& pArgs
)
548 const SfxPoolItem
* pItem
= nullptr;
550 if (SfxItemState::SET
== pArgs
->GetItemState(SID_ATTR_LINE_WIDTH_ARG
, false, &pItem
))
552 double fValue
= static_cast<const SvxDoubleItem
*>(pItem
)->GetValue();
553 // FIXME: different units...
555 int nValue
= fValue
* nPow
;
557 XLineWidthItem
aItem(nValue
);
560 if (SfxItemState::SET
== pArgs
->GetItemState(SID_FILL_GRADIENT_JSON
, false, &pItem
))
562 const SfxStringItem
* pJSON
= static_cast<const SfxStringItem
*>(pItem
);
565 basegfx::BGradient aGradient
= basegfx::BGradient::fromJSON(pJSON
->GetValue());
566 XFillGradientItem
aItem(aGradient
);
571 if (nSlot
== SID_ATTR_FILL_COLOR
)
573 // Merge the color parameters to the color itself.
574 const XFillColorItem
* pColorItem
= static_cast<const XFillColorItem
*>(pArgs
->GetItem(SID_ATTR_FILL_COLOR
));
577 XFillColorItem
aColorItem(*pColorItem
);
578 model::ComplexColor aComplexColor
= aColorItem
.getComplexColor();
580 if (pArgs
->GetItemState(SID_ATTR_COLOR_THEME_INDEX
, false, &pItem
) == SfxItemState::SET
)
582 auto pIntItem
= static_cast<const SfxInt16Item
*>(pItem
);
583 aComplexColor
.setSchemeColor(model::convertToThemeColorType(pIntItem
->GetValue()));
585 if (pArgs
->GetItemState(SID_ATTR_COLOR_LUM_MOD
, false, &pItem
) == SfxItemState::SET
)
587 auto pIntItem
= static_cast<const SfxInt16Item
*>(pItem
);
588 aComplexColor
.addTransformation({model::TransformationType::LumMod
, pIntItem
->GetValue()});
590 if (pArgs
->GetItemState(SID_ATTR_COLOR_LUM_OFF
, false, &pItem
) == SfxItemState::SET
)
592 auto pIntItem
= static_cast<const SfxInt16Item
*>(pItem
);
593 aComplexColor
.addTransformation({model::TransformationType::LumOff
, pIntItem
->GetValue()});
595 aColorItem
.setComplexColor(aComplexColor
);
596 pArgs
->Put(aColorItem
);
603 * SfxRequests for temporary actions
606 void DrawViewShell::FuTemporary(SfxRequest
& rReq
)
608 // during a native slide show nothing gets executed!
609 if(SlideShow::IsRunning( GetViewShellBase() ) && (rReq
.GetSlot() != SID_NAVIGATOR
))
612 DBG_ASSERT( mpDrawView
, "sd::DrawViewShell::FuTemporary(), no draw view!" );
618 DeactivateCurrentFunction();
620 sal_uInt16 nSId
= rReq
.GetSlot();
624 case SID_OUTLINE_TEXT_AUTOFIT
:
626 SfxUndoManager
* pUndoManager
= GetDocSh()->GetUndoManager();
627 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
628 if( rMarkList
.GetMarkCount() == 1 )
630 pUndoManager
->EnterListAction("", "", 0, GetViewShellBase().GetViewShellId());
631 mpDrawView
->BegUndo();
633 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
634 bool bSet
= pObj
->GetMergedItemSet().GetItem
<SdrTextFitToSizeTypeItem
>(SDRATTR_TEXT_FITTOSIZE
)->GetValue() != drawing::TextFitToSizeType_NONE
;
636 mpDrawView
->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj
));
640 //If we are turning on AutoFit we have to turn these off if already on
641 if (pObj
->GetMergedItemSet().GetItem
<SdrOnOffItem
>(SDRATTR_TEXT_AUTOGROWHEIGHT
)->GetValue())
642 pObj
->SetMergedItem(makeSdrTextAutoGrowHeightItem(false));
643 if (pObj
->GetMergedItemSet().GetItem
<SdrOnOffItem
>(SDRATTR_TEXT_AUTOGROWWIDTH
)->GetValue())
644 pObj
->SetMergedItem(makeSdrTextAutoGrowWidthItem(false));
647 pObj
->SetMergedItem(SdrTextFitToSizeTypeItem(bSet
? drawing::TextFitToSizeType_NONE
: drawing::TextFitToSizeType_AUTOFIT
));
649 mpDrawView
->EndUndo();
650 pUndoManager
->LeaveListAction();
657 // area and line attributes: shall have
658 // an own Execute method (like StateMethode)
659 case SID_ATTR_FILL_STYLE
:
660 case SID_ATTR_FILL_COLOR
:
661 case SID_ATTR_FILL_GRADIENT
:
662 case SID_ATTR_FILL_HATCH
:
663 case SID_ATTR_FILL_BITMAP
:
664 case SID_ATTR_FILL_SHADOW
:
665 case SID_ATTR_SHADOW_COLOR
:
666 case SID_ATTR_SHADOW_TRANSPARENCE
:
667 case SID_ATTR_SHADOW_BLUR
:
668 case SID_ATTR_SHADOW_XDISTANCE
:
669 case SID_ATTR_SHADOW_YDISTANCE
:
670 case SID_ATTR_FILL_USE_SLIDE_BACKGROUND
:
671 case SID_ATTR_FILL_TRANSPARENCE
:
672 case SID_ATTR_FILL_FLOATTRANSPARENCE
:
674 case SID_ATTR_LINE_STYLE
:
675 case SID_ATTR_LINE_DASH
:
676 case SID_ATTR_LINE_WIDTH
:
677 case SID_ATTR_LINE_COLOR
:
678 case SID_ATTR_LINEEND_STYLE
:
679 case SID_ATTR_LINE_START
:
680 case SID_ATTR_LINE_END
:
681 case SID_ATTR_LINE_TRANSPARENCE
:
682 case SID_ATTR_LINE_JOINT
:
683 case SID_ATTR_LINE_CAP
:
685 case SID_ATTR_TEXT_FITTOSIZE
:
689 std::unique_ptr
<SfxItemSet
> pNewArgs
= rReq
.GetArgs()->Clone();
690 lcl_convertStringArguments(rReq
.GetSlot(), pNewArgs
);
691 mpDrawView
->SetAttributes(*pNewArgs
);
696 switch( rReq
.GetSlot() )
698 case SID_ATTR_FILL_SHADOW
:
699 case SID_ATTR_SHADOW_COLOR
:
700 case SID_ATTR_SHADOW_TRANSPARENCE
:
701 case SID_ATTR_SHADOW_BLUR
:
702 case SID_ATTR_SHADOW_XDISTANCE
:
703 case SID_ATTR_SHADOW_YDISTANCE
:
704 case SID_ATTR_FILL_STYLE
:
705 case SID_ATTR_FILL_COLOR
:
706 case SID_ATTR_FILL_GRADIENT
:
707 case SID_ATTR_FILL_HATCH
:
708 case SID_ATTR_FILL_BITMAP
:
709 case SID_ATTR_FILL_USE_SLIDE_BACKGROUND
:
710 case SID_ATTR_FILL_TRANSPARENCE
:
711 case SID_ATTR_FILL_FLOATTRANSPARENCE
:
712 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA
, SfxCallMode::ASYNCHRON
);
714 case SID_ATTR_LINE_STYLE
:
715 case SID_ATTR_LINE_DASH
:
716 case SID_ATTR_LINE_WIDTH
:
717 case SID_ATTR_LINE_COLOR
:
718 case SID_ATTR_LINE_TRANSPARENCE
:
719 case SID_ATTR_LINE_JOINT
:
720 case SID_ATTR_LINE_CAP
:
721 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE
, SfxCallMode::ASYNCHRON
);
723 case SID_ATTR_TEXT_FITTOSIZE
:
724 GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG
, SfxCallMode::ASYNCHRON
);
732 case SID_HYPHENATION
:
734 const SfxBoolItem
* pItem
= rReq
.GetArg
<SfxBoolItem
>(SID_HYPHENATION
);
738 SfxItemSetFixed
<EE_PARA_HYPHENATE
, EE_PARA_HYPHENATE
> aSet( GetPool() );
739 bool bValue
= pItem
->GetValue();
740 aSet
.Put( SfxBoolItem( EE_PARA_HYPHENATE
, bValue
) );
741 mpDrawView
->SetAttributes( aSet
);
743 else // only for testing purpose
745 OSL_FAIL(" no value for hyphenation!");
746 SfxItemSetFixed
<EE_PARA_HYPHENATE
, EE_PARA_HYPHENATE
> aSet( GetPool() );
747 aSet
.Put( SfxBoolItem( EE_PARA_HYPHENATE
, true ) );
748 mpDrawView
->SetAttributes( aSet
);
756 case SID_INSERTPAGE_QUICK
:
758 SdPage
* pNewPage
= CreateOrDuplicatePage (rReq
, mePageKind
, GetActualPage());
760 if(HasCurrentFunction(SID_BEZIER_EDIT
) )
761 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
762 if (pNewPage
!= nullptr)
763 SwitchPage((pNewPage
->GetPageNum()-1)/2);
768 case SID_DUPLICATE_PAGE
:
770 auto slideSorter
= sd::slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase());
771 SdPage
* pNewPage
= nullptr;
773 DuplicateSelectedSlides(rReq
);
775 pNewPage
= CreateOrDuplicatePage (rReq
, mePageKind
, GetActualPage());
777 if(HasCurrentFunction(SID_BEZIER_EDIT
) )
778 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
779 if(!slideSorter
&& pNewPage
!= nullptr)
780 SwitchPage((pNewPage
->GetPageNum()-1)/2);
785 case SID_INSERT_MASTER_PAGE
:
787 // Use the API to create a new page.
788 Reference
<drawing::XMasterPagesSupplier
> xMasterPagesSupplier (
789 GetDoc()->getUnoModel(), UNO_QUERY
);
790 if (xMasterPagesSupplier
.is())
792 Reference
<drawing::XDrawPages
> xMasterPages (
793 xMasterPagesSupplier
->getMasterPages());
794 if (xMasterPages
.is())
796 sal_uInt16 nIndex
= GetCurPagePos() + 1;
797 xMasterPages
->insertNewByIndex (nIndex
);
799 // Create shapes for the default layout.
800 SdPage
* pMasterPage
= GetDoc()->GetMasterSdPage(
801 nIndex
, PageKind::Standard
);
802 pMasterPage
->CreateTitleAndLayout (true,true);
807 if(HasCurrentFunction(SID_BEZIER_EDIT
))
808 GetViewFrame()->GetDispatcher()->Execute(
809 SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
816 if (mePageKind
==PageKind::Standard
|| mePageKind
==PageKind::Notes
||
817 (mePageKind
==PageKind::Handout
&& meEditMode
==EditMode::MasterPage
) )
819 if ( mpDrawView
->IsTextEdit() )
821 mpDrawView
->SdrEndTextEdit();
823 sal_uInt16 nPage
= maTabControl
->GetCurPagePos();
824 mpActualPage
= GetDoc()->GetSdPage(nPage
, mePageKind
);
825 ::sd::ViewShell::mpImpl
->ProcessModifyPageSlot (
836 case SID_ASSIGN_LAYOUT
:
838 if (mePageKind
==PageKind::Standard
|| mePageKind
==PageKind::Notes
|| (mePageKind
==PageKind::Handout
&& meEditMode
==EditMode::MasterPage
))
840 if ( mpDrawView
->IsTextEdit() )
841 mpDrawView
->SdrEndTextEdit();
843 ::sd::ViewShell::mpImpl
->AssignLayout(rReq
, mePageKind
);
851 case SID_RENAME_MASTER_PAGE
:
853 if (mePageKind
==PageKind::Standard
|| mePageKind
==PageKind::Notes
)
855 if ( mpDrawView
->IsTextEdit() )
857 mpDrawView
->SdrEndTextEdit();
860 sal_uInt16 nPage
= maTabControl
->GetCurPagePos();
861 SdPage
* pCurrentPage
= ( GetEditMode() == EditMode::Page
)
862 ? GetDoc()->GetSdPage( nPage
, GetPageKind() )
863 : GetDoc()->GetMasterSdPage( nPage
, GetPageKind() );
865 OUString aTitle
= SdResId(STR_TITLE_RENAMESLIDE
);
866 OUString aDescr
= SdResId(STR_DESC_RENAMESLIDE
);
867 const OUString
& aPageName
= pCurrentPage
->GetName();
871 OUString aName
= rReq
.GetArgs()->GetItem
<const SfxStringItem
>(SID_RENAMEPAGE
)->GetValue();
873 bool bResult
= RenameSlide( maTabControl
->GetPageId(nPage
), aName
);
874 DBG_ASSERT( bResult
, "Couldn't rename slide" );
878 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
879 ScopedVclPtr
<AbstractSvxNameDialog
> aNameDlg(pFact
->CreateSvxNameDialog(GetFrameWeld(), aPageName
, aDescr
));
880 aNameDlg
->SetText( aTitle
);
881 aNameDlg
->SetCheckNameHdl( LINK( this, DrawViewShell
, RenameSlideHdl
), true );
882 aNameDlg
->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE
);
884 if( aNameDlg
->Execute() == RET_OK
)
887 aNameDlg
->GetName( aNewName
);
888 if (aNewName
!= aPageName
)
890 bool bResult
= RenameSlide( maTabControl
->GetPageId(nPage
), aNewName
);
891 DBG_ASSERT( bResult
, "Couldn't rename slide" );
901 case SID_RENAMEPAGE_QUICK
:
903 if (mePageKind
==PageKind::Standard
|| mePageKind
==PageKind::Notes
)
905 if ( mpDrawView
->IsTextEdit() )
907 mpDrawView
->SdrEndTextEdit();
910 maTabControl
->StartEditMode( maTabControl
->GetCurPageId() );
918 case SID_PAGESIZE
: // either this (no menu entries or something else!)
920 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
922 if (pArgs
&& pArgs
->Count () == 3)
924 const SfxUInt32Item
* pWidth
= rReq
.GetArg
<SfxUInt32Item
>(ID_VAL_PAGEWIDTH
);
925 const SfxUInt32Item
* pHeight
= rReq
.GetArg
<SfxUInt32Item
>(ID_VAL_PAGEHEIGHT
);
926 const SfxBoolItem
* pScaleAll
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_SCALEOBJECTS
);
928 Size
aSize (pWidth
->GetValue (), pHeight
->GetValue ());
930 SetupPage (aSize
, 0, 0, 0, 0, true, false, pScaleAll
->GetValue ());
934 #if HAVE_FEATURE_SCRIPTING
935 StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS
);
941 case SID_PAGEMARGIN
: // or this (no menu entries or something else!)
943 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
945 if (pArgs
&& pArgs
->Count () == 5)
947 const SfxUInt32Item
* pLeft
= rReq
.GetArg
<SfxUInt32Item
>(ID_VAL_PAGELEFT
);
948 const SfxUInt32Item
* pRight
= rReq
.GetArg
<SfxUInt32Item
>(ID_VAL_PAGERIGHT
);
949 const SfxUInt32Item
* pUpper
= rReq
.GetArg
<SfxUInt32Item
>(ID_VAL_PAGETOP
);
950 const SfxUInt32Item
* pLower
= rReq
.GetArg
<SfxUInt32Item
>(ID_VAL_PAGEBOTTOM
);
951 const SfxBoolItem
* pScaleAll
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_SCALEOBJECTS
);
953 Size
aEmptySize (0, 0);
955 SetupPage (aEmptySize
, pLeft
->GetValue (), pRight
->GetValue (),
956 pUpper
->GetValue (), pLower
->GetValue (),
957 false, true, pScaleAll
->GetValue ());
961 #if HAVE_FEATURE_SCRIPTING
962 StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS
);
968 case SID_ATTR_ZOOMSLIDER
:
970 const SfxItemSet
* pArgs
= rReq
.GetArgs();
972 const SfxUInt16Item
* pScale
= (pArgs
&& pArgs
->Count () == 1) ?
973 rReq
.GetArg(SID_ATTR_ZOOMSLIDER
) : nullptr;
974 if (pScale
&& CHECK_RANGE (5, pScale
->GetValue (), 3000))
976 SetZoom (pScale
->GetValue ());
978 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
979 rBindings
.Invalidate( SID_ATTR_ZOOM
);
980 rBindings
.Invalidate( SID_ZOOM_IN
);
981 rBindings
.Invalidate( SID_ZOOM_OUT
);
982 rBindings
.Invalidate( SID_ATTR_ZOOMSLIDER
);
993 const SfxItemSet
* pArgs
= rReq
.GetArgs();
994 mbZoomOnPage
= false;
998 SvxZoomType eZT
= pArgs
->Get( SID_ATTR_ZOOM
).GetType();
1001 case SvxZoomType::PERCENT
:
1002 SetZoom( static_cast<::tools::Long
>( pArgs
->Get( SID_ATTR_ZOOM
).GetValue()) );
1005 case SvxZoomType::OPTIMAL
:
1006 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL
,
1007 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
1010 case SvxZoomType::PAGEWIDTH
:
1011 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH
,
1012 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
1015 case SvxZoomType::WHOLEPAGE
:
1016 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE
,
1017 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
1019 case SvxZoomType::PAGEWIDTH_NOBORDER
:
1020 OSL_FAIL("sd::DrawViewShell::FuTemporary(), SvxZoomType::PAGEWIDTH_NOBORDER not handled!" );
1028 SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1034 case SID_CHANGEBEZIER
:
1035 case SID_CHANGEPOLYGON
:
1036 if ( mpDrawView
->IsTextEdit() )
1038 mpDrawView
->SdrEndTextEdit();
1039 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
1042 if ( mpDrawView
->IsPresObjSelected() )
1044 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1045 VclMessageType::Info
, VclButtonsType::Ok
,
1046 SdResId(STR_ACTION_NOTPOSSIBLE
)));
1051 if( rReq
.GetSlot() == SID_CHANGEBEZIER
)
1053 weld::WaitObject
aWait(GetFrameWeld());
1054 mpDrawView
->ConvertMarkedToPathObj(false);
1058 if( mpDrawView
->IsVectorizeAllowed() )
1060 SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1064 weld::WaitObject
aWait(GetFrameWeld());
1065 mpDrawView
->ConvertMarkedToPolyObj();
1069 Invalidate(SID_CHANGEBEZIER
);
1070 Invalidate(SID_CHANGEPOLYGON
);
1074 if( HasCurrentFunction(SID_BEZIER_EDIT
) )
1075 { // where applicable, activate right edit action
1076 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT
,
1077 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
1082 case SID_CONVERT_TO_CONTOUR
:
1083 if ( mpDrawView
->IsTextEdit() )
1085 mpDrawView
->SdrEndTextEdit();
1086 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
1089 if ( mpDrawView
->IsPresObjSelected() )
1091 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1092 VclMessageType::Info
, VclButtonsType::Ok
,
1093 SdResId(STR_ACTION_NOTPOSSIBLE
)));
1098 weld::WaitObject
aWait(GetFrameWeld());
1099 mpDrawView
->ConvertMarkedToPathObj(true);
1101 Invalidate(SID_CONVERT_TO_CONTOUR
);
1108 case SID_CONVERT_TO_METAFILE
:
1109 case SID_CONVERT_TO_BITMAP
:
1111 // End text edit mode when it is active because the metafile or
1112 // bitmap that will be created does not support it.
1113 if ( mpDrawView
->IsTextEdit() )
1115 mpDrawView
->SdrEndTextEdit();
1116 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
1119 if ( mpDrawView
->IsPresObjSelected(true,true,true) )
1121 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1122 VclMessageType::Info
, VclButtonsType::Ok
,
1123 SdResId(STR_ACTION_NOTPOSSIBLE
)));
1128 weld::WaitObject
aWait(GetFrameWeld());
1130 // create SdrGrafObj from metafile/bitmap
1134 case SID_CONVERT_TO_METAFILE
:
1136 // switch on undo for the next operations
1137 mpDrawView
->BegUndo(SdResId(STR_UNDO_CONVERT_TO_METAFILE
));
1138 GDIMetaFile
aMetaFile(mpDrawView
->GetMarkedObjMetaFile());
1139 aGraphic
= Graphic(aMetaFile
);
1142 case SID_CONVERT_TO_BITMAP
:
1144 // Disable spelling during conversion
1145 bool bOnlineSpell
= GetDoc()->GetOnlineSpell();
1146 GetDoc()->SetOnlineSpell(false);
1148 // switch on undo for the next operations
1149 mpDrawView
->BegUndo(SdResId(STR_UNDO_CONVERT_TO_BITMAP
));
1152 // I have to get the image here directly since GetMarkedObjBitmapEx works
1153 // based on Bitmaps, but not on BitmapEx, thus throwing away the alpha
1154 // channel. Argh! GetMarkedObjBitmapEx itself is too widely used to safely
1155 // change that, e.g. in the exchange formats. For now I can only add this
1156 // exception to get good results for Svgs. This is how the code gets more
1157 // and more crowded, at last I made a remark for myself to change this
1158 // as one of the next tasks.
1159 if(1 == mpDrawView
->GetMarkedObjectCount())
1161 const SdrGrafObj
* pSdrGrafObj
= dynamic_cast< const SdrGrafObj
* >(mpDrawView
->GetMarkedObjectByIndex(0));
1163 if(pSdrGrafObj
&& pSdrGrafObj
->isEmbeddedVectorGraphicData())
1165 aGraphic
= Graphic(pSdrGrafObj
->GetGraphic().getVectorGraphicData()->getReplacement());
1172 aGraphic
= Graphic(mpDrawView
->GetMarkedObjBitmapEx());
1174 // Restore online spelling
1175 GetDoc()->SetOnlineSpell(bOnlineSpell
);
1180 // create new object
1181 rtl::Reference
<SdrGrafObj
> pGraphicObj
= new SdrGrafObj(
1185 // get some necessary info and ensure it
1186 const SdrMarkList
& rMarkList(mpDrawView
->GetMarkedObjectList());
1187 const size_t nMarkCount(rMarkList
.GetMarkCount());
1188 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
1189 OSL_ENSURE(nMarkCount
, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)");
1190 OSL_ENSURE(pPageView
, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)");
1192 // fit rectangle of new graphic object to selection's mark rect
1193 ::tools::Rectangle aAllMarkedRect
;
1194 rMarkList
.TakeBoundRect(pPageView
, aAllMarkedRect
);
1195 pGraphicObj
->SetLogicRect(aAllMarkedRect
);
1197 // #i71540# to keep the order, it is necessary to replace the lowest object
1198 // of the selection with the new object. This also means that with multi
1199 // selection, all other objects need to be deleted first
1200 SdrMark
* pFirstMark
= rMarkList
.GetMark(0);
1201 SdrObject
* pReplacementCandidate
= pFirstMark
->GetMarkedSdrObj();
1205 // take first object out of selection
1206 mpDrawView
->MarkObj(pReplacementCandidate
, pPageView
, true, true);
1208 // clear remaining selection
1209 mpDrawView
->DeleteMarkedObj();
1212 // #i124816# copy layer from lowest object which gets replaced
1213 pGraphicObj
->SetLayer(pReplacementCandidate
->GetLayer());
1215 // now replace lowest object with new one
1216 mpDrawView
->ReplaceObjectAtView(pReplacementCandidate
, *pPageView
, pGraphicObj
.get());
1219 mpDrawView
->EndUndo();
1228 case SID_REMOVE_HYPERLINK
:
1230 if (mpDrawView
->IsTextEdit())
1232 // First make sure the field is selected
1233 OutlinerView
* pOutView
= mpDrawView
->GetTextEditOutlinerView();
1236 pOutView
->SelectFieldAtCursor();
1237 URLFieldHelper::RemoveURLField(pOutView
->GetEditView());
1245 case SID_SET_DEFAULT
:
1247 std::optional
<SfxItemSet
> pSet
;
1249 if (mpDrawView
->IsTextEdit())
1251 pSet
.emplace( GetPool(), svl::Items
<EE_ITEMS_START
, EE_ITEMS_END
> );
1252 mpDrawView
->SetAttributes( *pSet
, true );
1256 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
1257 const size_t nCount
= rMarkList
.GetMarkCount();
1259 // For every presentation object a SfxItemSet of hard attributes
1260 // and the UserCall is stored in this list. This is because
1261 // at the following mpDrawView->SetAttributes( *pSet, sal_True )
1262 // they get lost and have to be restored.
1263 std::vector
<std::pair
<std::unique_ptr
<SfxItemSet
>,SdrObjUserCall
*> > aAttrList
;
1264 SdPage
* pPresPage
= static_cast<SdPage
*>( mpDrawView
->GetSdrPageView()->GetPage() );
1266 for ( size_t i
= 0; i
< nCount
; ++i
)
1268 SdrObject
* pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
1270 if( pPresPage
->IsPresObj( pObj
) )
1272 auto pNewSet
= std::make_unique
<SfxItemSetFixed
<SDRATTR_TEXT_MINFRAMEHEIGHT
, SDRATTR_TEXT_AUTOGROWHEIGHT
>>( GetDoc()->GetPool() );
1273 pNewSet
->Put(pObj
->GetMergedItemSet());
1274 aAttrList
.emplace_back(std::move(pNewSet
), pObj
->GetUserCall());
1278 pSet
.emplace( GetPool() );
1279 mpDrawView
->SetAttributes( *pSet
, true );
1283 for ( size_t i
= 0; i
< nCount
; ++i
)
1285 SfxStyleSheet
* pSheet
= nullptr;
1286 SdrObject
* pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
1288 if (pObj
->GetObjIdentifier() == SdrObjKind::TitleText
)
1290 pSheet
= mpActualPage
->GetStyleSheetForPresObj(PresObjKind::Title
);
1292 pObj
->SetStyleSheet(pSheet
, false);
1294 else if(pObj
->GetObjIdentifier() == SdrObjKind::OutlineText
)
1296 for (sal_uInt16 nLevel
= 1; nLevel
< 10; nLevel
++)
1298 pSheet
= mpActualPage
->GetStyleSheetForPresObj( PresObjKind::Outline
);
1299 DBG_ASSERT(pSheet
, "Template for outline object not found");
1302 pObj
->StartListening(*pSheet
);
1305 // text frame listens on StyleSheet of level1
1306 pObj
->NbcSetStyleSheet(pSheet
, false);
1311 if( pPresPage
->IsPresObj( pObj
) )
1313 std::pair
<std::unique_ptr
<SfxItemSet
>,SdrObjUserCall
*> &rAttr
= aAttrList
[j
++];
1315 std::unique_ptr
<SfxItemSet
> & pNewSet(rAttr
.first
);
1316 SdrObjUserCall
* pUserCall
= rAttr
.second
;
1318 if ( pNewSet
&& pNewSet
->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT
) == SfxItemState::SET
)
1320 pObj
->SetMergedItem(pNewSet
->Get(SDRATTR_TEXT_MINFRAMEHEIGHT
));
1323 if ( pNewSet
&& pNewSet
->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT
) == SfxItemState::SET
)
1325 pObj
->SetMergedItem(pNewSet
->Get(SDRATTR_TEXT_AUTOGROWHEIGHT
));
1329 pObj
->SetUserCall( pUserCall
);
1339 case SID_DELETE_SNAPITEM
:
1342 Point aMPos
= GetActiveWindow()->PixelToLogic( maMousePos
);
1343 sal_uInt16 nHitLog
= static_cast<sal_uInt16
>(GetActiveWindow()->PixelToLogic( Size(
1344 FuPoor::HITPIX
, 0 ) ).Width());
1345 sal_uInt16 nHelpLine
;
1347 if( mpDrawView
->PickHelpLine( aMPos
, nHitLog
, *GetActiveWindow()->GetOutDev(), nHelpLine
, pPV
) )
1349 pPV
->DeleteHelpLine( nHelpLine
);
1356 case SID_DELETE_PAGE
:
1357 case SID_DELETE_MASTER_PAGE
:
1363 case SID_DELETE_LAYER
:
1364 DeleteActualLayer();
1369 case SID_ORIGINAL_SIZE
:
1370 mpDrawView
->SetMarkedOriginalSize();
1375 case SID_DRAW_FONTWORK
:
1376 case SID_DRAW_FONTWORK_VERTICAL
:
1378 svx::FontworkBar::execute(*mpView
, rReq
, GetViewFrame()->GetBindings()); // SJ: can be removed (I think)
1384 case SID_SAVE_GRAPHIC
:
1386 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
1387 if( rMarkList
.GetMarkCount() == 1 )
1389 const SdrGrafObj
* pObj
= dynamic_cast<const SdrGrafObj
*>(rMarkList
.GetMark(0)->GetMarkedSdrObj());
1390 if (pObj
&& pObj
->GetGraphicType() == GraphicType::Bitmap
)
1392 weld::Window
* pFrame
= GetFrameWeld();
1393 GraphicAttr aGraphicAttr
= pObj
->GetGraphicAttr();
1394 short nState
= RET_CANCEL
;
1395 if (aGraphicAttr
!= GraphicAttr()) // the image has been modified
1399 nState
= GraphicHelper::HasToSaveTransformedImage(pFrame
);
1407 if (nState
== RET_YES
)
1409 GraphicHelper::ExportGraphic(pFrame
, pObj
->GetTransformedGraphic(), "");
1411 else if (nState
== RET_NO
)
1413 const GraphicObject
& aGraphicObject(pObj
->GetGraphicObject());
1414 GraphicHelper::ExportGraphic(pFrame
, aGraphicObject
.GetGraphic(), "");
1423 case SID_EXTERNAL_EDIT
:
1425 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
1426 if( rMarkList
.GetMarkCount() == 1 )
1428 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
1429 if( auto pGraphicObj
= dynamic_cast<SdrGrafObj
*>( pObj
) )
1430 if( pGraphicObj
->GetGraphicType() == GraphicType::Bitmap
)
1432 GraphicObject
aGraphicObject( pGraphicObj
->GetGraphicObject() );
1433 m_ExternalEdits
.push_back(
1434 std::make_unique
<SdrExternalToolEdit
>(
1435 mpDrawView
.get(), pGraphicObj
));
1436 m_ExternalEdits
.back()->Edit( &aGraphicObject
);
1444 case SID_COMPRESS_GRAPHIC
:
1446 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
1447 if( rMarkList
.GetMarkCount() == 1 )
1449 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
1451 if( auto pGraphicObj
= dynamic_cast<SdrGrafObj
*>( pObj
) )
1452 if( pGraphicObj
->GetGraphicType() == GraphicType::Bitmap
)
1454 CompressGraphicsDialog
dialog(GetFrameWeld(), pGraphicObj
, GetViewFrame()->GetBindings() );
1455 if (dialog
.run() == RET_OK
)
1457 rtl::Reference
<SdrGrafObj
> pNewObject
= dialog
.GetCompressedSdrGrafObj();
1458 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
1459 OUString aUndoString
= mpDrawView
->GetDescriptionOfMarkedObjects() + " Compress";
1460 mpDrawView
->BegUndo( aUndoString
);
1461 mpDrawView
->ReplaceObjectAtView( pObj
, *pPageView
, pNewObject
.get() );
1462 mpDrawView
->EndUndo();
1471 case SID_GRAPHIC_SIZE_CHECK
:
1473 sd::GraphicSizeCheckGUIResult
aResult(GetDoc());
1474 svx::GenericCheckDialog
aDialog(GetFrameWeld(), aResult
);
1482 case SID_ATTRIBUTES_LINE
: // BASIC
1484 SetCurrentFunction( FuLine::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1490 case SID_ATTRIBUTES_AREA
: // BASIC
1492 SetCurrentFunction( FuArea::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1498 case SID_ATTR_TRANSFORM
:
1500 SetCurrentFunction( FuTransform::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1501 // tdf#138963 conditions tested for here must be the same as those
1502 // of the early returns from FuTransform::DoExecute
1503 if (rReq
.GetArgs() || !mpDrawView
->AreObjectsMarked())
1505 Invalidate(SID_RULER_OBJECT
);
1510 case SID_MOVE_SHAPE_HANDLE
:
1512 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
1513 if (pArgs
&& pArgs
->Count () >= 3)
1515 const SfxUInt32Item
* handleNumItem
= rReq
.GetArg
<SfxUInt32Item
>(FN_PARAM_1
);
1516 const SfxUInt32Item
* newPosXTwips
= rReq
.GetArg
<SfxUInt32Item
>(FN_PARAM_2
);
1517 const SfxUInt32Item
* newPosYTwips
= rReq
.GetArg
<SfxUInt32Item
>(FN_PARAM_3
);
1518 const SfxInt32Item
* OrdNum
= rReq
.GetArg
<SfxInt32Item
>(FN_PARAM_4
);
1520 const sal_uLong handleNum
= handleNumItem
->GetValue();
1521 const sal_uLong newPosX
= convertTwipToMm100(newPosXTwips
->GetValue());
1522 const sal_uLong newPosY
= convertTwipToMm100(newPosYTwips
->GetValue());
1524 mpDrawView
->MoveShapeHandle(handleNum
, Point(newPosX
, newPosY
), OrdNum
? OrdNum
->GetValue() : -1);
1529 case SID_CHAR_DLG_EFFECT
:
1530 case SID_CHAR_DLG
: // BASIC
1532 SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1539 SetCurrentFunction( FuParagraph::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1544 case FN_NUM_BULLET_ON
:
1546 // The value (sal_uInt16)0xFFFF means set bullet on/off.
1547 SfxUInt16Item
aItem(FN_SVX_SET_BULLET
, sal_uInt16(0xFFFF));
1548 GetViewFrame()->GetDispatcher()->ExecuteList(FN_SVX_SET_BULLET
,
1549 SfxCallMode::RECORD
, { &aItem
});
1553 case FN_NUM_NUMBERING_ON
:
1555 // The value (sal_uInt16)0xFFFF means set bullet on/off.
1556 SfxUInt16Item
aItem(FN_SVX_SET_NUMBER
, sal_uInt16(0xFFFF));
1557 GetViewFrame()->GetDispatcher()->ExecuteList(FN_SVX_SET_NUMBER
,
1558 SfxCallMode::RECORD
, { &aItem
});
1562 case SID_OUTLINE_BULLET
:
1563 case FN_SVX_SET_BULLET
:
1564 case FN_SVX_SET_NUMBER
:
1566 SetCurrentFunction( FuBulletAndPosition::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1571 case FN_INSERT_SOFT_HYPHEN
:
1572 case FN_INSERT_HARDHYPHEN
:
1573 case FN_INSERT_HARD_SPACE
:
1574 case FN_INSERT_NNBSP
:
1575 case SID_INSERT_RLM
:
1576 case SID_INSERT_LRM
:
1577 case SID_INSERT_WJ
:
1578 case SID_INSERT_ZWSP
:
1581 SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1586 case SID_PRESENTATION_LAYOUT
:
1588 SetCurrentFunction( FuPresentationLayout::Create(this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1593 case SID_PASTE_SPECIAL
:
1595 SetCurrentFunction( FuInsertClipboard::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1601 case SID_CHANGE_PICTURE
:
1602 case SID_INSERT_GRAPHIC
:
1604 SetCurrentFunction( FuInsertGraphic::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
,
1605 nSId
== SID_CHANGE_PICTURE
) );
1611 case SID_INSERT_AVMEDIA
:
1613 SetCurrentFunction( FuInsertAVMedia::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1620 case SID_INSERT_OBJECT
:
1621 case SID_INSERT_FLOATINGFRAME
:
1622 case SID_INSERT_MATH
:
1623 case SID_INSERT_DIAGRAM
:
1624 case SID_ATTR_TABLE
:
1626 SetCurrentFunction( FuInsertOLE::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1627 // Set the selection tool as the old one. This in particular important for the
1628 // zoom function, in which clicking without dragging zooms as well, and that
1629 // makes exiting the object editing mode impossible.
1630 if (dynamic_cast<FuSelection
*>( GetOldFunction().get() ) == nullptr)
1631 SetOldFunction( FuSelection::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1636 case SID_CLASSIFICATION_APPLY
:
1638 const SfxItemSet
* pArgs
= rReq
.GetArgs();
1639 const SfxPoolItem
* pItem
= nullptr;
1640 if (pArgs
&& pArgs
->GetItemState(nSId
, false, &pItem
) == SfxItemState::SET
)
1642 const OUString
& rName
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1643 auto eType
= SfxClassificationPolicyType::IntellectualProperty
;
1644 if (pArgs
->GetItemState(SID_TYPE_NAME
, false, &pItem
) == SfxItemState::SET
)
1646 const OUString
& rType
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1647 eType
= SfxClassificationHelper::stringToPolicyType(rType
);
1649 if (SfxViewFrame
* pViewFrame
= GetViewFrame())
1651 if (SfxObjectShell
* pObjectShell
= pViewFrame
->GetObjectShell())
1653 SfxClassificationHelper
aHelper(pObjectShell
->getDocProperties());
1654 aHelper
.SetBACName(rName
, eType
);
1659 SAL_WARN("sd.ui", "missing parameter for SID_CLASSIFICATION_APPLY");
1666 case SID_CLASSIFICATION_DIALOG
:
1668 if (SfxObjectShell
* pObjShell
= SfxObjectShell::Current())
1670 css::uno::Reference
<css::document::XDocumentProperties
> xDocProps(pObjShell
->getDocProperties());
1671 auto xDialog
= std::make_shared
<svx::ClassificationDialog
>(GetFrameWeld(), xDocProps
, false, [](){} );
1672 ClassificationCollector
aCollector(*this, xDocProps
);
1673 aCollector
.collect();
1675 xDialog
->setupValues(std::vector(aCollector
.getResults()));
1677 if (RET_OK
== xDialog
->run())
1679 ClassificationInserter
aInserter(*this, xDocProps
);
1680 aInserter
.insert(xDialog
->getResult());
1690 case SID_COPYOBJECTS
:
1692 if ( mpDrawView
->IsPresObjSelected(false) )
1694 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1695 VclMessageType::Info
, VclButtonsType::Ok
,
1696 SdResId(STR_ACTION_NOTPOSSIBLE
)));
1701 if ( mpDrawView
->IsTextEdit() )
1703 mpDrawView
->SdrEndTextEdit();
1706 SetCurrentFunction( FuCopy::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1713 case SID_INSERTFILE
: // BASIC
1715 Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START
));
1716 SetCurrentFunction( FuInsertFile::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1717 Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END
));
1723 case SID_SELECT_BACKGROUND
:
1724 case SID_SAVE_BACKGROUND
:
1725 case SID_ATTR_PAGE_SIZE
:
1727 case SID_PAGESETUP
: // BASIC ??
1729 SetCurrentFunction( FuPage::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1731 rReq
.Ignore (); // we generate independent macros !!
1735 case SID_BEFORE_OBJ
:
1736 case SID_BEHIND_OBJ
:
1738 SetCurrentFunction( FuDisplayOrder::Create(this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1740 // finishes itself, no Cancel() needed!
1744 case SID_REVERSE_ORDER
: // BASIC
1746 mpDrawView
->ReverseOrderOfMarked();
1752 case SID_ANIMATION_EFFECTS
:
1754 SetCurrentFunction( FuObjectAnimationParameters::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1759 case SID_EXECUTE_ANIMATION_EFFECT
:
1761 SetCurrentFunction(FuExecuteInteraction::Create(this, GetActiveWindow(),
1762 mpDrawView
.get(), GetDoc(), rReq
));
1767 case SID_LINEEND_POLYGON
:
1769 SetCurrentFunction( FuLineEnd::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1774 case SID_CAPTUREPOINT
:
1775 // negative value to signal call from menu
1776 maMousePos
= Point(-1,-1);
1778 case SID_SET_SNAPITEM
:
1780 SetCurrentFunction( FuSnapLine::Create(this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1785 case SID_MANAGE_LINKS
:
1787 SetCurrentFunction( FuLink::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1795 SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1801 case SID_TEXTATTR_DLG
:
1803 if (mpDrawView
->IsTextEdit())
1804 mpDrawView
->SdrEndTextEdit();
1805 SetCurrentFunction( FuTextAttrDlg::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1811 case SID_MEASURE_DLG
:
1813 SetCurrentFunction( FuMeasureDlg::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1819 case SID_CONNECTION_DLG
:
1821 SetCurrentFunction( FuConnectionDlg::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1827 case SID_CONNECTION_NEW_ROUTING
:
1829 SfxItemSetFixed
<SDRATTR_EDGELINE1DELTA
, SDRATTR_EDGELINE3DELTA
> aDefAttr( GetPool() );
1830 GetView()->SetAttributes( aDefAttr
, true ); // (ReplaceAll)
1837 case SID_TWAIN_SELECT
:
1839 if( mxScannerManager
.is() )
1843 const css::uno::Sequence
< css::scanner::ScannerContext
>
1844 aContexts( mxScannerManager
->getAvailableScanners() );
1846 if( aContexts
.hasElements() )
1848 css::scanner::ScannerContext
aContext( aContexts
.getConstArray()[ 0 ] );
1850 Reference
<lang::XInitialization
> xInit(mxScannerManager
, UNO_QUERY
);
1853 // initialize dialog
1854 weld::Window
* pWindow
= rReq
.GetFrameWeld();
1855 uno::Sequence
<uno::Any
> aSeq(comphelper::InitAnyPropertySequence(
1857 {"ParentWindow", pWindow
? uno::Any(pWindow
->GetXWindow()) : uno::Any(Reference
<awt::XWindow
>())}
1859 xInit
->initialize( aSeq
);
1862 mxScannerManager
->configureScannerAndScan( aContext
, mxScannerListener
);
1875 case SID_TWAIN_TRANSFER
:
1879 if( mxScannerManager
.is() )
1883 const css::uno::Sequence
< css::scanner::ScannerContext
> aContexts( mxScannerManager
->getAvailableScanners() );
1885 if( aContexts
.hasElements() )
1887 mxScannerManager
->startScan( aContexts
.getConstArray()[ 0 ], mxScannerListener
);
1898 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1899 VclMessageType::Info
, VclButtonsType::Ok
,
1901 SdResId(STR_TWAIN_NO_SOURCE
)
1903 SdResId(STR_TWAIN_NO_SOURCE_UNX
)
1911 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
1912 rBindings
.Invalidate( SID_TWAIN_SELECT
);
1913 rBindings
.Invalidate( SID_TWAIN_TRANSFER
);
1921 case SID_POLYGON_MORPHING
:
1923 SetCurrentFunction( FuMorph::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
1928 case SID_INSERTLAYER
:
1930 if ( mpDrawView
->IsTextEdit() )
1932 mpDrawView
->SdrEndTextEdit();
1935 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
1936 sal_uInt16 nLayerCnt
= rLayerAdmin
.GetLayerCount();
1937 sal_uInt16 nLayer
= nLayerCnt
- 2 + 1;
1938 OUString aLayerName
= SdResId(STR_LAYER
) + OUString::number(nLayer
);
1939 OUString aLayerTitle
, aLayerDesc
;
1940 bool bIsVisible
= false;
1941 bool bIsLocked
= false;
1942 bool bIsPrintable
= false;
1944 const SfxItemSet
* pArgs
= rReq
.GetArgs();
1948 SfxItemSetFixed
<ATTR_LAYER_START
, ATTR_LAYER_END
> aNewAttr( GetDoc()->GetPool() );
1950 aNewAttr
.Put( makeSdAttrLayerName( aLayerName
) );
1951 aNewAttr
.Put( makeSdAttrLayerTitle() );
1952 aNewAttr
.Put( makeSdAttrLayerDesc() );
1953 aNewAttr
.Put( makeSdAttrLayerVisible() );
1954 aNewAttr
.Put( makeSdAttrLayerPrintable() );
1955 aNewAttr
.Put( makeSdAttrLayerLocked() );
1956 aNewAttr
.Put( makeSdAttrLayerThisPage() );
1958 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
1959 vcl::Window
* pWin
= GetActiveWindow();
1960 ScopedVclPtr
<AbstractSdInsertLayerDlg
> pDlg( pFact
->CreateSdInsertLayerDlg(pWin
? pWin
->GetFrameWeld() : nullptr, aNewAttr
, true, SdResId(STR_INSERTLAYER
)) );
1961 pDlg
->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_INSERTLAYER
)->GetCommand() );
1963 // test for already existing names
1965 while( bLoop
&& pDlg
->Execute() == RET_OK
)
1967 pDlg
->GetAttr( aNewAttr
);
1968 aLayerName
= aNewAttr
.Get(ATTR_LAYER_NAME
).GetValue ();
1970 if( rLayerAdmin
.GetLayer( aLayerName
)
1971 || aLayerName
.isEmpty()
1972 || LayerTabBar::IsLocalizedNameOfStandardLayer( aLayerName
) )
1974 // name already exists
1975 std::unique_ptr
<weld::MessageDialog
> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
1976 VclMessageType::Warning
, VclButtonsType::Ok
,
1977 SdResId(STR_WARN_NAME_DUPLICATE
)));
1983 if( bLoop
) // was canceled
1985 pDlg
.disposeAndClear();
1992 aLayerTitle
= aNewAttr
.Get(ATTR_LAYER_TITLE
).GetValue();
1993 aLayerDesc
= aNewAttr
.Get(ATTR_LAYER_DESC
).GetValue ();
1994 bIsVisible
= static_cast<const SfxBoolItem
&>( aNewAttr
.Get (ATTR_LAYER_VISIBLE
)).GetValue ();
1995 bIsLocked
= static_cast<const SfxBoolItem
&>( aNewAttr
.Get (ATTR_LAYER_LOCKED
)).GetValue () ;
1996 bIsPrintable
= static_cast<const SfxBoolItem
&>( aNewAttr
.Get (ATTR_LAYER_PRINTABLE
)).GetValue () ;
1999 else if (pArgs
->Count () != 4)
2001 #if HAVE_FEATURE_SCRIPTING
2002 StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS
);
2010 const SfxStringItem
* pLayerName
= rReq
.GetArg
<SfxStringItem
>(ID_VAL_LAYERNAME
);
2011 const SfxBoolItem
* pIsVisible
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_ISVISIBLE
);
2012 const SfxBoolItem
* pIsLocked
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_ISLOCKED
);
2013 const SfxBoolItem
* pIsPrintable
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_ISPRINTABLE
);
2015 aLayerName
= pLayerName
->GetValue ();
2016 bIsVisible
= pIsVisible
->GetValue ();
2017 bIsLocked
= pIsLocked
->GetValue ();
2018 bIsPrintable
= pIsPrintable
->GetValue ();
2021 OUString aPrevLayer
= mpDrawView
->GetActiveLayer();
2023 sal_uInt16 nPrevLayer
= 0;
2024 nLayerCnt
= rLayerAdmin
.GetLayerCount();
2026 for ( nLayer
= 0; nLayer
< nLayerCnt
; nLayer
++ )
2028 pLayer
= rLayerAdmin
.GetLayer(nLayer
);
2029 OUString aName
= pLayer
->GetName();
2031 if ( aPrevLayer
== aName
)
2033 nPrevLayer
= std::max(nLayer
, sal_uInt16(4));
2037 mpDrawView
->InsertNewLayer(aLayerName
, nPrevLayer
+ 1);
2038 pLayer
= rLayerAdmin
.GetLayer(aLayerName
);
2041 pLayer
->SetTitle( aLayerTitle
);
2042 pLayer
->SetDescription( aLayerDesc
);
2045 mpDrawView
->SetLayerVisible( aLayerName
, bIsVisible
);
2046 mpDrawView
->SetLayerLocked( aLayerName
, bIsLocked
);
2047 mpDrawView
->SetLayerPrintable(aLayerName
, bIsPrintable
);
2049 mpDrawView
->SetActiveLayer(aLayerName
);
2053 GetDoc()->SetChanged();
2055 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHLAYER
,
2056 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
2063 case SID_MODIFYLAYER
:
2065 if(!GetLayerTabControl()) // #i87182#
2067 OSL_ENSURE(false, "No LayerTabBar (!)");
2073 if ( mpDrawView
->IsTextEdit() )
2075 mpDrawView
->SdrEndTextEdit();
2078 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
2079 sal_uInt16 nCurPage
= GetLayerTabControl()->GetCurPageId();
2080 OUString aLayerName
= GetLayerTabControl()->GetLayerName(nCurPage
);
2081 SdrLayer
* pLayer
= rLayerAdmin
.GetLayer(aLayerName
);
2083 OUString aLayerTitle
= pLayer
->GetTitle();
2084 OUString aLayerDesc
= pLayer
->GetDescription();
2086 OUString
aOldLayerName(aLayerName
);
2087 OUString
aOldLayerTitle(aLayerTitle
);
2088 OUString
aOldLayerDesc(aLayerDesc
);
2090 bool bIsVisible
, bIsLocked
, bIsPrintable
;
2091 bool bOldIsVisible
= bIsVisible
= mpDrawView
->IsLayerVisible(aLayerName
);
2092 bool bOldIsLocked
= bIsLocked
= mpDrawView
->IsLayerLocked(aLayerName
);
2093 bool bOldIsPrintable
= bIsPrintable
= mpDrawView
->IsLayerPrintable(aLayerName
);
2095 const SfxItemSet
* pArgs
= rReq
.GetArgs();
2096 // is it allowed to delete the layer?
2097 bool bDelete
= !( LayerTabBar::IsRealNameOfStandardLayer(aLayerName
) );
2101 SfxItemSetFixed
<ATTR_LAYER_START
, ATTR_LAYER_END
> aNewAttr( GetDoc()->GetPool() );
2103 aNewAttr
.Put( makeSdAttrLayerName( aLayerName
) );
2104 aNewAttr
.Put( makeSdAttrLayerTitle( aLayerTitle
) );
2105 aNewAttr
.Put( makeSdAttrLayerDesc( aLayerDesc
) );
2106 aNewAttr
.Put( makeSdAttrLayerVisible( bIsVisible
) );
2107 aNewAttr
.Put( makeSdAttrLayerLocked( bIsLocked
) );
2108 aNewAttr
.Put( makeSdAttrLayerPrintable( bIsPrintable
) );
2109 aNewAttr
.Put( makeSdAttrLayerThisPage() );
2111 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
2112 vcl::Window
* pWin
= GetActiveWindow();
2113 ScopedVclPtr
<AbstractSdInsertLayerDlg
> pDlg( pFact
->CreateSdInsertLayerDlg(pWin
? pWin
->GetFrameWeld() : nullptr, aNewAttr
, bDelete
, SdResId(STR_MODIFYLAYER
)) );
2114 pDlg
->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_MODIFYLAYER
)->GetCommand() );
2116 // test for already existing names
2118 sal_uInt16 nRet
= 0;
2121 nRet
= pDlg
->Execute();
2124 pDlg
->GetAttr( aNewAttr
);
2125 aLayerName
= aNewAttr
.Get(ATTR_LAYER_NAME
).GetValue ();
2128 if( (rLayerAdmin
.GetLayer( aLayerName
) && aLayerName
!= aOldLayerName
)
2129 || LayerTabBar::IsRealNameOfStandardLayer(aLayerName
)
2130 || LayerTabBar::IsLocalizedNameOfStandardLayer(aLayerName
)
2131 || aLayerName
.isEmpty() )
2133 // name already exists
2134 std::unique_ptr
<weld::MessageDialog
> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
2135 VclMessageType::Warning
, VclButtonsType::Ok
,
2136 SdResId(STR_WARN_NAME_DUPLICATE
)));
2143 bLoop
= false; // altering name is already disabled in the dialog itself
2148 aLayerTitle
= aNewAttr
.Get(ATTR_LAYER_TITLE
).GetValue ();
2149 aLayerDesc
= aNewAttr
.Get(ATTR_LAYER_DESC
).GetValue ();
2150 bIsVisible
= static_cast<const SfxBoolItem
&>( aNewAttr
.Get (ATTR_LAYER_VISIBLE
)).GetValue ();
2151 bIsLocked
= static_cast<const SfxBoolItem
&>( aNewAttr
.Get (ATTR_LAYER_LOCKED
)).GetValue ();
2152 bIsPrintable
= static_cast<const SfxBoolItem
&>( aNewAttr
.Get (ATTR_LAYER_PRINTABLE
)).GetValue ();
2156 pDlg
.disposeAndClear();
2162 else if (pArgs
->Count () == 4)
2164 const SfxStringItem
* pLayerName
= rReq
.GetArg
<SfxStringItem
>(ID_VAL_LAYERNAME
);
2165 const SfxBoolItem
* pIsVisible
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_ISVISIBLE
);
2166 const SfxBoolItem
* pIsLocked
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_ISLOCKED
);
2167 const SfxBoolItem
* pIsPrintable
= rReq
.GetArg
<SfxBoolItem
>(ID_VAL_ISPRINTABLE
);
2169 aLayerName
= pLayerName
->GetValue ();
2170 bIsVisible
= pIsVisible
->GetValue ();
2171 bIsLocked
= pIsLocked
->GetValue ();
2172 bIsPrintable
= pIsPrintable
->GetValue ();
2176 #if HAVE_FEATURE_SCRIPTING
2177 StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS
);
2184 SfxUndoManager
* pManager
= GetDoc()->GetDocSh()->GetUndoManager();
2185 std::unique_ptr
<SdLayerModifyUndoAction
> pAction( new SdLayerModifyUndoAction(
2203 pManager
->AddUndoAction( std::move(pAction
) );
2205 ModifyLayer( pLayer
, aLayerName
, aLayerTitle
, aLayerDesc
, bIsVisible
, bIsLocked
, bIsPrintable
);
2212 case SID_TOGGLELAYERVISIBILITY
:
2214 // tdf#113439; duplicates LayerTabBar::MouseButtonDown()
2215 sal_uInt16 aTabId
= GetLayerTabControl()->GetCurPageId();
2216 OUString
aName( GetLayerTabControl()->GetLayerName(aTabId
) );
2218 SdrPageView
* pPV
= mpDrawView
->GetSdrPageView();
2219 bool bVisible
= !pPV
->IsLayerVisible(aName
);
2221 pPV
->SetLayerVisible(aName
, bVisible
);
2224 GetDoc()->SetChanged();
2231 case SID_RENAMELAYER
:
2233 if ( mpDrawView
->IsTextEdit() )
2235 mpDrawView
->SdrEndTextEdit();
2238 if(GetLayerTabControl()) // #i87182#
2240 GetLayerTabControl()->StartEditMode(GetLayerTabControl()->GetCurPageId());
2244 OSL_ENSURE(false, "No LayerTabBar (!)");
2252 case SID_EDIT_HYPERLINK
:
2254 // Ensure the field is selected first
2255 OutlinerView
* pOutView
= mpDrawView
->GetTextEditOutlinerView();
2257 pOutView
->SelectFieldAtCursor();
2259 GetViewFrame()->GetDispatcher()->Execute( SID_HYPERLINK_DIALOG
);
2266 case SID_OPEN_HYPERLINK
:
2268 OutlinerView
* pOutView
= mpDrawView
->GetTextEditOutlinerView();
2271 const SvxFieldData
* pField
= pOutView
->GetFieldAtCursor();
2272 if( auto pURLField
= dynamic_cast< const SvxURLField
*>( pField
) )
2274 SfxStringItem
aUrl( SID_FILE_NAME
, pURLField
->GetURL() );
2275 SfxStringItem
aTarget( SID_TARGETNAME
, pURLField
->GetTargetFrame() );
2277 OUString aReferName
;
2278 SfxViewFrame
* pFrame
= GetViewFrame();
2279 SfxMedium
* pMed
= pFrame
->GetObjectShell()->GetMedium();
2281 aReferName
= pMed
->GetName();
2283 SfxFrameItem
aFrm( SID_DOCFRAME
, pFrame
);
2284 SfxStringItem
aReferer( SID_REFERER
, aReferName
);
2286 SfxBoolItem
aNewView( SID_OPEN_NEW_VIEW
, false );
2287 SfxBoolItem
aBrowsing( SID_BROWSE
, true );
2289 if (SfxViewFrame
* pViewFrm
= SfxViewFrame::Current())
2291 pViewFrm
->GetDispatcher()->ExecuteList(SID_OPENDOC
,
2292 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
,
2293 { &aUrl
, &aTarget
, &aFrm
, &aReferer
,
2294 &aNewView
, &aBrowsing
});
2303 case SID_COPY_HYPERLINK_LOCATION
:
2305 OutlinerView
* pOutView
= mpDrawView
->GetTextEditOutlinerView();
2308 const SvxFieldData
* pField
= pOutView
->GetFieldAtCursor();
2309 if (const SvxURLField
* pURLField
= dynamic_cast<const SvxURLField
*>(pField
))
2311 uno::Reference
<datatransfer::clipboard::XClipboard
> xClipboard
2312 = pOutView
->GetWindow()->GetClipboard();
2314 vcl::unohelper::TextDataObject::CopyStringTo(pURLField
->GetURL(), xClipboard
, SfxViewShell::Current());
2323 case SID_HYPERLINK_SETLINK
:
2325 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
2329 const SvxHyperlinkItem
* pHLItem
=
2330 &pReqArgs
->Get(SID_HYPERLINK_SETLINK
);
2332 if (pHLItem
->GetInsertMode() == HLINK_FIELD
)
2334 InsertURLField(pHLItem
->GetURL(), pHLItem
->GetName(),
2335 pHLItem
->GetTargetFrame());
2337 else if (pHLItem
->GetInsertMode() == HLINK_BUTTON
)
2339 InsertURLButton(pHLItem
->GetURL(), pHLItem
->GetName(),
2340 pHLItem
->GetTargetFrame(), nullptr);
2342 else if (pHLItem
->GetInsertMode() == HLINK_DEFAULT
)
2344 OutlinerView
* pOlView
= mpDrawView
->GetTextEditOutlinerView();
2346 if (pOlView
|| comphelper::LibreOfficeKit::isActive())
2348 InsertURLField(pHLItem
->GetURL(), pHLItem
->GetName(),
2349 pHLItem
->GetTargetFrame());
2353 InsertURLButton(pHLItem
->GetURL(), pHLItem
->GetName(),
2354 pHLItem
->GetTargetFrame(), nullptr);
2364 case SID_HIDE_LAST_LEVEL
:
2367 // fdo#78151 editing a PresObjKind::Outline in a master page ?
2368 ::Outliner
* pOL
= GetOutlinerForMasterPageOutlineTextObj(aSel
);
2371 //we are on the last paragraph
2373 if (aSel
.nEndPara
== pOL
->GetParagraphCount() - 1)
2375 sal_uInt16 nDepth
= pOL
->GetDepth(aSel
.nEndPara
);
2376 //there exists a previous numbering level
2377 if (nDepth
!= sal_uInt16(-1) && nDepth
> 0)
2379 Paragraph
* pPara
= pOL
->GetParagraph(aSel
.nEndPara
);
2380 pOL
->Remove(pPara
, 1);
2389 case SID_SHOW_NEXT_LEVEL
:
2391 const TranslateId STR_PRESOBJ_MPOUTLINE_ARY
[]
2393 STR_PRESOBJ_MPOUTLINE
,
2394 STR_PRESOBJ_MPOUTLLAYER2
,
2395 STR_PRESOBJ_MPOUTLLAYER3
,
2396 STR_PRESOBJ_MPOUTLLAYER4
,
2397 STR_PRESOBJ_MPOUTLLAYER5
,
2398 STR_PRESOBJ_MPOUTLLAYER6
,
2399 STR_PRESOBJ_MPOUTLLAYER7
,
2400 STR_PRESOBJ_MPNOTESTITLE
,
2401 STR_PRESOBJ_MPNOTESTEXT
,
2402 STR_PRESOBJ_NOTESTEXT
2406 // fdo#78151 editing a PresObjKind::Outline in a master page ?
2407 ::Outliner
* pOL
= GetOutlinerForMasterPageOutlineTextObj(aSel
);
2410 //we are on the last paragraph
2412 if (aSel
.nEndPara
== pOL
->GetParagraphCount() - 1)
2414 sal_uInt16 nDepth
= pOL
->GetDepth(aSel
.nEndPara
);
2415 //there exists a previous numbering level
2418 sal_uInt16 nNewDepth
= nDepth
+1;
2419 pOL
->Insert(SdResId(STR_PRESOBJ_MPOUTLINE_ARY
[nNewDepth
]), EE_PARA_APPEND
, nNewDepth
);
2428 case SID_INSERT_FLD_DATE_FIX
:
2429 case SID_INSERT_FLD_DATE_VAR
:
2430 case SID_INSERT_FLD_TIME_FIX
:
2431 case SID_INSERT_FLD_TIME_VAR
:
2432 case SID_INSERT_FLD_AUTHOR
:
2433 case SID_INSERT_FLD_PAGE
:
2434 case SID_INSERT_FLD_PAGE_TITLE
:
2435 case SID_INSERT_FLD_PAGES
:
2436 case SID_INSERT_FLD_FILE
:
2438 sal_uInt16 nMul
= 1;
2439 std::unique_ptr
<SvxFieldItem
> pFieldItem
;
2443 case SID_INSERT_FLD_DATE_FIX
:
2444 pFieldItem
.reset(new SvxFieldItem(
2445 SvxDateField( Date( Date::SYSTEM
), SvxDateType::Fix
), EE_FEATURE_FIELD
));
2448 case SID_INSERT_FLD_DATE_VAR
:
2449 pFieldItem
.reset(new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD
));
2452 case SID_INSERT_FLD_TIME_FIX
:
2453 pFieldItem
.reset(new SvxFieldItem(
2454 SvxExtTimeField( ::tools::Time( ::tools::Time::SYSTEM
), SvxTimeType::Fix
), EE_FEATURE_FIELD
));
2457 case SID_INSERT_FLD_TIME_VAR
:
2458 pFieldItem
.reset(new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD
));
2461 case SID_INSERT_FLD_AUTHOR
:
2463 SvtUserOptions aUserOptions
;
2464 pFieldItem
.reset(new SvxFieldItem(
2466 aUserOptions
.GetFirstName(), aUserOptions
.GetLastName(), aUserOptions
.GetID() ), EE_FEATURE_FIELD
));
2470 case SID_INSERT_FLD_PAGE
:
2472 pFieldItem
.reset(new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD
));
2477 case SID_INSERT_FLD_PAGE_TITLE
:
2479 pFieldItem
.reset(new SvxFieldItem( SvxPageTitleField(), EE_FEATURE_FIELD
));
2484 case SID_INSERT_FLD_PAGES
:
2486 pFieldItem
.reset(new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD
));
2491 case SID_INSERT_FLD_FILE
:
2494 if( GetDocSh()->HasName() )
2495 aName
= GetDocSh()->GetMedium()->GetName();
2496 pFieldItem
.reset(new SvxFieldItem( SvxExtFileField( aName
), EE_FEATURE_FIELD
));
2501 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
2505 const SvxFieldItem
* pOldFldItem
= pOLV
->GetFieldAtSelection();
2507 if( pOldFldItem
&& ( nullptr != dynamic_cast< const SvxURLField
*>( pOldFldItem
->GetField() ) ||
2508 nullptr != dynamic_cast< const SvxDateField
*>( pOldFldItem
->GetField() ) ||
2509 nullptr != dynamic_cast< const SvxTimeField
*>( pOldFldItem
->GetField() ) ||
2510 nullptr != dynamic_cast< const SvxExtTimeField
*>( pOldFldItem
->GetField() ) ||
2511 nullptr != dynamic_cast< const SvxExtFileField
*>( pOldFldItem
->GetField() ) ||
2512 nullptr != dynamic_cast< const SvxAuthorField
*>( pOldFldItem
->GetField() ) ||
2513 nullptr != dynamic_cast< const SvxPageField
*>( pOldFldItem
->GetField() ) ) )
2515 // select field, then it will be deleted when inserting
2516 ESelection aSel
= pOLV
->GetSelection();
2517 if( aSel
.nStartPos
== aSel
.nEndPos
)
2519 pOLV
->SetSelection( aSel
);
2523 pOLV
->InsertField( *pFieldItem
);
2527 Outliner
* pOutl
= GetDoc()->GetInternalOutliner();
2528 pOutl
->Init( OutlinerMode::TextObject
);
2529 OutlinerMode nOutlMode
= pOutl
->GetOutlinerMode();
2530 pOutl
->SetStyleSheet( 0, nullptr );
2531 pOutl
->QuickInsertField( *pFieldItem
, ESelection() );
2532 std::optional
<OutlinerParaObject
> pOutlParaObject
= pOutl
->CreateParaObject();
2534 rtl::Reference
<SdrRectObj
> pRectObj
= new SdrRectObj(
2537 pRectObj
->SetMergedItem(makeSdrTextAutoGrowWidthItem(true));
2539 pOutl
->UpdateFields();
2540 pOutl
->SetUpdateLayout( true );
2541 Size
aSize( pOutl
->CalcTextSize() );
2542 aSize
.setWidth( aSize
.Width() * nMul
);
2543 pOutl
->SetUpdateLayout( false );
2546 ::tools::Rectangle
aRect( aPos
, GetActiveWindow()->GetOutputSizePixel() );
2547 aPos
= aRect
.Center();
2548 aPos
= GetActiveWindow()->PixelToLogic(aPos
);
2549 aPos
.AdjustX( -(aSize
.Width() / 2) );
2550 aPos
.AdjustY( -(aSize
.Height() / 2) );
2552 ::tools::Rectangle
aLogicRect(aPos
, aSize
);
2553 pRectObj
->SetLogicRect(aLogicRect
);
2554 pRectObj
->SetOutlinerParaObject( std::move(pOutlParaObject
) );
2555 mpDrawView
->InsertObjectAtView(pRectObj
.get(), *mpDrawView
->GetSdrPageView());
2556 pOutl
->Init( nOutlMode
);
2566 case SID_MODIFY_FIELD
:
2568 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
2572 const SvxFieldItem
* pFldItem
= pOLV
->GetFieldAtSelection();
2574 if( pFldItem
&& (nullptr != dynamic_cast< const SvxDateField
*>( pFldItem
->GetField() ) ||
2575 nullptr != dynamic_cast< const SvxAuthorField
*>( pFldItem
->GetField() ) ||
2576 nullptr != dynamic_cast< const SvxExtFileField
*>( pFldItem
->GetField() ) ||
2577 nullptr != dynamic_cast< const SvxExtTimeField
*>( pFldItem
->GetField() ) ) )
2580 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
2581 vcl::Window
* pWin
= GetActiveWindow();
2582 ScopedVclPtr
<AbstractSdModifyFieldDlg
> pDlg( pFact
->CreateSdModifyFieldDlg(pWin
? pWin
->GetFrameWeld() : nullptr, pFldItem
->GetField(), pOLV
->GetAttribs() ) );
2583 if( pDlg
->Execute() == RET_OK
)
2585 // To make a correct SetAttribs() call at the utlinerView
2586 // it is necessary to split the actions here
2587 std::unique_ptr
<SvxFieldData
> pField(pDlg
->GetField());
2588 ESelection aSel
= pOLV
->GetSelection();
2589 bool bSelectionWasModified(false);
2593 SvxFieldItem
aFieldItem( *pField
, EE_FEATURE_FIELD
);
2595 if( aSel
.nStartPos
== aSel
.nEndPos
)
2597 bSelectionWasModified
= true;
2599 pOLV
->SetSelection( aSel
);
2602 pOLV
->InsertField( aFieldItem
);
2604 // select again for eventual SetAttribs call
2605 pOLV
->SetSelection( aSel
);
2608 SfxItemSet
aSet( pDlg
->GetItemSet() );
2612 pOLV
->SetAttribs( aSet
);
2614 ::Outliner
* pOutliner
= pOLV
->GetOutliner();
2616 pOutliner
->UpdateFields();
2621 // restore selection to original
2622 if(bSelectionWasModified
)
2625 pOLV
->SetSelection( aSel
);
2637 case SID_OPEN_XML_FILTERSETTINGS
:
2641 css::uno::Reference
< css::ui::dialogs::XExecutableDialog
> xDialog
= css::ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() );
2644 catch( css::uno::RuntimeException
& )
2646 DBG_UNHANDLED_EXCEPTION("sd.view");
2654 case SID_GROUP
: // BASIC
2656 if ( mpDrawView
->IsPresObjSelected( true, true, true ) )
2658 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2659 VclMessageType::Info
, VclButtonsType::Ok
,
2660 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2665 mpDrawView
->GroupMarked();
2672 case SID_UNGROUP
: // BASIC
2674 mpDrawView
->UnGroupMarked();
2680 case SID_NAME_GROUP
:
2682 // only allow for single object selection since the name of an object needs
2684 if(1 == mpDrawView
->GetMarkedObjectCount())
2687 SdrObject
* pSelected
= mpDrawView
->GetMarkedObjectByIndex(0);
2688 OSL_ENSURE(pSelected
, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
2689 OUString
aName(pSelected
->GetName());
2691 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
2692 ScopedVclPtr
<AbstractSvxObjectNameDialog
> pDlg(pFact
->CreateSvxObjectNameDialog(GetFrameWeld(), aName
));
2694 pDlg
->SetCheckNameHdl(LINK(this, DrawViewShell
, NameObjectHdl
));
2696 if(RET_OK
== pDlg
->Execute())
2698 pDlg
->GetName(aName
);
2699 pSelected
->SetName(aName
);
2701 SdPage
* pPage
= GetActualPage();
2703 pPage
->notifyObjectRenamed(pSelected
);
2707 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
2708 rBindings
.Invalidate( SID_NAVIGATOR_STATE
, true );
2709 rBindings
.Invalidate( SID_CONTEXT
);
2717 case SID_OBJECT_TITLE_DESCRIPTION
:
2719 if(1 == mpDrawView
->GetMarkedObjectCount())
2721 SdrObject
* pSelected
= mpDrawView
->GetMarkedObjectByIndex(0);
2722 OSL_ENSURE(pSelected
, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
2723 OUString
aTitle(pSelected
->GetTitle());
2724 OUString
aDescription(pSelected
->GetDescription());
2725 bool isDecorative(pSelected
->IsDecorative());
2727 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
2728 ScopedVclPtr
<AbstractSvxObjectTitleDescDialog
> pDlg(pFact
->CreateSvxObjectTitleDescDialog(
2729 GetFrameWeld(), aTitle
, aDescription
, isDecorative
));
2731 if(RET_OK
== pDlg
->Execute())
2733 pDlg
->GetTitle(aTitle
);
2734 pDlg
->GetDescription(aDescription
);
2735 pDlg
->IsDecorative(isDecorative
);
2736 pSelected
->SetTitle(aTitle
);
2737 pSelected
->SetDescription(aDescription
);
2738 pSelected
->SetDecorative(isDecorative
);
2742 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
2743 rBindings
.Invalidate( SID_NAVIGATOR_STATE
, true );
2744 rBindings
.Invalidate( SID_CONTEXT
);
2751 case SID_ENTER_GROUP
: // BASIC
2753 mpDrawView
->EnterMarkedGroup();
2759 case SID_LEAVE_GROUP
: // BASIC
2761 mpDrawView
->LeaveOneGroup();
2767 case SID_LEAVE_ALL_GROUPS
: // BASIC
2769 mpDrawView
->LeaveAllGroup();
2775 case SID_TEXT_COMBINE
: // BASIC
2777 // End text edit to avoid conflicts
2778 if(mpDrawView
->IsTextEdit())
2779 mpDrawView
->SdrEndTextEdit();
2781 if ( mpDrawView
->IsPresObjSelected() )
2783 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2784 VclMessageType::Info
, VclButtonsType::Ok
,
2785 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2790 weld::WaitObject
aWait(GetFrameWeld());
2791 mpDrawView
->CombineMarkedTextObjects();
2798 case SID_COMBINE
: // BASIC
2800 // End text edit to avoid conflicts
2801 if(mpDrawView
->IsTextEdit())
2802 mpDrawView
->SdrEndTextEdit();
2804 if ( mpDrawView
->IsPresObjSelected() )
2806 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2807 VclMessageType::Info
, VclButtonsType::Ok
,
2808 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2813 weld::WaitObject
aWait(GetFrameWeld());
2814 mpDrawView
->CombineMarkedObjects(false);
2821 case SID_DISTRIBUTE_HLEFT
:
2822 case SID_DISTRIBUTE_HCENTER
:
2823 case SID_DISTRIBUTE_HDISTANCE
:
2824 case SID_DISTRIBUTE_HRIGHT
:
2825 case SID_DISTRIBUTE_VTOP
:
2826 case SID_DISTRIBUTE_VCENTER
:
2827 case SID_DISTRIBUTE_VDISTANCE
:
2828 case SID_DISTRIBUTE_VBOTTOM
:
2830 if ( mpDrawView
->IsPresObjSelected() )
2832 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2833 VclMessageType::Info
, VclButtonsType::Ok
,
2834 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2839 mpDrawView
->DistributeMarkedObjects(nSId
);
2845 case SID_POLY_MERGE
:
2847 // End text edit to avoid conflicts
2848 if(mpDrawView
->IsTextEdit())
2849 mpDrawView
->SdrEndTextEdit();
2851 if ( mpDrawView
->IsPresObjSelected() )
2853 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2854 VclMessageType::Info
, VclButtonsType::Ok
,
2855 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2860 weld::WaitObject
aWait(GetFrameWeld());
2861 mpDrawView
->MergeMarkedObjects(SdrMergeMode::Merge
);
2868 case SID_POLY_SUBSTRACT
:
2870 // End text edit to avoid conflicts
2871 if(mpDrawView
->IsTextEdit())
2872 mpDrawView
->SdrEndTextEdit();
2874 if ( mpDrawView
->IsPresObjSelected() )
2876 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2877 VclMessageType::Info
, VclButtonsType::Ok
,
2878 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2883 weld::WaitObject
aWait(GetFrameWeld());
2884 mpDrawView
->MergeMarkedObjects(SdrMergeMode::Subtract
);
2891 case SID_POLY_INTERSECT
:
2893 // End text edit to avoid conflicts
2894 if(mpDrawView
->IsTextEdit())
2895 mpDrawView
->SdrEndTextEdit();
2897 if ( mpDrawView
->IsPresObjSelected() )
2899 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2900 VclMessageType::Info
, VclButtonsType::Ok
,
2901 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2906 weld::WaitObject
aWait(GetFrameWeld());
2907 mpDrawView
->MergeMarkedObjects(SdrMergeMode::Intersect
);
2914 case SID_EQUALIZEWIDTH
:
2915 case SID_EQUALIZEHEIGHT
:
2917 // End text edit to avoid conflicts
2918 if(mpDrawView
->IsTextEdit())
2919 mpDrawView
->SdrEndTextEdit();
2921 mpDrawView
->EqualizeMarkedObjects(nSId
== SID_EQUALIZEWIDTH
);
2927 case SID_DISMANTLE
: // BASIC
2929 if ( mpDrawView
->IsDismantlePossible() )
2931 weld::WaitObject
aWait(GetFrameWeld());
2932 mpDrawView
->DismantleMarkedObjects();
2939 case SID_CONNECT
: // BASIC
2941 if ( mpDrawView
->IsPresObjSelected() )
2943 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2944 VclMessageType::Info
, VclButtonsType::Ok
,
2945 SdResId(STR_ACTION_NOTPOSSIBLE
)));
2950 weld::WaitObject
aWait(GetFrameWeld());
2951 mpDrawView
->CombineMarkedObjects();
2958 case SID_BREAK
: // BASIC
2960 if ( mpDrawView
->IsTextEdit() )
2962 mpDrawView
->SdrEndTextEdit();
2965 if ( mpDrawView
->IsBreak3DObjPossible() )
2967 weld::WaitObject
aWait(GetFrameWeld());
2968 mpDrawView
->Break3DObj();
2970 else if ( mpDrawView
->IsDismantlePossible(true) )
2972 weld::WaitObject
aWait(GetFrameWeld());
2973 mpDrawView
->DismantleMarkedObjects(true);
2975 else if ( mpDrawView
->IsImportMtfPossible() )
2977 weld::WaitObject
aWait(GetFrameWeld());
2978 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
2979 const size_t nCnt
=rMarkList
.GetMarkCount();
2981 // determine the sum of meta objects of all selected meta files
2982 sal_uLong nCount
= 0;
2983 for(size_t nm
=0; nm
<nCnt
; ++nm
)
2985 SdrMark
* pM
=rMarkList
.GetMark(nm
);
2986 SdrObject
* pObj
=pM
->GetMarkedSdrObj();
2987 SdrGrafObj
* pGraf
= dynamic_cast< SdrGrafObj
*>( pObj
);
2988 SdrOle2Obj
* pOle2
= dynamic_cast< SdrOle2Obj
*>( pObj
);
2990 if (pGraf
!= nullptr)
2992 if (pGraf
->HasGDIMetaFile())
2994 nCount
+= pGraf
->GetGraphic().GetGDIMetaFile().GetActionSize();
2996 else if (pGraf
->isEmbeddedVectorGraphicData())
2998 nCount
+= pGraf
->getMetafileFromEmbeddedVectorGraphicData().GetActionSize();
3002 if(pOle2
&& pOle2
->GetGraphic())
3004 nCount
+= pOle2
->GetGraphic()->GetGDIMetaFile().GetActionSize();
3008 // decide with the sum of all meta objects if we should show a dialog
3009 if(nCount
< MIN_ACTIONS_FOR_DIALOG
)
3012 mpDrawView
->DoImportMarkedMtf();
3016 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
3017 ScopedVclPtr
<VclAbstractDialog
> pDlg(pFact
->CreateBreakDlg(GetFrameWeld(), mpDrawView
.get(), GetDocSh(), nCount
, static_cast<sal_uLong
>(nCnt
) ));
3027 case SID_CONVERT_TO_3D
:
3029 if ( mpDrawView
->IsPresObjSelected() )
3031 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
3032 VclMessageType::Info
, VclButtonsType::Ok
,
3033 SdResId(STR_ACTION_NOTPOSSIBLE
)));
3038 if (mpDrawView
->IsConvertTo3DObjPossible())
3040 if (mpDrawView
->IsTextEdit())
3042 mpDrawView
->SdrEndTextEdit();
3045 weld::WaitObject
aWait(GetFrameWeld());
3046 mpDrawView
->ConvertMarkedObjTo3D();
3055 case SID_FRAME_TO_TOP
: // BASIC
3057 mpDrawView
->PutMarkedToTop();
3063 case SID_MOREFRONT
: // BASIC
3064 case SID_FRAME_UP
: // BASIC
3066 mpDrawView
->MovMarkedToTop();
3072 case SID_MOREBACK
: // BASIC
3073 case SID_FRAME_DOWN
: // BASIC
3075 mpDrawView
->MovMarkedToBtm();
3081 case SID_FRAME_TO_BOTTOM
: // BASIC
3083 mpDrawView
->PutMarkedToBtm();
3089 case SID_HORIZONTAL
: // BASIC
3090 case SID_FLIP_HORIZONTAL
:
3092 mpDrawView
->MirrorAllMarkedHorizontal();
3098 case SID_VERTICAL
: // BASIC
3099 case SID_FLIP_VERTICAL
:
3101 mpDrawView
->MirrorAllMarkedVertical();
3107 case SID_OBJECT_ALIGN_LEFT
: // BASIC
3109 mpDrawView
->AlignMarkedObjects(SdrHorAlign::Left
, SdrVertAlign::NONE
);
3115 case SID_OBJECT_ALIGN_CENTER
: // BASIC
3117 mpDrawView
->AlignMarkedObjects(SdrHorAlign::Center
, SdrVertAlign::NONE
);
3123 case SID_OBJECT_ALIGN_RIGHT
: // BASIC
3125 mpDrawView
->AlignMarkedObjects(SdrHorAlign::Right
, SdrVertAlign::NONE
);
3131 case SID_OBJECT_ALIGN_UP
: // BASIC
3133 mpDrawView
->AlignMarkedObjects(SdrHorAlign::NONE
, SdrVertAlign::Top
);
3139 case SID_OBJECT_ALIGN_MIDDLE
: // BASIC
3141 mpDrawView
->AlignMarkedObjects(SdrHorAlign::NONE
, SdrVertAlign::Center
);
3147 case SID_OBJECT_ALIGN_DOWN
: // BASIC
3149 mpDrawView
->AlignMarkedObjects(SdrHorAlign::NONE
, SdrVertAlign::Bottom
);
3155 case SID_SELECTALL
: // BASIC
3157 if( (dynamic_cast<FuSelection
*>( GetOldFunction().get() ) != nullptr) &&
3158 !GetView()->IsFrameDragSingles() && GetView()->HasMarkablePoints())
3160 if ( !mpDrawView
->IsAction() )
3161 mpDrawView
->MarkAllPoints();
3164 mpDrawView
->SelectAll();
3166 FreshNavigatrTree();
3173 case SID_STYLE_NEW
: // BASIC ???
3174 case SID_STYLE_APPLY
:
3175 case SID_STYLE_EDIT
:
3176 case SID_STYLE_DELETE
:
3177 case SID_STYLE_HIDE
:
3178 case SID_STYLE_SHOW
:
3179 case SID_STYLE_FAMILY
:
3180 case SID_STYLE_WATERCAN
:
3181 case SID_STYLE_UPDATE_BY_EXAMPLE
:
3182 case SID_STYLE_NEW_BY_EXAMPLE
:
3184 if( rReq
.GetSlot() == SID_STYLE_EDIT
&& !rReq
.GetArgs() )
3186 SfxStyleSheet
* pStyleSheet
= mpDrawView
->GetStyleSheet();
3187 if( pStyleSheet
&& pStyleSheet
->GetFamily() == SfxStyleFamily::Page
)
3188 pStyleSheet
= static_cast<SdStyleSheet
*>(pStyleSheet
)->GetPseudoStyleSheet();
3190 if( (pStyleSheet
== nullptr) && GetView()->IsTextEdit() )
3192 GetView()->SdrEndTextEdit();
3194 pStyleSheet
= mpDrawView
->GetStyleSheet();
3195 if(pStyleSheet
&& pStyleSheet
->GetFamily() == SfxStyleFamily::Page
)
3196 pStyleSheet
= static_cast<SdStyleSheet
*>(pStyleSheet
)->GetPseudoStyleSheet();
3199 if( pStyleSheet
== nullptr )
3205 SfxAllItemSet
aSet(GetDoc()->GetPool());
3207 SfxStringItem
aStyleNameItem( SID_STYLE_EDIT
, pStyleSheet
->GetName() );
3208 aSet
.Put(aStyleNameItem
);
3210 SfxUInt16Item
aStyleFamilyItem( SID_STYLE_FAMILY
, static_cast<sal_uInt16
>(pStyleSheet
->GetFamily()) );
3211 aSet
.Put(aStyleFamilyItem
);
3216 if( rReq
.GetArgs() )
3218 SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
3219 if( rReq
.GetSlot() == SID_STYLE_APPLY
)
3220 GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY
);
3223 else if( rReq
.GetSlot() == SID_STYLE_APPLY
)
3224 GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER
, SfxCallMode::ASYNCHRON
);
3231 sal_uInt16 nId
= SvxIMapDlgChildWindow::GetChildWindowId();
3233 GetViewFrame()->ToggleChildWindow( nId
);
3234 GetViewFrame()->GetBindings().Invalidate( SID_IMAP
);
3236 if ( GetViewFrame()->HasChildWindow( nId
)
3237 && ( ( ViewShell::Implementation::GetImageMapDialog() ) != nullptr ) )
3239 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
3241 if ( rMarkList
.GetMarkCount() == 1 )
3242 UpdateIMapDlg( rMarkList
.GetMark( 0 )->GetMarkedSdrObj() );
3250 case SID_GRID_FRONT
:
3252 mpDrawView
->SetGridFront( !mpDrawView
->IsGridFront() );
3258 case SID_HELPLINES_FRONT
:
3260 mpDrawView
->SetHlplFront( !mpDrawView
->IsHlplFront() );
3268 if ( rReq
.GetArgs() )
3270 GetViewFrame()->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
3271 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
3272 Get(SID_FONTWORK
)).GetValue());
3276 GetViewFrame()->ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() );
3279 GetViewFrame()->GetBindings().Invalidate(SID_FONTWORK
);
3285 case SID_COLOR_CONTROL
:
3287 if ( rReq
.GetArgs() )
3288 GetViewFrame()->SetChildWindow(SvxColorChildWindow::GetChildWindowId(),
3289 rReq
.GetArgs()->Get(SID_COLOR_CONTROL
).GetValue());
3291 GetViewFrame()->ToggleChildWindow(SvxColorChildWindow::GetChildWindowId() );
3293 GetViewFrame()->GetBindings().Invalidate(SID_COLOR_CONTROL
);
3299 case SID_EXTRUSION_TOGGLE
:
3300 case SID_EXTRUSION_TILT_DOWN
:
3301 case SID_EXTRUSION_TILT_UP
:
3302 case SID_EXTRUSION_TILT_LEFT
:
3303 case SID_EXTRUSION_TILT_RIGHT
:
3304 case SID_EXTRUSION_3D_COLOR
:
3305 case SID_EXTRUSION_DEPTH
:
3306 case SID_EXTRUSION_DIRECTION
:
3307 case SID_EXTRUSION_PROJECTION
:
3308 case SID_EXTRUSION_LIGHTING_DIRECTION
:
3309 case SID_EXTRUSION_LIGHTING_INTENSITY
:
3310 case SID_EXTRUSION_SURFACE
:
3311 case SID_EXTRUSION_DEPTH_FLOATER
:
3312 case SID_EXTRUSION_DIRECTION_FLOATER
:
3313 case SID_EXTRUSION_LIGHTING_FLOATER
:
3314 case SID_EXTRUSION_SURFACE_FLOATER
:
3315 case SID_EXTRUSION_DEPTH_DIALOG
:
3316 svx::ExtrusionBar::execute( mpDrawView
.get(), rReq
, GetViewFrame()->GetBindings() );
3321 case SID_FONTWORK_SHAPE
:
3322 case SID_FONTWORK_SHAPE_TYPE
:
3323 case SID_FONTWORK_ALIGNMENT
:
3324 case SID_FONTWORK_SAME_LETTER_HEIGHTS
:
3325 case SID_FONTWORK_CHARACTER_SPACING
:
3326 case SID_FONTWORK_KERN_CHARACTER_PAIRS
:
3327 case SID_FONTWORK_GALLERY_FLOATER
:
3328 case SID_FONTWORK_CHARACTER_SPACING_FLOATER
:
3329 case SID_FONTWORK_ALIGNMENT_FLOATER
:
3330 case SID_FONTWORK_CHARACTER_SPACING_DIALOG
:
3331 svx::FontworkBar::execute(*mpDrawView
, rReq
, GetViewFrame()->GetBindings());
3338 GetViewFrame()->ToggleChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() );
3339 GetViewFrame()->GetBindings().Invalidate( SID_BMPMASK
);
3348 if (comphelper::LibreOfficeKit::isActive())
3350 GetViewFrame()->ShowChildWindow(SID_SIDEBAR
);
3351 OUString panelId
= "SdNavigatorPanel";
3352 ::sfx2::sidebar::Sidebar::TogglePanel(
3353 panelId
, GetViewFrame()->GetFrame().GetFrameInterface());
3358 if ( rReq
.GetArgs() )
3359 GetViewFrame()->SetChildWindow(SID_NAVIGATOR
,
3360 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
3361 Get(SID_NAVIGATOR
)).GetValue());
3363 GetViewFrame()->ToggleChildWindow( SID_NAVIGATOR
);
3365 GetViewFrame()->GetBindings().Invalidate(SID_NAVIGATOR
);
3372 case SID_SLIDE_TRANSITIONS_PANEL
:
3373 case SID_MASTER_SLIDES_PANEL
:
3374 case SID_CUSTOM_ANIMATION_PANEL
:
3377 // First make sure that the sidebar is visible
3378 GetViewFrame()->ShowChildWindow(SID_SIDEBAR
);
3381 if (nSId
== SID_CUSTOM_ANIMATION_PANEL
)
3382 panelId
= "SdCustomAnimationPanel";
3383 else if (nSId
== SID_GALLERY
)
3384 panelId
= "GalleryPanel";
3385 else if (nSId
== SID_SLIDE_TRANSITIONS_PANEL
)
3386 panelId
= "SdSlideTransitionPanel";
3387 else if (nSId
== SID_MASTER_SLIDES_PANEL
)
3388 panelId
= "SdAllMasterPagesPanel";
3390 ::sfx2::sidebar::Sidebar::TogglePanel(
3392 GetViewFrame()->GetFrame().GetFrameInterface());
3399 case SID_ANIMATION_OBJECTS
:
3401 if ( rReq
.GetArgs() )
3402 GetViewFrame()->SetChildWindow(
3403 AnimationChildWindow::GetChildWindowId(),
3404 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
3405 Get(SID_ANIMATION_OBJECTS
)).GetValue());
3407 GetViewFrame()->ToggleChildWindow(
3408 AnimationChildWindow::GetChildWindowId() );
3410 GetViewFrame()->GetBindings().Invalidate(SID_ANIMATION_OBJECTS
);
3418 if ( rReq
.GetArgs() )
3419 GetViewFrame()->SetChildWindow( Svx3DChildWindow::GetChildWindowId(),
3420 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
3421 Get( SID_3D_WIN
)).GetValue());
3423 GetViewFrame()->ToggleChildWindow( Svx3DChildWindow::GetChildWindowId() );
3425 GetViewFrame()->GetBindings().Invalidate( SID_3D_WIN
);
3431 case SID_CONVERT_TO_3D_LATHE_FAST
:
3433 /* The call is enough. The initialization via Start3DCreation and
3434 CreateMirrorPolygons is no longer needed if the parameter
3435 sal_True is provided. Then a tilted rotary body with an axis left
3436 besides the bounding rectangle of the selected objects is drawn
3437 immediately and without user interaction. */
3438 mpDrawView
->SdrEndTextEdit();
3439 if(GetActiveWindow())
3440 GetActiveWindow()->EnterWait();
3441 mpDrawView
->End3DCreation(true);
3444 if(GetActiveWindow())
3445 GetActiveWindow()->LeaveWait();
3449 case SID_PRESENTATION_DLG
:
3451 SetCurrentFunction( FuSlideShowDlg::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
3456 case SID_REMOTE_DLG
:
3458 #ifdef ENABLE_SDREMOTE
3459 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
3460 ScopedVclPtr
<VclAbstractDialog
> pDlg(pFact
->CreateRemoteDialog(GetFrameWeld()));
3466 case SID_CUSTOMSHOW_DLG
:
3468 SetCurrentFunction( FuCustomShowDlg::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
3473 case SID_EXPAND_PAGE
:
3475 SetCurrentFunction( FuExpandPage::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
3480 case SID_SUMMARY_PAGE
:
3482 mpDrawView
->SdrEndTextEdit();
3483 SetCurrentFunction( FuSummaryPage::Create( this, GetActiveWindow(), mpDrawView
.get(), GetDoc(), rReq
) );
3488 #if HAVE_FEATURE_AVMEDIA
3489 case SID_AVMEDIA_PLAYER
:
3491 GetViewFrame()->ToggleChildWindow( ::avmedia::MediaPlayer::GetChildWindowId() );
3492 GetViewFrame()->GetBindings().Invalidate( SID_AVMEDIA_PLAYER
);
3499 case SID_PRESENTATION_MINIMIZER
:
3501 Reference
<XComponentContext
> xContext(::comphelper::getProcessComponentContext());
3502 Reference
<util::XURLTransformer
> xParser(util::URLTransformer::create(xContext
));
3503 Reference
<frame::XDispatchProvider
> xProvider(GetViewShellBase().GetController()->getFrame(), UNO_QUERY
);
3507 aURL
.Complete
= "vnd.com.sun.star.comp.PresentationMinimizer:execute";
3508 xParser
->parseStrict(aURL
);
3509 uno::Reference
<frame::XDispatch
> xDispatch(xProvider
->queryDispatch(aURL
, OUString(), 0));
3512 xDispatch
->dispatch(aURL
, uno::Sequence
< beans::PropertyValue
>());
3520 case SID_DISPLAY_MASTER_BACKGROUND
:
3521 case SID_DISPLAY_MASTER_OBJECTS
:
3523 // Determine current page and toggle visibility of layers
3524 // associated with master page background or master page shapes.
3525 // FIXME: This solution is wrong, because shapes of master pages need
3526 // not be on layer "background" or "backgroundobjects".
3528 SdPage
* pPage
= GetActualPage();
3529 if (pPage
!= nullptr
3530 && GetDoc() != nullptr)
3532 SdrLayerIDSet aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
3533 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
3534 SdrLayerID aLayerId
;
3535 if (nSId
== SID_DISPLAY_MASTER_BACKGROUND
)
3536 aLayerId
= rLayerAdmin
.GetLayerID(sUNO_LayerName_background
);
3538 aLayerId
= rLayerAdmin
.GetLayerID(sUNO_LayerName_background_objects
);
3539 aVisibleLayers
.Set(aLayerId
, !aVisibleLayers
.IsSet(aLayerId
));
3540 pPage
->TRG_SetMasterPageVisibleLayers(aVisibleLayers
);
3543 rReq
.Done(); // Mark task as done to auto-update the state of each buttons tdf#132816
3547 case SID_PHOTOALBUM
:
3549 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
3550 vcl::Window
* pWin
= GetActiveWindow();
3551 ScopedVclPtr
<VclAbstractDialog
> pDlg(pFact
->CreateSdPhotoAlbumDialog(
3552 pWin
? pWin
->GetFrameWeld() : nullptr,
3561 case SID_INSERT_QRCODE
:
3562 case SID_EDIT_QRCODE
:
3564 VclAbstractDialogFactory
* pFact
= VclAbstractDialogFactory::Create();
3565 const uno::Reference
<frame::XModel
> xModel
= GetViewShellBase().GetController()->getModel();
3566 ScopedVclPtr
<AbstractQrCodeGenDialog
> pDlg(pFact
->CreateQrCodeGenDialog(
3567 GetFrameWeld(), xModel
, rReq
.GetSlot() == SID_EDIT_QRCODE
));
3574 case SID_ADDITIONS_DIALOG
:
3576 OUString sAdditionsTag
= "";
3578 const SfxStringItem
* pStringArg
= rReq
.GetArg
<SfxStringItem
>(FN_PARAM_ADDITIONS_TAG
);
3580 sAdditionsTag
= pStringArg
->GetValue();
3582 VclAbstractDialogFactory
* pFact
= VclAbstractDialogFactory::Create();
3583 ScopedVclPtr
<AbstractAdditionsDialog
> pDlg(
3584 pFact
->CreateAdditionsDialog(GetFrameWeld(), sAdditionsTag
));
3591 case SID_ATTR_GLOW_COLOR
:
3592 case SID_ATTR_GLOW_RADIUS
:
3593 case SID_ATTR_GLOW_TRANSPARENCY
:
3594 case SID_ATTR_SOFTEDGE_RADIUS
:
3595 case SID_ATTR_TEXTCOLUMNS_NUMBER
:
3596 case SID_ATTR_TEXTCOLUMNS_SPACING
:
3597 if (const SfxItemSet
* pNewArgs
= rReq
.GetArgs())
3598 mpDrawView
->SetAttributes(*pNewArgs
);
3605 SAL_WARN( "sd.ui", "Slot without function" );
3612 if(HasCurrentFunction())
3614 GetCurrentFunction()->Activate();
3618 void DrawViewShell::ExecChar( SfxRequest
&rReq
)
3620 SdDrawDocument
* pDoc
= GetDoc();
3621 if (!pDoc
|| !mpDrawView
)
3624 SfxItemSet
aEditAttr( pDoc
->GetPool() );
3625 mpDrawView
->GetAttributes( aEditAttr
);
3627 //modified by wj for sym2_1580, if put old itemset into new set,
3628 //when mpDrawView->SetAttributes(aNewAttr) it will invalidate all the item
3629 // and use old attr to update all the attributes
3630 // SfxItemSet aNewAttr( GetPool(),
3631 // EE_ITEMS_START, EE_ITEMS_END );
3632 // aNewAttr.Put( aEditAttr, sal_False );
3633 SfxItemSet
aNewAttr( pDoc
->GetPool() );
3636 sal_uInt16 nSId
= rReq
.GetSlot();
3640 case SID_ATTR_CHAR_FONT
:
3641 if( rReq
.GetArgs() )
3643 const SvxFontItem
* pItem
= rReq
.GetArg
<SvxFontItem
>(SID_ATTR_CHAR_FONT
);
3646 aNewAttr
.Put(*pItem
);
3650 case SID_ATTR_CHAR_FONTHEIGHT
:
3651 if( rReq
.GetArgs() )
3653 const SvxFontHeightItem
* pItem
= rReq
.GetArg
<SvxFontHeightItem
>(SID_ATTR_CHAR_FONTHEIGHT
);
3656 aNewAttr
.Put(*pItem
);
3660 case SID_ATTR_CHAR_WEIGHT
:
3661 if( rReq
.GetArgs() )
3663 const SvxWeightItem
* pItem
= rReq
.GetArg
<SvxWeightItem
>(SID_ATTR_CHAR_WEIGHT
);
3666 aNewAttr
.Put(*pItem
);
3670 case SID_ATTR_CHAR_POSTURE
:
3671 if( rReq
.GetArgs() )
3673 const SvxPostureItem
* pItem
= rReq
.GetArg
<SvxPostureItem
>(SID_ATTR_CHAR_POSTURE
);
3676 aNewAttr
.Put(*pItem
);
3680 case SID_ATTR_CHAR_UNDERLINE
:
3681 if( rReq
.GetArgs() )
3683 const SvxUnderlineItem
* pItem
= rReq
.GetArg
<SvxUnderlineItem
>(SID_ATTR_CHAR_UNDERLINE
);
3686 aNewAttr
.Put(*pItem
);
3690 FontLineStyle eFU
= aEditAttr
.Get( EE_CHAR_UNDERLINE
).GetLineStyle();
3691 aNewAttr
.Put( SvxUnderlineItem( eFU
!= LINESTYLE_NONE
?LINESTYLE_NONE
: LINESTYLE_SINGLE
, EE_CHAR_UNDERLINE
) );
3695 case SID_ATTR_CHAR_OVERLINE
:
3696 if( rReq
.GetArgs() )
3698 const SvxOverlineItem
* pItem
= rReq
.GetArg
<SvxOverlineItem
>(SID_ATTR_CHAR_OVERLINE
);
3701 aNewAttr
.Put(*pItem
);
3705 FontLineStyle eFU
= aEditAttr
.Get( EE_CHAR_OVERLINE
).GetLineStyle();
3706 aNewAttr
.Put( SvxOverlineItem( eFU
!= LINESTYLE_NONE
?LINESTYLE_NONE
: LINESTYLE_SINGLE
, EE_CHAR_OVERLINE
) );
3711 case SID_ULINE_VAL_NONE
:
3713 aNewAttr
.Put(SvxUnderlineItem(LINESTYLE_NONE
, EE_CHAR_UNDERLINE
));
3717 case SID_ULINE_VAL_SINGLE
:
3718 case SID_ULINE_VAL_DOUBLE
:
3719 case SID_ULINE_VAL_DOTTED
:
3721 FontLineStyle eOld
= aEditAttr
.Get(EE_CHAR_UNDERLINE
).GetLineStyle();
3722 FontLineStyle eNew
= eOld
;
3726 case SID_ULINE_VAL_SINGLE
:
3727 eNew
= ( eOld
== LINESTYLE_SINGLE
) ? LINESTYLE_NONE
: LINESTYLE_SINGLE
;
3729 case SID_ULINE_VAL_DOUBLE
:
3730 eNew
= ( eOld
== LINESTYLE_DOUBLE
) ? LINESTYLE_NONE
: LINESTYLE_DOUBLE
;
3732 case SID_ULINE_VAL_DOTTED
:
3733 eNew
= ( eOld
== LINESTYLE_DOTTED
) ? LINESTYLE_NONE
: LINESTYLE_DOTTED
;
3737 SvxUnderlineItem
aUnderline(eNew
, EE_CHAR_UNDERLINE
);
3738 aNewAttr
.Put(aUnderline
);
3742 case SID_ATTR_CHAR_SHADOWED
:
3743 if( rReq
.GetArgs() )
3745 const SvxShadowedItem
* pItem
= rReq
.GetArg
<SvxShadowedItem
>(SID_ATTR_CHAR_SHADOWED
);
3748 aNewAttr
.Put(*pItem
);
3752 case SID_ATTR_CHAR_CONTOUR
:
3753 if( rReq
.GetArgs() )
3755 const SvxContourItem
* pItem
= rReq
.GetArg
<SvxContourItem
>(SID_ATTR_CHAR_CONTOUR
);
3758 aNewAttr
.Put(*pItem
);
3763 case SID_ATTR_CHAR_STRIKEOUT
:
3764 if( rReq
.GetArgs() )
3766 const SvxCrossedOutItem
* pItem
= rReq
.GetArg
<SvxCrossedOutItem
>(SID_ATTR_CHAR_STRIKEOUT
);
3769 aNewAttr
.Put(*pItem
);
3773 case SID_ATTR_CHAR_COLOR
:
3774 if( rReq
.GetArgs() )
3776 const SvxColorItem
* pItem
= rReq
.GetArg
<SvxColorItem
>(SID_ATTR_CHAR_COLOR
);
3779 aNewAttr
.Put(*pItem
);
3783 case SID_ATTR_CHAR_KERNING
:
3784 if( rReq
.GetArgs() )
3786 const SvxKerningItem
* pItem
= rReq
.GetArg
<SvxKerningItem
>(SID_ATTR_CHAR_KERNING
);
3789 aNewAttr
.Put(*pItem
);
3793 case SID_ATTR_CHAR_CASEMAP
:
3794 if( rReq
.GetArgs() )
3796 const SvxCaseMapItem
* pItem
= rReq
.GetArg
<SvxCaseMapItem
>(SID_ATTR_CHAR_CASEMAP
);
3799 aNewAttr
.Put(*pItem
);
3803 case SID_SET_SUB_SCRIPT
:
3805 SvxEscapementItem
aItem( EE_CHAR_ESCAPEMENT
);
3806 SvxEscapement eEsc
= static_cast<SvxEscapement
>(aEditAttr
.Get( EE_CHAR_ESCAPEMENT
).GetEnumValue());
3807 if( eEsc
== SvxEscapement::Subscript
)
3808 aItem
.SetEscapement( SvxEscapement::Off
);
3810 aItem
.SetEscapement( SvxEscapement::Subscript
);
3811 aNewAttr
.Put( aItem
);
3814 case SID_SET_SUPER_SCRIPT
:
3816 SvxEscapementItem
aItem( EE_CHAR_ESCAPEMENT
);
3817 SvxEscapement eEsc
= static_cast<SvxEscapement
>(aEditAttr
.Get( EE_CHAR_ESCAPEMENT
).GetEnumValue());
3818 if( eEsc
== SvxEscapement::Superscript
)
3819 aItem
.SetEscapement( SvxEscapement::Off
);
3821 aItem
.SetEscapement( SvxEscapement::Superscript
);
3822 aNewAttr
.Put( aItem
);
3825 case SID_SHRINK_FONT_SIZE
:
3826 case SID_GROW_FONT_SIZE
:
3828 const SvxFontListItem
* pFonts
= dynamic_cast<const SvxFontListItem
*>(GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST
) );
3829 const FontList
* pFontList
= pFonts
? pFonts
->GetFontList() : nullptr;
3832 FuText::ChangeFontSize( nSId
== SID_GROW_FONT_SIZE
, nullptr, pFontList
, mpView
);
3833 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT
);
3837 case SID_ATTR_CHAR_BACK_COLOR
:
3838 if( rReq
.GetArgs() )
3840 const SvxColorItem
* pItem
= rReq
.GetArg
<SvxColorItem
>(SID_ATTR_CHAR_BACK_COLOR
);
3843 aNewAttr
.Put(*pItem
);
3851 mpDrawView
->SetAttributes(aNewAttr
);
3856 /** This method consists basically of three parts:
3857 1. Process the arguments of the SFX request.
3858 2. Use the model to create a new page or duplicate an existing one.
3859 3. Update the tab control and switch to the new page.
3861 SdPage
* DrawViewShell::CreateOrDuplicatePage (
3862 SfxRequest
& rRequest
,
3865 const sal_Int32 nInsertPosition
)
3867 SdPage
* pNewPage
= nullptr;
3868 if (ePageKind
== PageKind::Standard
&& meEditMode
!= EditMode::MasterPage
)
3870 if ( mpDrawView
->IsTextEdit() )
3872 mpDrawView
->SdrEndTextEdit();
3874 pNewPage
= ViewShell::CreateOrDuplicatePage (rRequest
, ePageKind
, pPage
, nInsertPosition
);
3879 void DrawViewShell::DuplicateSelectedSlides (SfxRequest
& rRequest
)
3881 // Create a list of the pages that are to be duplicated. The process of
3882 // duplication alters the selection.
3883 sal_Int32
nInsertPosition (0);
3884 ::std::vector
<SdPage
*> aPagesToDuplicate
;
3885 sd::slidesorter::SlideSorter
&mrSlideSorter
= sd::slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase())->GetSlideSorter();
3886 sd::slidesorter::model::PageEnumeration
aSelectedPages (
3887 sd::slidesorter::model::PageEnumerationProvider::CreateSelectedPagesEnumeration(mrSlideSorter
.GetModel()));
3888 while (aSelectedPages
.HasMoreElements())
3890 sd::slidesorter::model::SharedPageDescriptor
pDescriptor (aSelectedPages
.GetNextElement());
3891 if (pDescriptor
&& pDescriptor
->GetPage())
3893 aPagesToDuplicate
.push_back(pDescriptor
->GetPage());
3894 nInsertPosition
= pDescriptor
->GetPage()->GetPageNum()+2;
3898 // Duplicate the pages in aPagesToDuplicate and collect the newly
3899 // created pages in aPagesToSelect.
3900 const bool bUndo (aPagesToDuplicate
.size()>1 && mrSlideSorter
.GetView().IsUndoEnabled());
3902 mrSlideSorter
.GetView().BegUndo(SdResId(STR_INSERTPAGE
));
3904 ::std::vector
<SdPage
*> aPagesToSelect
;
3905 for(::std::vector
<SdPage
*>::const_iterator
3906 iPage(aPagesToDuplicate
.begin()),
3907 iEnd(aPagesToDuplicate
.end());
3909 ++iPage
, nInsertPosition
+=2)
3911 aPagesToSelect
.push_back(
3912 mrSlideSorter
.GetViewShell()->CreateOrDuplicatePage(
3913 rRequest
, PageKind::Standard
, *iPage
, nInsertPosition
));
3915 aPagesToDuplicate
.clear();
3918 mrSlideSorter
.GetView().EndUndo();
3920 // Set the selection to the pages in aPagesToSelect.
3921 sd::slidesorter::controller::PageSelector
& rSelector (mrSlideSorter
.GetController().GetPageSelector());
3922 rSelector
.DeselectAllPages();
3923 for (auto const& it
: aPagesToSelect
)
3925 rSelector
.SelectPage(it
);
3929 void DrawViewShell::ExecutePropPanelAttr (SfxRequest
const & rReq
)
3931 if(SlideShow::IsRunning( GetViewShellBase() ))
3934 SdDrawDocument
* pDoc
= GetDoc();
3935 if (!pDoc
|| !mpDrawView
)
3938 sal_uInt16 nSId
= rReq
.GetSlot();
3939 SfxItemSet
aAttrs( pDoc
->GetPool() );
3943 case SID_TABLE_VERT_NONE
:
3944 case SID_TABLE_VERT_CENTER
:
3945 case SID_TABLE_VERT_BOTTOM
:
3946 SdrTextVertAdjust eTVA
= SDRTEXTVERTADJUST_TOP
;
3947 if (nSId
== SID_TABLE_VERT_CENTER
)
3948 eTVA
= SDRTEXTVERTADJUST_CENTER
;
3949 else if (nSId
== SID_TABLE_VERT_BOTTOM
)
3950 eTVA
= SDRTEXTVERTADJUST_BOTTOM
;
3952 aAttrs
.Put( SdrTextVertAdjustItem(eTVA
) );
3953 mpDrawView
->SetAttributes(aAttrs
);
3959 void DrawViewShell::GetStatePropPanelAttr(SfxItemSet
& rSet
)
3961 SfxWhichIter
aIter( rSet
);
3962 sal_uInt16 nWhich
= aIter
.FirstWhich();
3964 SdDrawDocument
* pDoc
= GetDoc();
3965 if (!pDoc
|| !mpDrawView
)
3968 SfxItemSet
aAttrs( pDoc
->GetPool() );
3969 mpDrawView
->GetAttributes( aAttrs
);
3973 sal_uInt16 nSlotId
= SfxItemPool::IsWhich(nWhich
)
3974 ? GetPool().GetSlotId(nWhich
)
3978 case SID_TABLE_VERT_NONE
:
3979 case SID_TABLE_VERT_CENTER
:
3980 case SID_TABLE_VERT_BOTTOM
:
3981 bool bContour
= false;
3982 SfxItemState eConState
= aAttrs
.GetItemState( SDRATTR_TEXT_CONTOURFRAME
);
3983 if( eConState
!= SfxItemState::DONTCARE
)
3985 bContour
= aAttrs
.Get( SDRATTR_TEXT_CONTOURFRAME
).GetValue();
3987 if (bContour
) break;
3989 SfxItemState eVState
= aAttrs
.GetItemState( SDRATTR_TEXT_VERTADJUST
);
3990 //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
3992 //if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
3993 if(SfxItemState::DONTCARE
!= eVState
)
3995 SdrTextVertAdjust eTVA
= aAttrs
.Get(SDRATTR_TEXT_VERTADJUST
).GetValue();
3996 bool bSet
= (nSlotId
== SID_TABLE_VERT_NONE
&& eTVA
== SDRTEXTVERTADJUST_TOP
) ||
3997 (nSlotId
== SID_TABLE_VERT_CENTER
&& eTVA
== SDRTEXTVERTADJUST_CENTER
) ||
3998 (nSlotId
== SID_TABLE_VERT_BOTTOM
&& eTVA
== SDRTEXTVERTADJUST_BOTTOM
);
3999 rSet
.Put(SfxBoolItem(nSlotId
, bSet
));
4003 rSet
.Put(SfxBoolItem(nSlotId
, false));
4007 nWhich
= aIter
.NextWhich();
4011 } // end of namespace sd
4013 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */