/* -*- 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 .
*/
//deselect if same shape is selected again (but different custom shapes do have same slot id) if ( bDeselect || (nSlotId == m_nDrawSfxId &&
(!pStringItem || (pStringItem->GetValue() == m_sDrawCustom))
&& (nSlotId != SID_DRAW_CS_ID) ) )
{ if (GetDrawFuncPtr())
{
GetDrawFuncPtr()->Deactivate();
SetDrawFuncPtr(nullptr);
}
if (m_pWrtShell->GetSelectedObjCount() && !m_pWrtShell->IsSelFrameMode())
m_pWrtShell->EnterSelFrameMode();
LeaveDrawCreate();
AttrChangedNotify(nullptr); return;
}
LeaveDrawCreate();
if (m_pWrtShell->IsFrameSelected())
m_pWrtShell->EnterStdMode(); // because bug #45639
std::unique_ptr<SwDrawBase> pFuncPtr;
// for LibreOfficeKit - choosing a shape should construct it directly bool bCreateDirectly = false;
switch (nSlotId)
{ case SID_OBJECT_SELECT: case SID_DRAW_SELECT:
pFuncPtr.reset( new DrawSelection(m_pWrtShell.get(), m_pEditWin, *this) );
m_nDrawSfxId = m_nFormSfxId = SID_OBJECT_SELECT;
m_sDrawCustom.clear(); break;
case SID_LINE_ARROW_END: case SID_LINE_ARROW_CIRCLE: case SID_LINE_ARROW_SQUARE: case SID_LINE_ARROW_START: case SID_LINE_CIRCLE_ARROW: case SID_LINE_SQUARE_ARROW: case SID_LINE_ARROWS: case SID_DRAW_LINE: case SID_DRAW_XLINE: case SID_DRAW_MEASURELINE: case SID_DRAW_RECT: case SID_DRAW_ELLIPSE: case SID_DRAW_TEXT: case SID_DRAW_TEXT_VERTICAL: case SID_DRAW_TEXT_MARQUEE: case SID_DRAW_CAPTION: case SID_DRAW_CAPTION_VERTICAL:
pFuncPtr.reset( new ConstRectangle(m_pWrtShell.get(), m_pEditWin, *this) );
bCreateDirectly = comphelper::LibreOfficeKit::isActive();
m_nDrawSfxId = nSlotId;
m_sDrawCustom.clear(); break;
case SID_DRAW_XPOLYGON_NOFILL: case SID_DRAW_XPOLYGON: case SID_DRAW_POLYGON_NOFILL: case SID_DRAW_POLYGON: case SID_DRAW_BEZIER_NOFILL: case SID_DRAW_BEZIER_FILL: case SID_DRAW_FREELINE_NOFILL: case SID_DRAW_FREELINE:
pFuncPtr.reset( new ConstPolygon(m_pWrtShell.get(), m_pEditWin, *this) );
m_nDrawSfxId = nSlotId;
m_sDrawCustom.clear(); break;
case SID_DRAW_ARC: case SID_DRAW_PIE: case SID_DRAW_CIRCLECUT:
pFuncPtr.reset( new ConstArc(m_pWrtShell.get(), m_pEditWin, *this) );
m_nDrawSfxId = nSlotId;
m_sDrawCustom.clear(); break;
case SID_DRAWTBX_CS_BASIC : case SID_DRAWTBX_CS_SYMBOL : case SID_DRAWTBX_CS_ARROW : case SID_DRAWTBX_CS_FLOWCHART : case SID_DRAWTBX_CS_CALLOUT : case SID_DRAWTBX_CS_STAR : case SID_DRAW_CS_ID :
{
pFuncPtr.reset( new ConstCustomShape(m_pWrtShell.get(), m_pEditWin, *this, rReq ) );
if (pObj)
{ // To allow SwDrawVirtObj text objects to be activated, allow their type, too. auto pVirtObj = dynamic_cast<SwDrawVirtObj*>( pObj ); if ( (pVirtObj && DynCastSdrTextObj(&pVirtObj->GetReferencedObj() ) != nullptr &&
m_pWrtShell->IsSelObjProtected(FlyProtectFlags::Content) == FlyProtectFlags::NONE) ||
DynCastSdrTextObj( pObj ) != nullptr )
{ // Refuse to edit editeng text of the shape if it has textbox attached. if (!lcl_isTextBox(pObj))
bReturn = BeginTextEdit( pObj, pPV, m_pEditWin );
}
}
// set default horizontal text direction at outliner
EEHorizontalTextDirection aDefHoriTextDir =
pSh->IsShapeDefaultHoriTextDirR2L() ? EEHorizontalTextDirection::R2L : EEHorizontalTextDirection::L2R;
pOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir );
}
// To allow editing the referenced object from a SwDrawVirtObj here // the original needs to be fetched eventually. This ATM activates the // text edit mode for the original object.
SdrObject* pToBeActivated = pObj;
// Always the original object is edited. To allow the TextEdit to happen // where the VirtObj is positioned, on demand an occurring offset is set at // the TextEdit object. That offset is used for creating and managing the // OutlinerView.
Point aNewTextEditOffset(0, 0);
// #i7672# // Since SdrBeginTextEdit actually creates the OutlinerView and thus also // sets the background color, an own background color needs to be set // after TextEditing was started. This is now done here. if(bRet)
{
OutlinerView* pView = pSdrView->GetTextEditOutlinerView();
if(pView)
{
Color aBackground(pSh->GetShapeBackground());
pView->SetBackgroundColor(aBackground);
}
// editing should start at the end of text, spell checking at the beginning ...
ESelection aNewSelection(ESelection::AtEnd()); if (bSetSelectionToStart)
aNewSelection = ESelection(); if (pView)
{
pView->SetSelection(aNewSelection);
if (nCount)
{ for (size_t i = 0; i < nCount; ++i)
{ // Except controls, are still normal draw objects selected?
SdrObject *pSdrObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); if (!pSdrObj) continue;
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.