Files
libreoffice/sd/source/ui/func/futempl.cxx

650 lines
26 KiB
C++
Raw Normal View History

/* -*- 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 .
*/
2000-09-18 16:07:07 +00:00
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
2000-09-18 16:07:07 +00:00
#include <futempl.hxx>
#include <editeng/editdata.hxx>
#include <editeng/bulletitem.hxx>
#include <svx/svxids.hrc>
2000-09-18 16:07:07 +00:00
#include <sfx2/bindings.hxx>
#include <svl/aeitem.hxx>
2000-09-18 16:07:07 +00:00
#include <sfx2/dispatch.hxx>
#include <editeng/eeitem.hxx>
2000-09-18 16:07:07 +00:00
#include <sfx2/request.hxx>
#include <sfx2/sfxdlg.hxx>
#include <editeng/numitem.hxx>
#include <editeng/editeng.hxx>
#include <editeng/lrspitem.hxx>
#include <svx/svdopage.hxx>
#include <editeng/colritem.hxx>
#include <editeng/brushitem.hxx>
#include <svx/svditer.hxx>
#include <svx/sdr/properties/properties.hxx>
2000-09-18 16:07:07 +00:00
#include <sfx2/viewfrm.hxx>
#include <svx/xlndsit.hxx>
#include <svx/xlnstit.hxx>
#include <svx/xlnedit.hxx>
#include <app.hrc>
#include <stlsheet.hxx>
#include <sdpage.hxx>
#include <stlpool.hxx>
#include <sdmod.hxx>
#include <View.hxx>
#include <Window.hxx>
#include <drawview.hxx>
#include <drawdoc.hxx>
#include <DrawDocShell.hxx>
#include <DrawViewShell.hxx>
#include <ViewShell.hxx>
migrate to boost::gettext * all .ui files go from <interface> to <interface domain="MODULE"> e.g. vcl * all .src files go away and the english source strings folded into the .hrc as NC_("context", "source string") * ResMgr is dropped in favour of std::locale imbued by boost::locale::generator pointed at matching MODULE .mo files * UIConfig translations are folded into the module .mo, so e.g. UIConfig_cui goes from l10n target to normal one, so the res/lang.zips of UI files go away * translation via Translation::get(hrc-define-key, imbued-std::locale) * python can now be translated with its inbuilt gettext support (we keep the name strings.hrc there to keep finding the .hrc file uniform) so magic numbers can go away there * java and starbasic components can be translated via the pre-existing css.resource.StringResourceWithLocation mechanism * en-US res files go away, their strings are now the .hrc keys in the source code * remaining .res files are replaced by .mo files * in .res/.ui-lang-zip files, the old scheme missing translations of strings results in inserting the english original so something can be found, now the standard fallback of using the english original from the source key is used, so partial translations shrink dramatically in size * extract .hrc strings with hrcex which backs onto xgettext -C --add-comments --keyword=NC_:1c,2 --from-code=UTF-8 --no-wrap * extract .ui strings with uiex which backs onto xgettext --add-comments --no-wrap * qtz for gettext translations is generated at runtime as ascii-ified crc32 of content + "|" + msgid * [API CHANGE] remove deprecated binary .res resouce loader related uno apis com::sun::star::resource::OfficeResourceLoader com::sun::star::resource::XResourceBundleLoader com::sun::star::resource::XResourceBundle when translating strings via uno apis com.sun.star.resource.StringResourceWithLocation can continue to be used Change-Id: Ia2594a2672b7301d9c3421fdf31b6cfe7f3f8d0a
2017-06-11 20:56:30 +01:00
#include <strings.hrc>
#include <prlayout.hxx>
2012-02-12 19:18:44 +01:00
#include <svx/xfillit.hxx>
#include <sdresid.hxx>
#include <OutlineView.hxx>
#include <OutlineViewShell.hxx>
#include <helpids.h>
#include <sdabstdlg.hxx>
#include <memory>
using namespace com::sun::star::uno;
using namespace com::sun::star::container;
using namespace com::sun::star::beans;
using namespace com::sun::star::style;
namespace sd
{
2000-09-18 16:07:07 +00:00
FuTemplate::FuTemplate (
ViewShell* pViewSh,
::sd::Window* pWin,
::sd::View* pView,
SdDrawDocument* pDoc,
SfxRequest& rReq )
: FuPoor( pViewSh, pWin, pView, pDoc, rReq )
{
}
rtl::Reference<FuPoor> FuTemplate::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
{
rtl::Reference<FuPoor> xFunc( new FuTemplate( pViewSh, pWin, pView, pDoc, rReq ) );
xFunc->DoExecute(rReq);
return xFunc;
}
void FuTemplate::DoExecute( SfxRequest& rReq )
2000-09-18 16:07:07 +00:00
{
const SfxItemSet* pArgs = rReq.GetArgs();
sal_uInt16 nSId = rReq.GetSlot();
2000-09-18 16:07:07 +00:00
// get StyleSheet parameter
SfxStyleSheetBasePool* pSSPool = mpDoc->GetDocSh()->GetStyleSheetPool();
SfxStyleSheetBase* pStyleSheet = nullptr;
2000-09-18 16:07:07 +00:00
const SfxPoolItem* pItem;
SfxStyleFamily nFamily = SfxStyleFamily(USHRT_MAX);
if( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY,
false, &pItem ))
{
nFamily = static_cast<SfxStyleFamily>( pArgs->Get( SID_STYLE_FAMILY ).GetValue());
}
else if( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILYNAME,
false, &pItem ))
{
OUString sFamily = pArgs->Get( SID_STYLE_FAMILYNAME ).GetValue();
if (sFamily == "graphics")
nFamily = SfxStyleFamily::Para;
else
nFamily = SfxStyleFamily::Pseudo;
}
OUString aStyleName;
sal_uInt16 nRetMask = static_cast<sal_uInt16>(SfxStyleSearchBits::All);
2000-09-18 16:07:07 +00:00
switch( nSId )
2000-09-18 16:07:07 +00:00
{
case SID_STYLE_APPLY:
case SID_STYLE_EDIT:
case SID_STYLE_DELETE:
case SID_STYLE_HIDE:
case SID_STYLE_SHOW:
2000-09-18 16:07:07 +00:00
case SID_STYLE_FAMILY:
case SID_STYLE_NEW_BY_EXAMPLE:
{
const SfxStringItem* pNameItem = rReq.GetArg<SfxStringItem>(SID_APPLY_STYLE);
const SfxStringItem* pFamilyItem = rReq.GetArg<SfxStringItem>(SID_STYLE_FAMILYNAME);
if ( pFamilyItem && pNameItem )
{
try
{
Reference< XStyleFamiliesSupplier > xModel(mpDoc->GetDocSh()->GetModel(), UNO_QUERY_THROW );
Reference< XNameAccess > xCont( xModel->getStyleFamilies() );
Reference< XNameAccess > xStyles( xCont->getByName(pFamilyItem->GetValue()), UNO_QUERY_THROW );
Reference< XPropertySet > xInfo( xStyles->getByName( pNameItem->GetValue() ), UNO_QUERY_THROW );
OUString aUIName;
xInfo->getPropertyValue( "DisplayName" ) >>= aUIName;
if ( !aUIName.isEmpty() )
rReq.AppendItem( SfxStringItem( nSId, aUIName ) );
}
catch( Exception& )
{
}
}
if (pArgs && pArgs->GetItemState(nSId) == SfxItemState::SET)
aStyleName = static_cast<const SfxStringItem &>( pArgs->Get( nSId ) ).GetValue();
2000-09-18 16:07:07 +00:00
}
}
switch( nSId )
2000-09-18 16:07:07 +00:00
{
case SID_STYLE_NEW:
{
SfxStyleSheetBase *p = pSSPool->Find(aStyleName, nFamily );
2000-09-18 16:07:07 +00:00
if(p)
{
pSSPool->Remove(p);
p = nullptr;
2000-09-18 16:07:07 +00:00
}
pStyleSheet = &pSSPool->Make( aStyleName, nFamily, SfxStyleSearchBits::UserDefined );
2000-09-18 16:07:07 +00:00
if (pArgs && pArgs->GetItemState(SID_STYLE_REFERENCE) == SfxItemState::SET)
2000-09-18 16:07:07 +00:00
{
OUString aParentName( pArgs->Get(SID_STYLE_REFERENCE).GetValue());
2000-09-18 16:07:07 +00:00
pStyleSheet->SetParent(aParentName);
}
else
{
pStyleSheet->SetParent(SdResId(STR_STANDARD_STYLESHEET_NAME));
2000-09-18 16:07:07 +00:00
}
}
break;
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));
2000-09-18 16:07:07 +00:00
}
break;
case SID_STYLE_EDIT:
pStyleSheet = pSSPool->Find( aStyleName, nFamily);
2000-09-18 16:07:07 +00:00
break;
case SID_STYLE_DELETE:
pStyleSheet = pSSPool->Find( aStyleName, nFamily);
2000-09-18 16:07:07 +00:00
if( pStyleSheet )
{
pSSPool->Remove( pStyleSheet );
nRetMask = sal_uInt16(true);
mpDoc->SetChanged();
2000-09-18 16:07:07 +00:00
}
else
{
nRetMask = sal_uInt16(false);
}
2000-09-18 16:07:07 +00:00
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;
2000-09-18 16:07:07 +00:00
case SID_STYLE_APPLY:
// apply the template to the document
pStyleSheet = pSSPool->Find( aStyleName, nFamily);
2000-09-18 16:07:07 +00:00
// do not set presentation styles, they will be set implicit
if ( pStyleSheet && pStyleSheet->GetFamily() != SfxStyleFamily::Pseudo )
2000-09-18 16:07:07 +00:00
{
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 && mpDoc->GetDocumentType() == DocumentType::Draw) )
2000-09-18 16:07:07 +00:00
{
mpView->SetStyleSheet( static_cast<SfxStyleSheet*>(pStyleSheet));
mpDoc->SetChanged();
mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
2000-09-18 16:07:07 +00:00
}
}
break;
case SID_STYLE_WATERCAN:
{
if( !SD_MOD()->GetWaterCan() )
{
if (pArgs && pArgs->GetItemState( nSId ) == SfxItemState::SET)
2000-09-18 16:07:07 +00:00
{
aStyleName = static_cast<const SfxStringItem &>( pArgs->Get( nSId ) ).GetValue();
SD_MOD()->SetWaterCan( true );
pStyleSheet = pSSPool->Find( aStyleName, nFamily);
2000-09-18 16:07:07 +00:00
}
// no presentation object templates, they are only allowed implicitly
if( pStyleSheet && pStyleSheet->GetFamily() != SfxStyleFamily::Pseudo )
2000-09-18 16:07:07 +00:00
{
static_cast<SdStyleSheetPool*>( pSSPool )->SetActualStyleSheet( pStyleSheet );
2000-09-18 16:07:07 +00:00
// we switch explicitly into selection mode
mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_SELECT,
SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
2000-09-18 16:07:07 +00:00
}
else
SD_MOD()->SetWaterCan( false );
2000-09-18 16:07:07 +00:00
}
else
{
SD_MOD()->SetWaterCan( false );
// we have to re-enable to tools-bar
mpViewShell->Invalidate();
2000-09-18 16:07:07 +00:00
}
}
break;
default:
break;
}
switch( nSId )
2000-09-18 16:07:07 +00:00
{
case SID_STYLE_NEW:
case SID_STYLE_EDIT:
{
PresentationObjects ePO = PO_OUTLINE_1;
2000-09-18 16:07:07 +00:00
if( pStyleSheet )
{
ScopedVclPtr<SfxAbstractTabDialog> pStdDlg;
ScopedVclPtr<SfxAbstractTabDialog> pPresDlg;
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
bool bOldDocInOtherLanguage = false;
2000-09-18 16:07:07 +00:00
SfxStyleFamily eFamily = pStyleSheet->GetFamily();
if (eFamily == SfxStyleFamily::Para)
2000-09-18 16:07:07 +00:00
{
pStdDlg.disposeAndReset(pFact ? pFact->CreateSdTabTemplateDlg(mpViewShell->GetActiveWindow(), mpDoc->GetDocSh(), *pStyleSheet, mpDoc, mpView) : nullptr);
2000-09-18 16:07:07 +00:00
}
else if (eFamily == SfxStyleFamily::Pseudo)
2000-09-18 16:07:07 +00:00
{
OUString aName(pStyleSheet->GetName());
bool bBackground = false;
2000-09-18 16:07:07 +00:00
if (aName == SdResId(STR_PSEUDOSHEET_TITLE))
2000-09-18 16:07:07 +00:00
{
ePO = PO_TITLE;
}
else if (aName == SdResId(STR_PSEUDOSHEET_SUBTITLE))
2000-09-18 16:07:07 +00:00
{
ePO = PO_SUBTITLE;
}
else if (aName ==
SdResId(STR_PSEUDOSHEET_BACKGROUND))
2000-09-18 16:07:07 +00:00
{
bBackground = true;
2000-09-18 16:07:07 +00:00
ePO = PO_BACKGROUND;
}
else if (aName ==
SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS))
2000-09-18 16:07:07 +00:00
{
ePO = PO_BACKGROUNDOBJECTS;
}
else if (aName ==
SdResId(STR_PSEUDOSHEET_NOTES))
2000-09-18 16:07:07 +00:00
{
ePO = PO_NOTES;
}
else if(aName.indexOf(SdResId(STR_PSEUDOSHEET_OUTLINE)) != -1)
2000-09-18 16:07:07 +00:00
{
OUString aOutlineStr(SdResId(STR_PSEUDOSHEET_OUTLINE));
// determine number, mind the blank between name and number
OUString aNumStr(aName.copy(aOutlineStr.getLength() + 1));
sal_uInt16 nLevel = static_cast<sal_uInt16>(aNumStr.toInt32());
2000-09-18 16:07:07 +00:00
switch (nLevel)
{
case 1: ePO = PO_OUTLINE_1; break;
case 2: ePO = PO_OUTLINE_2; break;
case 3: ePO = PO_OUTLINE_3; break;
case 4: ePO = PO_OUTLINE_4; break;
case 5: ePO = PO_OUTLINE_5; break;
case 6: ePO = PO_OUTLINE_6; break;
case 7: ePO = PO_OUTLINE_7; break;
case 8: ePO = PO_OUTLINE_8; break;
case 9: ePO = PO_OUTLINE_9; break;
}
}
else
{
OSL_FAIL("StyleSheet from older version with different language");
bOldDocInOtherLanguage = true;
2000-09-18 16:07:07 +00:00
}
if( !bOldDocInOtherLanguage )
{
pPresDlg.disposeAndReset(pFact ? pFact->CreateSdPresLayoutTemplateDlg( mpDocSh, mpViewShell->GetActiveWindow(), bBackground, *pStyleSheet, ePO, pSSPool ) : nullptr);
}
2000-09-18 16:07:07 +00:00
}
sal_uInt16 nResult = RET_CANCEL;
const SfxItemSet* pOutSet = nullptr;
2000-09-18 16:07:07 +00:00
if (pStdDlg)
{
nResult = pStdDlg->Execute();
pOutSet = pStdDlg->GetOutputItemSet();
}
else if( pPresDlg )
{
nResult = pPresDlg->Execute();
pOutSet = pPresDlg->GetOutputItemSet();
}
switch( nResult )
{
case RET_OK:
{
nRetMask = static_cast<sal_uInt16>(pStyleSheet->GetMask());
2000-09-18 16:07:07 +00:00
if (eFamily == SfxStyleFamily::Pseudo)
2000-09-18 16:07:07 +00:00
{
SfxItemSet aTempSet(*pOutSet);
/* Extract SvxBrushItem out of set and insert SvxBackgroundColorItem */
const SvxBrushItem* pBrushItem = aTempSet.GetItem<SvxBrushItem>( SID_ATTR_BRUSH_CHAR );
2000-09-18 16:07:07 +00:00
if ( pBrushItem )
{
SvxBackgroundColorItem aBackColorItem(pBrushItem->GetColor(), EE_CHAR_BKGCOLOR);
aTempSet.ClearItem( EE_CHAR_BKGCOLOR );
aTempSet.Put( aBackColorItem );
}
static_cast<SdStyleSheet*>(pStyleSheet)->AdjustToFontHeight(aTempSet);
/* Special treatment: reset the INVALIDS to
NULL-Pointer (otherwise INVALIDs or pointer point
to DefaultItems in the template; both would
prevent the attribute inheritance) */
2000-09-18 16:07:07 +00:00
aTempSet.ClearInvalidItems();
// EE_PARA_NUMBULLET item is only valid in first outline template
if( (ePO >= PO_OUTLINE_2) && (ePO <= PO_OUTLINE_9) )
2000-09-18 16:07:07 +00:00
{
if (aTempSet.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET)
{
SvxNumRule aRule(*aTempSet.GetItem<SvxNumBulletItem>(EE_PARA_NUMBULLET)->GetNumRule());
2000-09-18 16:07:07 +00:00
OUString sStyleName(SdResId(STR_PSEUDOSHEET_OUTLINE) + " 1");
SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( sStyleName, SfxStyleFamily::Pseudo);
2000-09-18 16:07:07 +00:00
if(pFirstStyleSheet)
{
pFirstStyleSheet->GetItemSet().Put( SvxNumBulletItem( aRule, EE_PARA_NUMBULLET ));
SdStyleSheet* pRealSheet = static_cast<SdStyleSheet*>(pFirstStyleSheet)->GetRealStyleSheet();
pRealSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
}
2000-09-18 16:07:07 +00:00
aTempSet.ClearItem( EE_PARA_NUMBULLET );
}
2000-09-18 16:07:07 +00:00
}
pStyleSheet->GetItemSet().Put(aTempSet);
SdStyleSheet::BroadcastSdStyleSheetChange(pStyleSheet, ePO, pSSPool);
2000-09-18 16:07:07 +00:00
}
SfxItemSet& rAttr = pStyleSheet->GetItemSet();
sdr::properties::CleanupFillProperties( rAttr );
// check for unique names of named items for xml
if( rAttr.GetItemState( XATTR_FILLBITMAP ) == SfxItemState::SET )
{
const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLBITMAP );
SfxPoolItem* pNewItem = static_cast<const XFillBitmapItem*>(pOldItem)->checkForUniqueItem( mpDoc );
if( pNewItem )
{
rAttr.Put( *pNewItem );
delete pNewItem;
}
}
if( rAttr.GetItemState( XATTR_LINEDASH ) == SfxItemState::SET )
{
const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEDASH );
SfxPoolItem* pNewItem = static_cast<const XLineDashItem*>(pOldItem)->checkForUniqueItem( mpDoc );
if( pNewItem )
{
rAttr.Put( *pNewItem );
delete pNewItem;
}
}
if( rAttr.GetItemState( XATTR_LINESTART ) == SfxItemState::SET )
{
const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINESTART );
SfxPoolItem* pNewItem = static_cast<const XLineStartItem*>(pOldItem)->checkForUniqueItem( mpDoc );
if( pNewItem )
{
rAttr.Put( *pNewItem );
delete pNewItem;
}
}
if( rAttr.GetItemState( XATTR_LINEEND ) == SfxItemState::SET )
{
const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEEND );
SfxPoolItem* pNewItem = static_cast<const XLineEndItem*>(pOldItem)->checkForUniqueItem( mpDoc );
if( pNewItem )
{
rAttr.Put( *pNewItem );
delete pNewItem;
}
}
if( rAttr.GetItemState( XATTR_FILLGRADIENT ) == SfxItemState::SET )
{
const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLGRADIENT );
SfxPoolItem* pNewItem = static_cast<const XFillGradientItem*>(pOldItem)->checkForUniqueItem( mpDoc );
if( pNewItem )
{
rAttr.Put( *pNewItem );
delete pNewItem;
}
}
if( rAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SfxItemState::SET )
{
const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLFLOATTRANSPARENCE );
SfxPoolItem* pNewItem = static_cast<const XFillFloatTransparenceItem*>(pOldItem)->checkForUniqueItem( mpDoc );
if( pNewItem )
{
rAttr.Put( *pNewItem );
delete pNewItem;
}
}
if( rAttr.GetItemState( XATTR_FILLHATCH ) == SfxItemState::SET )
{
const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLHATCH );
SfxPoolItem* pNewItem = static_cast<const XFillHatchItem*>(pOldItem)->checkForUniqueItem( mpDoc );
if( pNewItem )
{
rAttr.Put( *pNewItem );
delete pNewItem;
}
}
static_cast<SfxStyleSheet*>( pStyleSheet )->Broadcast( SfxHint( SfxHintId::DataChanged ) );
DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( mpViewShell );
if( pDrawViewShell )
{
PageKind ePageKind = pDrawViewShell->GetPageKind();
if( ePageKind == PageKind::Notes || ePageKind == PageKind::Handout )
{
SdPage* pPage = mpViewShell->GetActualPage();
if(pDrawViewShell->GetEditMode() == EditMode::MasterPage)
{
pPage = static_cast<SdPage*>((&(pPage->TRG_GetMasterPage())));
}
if( pPage )
{
SOSAW080: Derive SdrObjGroup from SdrObjList Also simplify parent/child relationships, get rid of double data (SdrPage/Parent infos in SdrObjects, also in SdrObjList). This is all not needed - when a SdrObject is inserted to a SdrPage, get SdrPage by traveling over parents (no double info, member as soon as inserted, ...). More cleanups/reworks included, will need some more cleanups, too. Stabilizing: SetRectsDirty/DefaultStyleSheet Had to correct the SetRectsDirty stuff for 3D due to going down the hierarchy while the 2D implementation goes the other direction -> endless loops. Added special handling for 3D stuff for now (will be chnaged again when SnapRect is no longer needed at SdrObject level). Also had to adapt how the DefaultStyleSheet is set at incarnated SdrObjects - better: their properties. Since we now always have a SdrModel, it is possible to correctly initialize with the correct default StyleSheet from that SdrModel. This needs to be done after ForceDefaultAttributes and in a way that again deletes Items that are set in the StyleSheet. This leads to an error in CppunitTest_sd_import_tests where I checked tdf100491 - it is okay and thus I change the control instance of the imported, XML-dumped file. The less hard attributes, the better for Styles in general. Cleanup of comments for last two commits Corrected SvxShape::getParent() Needed to get the direct parent, so test for SdrObject first (to get SdrObjGroup/E3DScene), for SdrPage second Fixed CppunitTest_sc_subsequent_export_test Several problems arose. The used SdrCaptionObj was Cloned, but the clone not inserted to a SdrPage. This leads to not being able to access a UNO API imlementation of the SdrPage (SvxPage) on lower levels. It worked before due to SdrObject having a SdrPage* additionally to being added to a SdrPage - this is exactly the main cleanup this change does. Looked for why it is cloned, could see no reasons. The SdrCaptionObj exists during all im/export, not difference to other SdrObjects (that do not get cloned). It is not changed in any way. It *might* be to suppress a crash that happened due to UNO API Service emfio/emfio not being available in the UnitTest scenario. Interestingly it did not crash with the cloned SdrCaptionObj, but the Graphic exported was probably wrong. Fixed by no longer Cloning the SdrCaptionObj and adding emfio/emfio UNO API Service. d139f821a5b39535a3e7b9c6261df7e18f8ae8ac 910e7f4bc628a715fda7545dffaf3369d5e76ea0 ca1de01b723051e09ac37d7ec7bba978beea41c5 3a76da1471dfe75e69847f64a6a3519ad21c8c9c Change-Id: I986586e326b563acebf00d931a7084c6eb09e5f8 Reviewed-on: https://gerrit.libreoffice.org/54689 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
2018-04-16 22:34:50 +02:00
SdrObjListIter aIter( pPage );
while( aIter.IsMore() )
{
SdrObject* pObj = aIter.Next();
if( dynamic_cast< const SdrPageObj *>( pObj ) != nullptr )
{
// repaint only
pObj->ActionChanged();
// pObj->SendRepaintBroadcast();
}
}
}
}
}
if( mpDoc->GetOnlineSpell() )
2001-11-23 10:29:44 +00:00
{
const SfxPoolItem* pTempItem;
if( SfxItemState::SET == rAttr.GetItemState(EE_CHAR_LANGUAGE, false, &pTempItem ) ||
SfxItemState::SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CJK, false, &pTempItem ) ||
SfxItemState::SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CTL, false, &pTempItem ) )
2001-11-23 10:29:44 +00:00
{
mpDoc->StopOnlineSpelling();
mpDoc->StartOnlineSpelling();
2001-11-23 10:29:44 +00:00
}
}
mpDoc->SetChanged();
2000-09-18 16:07:07 +00:00
}
break;
default:
{
if( nSId == SID_STYLE_NEW )
pSSPool->Remove( pStyleSheet );
2000-09-18 16:07:07 +00:00
}
return; // Cancel
2000-09-18 16:07:07 +00:00
}
}
}
break;
case SID_STYLE_NEW_BY_EXAMPLE:
{
if( pStyleSheet )
{
nRetMask = static_cast<sal_uInt16>(pStyleSheet->GetMask());
SfxItemSet aCoreSet( mpDoc->GetPool() );
mpView->GetAttributes( aCoreSet, true );
2000-09-18 16:07:07 +00:00
// if the object had a template, this becomes parent of the new template
SfxStyleSheet* pOldStyle = mpView->GetStyleSheet();
2000-09-18 16:07:07 +00:00
// if pOldStyle == pStyleSheet -> recursion
2000-09-18 16:07:07 +00:00
if( pOldStyle != pStyleSheet )
{
if (pOldStyle)
{
pStyleSheet->SetParent(pOldStyle->GetName());
}
SfxItemSet* pStyleSet = &pStyleSheet->GetItemSet();
pStyleSet->Put(aCoreSet);
/* 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())
2000-09-18 16:07:07 +00:00
{
mpView->SetStyleSheet( static_cast<SfxStyleSheet*>(pStyleSheet));
2000-09-18 16:07:07 +00:00
}
static_cast<SfxStyleSheet*>( pStyleSheet )->Broadcast( SfxHint( SfxHintId::DataChanged ) );
mpDoc->SetChanged();
2000-09-18 16:07:07 +00:00
mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
2000-09-18 16:07:07 +00:00
}
}
}
break;
case SID_STYLE_UPDATE_BY_EXAMPLE:
{
CWS-TOOLING: integrate CWS impress172 2009-07-30 15:29:39 +0200 cl r274492 : #i102921# remove reference to inssrc.obj which was moved to svx 2009-07-29 11:40:35 +0200 wg r274445 : i103869 2009-07-22 14:39:13 +0200 sj r274241 : #i102713# fixed cloud shape 2009-07-07 15:28:04 +0200 sj r273800 : fixed build problem 2009-07-07 13:27:13 +0200 cl r273792 : #i102921# moved insert col/rows dialog to svx 2009-07-07 10:36:05 +0200 cl r273782 : fixed compiler warnings 2009-07-02 10:40:21 +0200 sj r273626 : fixed build problem 2009-07-02 10:27:56 +0200 cl r273624 : fixed merge problem 2009-07-02 10:27:19 +0200 cl r273623 : fixed compiler warning 2009-07-01 10:04:58 +0200 cl r273550 : CWS-TOOLING: rebase CWS impress172 to trunk@273468 (milestone: DEV300:m51) 2009-06-30 16:22:02 +0200 cl r273518 : #i102921# added insert table row/col dialog for impress tables 2009-06-30 16:20:46 +0200 cl r273517 : #i102921# added insert table row/col dialog for impress tables 2009-06-30 16:20:28 +0200 cl r273516 : #i102921# added insert table row/col dialog for impress tables 2009-06-30 16:19:49 +0200 cl r273515 : #i102921# added insert table row/col dialog for impress tables 2009-06-30 16:19:28 +0200 cl r273514 : #i102921# added insert table row/col dialog for impress tables 2009-06-30 16:17:38 +0200 cl r273513 : #i102921# added insert table row/col dialog for impress tables 2009-06-30 15:45:44 +0200 cl r273511 : #i102921# added insert table row/col dialog for impress tables 2009-06-30 15:37:16 +0200 cl r273510 : #i102921# added insert table row/col dialog for impress tables 2009-06-30 15:33:47 +0200 cl r273509 : #i102921# added insert table row/col dialog for impress tables 2009-06-30 15:32:10 +0200 cl r273508 : #i102921# added insert table row/col dialog for impress tables 2009-06-30 15:30:05 +0200 cl r273507 : #i102921# added insert table row/col dialog for impress tables 2009-06-29 12:32:42 +0200 sj r273465 : #158632# fixed textrange hyperlinks to specific pages, added slide names 2009-06-24 15:17:59 +0200 sj r273349 : #158636# fixed text range hyperlink to first/last slide 2009-06-22 13:18:30 +0200 sj r273224 : #158651# fixed header footer import 2009-06-19 15:18:24 +0200 sj r273160 : #158614# default text of presentation objects now cleared 2009-06-16 15:54:19 +0200 sj r273023 : #i101545# fixed crash - bracketing of graphic links has been done twice leading to a broken graphic state stack 2009-06-15 16:26:26 +0200 sj r272998 : #158635# importing bookmark interactions: firstslide, lastslide, nextslide, previousslide 2009-06-15 16:25:26 +0200 sj r272997 : #158635# added bookmark interactions: firstslide, lastslide, nextslide, previousslide 2009-06-12 13:17:32 +0200 sj r272915 : #i102713# fixed cloud shape 2009-06-10 18:36:58 +0200 sj r272833 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow 2009-06-08 19:52:28 +0200 sj r272746 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow 2009-06-04 15:28:32 +0200 cl r272640 : #i102358# applied patch to remove warnings 2009-06-04 14:39:45 +0200 cl r272630 : #i99423# applied path to change impress wizard create button to open when opening exisitng documents 2009-06-03 18:21:26 +0200 sj r272601 : #158635# now using the correct paragraph bottom spacing. using font independent linespacing for impress text objects 2009-06-03 15:47:27 +0200 cl r272583 : #i101817# added color collection based on scribus 2009-06-03 14:43:59 +0200 cl r272580 : #i102163# use weak ref to SdrObject instead of listening to the model 2009-06-03 12:39:29 +0200 cl r272556 : #i93308# correct namespace for com.sun.star.text.textfields 2009-06-03 12:27:00 +0200 cl r272555 : #i93308# correct namespace for com.sun.star.text.textfields 2009-06-03 11:33:44 +0200 cl r272553 : #i23221# allow all settings (that make sense) for presentation styles 2009-06-03 11:30:59 +0200 cl r272552 : #i23221# allow all settings (that make sense) for presentation styles 2009-06-03 11:30:22 +0200 cl r272551 : #i23221# allow all settings (that make sense) for presentation styles 2009-06-02 18:41:07 +0200 sj r272527 : #i28358# applied patch (better conversion of dotted lines) 2009-06-02 11:52:13 +0200 cl r272491 : #i98668# applied patch to fix possible endless loop if exception occours 2009-05-28 17:02:55 +0200 sj r272416 : #i102336# retaining graphic file names unchanged 2009-05-28 17:00:25 +0200 sj r272415 : #i102336# retaining graphic file names unchanged 2009-05-28 17:00:10 +0200 sj r272414 : #i102336# retaining graphic file names unchanged 2009-05-25 12:43:58 +0200 sj r272232 : #i102069# added patch from thb (fixed rotated group objects)
2009-08-05 17:01:07 +00:00
if ((mpView->AreObjectsMarked() && mpView->GetMarkedObjectList().GetMarkCount() == 1) ||
dynamic_cast< const OutlineView *>( mpView ) != nullptr)
2000-09-18 16:07:07 +00:00
{
pStyleSheet = mpView->GetStyleSheet();
2000-09-18 16:07:07 +00:00
if( pStyleSheet )
{
nRetMask = static_cast<sal_uInt16>(pStyleSheet->GetMask());
SfxItemSet aCoreSet( mpDoc->GetPool() );
mpView->GetAttributes( aCoreSet );
2000-09-18 16:07:07 +00:00
SfxItemSet* pStyleSet = &pStyleSheet->GetItemSet();
pStyleSet->Put( aCoreSet );
mpView->SetStyleSheet( static_cast<SfxStyleSheet*>(pStyleSheet));
2000-09-18 16:07:07 +00:00
static_cast<SfxStyleSheet*>( pStyleSheet )->Broadcast( SfxHint( SfxHintId::DataChanged ) );
mpDoc->SetChanged();
mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
2000-09-18 16:07:07 +00:00
}
}
}
break;
}
if( nRetMask != static_cast<sal_uInt16>(SfxStyleSearchBits::All) )
rReq.SetReturnValue( SfxUInt16Item( nSId, nRetMask ) );
2000-09-18 16:07:07 +00:00
}
void FuTemplate::Activate()
{
}
void FuTemplate::Deactivate()
{
}
2000-09-18 16:07:07 +00:00
} // end of namespace sd
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */