/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
void SwBaseShell::ExecDelete(SfxRequest &rReq)
{
SwWrtShell &rSh = GetShell();
SwEditWin& rTmpEditWin = GetView().GetEditWin(); switch(rReq.GetSlot())
{ case SID_DELETE: if (rSh.GetViewOptions()->IsShowOutlineContentVisibilityButton())
{ // Disallow if the cursor is at the end of a paragraph and the document model // node at this position is an outline node with folded content or the next node // is an outline node with folded content. if (rSh.IsEndPara())
{
SwNodeIndex aIdx(rSh.GetCursor()->GetPointNode()); if (aIdx.GetNode().IsTextNode())
{ if (!aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible()) break;
++aIdx; if (aIdx.GetNode().IsTextNode())
{ if (!aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible()) break;
}
}
}
}
rSh.DelRight(); break;
case FN_BACKSPACE: if (rSh.GetViewOptions()->IsShowOutlineContentVisibilityButton())
{ // Disallow if the cursor is at the start of a paragraph and the document model // node at this position is an outline node with folded content or the previous // node is a content node without a layout frame. if (rSh.IsSttPara())
{
SwNodeIndex aIdx(rSh.GetCursor()->GetPointNode()); if (aIdx.GetNode().IsTextNode())
{ if (!aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible()) break;
--aIdx; if (aIdx.GetNode().IsContentNode() &&
!aIdx.GetNode().GetContentNode()->getLayoutFrame(rSh.GetLayout())) break;
}
}
} if( rSh.IsNoNum() )
{
rSh.SttCursorMove(); bool bLeft = rSh.Left( SwCursorSkipMode::Chars, true, 1, false ); if( bLeft )
{
rSh.DelLeft();
} else // JP 15.07.96: If it no longer goes forward, cancel // the numbering. For example at the beginning // of a doc, frame, table or an area.
rSh.DelNumRules();
switch( nId )
{ case SID_CUT: case SID_COPY:
m_rView.GetEditWin().FlushInBuffer(); if ( rSh.HasSelection() )
{
rtl::Reference<SwTransferable> pTransfer = new SwTransferable( rSh );
case FN_PASTE_NESTED_TABLE: case FN_TABLE_PASTE_ROW_BEFORE: case FN_TABLE_PASTE_COL_BEFORE: switch ( nId )
{ case FN_PASTE_NESTED_TABLE:
ePasteTable = PasteTableType::PASTE_TABLE; break; case FN_TABLE_PASTE_ROW_BEFORE:
ePasteTable = PasteTableType::PASTE_ROW; break; case FN_TABLE_PASTE_COL_BEFORE:
ePasteTable = PasteTableType::PASTE_COLUMN; break; default:
;
}
[[fallthrough]]; case SID_PASTE:
{
TransferableDataHelper aDataHelper(
TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin() ) ); if( aDataHelper.GetXTransferable().is()
&& SwTransferable::IsPaste( rSh, aDataHelper ) )
{ // Temporary variables, because the shell could already be // destroyed after the paste.
SwView* pView = &m_rView;
//Done() has to be called before the shell has been removed
rReq.Done();
bIgnore = true; if( rSh.IsFrameSelected() || rSh.GetSelectedObjCount())
rSh.EnterSelFrameMode();
pView->AttrChangedNotify(nullptr);
// Fold pasted outlines that have outline content visible attribute false
MakeAllOutlineContentTemporarilyVisible a(rSh.GetDoc());
}
}
} break;
case SID_PASTE_UNFORMATTED:
{
TransferableDataHelper aDataHelper(
TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()) ); if( aDataHelper.GetXTransferable().is()
&& SwTransferable::IsPaste( rSh, aDataHelper ) )
{ // Temporary variables, because the shell could already be // destroyed after the paste.
SwView* pView = &m_rView;
rReq.Ignore();
bIgnore = true; if(SwTransferable::PasteUnformatted( rSh, aDataHelper ))
{
SfxViewFrame& rViewFrame = pView->GetViewFrame();
uno::Reference< frame::XDispatchRecorder > xRecorder =
rViewFrame.GetBindings().GetRecorder(); if(xRecorder.is()) {
SfxRequest aReq(rViewFrame, SID_CLIPBOARD_FORMAT_ITEMS);
aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, static_cast<sal_uInt32>(SotClipboardFormatId::STRING) ) );
aReq.Done();
}
}
if (rSh.IsFrameSelected() || rSh.GetSelectedObjCount())
rSh.EnterSelFrameMode();
pView->AttrChangedNotify(nullptr);
// Fold pasted outlines that have outline content visible attribute false
MakeAllOutlineContentTemporarilyVisible a(rSh.GetDoc());
} else return;
} break;
case SID_PASTE_SPECIAL:
{
std::shared_ptr<const TransferableDataHelper> aDataHelper =
std::make_shared<TransferableDataHelper>(TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()));
case FN_PASTE_NESTED_TABLE: case FN_TABLE_PASTE_ROW_BEFORE: case FN_TABLE_PASTE_COL_BEFORE: if( !rSh.IsCursorInTable()
|| !GetView().IsPasteSpecialAllowed()
|| rSh.CursorInsideInputField() // disable if not a native Writer table and not a spreadsheet format
|| !GetView().IsPasteSpreadsheet(rSh.GetTableCopied()) )
{
rSet.DisableItem( nWhich );
} break;
// Repair mode: allow undo/redo of all undo actions, even if access would // be limited based on the view shell ID. bool bRepair = false; const SfxBoolItem* pRepairItem; if (pArgs && (pRepairItem = pArgs->GetItemIfSet(SID_REPAIRPACKAGE, false)))
bRepair = pRepairItem->GetValue();
// #i106349#: save pointer: undo/redo may delete the shell, i.e., this!
SfxViewFrame& rViewFrame( GetView().GetViewFrame() );
switch( nId )
{ case SID_UNDO: if (rUndoRedo.GetLastUndoInfo(nullptr, &nUndoId, &rWrtShell.GetView()))
{ for (SwViewShell& rShell : rWrtShell.GetRingContainer())
rShell.LockPaint(LockPaintReason::Undo);
sal_uInt16 nUndoOffset = 0; if (comphelper::LibreOfficeKit::isActive() && !bRepair && nCnt == 1)
{
sw::UndoManager& rManager = rWrtShell.GetDoc()->GetUndoManager(); const SfxUndoAction* pAction = rManager.GetUndoAction();
SwView& rView = rWrtShell.GetView();
ViewShellId nViewShellId = rView.GetViewShellId();
sal_uInt16 nOffset = 0; if (pAction->GetViewShellId() != nViewShellId
&& rManager.IsViewUndoActionIndependent(&rView, nOffset))
{ // Execute the undo with an offset: don't undo the top action, but an // earlier one, since it's independent and that belongs to our view.
nUndoOffset += nOffset;
}
}
namespace
{ /// Searches for the specified field type and field name prefix and update the matching fields to /// have the provided new name and content. bool UpdateFieldContents(const SfxRequest& rReq, SwWrtShell& rWrtSh)
{ const SfxStringItem* pTypeName = rReq.GetArg<SfxStringItem>(FN_PARAM_1); if (!pTypeName || pTypeName->GetValue() != "SetRef")
{ // This is implemented so far only for reference marks. returnfalse;
}
sal_uInt16 nFieldIndex = 0; for (auto& pIntermediateRefMark : aRefMarks)
{ auto pRefMark = const_cast<SwFormatRefMark*>(pIntermediateRefMark); if (!pRefMark->GetRefName().toString().startsWith(rNamePrefix))
{ continue;
}
auto pTextRefMark = const_cast<SwTextRefMark*>(pRefMark->GetTextRefMark()); if (bNeverExpand)
{
pTextRefMark->SetDontExpand(true);
pTextRefMark->SetLockExpandFlag(true);
pTextRefMark->SetDontExpandStartAttr(true);
}
if (nFieldIndex >= aFields.getLength())
{ // earlier we used to break here // but now we need to set expand flags for each refmark continue;
}
comphelper::SequenceAsHashMap aMap(aFields[nFieldIndex++]);
pRefMark->GetRefName() = SwMarkName(aMap[u"Name"_ustr].get<OUString>());
/// Searches for the specified field type and field name prefix under cursor and update the matching /// field to have the provided new name and content. void UpdateFieldContent(const SfxRequest& rReq, SwWrtShell& rWrtSh)
{ const SfxStringItem* pTypeName = rReq.GetArg<SfxStringItem>(FN_PARAM_1); if (!pTypeName || pTypeName->GetValue() != "SetRef")
{ // This is implemented so far only for reference marks. return;
}
sal_uInt16 nSlot = rReq.GetSlot(); switch(nSlot)
{ case FN_REPAGINATE:
{
Reference < XModel > xModel = GetView().GetDocShell()->GetModel(); auto pDoc = comphelper::getFromUnoTunnel<SwXTextDocument>(xModel);
pDoc->NotifyRefreshListeners();
rSh.CalcLayout();
} break; case FN_UPDATE_FIELDS:
{ if (UpdateFieldContents(rReq, rSh))
{ // Parameters indicated that the name / content of fields has to be updated to // the provided values, don't do an actual fields update. break;
}
rSh.LockView( bLockedView );
} else // Will be recorded from the DocShell
GetView().GetDocShell()->ExecStyleSheet(rReq);
}
} break; case SID_CLASSIFICATION_APPLY:
{
GetView().GetDocShell()->Execute(rReq);
} break; case SID_CLASSIFICATION_DIALOG:
{
GetView().GetDocShell()->Execute(rReq);
} break; case SID_PARAGRAPH_SIGN_CLASSIFY_DLG:
{
GetView().GetDocShell()->Execute(rReq);
} break; case SID_WATERMARK:
{
GetView().GetDocShell()->Execute(rReq);
} break; case FN_ESCAPE:
GetView().ExecuteSlot(rReq); break; case SID_IMAP:
{
sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
SfxViewFrame& rVFrame = GetView().GetViewFrame();
rVFrame.ToggleChildWindow( nId );
rVFrame.GetBindings().Invalidate( SID_IMAP );
if ( rVFrame.HasChildWindow( nId ) && rSh.IsFrameSelected() )
lcl_UpdateIMapDlg( rSh );
} break; case SID_IMAP_EXEC:
{
SvxIMapDlg* pDlg = GetIMapDlg(GetView());
// Check, if the allocation is useful or allowed at all. if ( rSh.IsFrameSelected() &&
pDlg->GetEditingObject() == rSh.GetIMapInventor() )
{
SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<RES_URL, RES_URL>(rSh.GetAttrPool()));
rSh.GetFlyFrameAttr( aSet );
SwFormatURL aURL( aSet.Get( RES_URL ) );
aURL.SetMap( &pDlg->GetImageMap() );
aSet.Put( aURL );
rSh.SetFlyFrameAttr( aSet );
}
} break; case FN_SET_TRACKED_CHANGES_IN_TEXT: case FN_SET_TRACKED_DELETIONS_IN_MARGIN: case FN_SET_TRACKED_INSERTIONS_IN_MARGIN:
{
SwViewOption aViewOption = *rSh.GetViewOptions(); bool bAllInText = FN_SET_TRACKED_CHANGES_IN_TEXT == nSlot;
aViewOption.SetShowChangesInMargin( !bAllInText ); if ( !bAllInText )
aViewOption.SetShowChangesInMargin2( FN_SET_TRACKED_INSERTIONS_IN_MARGIN == nSlot );
rSh.ApplyViewOptions( aViewOption );
// tdf#140982 restore annotation ranges stored in temporary bookmarks // (only remove temporary bookmarks during file saving to avoid possible // conflict with lazy deletion of the bookmarks of the moved tracked deletions) if ( bAllInText || FN_SET_TRACKED_INSERTIONS_IN_MARGIN == nSlot )
rSh.GetDoc()->getIDocumentMarkAccess()->restoreAnnotationMarks(false);
} break; case SID_CONTOUR_DLG:
{
sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
SfxViewFrame& rVFrame = GetView().GetViewFrame();
rVFrame.ToggleChildWindow( nId );
rVFrame.GetBindings().Invalidate( SID_CONTOUR_DLG );
SelectionType nSel = rSh.GetSelectionType(); if ( rVFrame.HasChildWindow( nId ) &&
(nSel & (SelectionType::Graphic|SelectionType::Ole)) )
{
lcl_UpdateContourDlg( rSh, nSel );
}
} break; case SID_CONTOUR_EXEC:
{
SvxContourDlg *pDlg = GetContourDlg(GetView()); // Check, if the allocation is useful or allowed at all.
SelectionType nSel = rSh.GetSelectionType(); if ( nSel & (SelectionType::Graphic|SelectionType::Ole) )
{ if (pDlg && pDlg->GetEditingObject() == rSh.GetIMapInventor())
{
rSh.StartAction();
SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<RES_SURROUND, RES_SURROUND>(rSh.GetAttrPool()));
rSh.GetFlyFrameAttr( aSet );
SwFormatSurround aSur( aSet.Get( RES_SURROUND ) ); if ( !aSur.IsContour() )
{
aSur.SetContour( true ); if ( aSur.GetSurround() == css::text::WrapTextMode_NONE )
aSur.SetSurround( css::text::WrapTextMode_PARALLEL );
aSet.Put( aSur );
rSh.SetFlyFrameAttr( aSet );
} const tools::PolyPolygon aPoly( pDlg->GetPolyPolygon() );
rSh.SetGraphicPolygon( &aPoly ); if ( pDlg->IsGraphicChanged() )
rSh.ReRead( OUString(), OUString(), &pDlg->GetGraphic());
rSh.EndAction();
}
}
} break; case FN_FRAME_TO_ANCHOR:
{
rSh.GotoFlyAnchor();
rSh.EnterStdMode();
rSh.CallChgLnk();
} break; case FN_TOOL_ANCHOR_PAGE: case FN_TOOL_ANCHOR_PARAGRAPH: case FN_TOOL_ANCHOR_CHAR: case FN_TOOL_ANCHOR_AT_CHAR: case FN_TOOL_ANCHOR_FRAME:
{
RndStdIds eSet = nSlot == FN_TOOL_ANCHOR_PAGE
? RndStdIds::FLY_AT_PAGE
: nSlot == FN_TOOL_ANCHOR_PARAGRAPH
? RndStdIds::FLY_AT_PARA
: nSlot == FN_TOOL_ANCHOR_FRAME
? RndStdIds::FLY_AT_FLY
: nSlot == FN_TOOL_ANCHOR_CHAR
? RndStdIds::FLY_AS_CHAR
: RndStdIds::FLY_AT_CHAR;
rSh.StartUndo(); if (rSh.GetSelectedObjCount())
rSh.ChgAnchor(eSet); elseif (rSh.IsFrameSelected())
{
SwFormatAnchor aAnc(eSet, eSet == RndStdIds::FLY_AT_PAGE ? rSh.GetPhyPageNum() : 0);
SfxItemSet aSet(SwFEShell::makeItemSetFromFormatAnchor(GetPool(), aAnc));
rSh.SetFlyFrameAttr(aSet);
} // if new anchor is 'as char' and it is a Math object and the usual // pre-conditions are met then align the formula to the baseline of the text const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() ); constbool bDoMathBaselineAlignment = xObj.is() && SotExchange::IsMath( xObj->getClassID() )
&& RndStdIds::FLY_AS_CHAR == eSet && rSh.GetDoc()->getIDocumentSettingAccess().get( DocumentSettingId::MATH_BASELINE_ALIGNMENT ); if (bDoMathBaselineAlignment)
rSh.AlignFormulaToBaseline( xObj );
switch( eSet )
{ case RndStdIds::FLY_AT_FLY: case RndStdIds::FLY_AT_PAGE: //Wrap through, left or from left, top, from top if(eSurround != css::text::WrapTextMode_THROUGH)
aSet.Put(SwFormatSurround(css::text::WrapTextMode_THROUGH));
case RndStdIds::FLY_AT_PARA: // left, from left, right, top, no wrap, wrap left and right if (eSurround != css::text::WrapTextMode_LEFT && eSurround != css::text::WrapTextMode_RIGHT)
aSet.Put(SwFormatSurround(css::text::WrapTextMode_LEFT));
case RndStdIds::FLY_AT_CHAR: // left, from left, right, top, wrap through if(eSurround != css::text::WrapTextMode_THROUGH)
aSet.Put(SwFormatSurround(css::text::WrapTextMode_THROUGH));
case FN_FRAME_NOWRAP: case FN_FRAME_WRAP: case FN_FRAME_WRAP_IDEAL: case FN_FRAME_WRAPTHRU: case FN_FRAME_WRAPTHRU_TRANSP: case FN_FRAME_WRAPTHRU_TOGGLE: case FN_FRAME_WRAP_CONTOUR: case FN_WRAP_ANCHOR_ONLY: case FN_FRAME_WRAP_LEFT: case FN_FRAME_WRAP_RIGHT:
SetWrapMode( nSlot ); break;
case FN_UPDATE_ALL_LINKS:
{ if( !rSh.GetLinkManager().GetLinks().empty() )
{
rSh.EnterStdMode();
rSh.StartAllAction();
SfxMedium * medium = nullptr; if (autoconst sh = rSh.GetDoc()->GetDocShell()) {
medium = sh->GetMedium();
}
rSh.GetLinkManager().UpdateAllLinks( false, false, nullptr, medium == nullptr ? OUString() : medium->GetName() );
rSh.EndAllAction();
}
} break;
case FN_XFORMS_DESIGN_MODE: if (pArgs && pArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET)
{ if (const SfxBoolItem* pBoolItem = dynamic_cast<const SfxBoolItem*>(pItem))
{ bool bDesignMode = pBoolItem->GetValue();
case SID_GRFFILTER: case SID_GRFFILTER_INVERT: case SID_GRFFILTER_SMOOTH: case SID_GRFFILTER_SHARPEN: case SID_GRFFILTER_REMOVENOISE: case SID_GRFFILTER_SOBEL: case SID_GRFFILTER_MOSAIC: case SID_GRFFILTER_EMBOSS: case SID_GRFFILTER_POSTER: case SID_GRFFILTER_POPART: case SID_GRFFILTER_SEPIA: case SID_GRFFILTER_SOLARIZE:
bSetState = bState = GraphicType::Bitmap == nGrfType; break;
}
void SwBaseShell::GetState( SfxItemSet &rSet )
{
SwWrtShell &rSh = GetShell();
SfxViewFrame& rVFrame = GetView().GetViewFrame();
SfxWhichIter aIter( rSet );
sal_uInt16 nWhich = aIter.FirstWhich();
m_pGetStateSet = &rSet; while ( nWhich )
{ switch ( nWhich )
{ case SID_GALLERY_FORMATS: if ( rSh.GetSelectedObjCount() ||
(rSh.IsSelFrameMode() &&
!(rSh.GetSelectionType() & SelectionType::Graphic)) )
rSet.DisableItem( nWhich ); break; case SID_GALLERY_ENABLE_ADDCOPY: // #108230# allow copy from gallery in Writer AND Writer/Web!
rSet.Put( SfxBoolItem( SID_GALLERY_ENABLE_ADDCOPY, true ) ); break; case FN_EDIT_REGION: if( !rSh.IsAnySectionInDoc() )
rSet.DisableItem(nWhich); break;
case FN_EDIT_CURRENT_REGION: //tdf#112808 if cursor is in an index, don't show the edit section. if( !rSh.GetCurrSection() ||
(rSh.GetCurrSection()->GetType() != SectionType::Content &&
rSh.GetCurrSection()->GetType() != SectionType::FileLink ))
{
rSet.DisableItem(nWhich);
} break;
bool bDisable = false; if( !bHas && !bOk )
bDisable = true; // #i59688# // Avoid unnecessary loading of selected graphic. // The graphic is only needed, if the dialog is open. // If the swapping of the graphic is finished, the status // must be determined asynchronously, until this the slot // will be disabled. elseif ( bHas && (nSel & SelectionType::Graphic) &&
rSh.IsLinkedGrfSwapOut() )
{ if( AddGrfUpdateSlot( nWhich ))
rSh.GetGraphic(false); // start the loading // #i75481#
bDisable = true;
} elseif( bHas && bOk )
bDisable = !lcl_UpdateContourDlg( rSh, nSel ); elseif( bOk )
{ // #i75481# // apply fix #i59688# only for selected graphics if ( nSel & SelectionType::Graphic )
bDisable = GraphicType::NONE == rSh.GetGraphicType(); else
bDisable = GraphicType::NONE == rSh.GetIMapGraphic().GetType();
}
case SID_ANCHOR_MENU: case FN_TOOL_ANCHOR_PAGE: case FN_TOOL_ANCHOR_PARAGRAPH: case FN_TOOL_ANCHOR_CHAR: case FN_TOOL_ANCHOR_AT_CHAR: case FN_TOOL_ANCHOR_FRAME:
{ bool bObj = 0 != rSh.GetSelectedObjCount(); bool bParentCntProt = rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE;
if (comphelper::LibreOfficeKit::isActive())
{ if (nWhich == FN_TOOL_ANCHOR_PAGE || nWhich == FN_TOOL_ANCHOR_FRAME)
{
rSet.DisableItem(nWhich);
}
}
} else
rSet.DisableItem( nWhich );
} break; case FN_FRAME_NOWRAP: case FN_FRAME_WRAP: case FN_FRAME_WRAP_IDEAL: case FN_FRAME_WRAPTHRU: case FN_FRAME_WRAPTHRU_TRANSP: case FN_FRAME_WRAPTHRU_TOGGLE: case FN_FRAME_WRAP_CONTOUR: case FN_WRAP_ANCHOR_ONLY: case FN_FRAME_WRAP_LEFT: case FN_FRAME_WRAP_RIGHT:
{ bool bObj = 0 != rSh.GetSelectedObjCount(); bool bParentCntProt = rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE;
if( nWhich == SID_TABLE_CELL_BACKGROUND_COLOR )
{
rSh.GetBoxBackground( aBrushItem );
} else
{ // Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
SfxItemSet aCoreSet(SfxItemSet::makeFixedSfxItemSet<XATTR_FILL_FIRST, XATTR_FILL_LAST>(GetPool()));
while(nWhich)
{ switch(nWhich)
{ case SID_BACKGROUND_COLOR: case SID_TABLE_CELL_BACKGROUND_COLOR:
{
SvxColorItem aColorItem(aBrushItem->GetColor(), aBrushItem->getComplexColor(), nWhich);
rSet.Put(aColorItem); break;
} case SID_ATTR_BRUSH: case RES_BACKGROUND:
{ // if this was intended to have a independent copy of the Item to be set // this is not needed due to the ItemSet/Pool cloning Items which get set anyways. // Keeping code as reference - it may have had other reasons I do notz see (?!?) // std::unique_ptr<SfxPoolItem> pNewItem(aBrushItem.CloneSetWhich(GetPool().GetWhich(nWhich)));
rSet.Put(*aBrushItem); break;
}
}
if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR )
{
rSh.GetBoxBackground( aBrushItem );
} else
{ // Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
SfxItemSet aCoreSet(SfxItemSet::makeFixedSfxItemSet<XATTR_FILL_FIRST, XATTR_FILL_LAST>(GetPool()));
if (bIsTransparent)
{
aBrushItem->SetColor(COL_TRANSPARENT);
rReq.AppendItem(SvxColorItem(COL_TRANSPARENT,nSlot));
} break;
}
case SID_ATTR_BRUSH: case RES_BACKGROUND:
{
assert(pArgs && "only SID_BACKGROUND_COLOR can have !pArgs, checked at entry");
aBrushItem.reset(static_cast<SvxBrushItem*>(pArgs->Get(GetPool().GetWhichIDFromSlotID(nSlot)).Clone())); break;
} default:
{
rReq.Ignore();
OSL_FAIL("unknown message in ExecuteAttr!" ); return;
}
}
if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR )
{
rSh.SetBoxBackground( *aBrushItem );
} else
{ // Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
SfxItemSet aCoreSet(SfxItemSet::makeFixedSfxItemSet<XATTR_FILL_FIRST, XATTR_FILL_LAST>(GetPool()));
switch ( nSlot )
{ case FN_FORMAT_TITLEPAGE_DLG:
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateTitlePageDlg(pMDI));
VclAbstractDialog::AsyncContext aContext;
aContext.maEndDialogFn = [](sal_Int32){};
pDlg->StartExecuteAsync(aContext);
} break; case FN_FORMAT_PAGE_DLG: case FN_FORMAT_PAGE_COLUMN_DLG: case FN_FORMAT_PAGE_SETTING_DLG: case FN_FORMAT_PAGE_AREA_DLG:
{ if( !bBackground )
{ const size_t nCurIdx = rSh.GetCurPageDesc(); const SwPageDesc& rPageDesc = rSh.GetPageDesc( nCurIdx ); // Temporary view, because the shell does not need to be valid after the dialog // for example disable header
SwView& rTempView = GetView();
OUString sPageId; switch (nSlot)
{ case FN_FORMAT_PAGE_COLUMN_DLG:
sPageId = "columns"; break; case FN_FORMAT_PAGE_SETTING_DLG:
sPageId = "page"; break; case FN_FORMAT_PAGE_AREA_DLG:
sPageId = "area"; break; case FN_FORMAT_PAGE_DLG: if (pItem)
sPageId = static_cast<const SfxStringItem*>(pItem)->GetValue(); break;
}
rTempView.GetDocShell()->FormatPage(rReq.GetFrameWeld(), rPageDesc.GetName(), sPageId, rSh, &rReq);
rTempView.InvalidateRulerPos();
bDone = true; // FormatPage() takes care of calling Done()
}
} break; case FN_FORMAT_BORDER_DLG:
{
SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<
RES_BOX, RES_SHADOW, SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>(rSh.GetAttrPool()));
ScopedVclPtr<SfxAbstractDialog> pDlg; // Table cell(s) selected? if ( rSh.IsTableMode() )
{ // Set border attributes Get/SetTabBorders()
::PrepareBoxInfo( aSet, rSh );
rSh.GetTabBorders( aSet );
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
pDlg.disposeAndReset(pFact->CreateSwBorderDlg(pMDI, aSet, SwBorderModes::TABLE)); if ( pDlg->Execute() == RET_OK )
{
rSh.SetTabBorders( *pDlg->GetOutputItemSet() );
pOutSet = pDlg->GetOutputItemSet();
}
} elseif ( rSh.IsFrameSelected() )
{ // Set border attributes via Frame-Manager
SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
aSet.Put( aMgr.GetAttrSet() );
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
pDlg.disposeAndReset(pFact->CreateSwBorderDlg(pMDI, aSet, SwBorderModes::FRAME)); if ( pDlg->Execute() == RET_OK )
{
aMgr.SetAttrSet( *pDlg->GetOutputItemSet() );
aMgr.UpdateFlyFrame();
pOutSet = pDlg->GetOutputItemSet();
}
} else
{ // Set border attributes via Shell quite normal
rSh.GetCurAttr( aSet );
::PrepareBoxInfo( aSet, rSh );
// Table cell(s) selected? if ( rSh.IsTableMode() )
{ // Get background attributes of the table and put it in the set // tdf#144843 calling GetBoxBackground *requires* an incarnation to be handed over
std::unique_ptr<SvxBrushItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
rSh.GetBoxBackground( aBrush );
pDlg.disposeAndReset(pFact->CreateSwBackgroundDialog(pMDI, aSet));
aSet.Put( std::move(aBrush) ); if ( pDlg->Execute() == RET_OK )
{
if ( rSh.GetFrameType( nullptr, true ) & FrameTypeFlags::FOOTNOTE ) return;
SwView &rTempView = GetView(); // Because GetView() does not work after the shell exchange bool bHTMLMode = 0 != (::GetHtmlMode(rTempView.GetDocShell())&HTMLMODE_ON); bool bCallEndUndo = false;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.