/* -*- 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 .
*/
case SID_STYLE_NEW_BY_EXAMPLE:
{ // at the moment, the dialog to enter the name of the template is still opened
SfxStyleSheetBase *p = pSSPool->Find(aStyleName, nFamily ); if(p)
{
pSSPool->Remove(p);
p = nullptr;
}
pStyleSheet = &pSSPool->Make( aStyleName, nFamily, SfxStyleSearchBits::UserDefined );
pStyleSheet->SetParent(SdResId(STR_STANDARD_STYLESHEET_NAME));
} break;
case SID_STYLE_EDIT:
pStyleSheet = pSSPool->Find( aStyleName, nFamily); break;
case SID_STYLE_HIDE: case SID_STYLE_SHOW:
pStyleSheet = pSSPool->Find( aStyleName, nFamily);
pStyleSheet->SetHidden( nSId == SID_STYLE_HIDE );
nRetMask = sal_uInt16(true); break;
case SID_STYLE_APPLY: // apply the template to the document
pStyleSheet = pSSPool->Find( aStyleName, nFamily);
// do not set presentation styles, they will be set implicit if ( pStyleSheet && pStyleSheet->GetFamily() != SfxStyleFamily::Pseudo )
{
SfxStyleSheet* pOldStyleSheet = mpView->GetStyleSheet();
OUString aStr;
if( // if the object had no style sheet, allow all
!pOldStyleSheet ||
// allow if old and new style sheet has same family
pStyleSheet->GetFamily() == pOldStyleSheet->GetFamily() ||
// allow if old was background objects and new is graphics
(pStyleSheet->GetFamily() == SfxStyleFamily::Para && pOldStyleSheet->GetHelpId( aStr ) == HID_PSEUDOSHEET_BACKGROUNDOBJECTS) ||
// allow if old was presentation and we are a drawing document
(pOldStyleSheet->GetFamily() == SfxStyleFamily::Page && mrDoc.GetDocumentType() == DocumentType::Draw) )
{
mpView->SetStyleSheet( static_cast<SfxStyleSheet*>(pStyleSheet));
mrDoc.SetChanged();
mrViewShell.GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
}
} break;
case SID_STYLE_WATERCAN:
{ if (SdModule* mod = SdModule::get(); !mod->GetWaterCan())
{ if (pArgs && pArgs->GetItemState( nSId ) == SfxItemState::SET)
{
aStyleName = static_cast<const SfxStringItem &>( pArgs->Get( nSId ) ).GetValue();
mod->SetWaterCan(true);
pStyleSheet = pSSPool->Find( aStyleName, nFamily);
} // no presentation object templates, they are only allowed implicitly if( pStyleSheet && pStyleSheet->GetFamily() != SfxStyleFamily::Pseudo )
{ static_cast<SdStyleSheetPool*>( pSSPool )->SetActualStyleSheet( pStyleSheet );
// we switch explicitly into selection mode
mrViewShell.GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_SELECT,
SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
} else
mod->SetWaterCan(false);
} else
{
mod->SetWaterCan(false); // we have to re-enable to tools-bar
mrViewShell.Invalidate();
}
} break;
default: break;
}
switch( nSId )
{ case SID_STYLE_NEW: case SID_STYLE_EDIT:
{
PresentationObjects ePO = PresentationObjects::Outline_1;
switch( nResult )
{ case RET_OK:
{
nRetMask = static_cast<sal_uInt16>(pStyleSheet->GetMask());
if (eFamily == SfxStyleFamily::Pseudo)
{
SfxItemSet aTempSet(*pOutSet); /* Extract SvxBrushItem out of set and insert SvxColorItem */ const SvxBrushItem* pBrushItem = aTempSet.GetItem<SvxBrushItem>( SID_ATTR_BRUSH_CHAR );
/* Special treatment: reset the INVALIDS to NULL-Pointer (otherwise INVALIDs or pointer point to DefaultItems in the template; both would
prevent the attribute inheritance) */
aTempSet.ClearInvalidItems();
// EE_PARA_NUMBULLET item is only valid in first outline template if( (ePO >= PresentationObjects::Outline_2) && (ePO <= PresentationObjects::Outline_9) )
{ const SvxNumBulletItem* pBulletItem = nullptr; if (aTempSet.GetItemState(EE_PARA_NUMBULLET, true, &pBulletItem) == SfxItemState::SET)
{
SvxNumRule aRule(pBulletItem->GetNumRule());
/* apply template (but not when somebody is editing a text. To do this, the edit engine had to be capable to use
templates on a character level. */ if (!mpView->GetTextEditObject())
{
mpView->SetStyleSheet( static_cast<SfxStyleSheet*>(pStyleSheet));
}
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.