/* -*- 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 .
*/
switch (rMarkList.GetMarkCount())
{ case 0: // Empty selection. Return Context::Unknown to let the caller // substitute it with the default context. break;
// Note that some cases are handled by the caller. They rely on // sd specific data. switch (rMarkList.GetMarkCount())
{ case 0: switch (eViewType)
{ case ViewType::Standard:
eContext = EnumContext::Context::DrawPage; break; case ViewType::Master:
eContext = EnumContext::Context::MasterPage; break; case ViewType::Handout:
eContext = EnumContext::Context::HandoutPage; break; case ViewType::Notes:
eContext = EnumContext::Context::NotesPage; break;
} break;
case 1:
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); auto pTextObj = DynCastSdrTextObj(pObj); if (pTextObj && pTextObj->IsInEditMode())
{ if (pObj->GetObjIdentifier() == SdrObjKind::Table)
{ // Let a table object take precedence over text // edit mode. The panels for text editing are // present for table context as well, anyway.
eContext = EnumContext::Context::Table;
} else
eContext = EnumContext::Context::DrawText;
} elseif (svx::checkForFontWork(pObj))
{
eContext = EnumContext::Context::DrawFontwork;
} else
{ const SdrInventor nInv = pObj->GetObjInventor();
SdrObjKind nObjId = pObj->GetObjIdentifier(); if (nInv == SdrInventor::Default)
{ if (nObjId == SdrObjKind::Group)
{
nObjId = GetObjectTypeFromGroup(pObj); if (nObjId == SdrObjKind::NONE)
nObjId = SdrObjKind::Group;
}
eContext = GetContextForObjectId_SD(nObjId, eViewType);
} elseif (nInv == SdrInventor::E3d)
{
eContext = EnumContext::Context::ThreeDObject;
} elseif (nInv == SdrInventor::FmForm)
{
eContext = EnumContext::Context::Form;
}
} break;
}
case SdrInventor::E3d:
eContext = EnumContext::Context::ThreeDObject; break;
case SdrInventor::FmForm:
eContext = EnumContext::Context::Form; break;
case SdrInventor::Unknown:
eContext = EnumContext::Context::MultiObject; break;
default: break;
} break;
}
}
return eContext;
}
EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SC(const SdrObjKind nObjectId)
{ switch (nObjectId)
{ case SdrObjKind::Caption: case SdrObjKind::TitleText: case SdrObjKind::OutlineText: case SdrObjKind::Text: case SdrObjKind::Measure: case SdrObjKind::Rectangle: case SdrObjKind::CircleOrEllipse: case SdrObjKind::FreehandFill: case SdrObjKind::PathFill: case SdrObjKind::Polygon: case SdrObjKind::CircleSection: case SdrObjKind::CircleArc: case SdrObjKind::CircleCut: case SdrObjKind::CustomShape: case SdrObjKind::Group: return EnumContext::Context::Draw;
case SdrObjKind::PolyLine: case SdrObjKind::PathLine: case SdrObjKind::FreehandLine: case SdrObjKind::Line: case SdrObjKind::Edge: return EnumContext::Context::DrawLine;
case SdrObjKind::Graphic: return EnumContext::Context::Graphic;
case SdrObjKind::OLE2: return EnumContext::Context::OLE;
case SdrObjKind::Media: return EnumContext::Context::Media;
EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SD(const SdrObjKind nObjectId, const ViewType eViewType)
{ switch (nObjectId)
{ case SdrObjKind::Caption: case SdrObjKind::Measure: case SdrObjKind::Rectangle: case SdrObjKind::CircleOrEllipse: case SdrObjKind::FreehandFill: case SdrObjKind::PathFill: case SdrObjKind::Polygon: case SdrObjKind::CircleSection: case SdrObjKind::CircleArc: case SdrObjKind::CircleCut: case SdrObjKind::CustomShape: case SdrObjKind::Group: return EnumContext::Context::Draw;
case SdrObjKind::Edge: case SdrObjKind::PathLine: case SdrObjKind::FreehandLine: case SdrObjKind::PolyLine: case SdrObjKind::Line: return EnumContext::Context::DrawLine;
case SdrObjKind::TitleText: case SdrObjKind::OutlineText: case SdrObjKind::Text: return EnumContext::Context::TextObject;
case SdrObjKind::Graphic: return EnumContext::Context::Graphic;
case SdrObjKind::OLE2: return EnumContext::Context::OLE;
case SdrObjKind::Media: return EnumContext::Context::Media;
case SdrObjKind::Table: return EnumContext::Context::Table;
case SdrObjKind::Page: switch (eViewType)
{ case ViewType::Handout: return EnumContext::Context::HandoutPage; case ViewType::Notes: return EnumContext::Context::NotesPage; default: return EnumContext::Context::Unknown;
}
if (nType != nResultType) return SdrObjKind::NONE;
}
return nResultType;
}
bool SelectionAnalyzer::IsShapeType(const SdrObjKind nType)
{ switch (nType)
{ case SdrObjKind::Line: case SdrObjKind::CircleArc: case SdrObjKind::PolyLine: case SdrObjKind::PathLine: case SdrObjKind::Rectangle: case SdrObjKind::CircleOrEllipse: case SdrObjKind::CircleSection: case SdrObjKind::CircleCut: case SdrObjKind::PathFill: case SdrObjKind::CustomShape: case SdrObjKind::Caption: case SdrObjKind::Measure: case SdrObjKind::Edge: case SdrObjKind::Polygon: case SdrObjKind::FreehandLine: case SdrObjKind::FreehandFill:
// #122145# adding SdrObjKind::OLE2 since these also allow line/fill style and may // be multiselected/grouped with normal draw objects, e.g. math OLE objects case SdrObjKind::OLE2: returntrue;
default: returnfalse;
}
}
bool SelectionAnalyzer::IsTextObjType(const SdrObjKind nType)
{ switch (nType)
{ case SdrObjKind::Text: case SdrObjKind::TitleText: case SdrObjKind::OutlineText: returntrue;
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.