LCOV - code coverage report
Current view: top level - sd/source/ui/func - futempl.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 298 0.0 %
Date: 2014-04-14 Functions: 0 12 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      21             : #include <com/sun/star/beans/XPropertySet.hpp>
      22             : #include <com/sun/star/container/XNameAccess.hpp>
      23             : 
      24             : #include "futempl.hxx"
      25             : 
      26             : #include <editeng/editdata.hxx>
      27             : #include <editeng/bulletitem.hxx>
      28             : #include <svx/svxids.hrc>
      29             : #include <sfx2/bindings.hxx>
      30             : #include <svl/aeitem.hxx>
      31             : #include <sfx2/dispatch.hxx>
      32             : #include <vcl/msgbox.hxx>
      33             : #include <editeng/eeitem.hxx>
      34             : #include <sfx2/request.hxx>
      35             : #include <editeng/numitem.hxx>
      36             : #include <editeng/editeng.hxx>
      37             : #include <editeng/lrspitem.hxx>
      38             : #include <svx/svdopage.hxx>
      39             : #include <svx/svditer.hxx>
      40             : #include <svx/sdr/properties/properties.hxx>
      41             : 
      42             : #include <sfx2/viewfrm.hxx>
      43             : #include <svx/xlndsit.hxx>
      44             : #include <svx/xlnstit.hxx>
      45             : #include <svx/xlnedit.hxx>
      46             : #include "app.hrc"
      47             : #include "stlsheet.hxx"
      48             : #include "sdpage.hxx"
      49             : #include "stlpool.hxx"
      50             : #include "sdmod.hxx"
      51             : #include "View.hxx"
      52             : #include "Window.hxx"
      53             : #include "drawview.hxx"
      54             : #include "drawdoc.hxx"
      55             : #include "DrawDocShell.hxx"
      56             : #include "DrawViewShell.hxx"
      57             : #include "ViewShell.hxx"
      58             : #include "res_bmp.hrc"
      59             : #include "glob.hrc"
      60             : #include "prlayout.hxx"
      61             : #include "prltempl.hrc"
      62             : #include <svx/xfillit.hxx>
      63             : #include "sdresid.hxx"
      64             : #include "OutlineViewShell.hxx"
      65             : #include "strings.hrc"
      66             : #include "helpids.h"
      67             : #include "sdabstdlg.hxx"
      68             : 
      69             : using namespace com::sun::star::uno;
      70             : using namespace com::sun::star::container;
      71             : using namespace com::sun::star::beans;
      72             : using namespace com::sun::star::style;
      73             : 
      74             : namespace sd
      75             : {
      76             : 
      77           0 : TYPEINIT1( FuTemplate, FuPoor );
      78             : 
      79           0 : FuTemplate::FuTemplate (
      80             :     ViewShell* pViewSh,
      81             :     ::sd::Window* pWin,
      82             :     ::sd::View* pView,
      83             :     SdDrawDocument* pDoc,
      84             :     SfxRequest& rReq )
      85           0 :     : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
      86             : {
      87           0 : }
      88             : 
      89           0 : rtl::Reference<FuPoor> FuTemplate::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
      90             : {
      91           0 :     rtl::Reference<FuPoor> xFunc( new FuTemplate( pViewSh, pWin, pView, pDoc, rReq ) );
      92           0 :     xFunc->DoExecute(rReq);
      93           0 :     return xFunc;
      94             : }
      95             : 
      96           0 : void FuTemplate::DoExecute( SfxRequest& rReq )
      97             : {
      98           0 :     const SfxItemSet* pArgs = rReq.GetArgs();
      99           0 :     sal_uInt16 nSId = rReq.GetSlot();
     100             : 
     101             :     // get StyleSheet parameter
     102           0 :     SfxStyleSheetBasePool* pSSPool = mpDoc->GetDocSh()->GetStyleSheetPool();
     103           0 :     SfxStyleSheetBase* pStyleSheet = NULL;
     104             : 
     105             :     const SfxPoolItem* pItem;
     106           0 :     sal_uInt16 nFamily = USHRT_MAX;
     107           0 :     if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILY,
     108           0 :         false, &pItem ))
     109             :     {
     110           0 :         nFamily = ( (const SfxUInt16Item &) pArgs->Get( SID_STYLE_FAMILY ) ).GetValue();
     111             :     }
     112           0 :     else if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILYNAME,
     113           0 :         false, &pItem ))
     114             :     {
     115           0 :         OUString sFamily = ( (const SfxStringItem &) pArgs->Get( SID_STYLE_FAMILYNAME ) ).GetValue();
     116           0 :         if (sFamily == "graphics")
     117           0 :             nFamily = SD_STYLE_FAMILY_GRAPHICS;
     118             :         else
     119           0 :             nFamily = SD_STYLE_FAMILY_PSEUDO;
     120             :     }
     121             : 
     122           0 :     OUString aStyleName;
     123           0 :     sal_uInt16 nRetMask = SFXSTYLEBIT_ALL;
     124             : 
     125           0 :     switch( nSId )
     126             :     {
     127             :         case SID_STYLE_APPLY:
     128             :         case SID_STYLE_EDIT:
     129             :         case SID_STYLE_DELETE:
     130             :         case SID_STYLE_HIDE:
     131             :         case SID_STYLE_SHOW:
     132             :         case SID_STYLE_FAMILY:
     133             :         case SID_STYLE_NEW_BY_EXAMPLE:
     134             :         {
     135           0 :             SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_APPLY_STYLE, false );
     136           0 :             SFX_REQUEST_ARG( rReq, pFamilyItem, SfxStringItem, SID_STYLE_FAMILYNAME, false );
     137           0 :             if ( pFamilyItem && pNameItem )
     138             :             {
     139             :                 try
     140             :                 {
     141           0 :                     Reference< XStyleFamiliesSupplier > xModel(mpDoc->GetDocSh()->GetModel(), UNO_QUERY_THROW );
     142           0 :                     Reference< XNameAccess > xCont( xModel->getStyleFamilies() );
     143           0 :                     Reference< XNameAccess > xStyles( xCont->getByName(pFamilyItem->GetValue()), UNO_QUERY_THROW );
     144           0 :                     Reference< XPropertySet > xInfo( xStyles->getByName( pNameItem->GetValue() ), UNO_QUERY_THROW );
     145             : 
     146           0 :                     OUString aUIName;
     147           0 :                     xInfo->getPropertyValue( "DisplayName" ) >>= aUIName;
     148           0 :                     if ( !aUIName.isEmpty() )
     149           0 :                         rReq.AppendItem( SfxStringItem( nSId, aUIName ) );
     150             :                 }
     151           0 :                 catch( Exception& )
     152             :                 {
     153             :                 }
     154             :             }
     155             : 
     156           0 :             if (pArgs->GetItemState(nSId) == SFX_ITEM_SET)
     157           0 :                 aStyleName = ( ( (const SfxStringItem &) pArgs->Get( nSId ) ).GetValue() );
     158             :         }
     159             :     }
     160             : 
     161           0 :     switch( nSId )
     162             :     {
     163             :         case SID_STYLE_NEW:
     164             :         {
     165           0 :             SfxStyleSheetBase *p = pSSPool->Find(aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_ALL );
     166           0 :             if(p)
     167             :             {
     168           0 :                 pSSPool->Remove(p);
     169           0 :                 p = 0;
     170             :             }
     171           0 :             pStyleSheet = &pSSPool->Make( aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_USERDEF );
     172             : 
     173           0 :             if (pArgs->GetItemState(SID_STYLE_REFERENCE) == SFX_ITEM_ON)
     174             :             {
     175           0 :                 OUString aParentName(((const SfxStringItem&) pArgs->Get(SID_STYLE_REFERENCE)).GetValue());
     176           0 :                 pStyleSheet->SetParent(aParentName);
     177             :             }
     178             :             else
     179             :             {
     180           0 :                 pStyleSheet->SetParent(SD_RESSTR(STR_STANDARD_STYLESHEET_NAME));
     181             :             }
     182             :         }
     183           0 :         break;
     184             : 
     185             :         case SID_STYLE_NEW_BY_EXAMPLE:
     186             :         {
     187             :             // at the moment, the dialog to enter the name of the template is still opened
     188           0 :             mpView->AreObjectsMarked();
     189           0 :                 SfxStyleSheetBase *p = pSSPool->Find(aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_ALL );
     190           0 :                 if(p)
     191             :                 {
     192           0 :                     pSSPool->Remove(p);
     193           0 :                     p = 0;
     194             :                 }
     195           0 :                 pStyleSheet = &pSSPool->Make( aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_USERDEF );
     196           0 :                 pStyleSheet->SetParent(SD_RESSTR(STR_STANDARD_STYLESHEET_NAME));
     197             :         }
     198           0 :         break;
     199             : 
     200             :         case SID_STYLE_EDIT:
     201           0 :             pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
     202           0 :         break;
     203             : 
     204             :         case SID_STYLE_DELETE:
     205           0 :             pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
     206           0 :             if( pStyleSheet )
     207             :             {
     208           0 :                 pSSPool->Remove( pStyleSheet );
     209           0 :                 nRetMask = sal_True;
     210           0 :                 mpDoc->SetChanged(true);
     211             :             }
     212             :             else
     213             :             {
     214           0 :                 nRetMask = sal_False;
     215             :             }
     216           0 :         break;
     217             : 
     218             :         case SID_STYLE_HIDE:
     219             :         case SID_STYLE_SHOW:
     220           0 :             pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
     221           0 :             pStyleSheet->SetHidden( nSId == SID_STYLE_HIDE );
     222           0 :             nRetMask = sal_True;
     223           0 :         break;
     224             : 
     225             :         case SID_STYLE_APPLY:
     226             :             // apply the template to the document
     227           0 :             pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
     228             : 
     229             :             // do not set presentation styles, they will be set implicit
     230           0 :             if ( pStyleSheet && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_PSEUDO )
     231             :             {
     232           0 :                 SfxStyleSheet* pOldStyleSheet = mpView->GetStyleSheet();
     233           0 :                 OUString aStr;
     234             : 
     235           0 :                 if( // if the object had no style sheet, allow all
     236           0 :                     !pOldStyleSheet ||
     237             : 
     238             :                     // allow if old and new style sheet has same family
     239           0 :                     pStyleSheet->GetFamily() == pOldStyleSheet->GetFamily() ||
     240             : 
     241             :                     // allow if old was background objects and new is graphics
     242           0 :                     (pStyleSheet->GetFamily() == SD_STYLE_FAMILY_GRAPHICS && pOldStyleSheet->GetHelpId( aStr ) == HID_PSEUDOSHEET_BACKGROUNDOBJECTS) ||
     243             : 
     244             :                     // allow if old was presentation and we are a drawing document
     245           0 :                     (pOldStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE && mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW) )
     246             :                 {
     247           0 :                     mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
     248           0 :                     mpDoc->SetChanged(true);
     249           0 :                     mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
     250           0 :                 }
     251             :             }
     252           0 :         break;
     253             : 
     254             :         case SID_STYLE_WATERCAN:
     255             :         {
     256           0 :             if( !SD_MOD()->GetWaterCan() )
     257             :             {
     258           0 :                 if (pArgs && pArgs->GetItemState( nSId ) == SFX_ITEM_SET)
     259             :                 {
     260           0 :                     aStyleName = ( ( (const SfxStringItem &) pArgs->Get( nSId ) ).GetValue() );
     261           0 :                     SD_MOD()->SetWaterCan( sal_True );
     262           0 :                     pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
     263             :                 }
     264             :                 // no presentation object templates, they are only allowed implicitly
     265           0 :                 if( pStyleSheet && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_PSEUDO )
     266             :                 {
     267           0 :                     ( (SdStyleSheetPool*) pSSPool )->SetActualStyleSheet( pStyleSheet );
     268             : 
     269             :                     // we switch explicitly into selection mode
     270             :                     mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_SELECT,
     271           0 :                                         SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
     272             : 
     273             :                 }
     274             :                 else
     275           0 :                     SD_MOD()->SetWaterCan( sal_False );
     276             :             }
     277             :             else
     278             :             {
     279           0 :                 SD_MOD()->SetWaterCan( sal_False );
     280             :                 // we have to re-enable to tools-bar
     281           0 :                 mpViewShell->Invalidate();
     282             :             }
     283             :         }
     284           0 :         break;
     285             : 
     286             :         default:
     287           0 :         break;
     288             :     }
     289             : 
     290           0 :     switch( nSId )
     291             :     {
     292             :         case SID_STYLE_NEW:
     293             :         case SID_STYLE_EDIT:
     294             :         {
     295           0 :             PresentationObjects ePO = PO_OUTLINE_1;
     296             : 
     297           0 :             if( pStyleSheet )
     298             :             {
     299           0 :                 SfxAbstractTabDialog*  pStdDlg  = NULL;
     300           0 :                 SfxAbstractTabDialog*  pPresDlg = NULL;
     301           0 :                 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     302           0 :                 sal_Bool bOldDocInOtherLanguage = sal_False;
     303           0 :                 SfxItemSet aOriSet( pStyleSheet->GetItemSet() );
     304             : 
     305           0 :                 SfxStyleFamily eFamily = pStyleSheet->GetFamily();
     306             : 
     307           0 :                 if (eFamily == SD_STYLE_FAMILY_GRAPHICS)
     308             :                 {
     309           0 :                     pStdDlg = pFact ? pFact->CreateSdTabTemplateDlg( 0, mpDoc->GetDocSh(), *pStyleSheet, mpDoc, mpView ) : 0;
     310             :                 }
     311           0 :                 else if (eFamily == SD_STYLE_FAMILY_PSEUDO)
     312             :                 {
     313           0 :                     OUString aName(pStyleSheet->GetName());
     314           0 :                     sal_uInt16 nDlgId = 0;
     315             : 
     316           0 :                     if (aName == SD_RESSTR(STR_PSEUDOSHEET_TITLE))
     317             :                     {
     318           0 :                         nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
     319           0 :                         ePO    = PO_TITLE;
     320             :                     }
     321           0 :                     else if (aName == SD_RESSTR(STR_PSEUDOSHEET_SUBTITLE))
     322             :                     {
     323           0 :                         nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
     324           0 :                         ePO    = PO_SUBTITLE;
     325             :                     }
     326           0 :                     else if (aName ==
     327             :                              SD_RESSTR(STR_PSEUDOSHEET_BACKGROUND))
     328             :                     {
     329           0 :                         nDlgId = TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND;
     330           0 :                         ePO    = PO_BACKGROUND;
     331             :                     }
     332           0 :                     else if (aName ==
     333             :                              SD_RESSTR(STR_PSEUDOSHEET_BACKGROUNDOBJECTS))
     334             :                     {
     335           0 :                         nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
     336           0 :                         ePO    = PO_BACKGROUNDOBJECTS;
     337             :                     }
     338           0 :                     else if (aName ==
     339             :                              SD_RESSTR(STR_PSEUDOSHEET_NOTES))
     340             :                     {
     341           0 :                         nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
     342           0 :                         ePO    = PO_NOTES;
     343             :                     }
     344           0 :                     else if(aName.indexOf(SD_RESSTR(STR_PSEUDOSHEET_OUTLINE)) != -1)
     345             :                     {
     346           0 :                         nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
     347             : 
     348           0 :                         OUString aOutlineStr(SD_RESSTR(STR_PSEUDOSHEET_OUTLINE));
     349             :                         // determine number, mind the blank between name and number
     350           0 :                         OUString aNumStr(aName.copy(aOutlineStr.getLength() + 1));
     351           0 :                         sal_uInt16 nLevel = (sal_uInt16)aNumStr.toInt32();
     352           0 :                         switch (nLevel)
     353             :                         {
     354           0 :                             case 1: ePO = PO_OUTLINE_1; break;
     355           0 :                             case 2: ePO = PO_OUTLINE_2; break;
     356           0 :                             case 3: ePO = PO_OUTLINE_3; break;
     357           0 :                             case 4: ePO = PO_OUTLINE_4; break;
     358           0 :                             case 5: ePO = PO_OUTLINE_5; break;
     359           0 :                             case 6: ePO = PO_OUTLINE_6; break;
     360           0 :                             case 7: ePO = PO_OUTLINE_7; break;
     361           0 :                             case 8: ePO = PO_OUTLINE_8; break;
     362           0 :                             case 9: ePO = PO_OUTLINE_9; break;
     363           0 :                         }
     364             :                     }
     365             :                     else
     366             :                     {
     367             :                         OSL_FAIL("StyleSheet from older version with different language");
     368           0 :                         bOldDocInOtherLanguage = sal_True;
     369             :                     }
     370             : 
     371           0 :                     if( !bOldDocInOtherLanguage )
     372             :                     {
     373           0 :                         pPresDlg = pFact ? pFact->CreateSdPresLayoutTemplateDlg( mpDocSh, NULL, SdResId(nDlgId), *pStyleSheet, ePO, pSSPool ) : 0;
     374           0 :                     }
     375             :                 }
     376             :                 else if (eFamily == SD_STYLE_FAMILY_CELL)
     377             :                 {
     378             :                 }
     379             : 
     380           0 :                 sal_uInt16 nResult = RET_CANCEL;
     381           0 :                 const SfxItemSet* pOutSet = NULL;
     382           0 :                 if (pStdDlg)
     383             :                 {
     384           0 :                     nResult = pStdDlg->Execute();
     385           0 :                     pOutSet = pStdDlg->GetOutputItemSet();
     386             :                 }
     387           0 :                 else if( pPresDlg )
     388             :                 {
     389           0 :                     nResult = pPresDlg->Execute();
     390           0 :                     pOutSet = pPresDlg->GetOutputItemSet();
     391             :                 }
     392             : 
     393           0 :                 switch( nResult )
     394             :                 {
     395             :                     case RET_OK:
     396             :                     {
     397           0 :                         nRetMask = pStyleSheet->GetMask();
     398             : 
     399           0 :                         if (eFamily == SD_STYLE_FAMILY_PSEUDO)
     400             :                         {
     401           0 :                             SfxItemSet aTempSet(*pOutSet);
     402           0 :                             ((SdStyleSheet*)pStyleSheet)->AdjustToFontHeight(aTempSet);
     403             : 
     404             :                             /* Special treatment: reset the INVALIDS to
     405             :                                NULL-Pointer (otherwise INVALIDs or pointer point
     406             :                                to DefaultItems in the template; both would
     407             :                                prevent the attribute inheritance) */
     408           0 :                             aTempSet.ClearInvalidItems();
     409             : 
     410             :                             // EE_PARA_NUMBULLET item is only valid in first outline template
     411           0 :                             if( (ePO >= PO_OUTLINE_2) && (ePO <= PO_OUTLINE_9) )
     412             :                             {
     413           0 :                                 if (aTempSet.GetItemState(EE_PARA_NUMBULLET) == SFX_ITEM_SET)
     414             :                                 {
     415           0 :                                     SvxNumRule aRule(*((SvxNumBulletItem*)aTempSet.GetItem(EE_PARA_NUMBULLET))->GetNumRule());
     416             : 
     417           0 :                                     OUString sStyleName(SD_RESSTR(STR_PSEUDOSHEET_OUTLINE) + " 1");
     418           0 :                                     SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( sStyleName, SD_STYLE_FAMILY_PSEUDO);
     419             : 
     420           0 :                                     if(pFirstStyleSheet)
     421             :                                     {
     422           0 :                                         pFirstStyleSheet->GetItemSet().Put( SvxNumBulletItem( aRule, EE_PARA_NUMBULLET ));
     423           0 :                                         SdStyleSheet* pRealSheet = ((SdStyleSheet*)pFirstStyleSheet)->GetRealStyleSheet();
     424           0 :                                         pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     425             :                                     }
     426             : 
     427           0 :                                     aTempSet.ClearItem( EE_PARA_NUMBULLET );
     428             :                                 }
     429             :                             }
     430             : 
     431           0 :                             OUString sStyleName(SD_RESSTR(STR_PSEUDOSHEET_OUTLINE) + " ");
     432             : 
     433           0 :                             pStyleSheet->GetItemSet().Put(aTempSet);
     434           0 :                             SdStyleSheet* pRealSheet =((SdStyleSheet*)pStyleSheet)->GetRealStyleSheet();
     435           0 :                             pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     436             : 
     437           0 :                             if( (ePO >= PO_OUTLINE_1) && (ePO <= PO_OUTLINE_8) )
     438             :                             {
     439           0 :                                 for( sal_uInt16 n = (sal_uInt16)(ePO - PO_OUTLINE_1 + 2); n < 10; n++ )
     440             :                                 {
     441           0 :                                     OUString aName( sStyleName + OUString::number(n) );
     442             : 
     443           0 :                                     SfxStyleSheetBase* pSheet = pSSPool->Find( aName, SD_STYLE_FAMILY_PSEUDO);
     444             : 
     445           0 :                                     if(pSheet)
     446             :                                     {
     447           0 :                                         SdStyleSheet* pRealStyleSheet = ((SdStyleSheet*)pSheet)->GetRealStyleSheet();
     448           0 :                                         pRealStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     449             :                                     }
     450           0 :                                 }
     451           0 :                             }
     452             :                         }
     453             : 
     454           0 :                         SfxItemSet& rAttr = pStyleSheet->GetItemSet();
     455             : 
     456           0 :                         sdr::properties::CleanupFillProperties( rAttr );
     457             : 
     458             :                         // check for unique names of named items for xml
     459           0 :                         if( rAttr.GetItemState( XATTR_FILLBITMAP ) == SFX_ITEM_SET )
     460             :                         {
     461           0 :                             const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLBITMAP );
     462           0 :                             SfxPoolItem* pNewItem = ((XFillBitmapItem*)pOldItem)->checkForUniqueItem( mpDoc );
     463           0 :                             if( pOldItem != pNewItem )
     464             :                             {
     465           0 :                                 rAttr.Put( *pNewItem );
     466           0 :                                 delete pNewItem;
     467             :                             }
     468             :                         }
     469           0 :                         if( rAttr.GetItemState( XATTR_LINEDASH ) == SFX_ITEM_SET )
     470             :                         {
     471           0 :                             const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEDASH );
     472           0 :                             SfxPoolItem* pNewItem = ((XLineDashItem*)pOldItem)->checkForUniqueItem( mpDoc );
     473           0 :                             if( pOldItem != pNewItem )
     474             :                             {
     475           0 :                                 rAttr.Put( *pNewItem );
     476           0 :                                 delete pNewItem;
     477             :                             }
     478             :                         }
     479           0 :                         if( rAttr.GetItemState( XATTR_LINESTART ) == SFX_ITEM_SET )
     480             :                         {
     481           0 :                             const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINESTART );
     482           0 :                             SfxPoolItem* pNewItem = ((XLineStartItem*)pOldItem)->checkForUniqueItem( mpDoc );
     483           0 :                             if( pOldItem != pNewItem )
     484             :                             {
     485           0 :                                 rAttr.Put( *pNewItem );
     486           0 :                                 delete pNewItem;
     487             :                             }
     488             :                         }
     489           0 :                         if( rAttr.GetItemState( XATTR_LINEEND ) == SFX_ITEM_SET )
     490             :                         {
     491           0 :                             const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEEND );
     492           0 :                             SfxPoolItem* pNewItem = ((XLineEndItem*)pOldItem)->checkForUniqueItem( mpDoc );
     493           0 :                             if( pOldItem != pNewItem )
     494             :                             {
     495           0 :                                 rAttr.Put( *pNewItem );
     496           0 :                                 delete pNewItem;
     497             :                             }
     498             :                         }
     499           0 :                         if( rAttr.GetItemState( XATTR_FILLGRADIENT ) == SFX_ITEM_SET )
     500             :                         {
     501           0 :                             const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLGRADIENT );
     502           0 :                             SfxPoolItem* pNewItem = ((XFillGradientItem*)pOldItem)->checkForUniqueItem( mpDoc );
     503           0 :                             if( pOldItem != pNewItem )
     504             :                             {
     505           0 :                                 rAttr.Put( *pNewItem );
     506           0 :                                 delete pNewItem;
     507             :                             }
     508             :                         }
     509           0 :                         if( rAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SFX_ITEM_SET )
     510             :                         {
     511           0 :                             const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLFLOATTRANSPARENCE );
     512           0 :                             SfxPoolItem* pNewItem = ((XFillFloatTransparenceItem*)pOldItem)->checkForUniqueItem( mpDoc );
     513           0 :                             if( pOldItem != pNewItem )
     514             :                             {
     515           0 :                                 rAttr.Put( *pNewItem );
     516           0 :                                 delete pNewItem;
     517             :                             }
     518             :                         }
     519           0 :                         if( rAttr.GetItemState( XATTR_FILLHATCH ) == SFX_ITEM_SET )
     520             :                         {
     521           0 :                             const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLHATCH );
     522           0 :                             SfxPoolItem* pNewItem = ((XFillHatchItem*)pOldItem)->checkForUniqueItem( mpDoc );
     523           0 :                             if( pOldItem != pNewItem )
     524             :                             {
     525           0 :                                 rAttr.Put( *pNewItem );
     526           0 :                                 delete pNewItem;
     527             :                             }
     528             :                         }
     529             : 
     530           0 :                         ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
     531             : 
     532           0 :                         DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( mpViewShell );
     533           0 :                         if( pDrawViewShell )
     534             :                         {
     535           0 :                             PageKind ePageKind = pDrawViewShell->GetPageKind();
     536           0 :                             if( ePageKind == PK_NOTES || ePageKind == PK_HANDOUT )
     537             :                             {
     538           0 :                                 SdPage* pPage = mpViewShell->GetActualPage();
     539             : 
     540           0 :                                 if(pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
     541             :                                 {
     542           0 :                                     pPage = static_cast<SdPage*>((&(pPage->TRG_GetMasterPage())));
     543             :                                 }
     544             : 
     545           0 :                                 if( pPage )
     546             :                                 {
     547           0 :                                     SdrObjListIter aIter( *pPage );
     548           0 :                                     while( aIter.IsMore() )
     549             :                                     {
     550           0 :                                         SdrObject* pObj = aIter.Next();
     551           0 :                                         if( pObj->ISA(SdrPageObj) )
     552             :                                         {
     553             :                                             // repaint only
     554           0 :                                             pObj->ActionChanged();
     555             :                                             // pObj->SendRepaintBroadcast();
     556             :                                         }
     557           0 :                                     }
     558             :                                 }
     559             :                             }
     560             :                         }
     561             : 
     562           0 :                         if( mpDoc->GetOnlineSpell() )
     563             :                         {
     564             :                             const SfxPoolItem* pTempItem;
     565           0 :                             if( SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE, false, &pTempItem ) ||
     566           0 :                                 SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CJK, false, &pTempItem ) ||
     567           0 :                                 SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CTL, false, &pTempItem ) )
     568             :                             {
     569           0 :                                 mpDoc->StopOnlineSpelling();
     570           0 :                                 mpDoc->StartOnlineSpelling();
     571             :                             }
     572             :                         }
     573             : 
     574           0 :                         mpDoc->SetChanged(true);
     575             :                     }
     576           0 :                     break;
     577             : 
     578             :                     default:
     579             :                     {
     580           0 :                         if( nSId == SID_STYLE_NEW )
     581           0 :                             pSSPool->Remove( pStyleSheet );
     582           0 :                         delete pStdDlg;
     583           0 :                         delete pPresDlg;
     584             :                     }
     585           0 :                     return; // Cancel
     586             :                 }
     587           0 :                 delete pStdDlg;
     588           0 :                 delete pPresDlg;
     589             :             }
     590             :         }
     591           0 :         break;
     592             : 
     593             :         case SID_STYLE_NEW_BY_EXAMPLE:
     594             :         {
     595           0 :             if( pStyleSheet )
     596             :             {
     597           0 :                 nRetMask = pStyleSheet->GetMask();
     598           0 :                 SfxItemSet aCoreSet( mpDoc->GetPool() );
     599           0 :                 mpView->GetAttributes( aCoreSet, sal_True );
     600             : 
     601             :                 // if the object had a template, this becomes parent of the new template
     602           0 :                 SfxStyleSheet* pOldStyle = mpView->GetStyleSheet();
     603             : 
     604             :                 // if pOldStyle == pStyleSheet -> recursion
     605           0 :                 if( pOldStyle != pStyleSheet )
     606             :                 {
     607           0 :                     if (pOldStyle)
     608             :                     {
     609           0 :                         pStyleSheet->SetParent(pOldStyle->GetName());
     610             :                     }
     611             : 
     612           0 :                     SfxItemSet* pStyleSet = &pStyleSheet->GetItemSet();
     613           0 :                     pStyleSet->Put(aCoreSet);
     614             : 
     615             :                     /* apply template (but not when somebody is editing a text.
     616             :                        To do this, the edit engine had to be capable to use
     617             :                        templates on a character level. */
     618           0 :                     if (!mpView->GetTextEditObject())
     619             :                     {
     620           0 :                         mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
     621             :                     }
     622             : 
     623           0 :                     ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
     624           0 :                     mpDoc->SetChanged(true);
     625             : 
     626           0 :                     mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
     627           0 :                 }
     628             :             }
     629             :         }
     630           0 :         break;
     631             : 
     632             :         case SID_STYLE_UPDATE_BY_EXAMPLE:
     633             :         {
     634           0 :             if ((mpView->AreObjectsMarked() && mpView->GetMarkedObjectList().GetMarkCount() == 1) ||
     635           0 :                  mpView->ISA(OutlineView))
     636             :             {
     637           0 :                 pStyleSheet = mpView->GetStyleSheet();
     638             : 
     639           0 :                 if( pStyleSheet )
     640             :                 {
     641           0 :                     nRetMask = pStyleSheet->GetMask();
     642           0 :                     SfxItemSet aCoreSet( mpDoc->GetPool() );
     643           0 :                     mpView->GetAttributes( aCoreSet );
     644             : 
     645           0 :                     SfxItemSet* pStyleSet = &pStyleSheet->GetItemSet();
     646           0 :                     pStyleSet->Put( aCoreSet );
     647             : 
     648           0 :                     mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
     649             : 
     650           0 :                     ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
     651           0 :                     mpDoc->SetChanged(true);
     652           0 :                     mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
     653             :                 }
     654             :             }
     655             :         }
     656           0 :         break;
     657             : 
     658             :     }
     659           0 :     if( nRetMask != SFXSTYLEBIT_ALL )
     660           0 :         rReq.SetReturnValue( SfxUInt16Item( nSId, nRetMask ) );
     661             : }
     662             : 
     663           0 : void FuTemplate::Activate()
     664             : {
     665           0 : }
     666             : 
     667           0 : void FuTemplate::Deactivate()
     668             : {
     669           0 : }
     670             : 
     671           0 : } // end of namespace sd
     672             : 
     673             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10