/* -*- 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 .
*/
// #i123922# insert given graphic data dependent of the object type in focus void SwDrawShell::InsertPictureFromFile(SdrObject& rObject)
{
SwWrtShell &rSh = GetShell();
SdrView* pSdrView = rSh.GetDrawView();
// #i123922# for handling MasterObject and virtual ones correctly, SW // wants us to call ReplaceObject at the page, but that also // triggers the same assertion (I tried it), so stay at the view method
pSdrView->ReplaceObjectAtView(&rObject, *pSdrView->GetSdrPageView(), pNewGrafObj.get());
// set in all cases - the Clone() will have copied an existing link (!)
pNewGrafObj->SetGraphicLink(
bAsLink ? aDlg.GetPath() : OUString());
case SID_FLIP_VERTICAL:
bMirror = false;
[[fallthrough]]; case SID_FLIP_HORIZONTAL:
rSh.MirrorSelection( bMirror ); break;
case SID_FONTWORK:
{
FieldUnit eMetric = ::GetDfltMetric( dynamic_cast<SwWebView*>( &rSh.GetView()) != nullptr );
SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
SfxViewFrame& rVFrame = GetView().GetViewFrame(); if (pArgs)
{
rVFrame.SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(), static_cast<const SfxBoolItem&>((pArgs->Get(SID_FONTWORK))).GetValue());
} else
rVFrame.ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() );
rVFrame.GetBindings().Invalidate(SID_FONTWORK);
} break; case FN_FORMAT_FOOTNOTE_DLG:
{
GetView().ExecFormatFootnote(); break;
} case FN_NUMBERING_OUTLINE_DLG:
{
GetView().ExecNumberingOutline(GetPool());
rReq.Done();
} break; case SID_OPEN_XML_FILTERSETTINGS:
{
HandleOpenXmlFilterSettings(rReq);
} break; case FN_WORDCOUNT_DIALOG:
{
GetView().UpdateWordCount(this, nSlotId);
} break; case SID_EXTRUSION_TOGGLE: case SID_EXTRUSION_TILT_DOWN: case SID_EXTRUSION_TILT_UP: case SID_EXTRUSION_TILT_LEFT: case SID_EXTRUSION_TILT_RIGHT: case SID_EXTRUSION_3D_COLOR: case SID_EXTRUSION_DEPTH: case SID_EXTRUSION_DIRECTION: case SID_EXTRUSION_PROJECTION: case SID_EXTRUSION_LIGHTING_DIRECTION: case SID_EXTRUSION_LIGHTING_INTENSITY: case SID_EXTRUSION_SURFACE: case SID_EXTRUSION_DEPTH_FLOATER: case SID_EXTRUSION_DIRECTION_FLOATER: case SID_EXTRUSION_LIGHTING_FLOATER: case SID_EXTRUSION_SURFACE_FLOATER: case SID_EXTRUSION_DEPTH_DIALOG:
svx::ExtrusionBar::execute( pSdrView, rReq, rBnd );
rReq.Ignore (); break;
case SID_FONTWORK_SHAPE: case SID_FONTWORK_SHAPE_TYPE: case SID_FONTWORK_ALIGNMENT: case SID_FONTWORK_SAME_LETTER_HEIGHTS: case SID_FONTWORK_CHARACTER_SPACING: case SID_FONTWORK_KERN_CHARACTER_PAIRS: case SID_FONTWORK_CHARACTER_SPACING_FLOATER: case SID_FONTWORK_ALIGNMENT_FLOATER: case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
svx::FontworkBar::execute(*pSdrView, rReq, rBnd);
rReq.Ignore (); break;
case SID_INSERT_GRAPHIC:
{ // #i123922# check if we can do something
SdrObject* pObj = IsSingleFillableNonOLESelected();
if(pObj)
{ // ...and if yes, do something
InsertPictureFromFile(*pObj);
}
break;
}
case FN_ADD_TEXT_BOX:
{ if (SdrObject* pObj = IsSingleFillableNonOLESelected())
{
SwFrameFormat* pFrameFormat = ::FindFrameFormat(pObj); if (pFrameFormat)
SwTextBoxHelper::create(pFrameFormat, pObj, pObj->HasText());
} break;
} case FN_REMOVE_TEXT_BOX:
{ if (SdrObject* pObj = IsSingleFillableNonOLESelected())
{
SwFrameFormat* pFrameFormat = ::FindFrameFormat(pObj); if (pFrameFormat)
SwTextBoxHelper::destroy(pFrameFormat, pObj);
} break;
} default:
OSL_ENSURE(false, "wrong dispatcher"); return;
} if (pSdrView->GetModel().IsChanged())
rSh.SetModified(); elseif (bChanged)
pSdrView->GetModel().SetChanged();
}
case SID_BEZIER_EDIT: if (!Disable(rSet, nWhich))
rSet.Put( SfxBoolItem( nWhich, !GetView().IsDrawSelMode())); break;
case SID_FLIP_VERTICAL: if ( !pSdrView->IsMirrorAllowed() || bProtected )
{
rSet.DisableItem( nWhich );
} else
{ // TTTT - needs to be adapted in aw080: // state is not kept for drawing objects --> provide not flipped state
rSet.Put( SfxBoolItem( nWhich, false ) );
} break;
case SID_FLIP_HORIZONTAL: if ( !pSdrView->IsMirrorAllowed() || bProtected )
{
rSet.DisableItem( nWhich );
} else
{ // TTTT - needs to be adapted in aw080: // state is not kept for drawing objects --> provide not flipped state
rSet.Put( SfxBoolItem( nWhich, false ) );
} break;
case SID_FONTWORK:
{ if (bProtected)
rSet.DisableItem( nWhich ); else
{ const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
rSet.Put(SfxBoolItem( nWhich , GetView().GetViewFrame().HasChildWindow(nId)));
}
} break;
case SID_INSERT_GRAPHIC:
{ // #i123922# check if we can do something
SdrObject* pObj = IsSingleFillableNonOLESelected();
if(!pObj)
{
rSet.DisableItem(nWhich);
}
break;
} case FN_ADD_TEXT_BOX:
{ bool bDisable = true; if (SdrObject* pObj = IsSingleFillableNonOLESelected())
{
SwFrameFormat* pFrameFormat = ::FindFrameFormat(pObj); // Allow creating a TextBox only in case this is a draw format without a TextBox so far. if (pFrameFormat && pFrameFormat->Which() == RES_DRAWFRMFMT && !SwTextBoxHelper::isTextBox(pFrameFormat, RES_DRAWFRMFMT, pObj))
{ if (SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>( pObj) )
{ const SdrCustomShapeGeometryItem& rGeometryItem = pCustomShape->GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY); if (const uno::Any* pAny = rGeometryItem.GetPropertyValueByName(u"Type"_ustr)) // But still disallow fontwork shapes.
bDisable = pAny->get<OUString>().startsWith("fontwork-");
}
}
}
if (bDisable)
rSet.DisableItem(nWhich); break;
} case FN_REMOVE_TEXT_BOX:
{ bool bDisable = true; if (SdrObject* pObj = IsSingleFillableNonOLESelected())
{
SwFrameFormat* pFrameFormat = ::FindFrameFormat(pObj); // Allow removing a TextBox only in case it has one. if (pFrameFormat && SwTextBoxHelper::isTextBox(pFrameFormat, RES_DRAWFRMFMT, pObj))
bDisable = 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.