if ( rName == sUNO_LayerName_background_objects ) return SdResId( STR_LAYER_BCKGRNDOBJ );
if ( rName == sUNO_LayerName_layout ) return SdResId( STR_LAYER_LAYOUT );
if ( rName == sUNO_LayerName_controls ) return SdResId( STR_LAYER_CONTROLS );
if ( rName == sUNO_LayerName_measurelines ) return SdResId( STR_LAYER_MEASURELINES );
return rName;
}
// Use a method name, that is specific to LayerTabBar to make code better readable const OUString & LayerTabBar::GetLayerName(sal_uInt16 nPageId) const
{ return GetAuxiliaryText(nPageId);
}
if (rMEvt.IsLeft())
{
Point aPosPixel = rMEvt.GetPosPixel();
sal_uInt16 aTabId = GetPageId( PixelToLogic(aPosPixel) ); if (aTabId == 0)
{ if (SfxViewFrame* pFrame = pDrViewSh->GetViewFrame())
{
SfxDispatcher* pDispatcher = pFrame->GetDispatcher();
pDispatcher->Execute(SID_INSERTLAYER, SfxCallMode::SYNCHRON);
bSetPageID=true;
}
} elseif (rMEvt.IsMod2())
{ // direct editing of tab text // make sure the clicked tab is the current tab otherwise Edit() acts on the wrong tab if ( aTabId != GetCurPageId())
{
MouseEvent aSyntheticEvent (rMEvt.GetPosPixel(), 1, MouseEventModifiers::SYNTHETIC, MOUSE_LEFT, 0);
TabBar::MouseButtonDown(aSyntheticEvent);
}
} elseif (rMEvt.IsMod1() || rMEvt.IsShift())
{ // keyboard Shortcuts to change layer attributes
SdDrawDocument& rDoc = pView->GetDoc();
SdrLayer* pLayer = rDoc.GetLayerAdmin().GetLayer(aName);
if (pLayer)
{
assert (pDrView && "Change layer attribute undo action is only working with a SdDrawView"); if(pDrView)
{
SfxUndoManager* pManager = rDoc.GetDocSh()->GetUndoManager();
std::unique_ptr<SdLayerModifyUndoAction> pAction(new SdLayerModifyUndoAction(
rDoc,
pLayer,
aName,
pLayer->GetTitle(),
pLayer->GetDescription(),
bOldVisible,
bOldLocked,
bOldPrintable,
aName,
pLayer->GetTitle(),
pLayer->GetDescription(),
bNewVisible,
bNewLocked,
bNewPrintable
));
pManager->AddUndoAction(std::move(pAction));
}
}
// Mark document changed
pView->GetDoc().SetChanged();
}
}
// If you insert a new layer you must not call TabBar::MouseButtonDown(rMEvt); // because you want to activate the new layer if( !bSetPageID )
TabBar::MouseButtonDown(rMEvt);
}
if ( IsRealNameOfStandardLayer(aLayerName))
{ // It is not allowed to change these names
bOK = false;
} else
{
::sd::View* pView = pDrViewSh->GetView();
if ( pView->IsTextEdit() )
{
pView->SdrEndTextEdit();
}
}
return bOK;
}
TabBarAllowRenamingReturnCode LayerTabBar::AllowRenaming()
{ bool bOK = true;
if (aNewName.isEmpty() ||
(rLayerAdmin.GetLayer( aNewName ) && aLayerName != aNewName) )
{ if (SfxViewFrame* pFrame = pDrViewSh->GetViewFrame())
{ // Name already exists.
std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pFrame->GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok,
SdResId(STR_WARN_NAME_DUPLICATE)));
xWarn->run();
bOK = false;
}
}
if (bOK)
{ if ( IsLocalizedNameOfStandardLayer(aNewName) || IsRealNameOfStandardLayer(aNewName) )
{ // Standard layer names may not be changed.
bOK = false;
}
}
return bOK ? TABBAR_RENAMING_YES : TABBAR_RENAMING_NO;
}
OUString aNewName( GetEditText() );
assert (pDrView && "Rename layer undo action is only working with a SdDrawView"); if( pDrView )
{
SfxUndoManager* pManager = rDoc.GetDocSh()->GetUndoManager();
std::unique_ptr<SdLayerModifyUndoAction> pAction(new SdLayerModifyUndoAction(
rDoc,
pLayer,
aLayerName,
pLayer->GetTitle(),
pLayer->GetDescription(),
pDrView->IsLayerVisible(aLayerName),
pDrView->IsLayerLocked(aLayerName),
pDrView->IsLayerPrintable(aLayerName),
aNewName,
pLayer->GetTitle(),
pLayer->GetDescription(),
pDrView->IsLayerVisible(aLayerName),
pDrView->IsLayerLocked(aLayerName),
pDrView->IsLayerPrintable(aLayerName)
));
pManager->AddUndoAction( std::move(pAction) );
}
// First notify View since SetName() calls ResetActualLayer() and // the View then already has to know the Layer
pView->SetActiveLayer(aNewName);
pLayer->SetName(aNewName);
rDoc.SetChanged();
}
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.