2000-09-18 11:07:07 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-08 22:49:20 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-08 22:49:20 -05:00
|
|
|
* $RCSfile: fuprlout.cxx,v $
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-08 22:49:20 -05:00
|
|
|
* $Revision: 1.10 $
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-08 22:49:20 -05:00
|
|
|
* last change: $Author: rt $ $Date: 2005-09-09 04:49:20 $
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-08 22:49:20 -05:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
|
|
|
*
|
2005-09-08 22:49:20 -05:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-08 22:49:20 -05:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-08 22:49:20 -05:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2005-09-08 22:49:20 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#pragma hdrstop
|
|
|
|
|
2004-01-20 04:10:47 -06:00
|
|
|
#include "fuprlout.hxx"
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
#ifndef _SV_WRKWIN_HXX
|
|
|
|
#include <vcl/wrkwin.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXDISPATCH_HXX //autogen
|
|
|
|
#include <sfx2/dispatch.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXSMPLHINT_HXX //autogen
|
|
|
|
#include <svtools/smplhint.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXITEMPOOL_HXX //autogen
|
|
|
|
#include <svtools/itempool.hxx>
|
|
|
|
#endif
|
2004-10-04 12:33:21 -05:00
|
|
|
#include <sot/storage.hxx>
|
2000-09-18 11:07:07 -05:00
|
|
|
#ifndef _SV_MSGBOX_HXX //autogen
|
|
|
|
#include <vcl/msgbox.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDUNDO_HXX //autogen
|
|
|
|
#include <svx/svdundo.hxx>
|
|
|
|
#endif
|
|
|
|
|
2004-10-04 12:33:21 -05:00
|
|
|
#include <sfx2/viewfrm.hxx>
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
#include "drawdoc.hxx"
|
|
|
|
#include "sdpage.hxx"
|
|
|
|
#include "pres.hxx"
|
2004-01-20 04:10:47 -06:00
|
|
|
#ifndef SD_DRAW_VIEW_SHELL_HXX
|
|
|
|
#include "DrawViewShell.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_FRAMW_VIEW_HXX
|
|
|
|
#include "FrameView.hxx"
|
|
|
|
#endif
|
2000-09-18 11:07:07 -05:00
|
|
|
#include "stlpool.hxx"
|
2004-01-20 04:10:47 -06:00
|
|
|
#ifndef SD_VIEW_HXX
|
|
|
|
#include "View.hxx"
|
|
|
|
#endif
|
2000-09-18 11:07:07 -05:00
|
|
|
#include "glob.hrc"
|
|
|
|
#include "glob.hxx"
|
|
|
|
#include "strings.hrc"
|
|
|
|
#include "strmname.h"
|
|
|
|
#include "app.hrc"
|
2004-01-20 04:10:47 -06:00
|
|
|
#include "DrawDocShell.hxx"
|
2000-09-18 11:07:07 -05:00
|
|
|
#include "unprlout.hxx"
|
|
|
|
#include "unchss.hxx"
|
|
|
|
#include "unmovss.hxx"
|
|
|
|
#include "sdattr.hxx"
|
|
|
|
#include "sdresid.hxx"
|
2004-05-10 09:48:17 -05:00
|
|
|
//CHINA001 #include "sdpreslt.hxx"
|
2004-01-20 04:10:47 -06:00
|
|
|
#ifndef SD_DRAW_VIEW_HXX
|
2000-09-18 11:07:07 -05:00
|
|
|
#include "drawview.hxx"
|
2004-01-20 04:10:47 -06:00
|
|
|
#endif
|
2000-09-18 11:07:07 -05:00
|
|
|
#include "eetext.hxx"
|
|
|
|
#include <svx/editdata.hxx>
|
2004-05-10 09:48:17 -05:00
|
|
|
#include "sdabstdlg.hxx" //CHINA001
|
|
|
|
#include "sdpreslt.hrc" //CHINA001
|
2004-01-20 04:10:47 -06:00
|
|
|
namespace sd {
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
#ifndef SO2_DECL_SVSTORAGE_DEFINED
|
|
|
|
#define SO2_DECL_SVSTORAGE_DEFINED
|
|
|
|
SO2_DECL_REF(SvStorage)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
TYPEINIT1( FuPresentationLayout, FuPoor );
|
|
|
|
|
|
|
|
#define POOL_BUFFER_SIZE (USHORT)32768
|
|
|
|
#define DOCUMENT_BUFFER_SIZE (USHORT)32768
|
2001-05-18 09:11:02 -05:00
|
|
|
#define DOCUMENT_TOKEN (sal_Unicode('#'))
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Konstruktor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 04:10:47 -06:00
|
|
|
FuPresentationLayout::FuPresentationLayout (
|
|
|
|
ViewShell* pViewSh,
|
|
|
|
::sd::Window* pWin,
|
|
|
|
::sd::View* pView,
|
|
|
|
SdDrawDocument* pDoc,
|
|
|
|
SfxRequest& rReq)
|
|
|
|
: FuPoor(pViewSh, pWin, pView, pDoc, rReq)
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
// damit nicht Objekte, die gerade editiert werden oder selektiert
|
|
|
|
// sind , verschwinden
|
|
|
|
pView->EndTextEdit();
|
|
|
|
|
|
|
|
USHORT nPgViewCount = pView->GetPageViewCount();
|
|
|
|
for (USHORT nPgView = 0; nPgView < nPgViewCount; nPgView++)
|
|
|
|
{
|
|
|
|
pView->UnmarkAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL bError = FALSE;
|
|
|
|
|
|
|
|
// die aktive Seite ermitteln
|
|
|
|
USHORT nSelectedPage = SDRPAGE_NOTFOUND;
|
|
|
|
for (USHORT nPage = 0; nPage < pDoc->GetSdPageCount(PK_STANDARD); nPage++)
|
|
|
|
{
|
|
|
|
if (pDoc->GetSdPage(nPage, PK_STANDARD)->IsSelected())
|
|
|
|
{
|
|
|
|
nSelectedPage = nPage;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DBG_ASSERT(nSelectedPage != SDRPAGE_NOTFOUND, "keine selektierte Seite");
|
|
|
|
SdPage* pSelectedPage = pDoc->GetSdPage(nSelectedPage, PK_STANDARD);
|
|
|
|
String aOldPageLayoutName(pSelectedPage->GetLayoutName());
|
|
|
|
String aOldLayoutName(aOldPageLayoutName);
|
|
|
|
aOldLayoutName.Erase(aOldLayoutName.SearchAscii(SD_LT_SEPARATOR));
|
|
|
|
|
|
|
|
// wenn wir auf einer Masterpage sind, gelten die Aenderungen fuer alle
|
|
|
|
// Seiten und Notizseiten, die das betreffende Layout benutzen
|
|
|
|
BOOL bOnMaster = FALSE;
|
2004-01-20 04:10:47 -06:00
|
|
|
if (pViewSh->ISA(DrawViewShell))
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2004-01-20 04:10:47 -06:00
|
|
|
EditMode eEditMode =
|
|
|
|
static_cast<DrawViewShell*>(pViewSh)->GetEditMode();
|
2000-09-18 11:07:07 -05:00
|
|
|
if (eEditMode == EM_MASTERPAGE)
|
|
|
|
bOnMaster = TRUE;
|
|
|
|
}
|
|
|
|
BOOL bMasterPage = bOnMaster;
|
|
|
|
BOOL bCheckMasters = FALSE;
|
|
|
|
|
|
|
|
// Dialog aufrufen
|
|
|
|
BOOL bLoad = FALSE; // tauchen neue Masterpages auf?
|
|
|
|
String aFile;
|
|
|
|
SfxItemSet aSet(pDoc->GetPool(), ATTR_PRESLAYOUT_START, ATTR_PRESLAYOUT_END);
|
|
|
|
|
|
|
|
aSet.Put( SfxBoolItem( ATTR_PRESLAYOUT_LOAD, bLoad));
|
|
|
|
aSet.Put( SfxBoolItem( ATTR_PRESLAYOUT_MASTER_PAGE, bMasterPage ) );
|
|
|
|
aSet.Put( SfxBoolItem( ATTR_PRESLAYOUT_CHECK_MASTERS, bCheckMasters ) );
|
|
|
|
aSet.Put( SfxStringItem( ATTR_PRESLAYOUT_NAME, aOldLayoutName));
|
|
|
|
|
2004-05-10 09:48:17 -05:00
|
|
|
//CHINA001 SdPresLayoutDlg* pDlg = new SdPresLayoutDlg( pDocSh, pViewSh, NULL, aSet);
|
|
|
|
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();//CHINA001
|
|
|
|
DBG_ASSERT(pFact, "SdAbstractDialogFactory fail!");//CHINA001
|
|
|
|
AbstractSdPresLayoutDlg* pDlg = pFact->CreateSdPresLayoutDlg(ResId( DLG_PRESLT ), pDocSh, pViewSh, NULL, aSet );
|
|
|
|
DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
|
2000-09-18 11:07:07 -05:00
|
|
|
USHORT nResult = pDlg->Execute();
|
|
|
|
|
|
|
|
switch (nResult)
|
|
|
|
{
|
|
|
|
case RET_OK:
|
|
|
|
{
|
|
|
|
pDlg->GetAttr(aSet);
|
|
|
|
if (aSet.GetItemState(ATTR_PRESLAYOUT_LOAD) == SFX_ITEM_SET)
|
|
|
|
bLoad = ((SfxBoolItem&)aSet.Get(ATTR_PRESLAYOUT_LOAD)).GetValue();
|
|
|
|
if( aSet.GetItemState( ATTR_PRESLAYOUT_MASTER_PAGE ) == SFX_ITEM_SET )
|
|
|
|
bMasterPage = ( (SfxBoolItem&) aSet.Get( ATTR_PRESLAYOUT_MASTER_PAGE ) ).GetValue();
|
|
|
|
if( aSet.GetItemState( ATTR_PRESLAYOUT_CHECK_MASTERS ) == SFX_ITEM_SET )
|
|
|
|
bCheckMasters = ( (SfxBoolItem&) aSet.Get( ATTR_PRESLAYOUT_CHECK_MASTERS ) ).GetValue();
|
|
|
|
if (aSet.GetItemState(ATTR_PRESLAYOUT_NAME) == SFX_ITEM_SET)
|
|
|
|
aFile = ((SfxStringItem&)aSet.Get(ATTR_PRESLAYOUT_NAME)).GetValue();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
bError = TRUE;
|
|
|
|
}
|
|
|
|
delete pDlg;
|
|
|
|
|
|
|
|
if (!bError)
|
|
|
|
{
|
|
|
|
pDocSh->SetWaitCursor( TRUE );
|
|
|
|
|
|
|
|
// Hier werden nur Masterpages ausgewechselt, d.h. die aktuelle Seite
|
|
|
|
// bleibt aktuell. Damit beim Ein- und Ausfuegen der Masterpages nicht
|
|
|
|
// dauernd via PageOrderChangedHint die Methode ResetActualPage gerufen
|
|
|
|
// wird, wird jetzt blockiert.
|
|
|
|
// That isn't quitely right. If the masterpageview is active and you are
|
|
|
|
// removing a masterpage, it's possible that you are removing the
|
|
|
|
// current masterpage. So you have to call ResetActualPage !
|
2004-01-20 04:10:47 -06:00
|
|
|
if( pViewShell->ISA(DrawViewShell) && !bCheckMasters )
|
|
|
|
static_cast<DrawView*>(pView)->BlockPageOrderChangedHint(TRUE);
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
if (bLoad)
|
|
|
|
{
|
2001-05-18 09:11:02 -05:00
|
|
|
String aFileName = aFile.GetToken( 0, DOCUMENT_TOKEN );
|
|
|
|
SdDrawDocument* pTempDoc = pDoc->OpenBookmarkDoc( aFileName );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
// #69581: If I chosed the standard-template I got no filename and so I get no
|
|
|
|
// SdDrawDocument-Pointer. But the method SetMasterPage is able to handle
|
|
|
|
// a NULL-pointer as a Standard-template ( look at SdDrawDocument::SetMasterPage )
|
2001-05-18 09:11:02 -05:00
|
|
|
String aLayoutName;
|
|
|
|
if( pTempDoc )
|
|
|
|
aLayoutName = aFile.GetToken( 1, DOCUMENT_TOKEN );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2001-05-18 09:11:02 -05:00
|
|
|
pDoc->SetMasterPage(nSelectedPage, aLayoutName, pTempDoc, bMasterPage, bCheckMasters);
|
2000-09-18 11:07:07 -05:00
|
|
|
pDoc->CloseBookmarkDoc();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// MasterPage mit dem LayoutNamen aFile aus aktuellem Doc verwenden
|
|
|
|
pDoc->SetMasterPage(nSelectedPage, aFile, pDoc, bMasterPage, bCheckMasters);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Blockade wieder aufheben
|
2004-01-20 04:10:47 -06:00
|
|
|
if (pViewShell->ISA(DrawViewShell) && !bCheckMasters )
|
|
|
|
static_cast<DrawView*>(pView)->BlockPageOrderChangedHint(FALSE);
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* Falls dargestellte Masterpage sichtbar war, neu darstellen
|
|
|
|
\************************************************************************/
|
|
|
|
if (!bError && nSelectedPage != SDRPAGE_NOTFOUND)
|
|
|
|
{
|
|
|
|
if (bOnMaster)
|
|
|
|
{
|
2004-01-20 04:10:47 -06:00
|
|
|
if (pViewShell->ISA(DrawViewShell))
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2004-01-20 04:10:47 -06:00
|
|
|
::sd::View* pView =
|
|
|
|
static_cast<DrawViewShell*>(pViewShell)->GetView();
|
2004-07-12 09:05:33 -05:00
|
|
|
USHORT nPgNum = pSelectedPage->TRG_GetMasterPage().GetPageNum();
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2004-01-20 04:10:47 -06:00
|
|
|
if (static_cast<DrawViewShell*>(pViewShell)->GetPageKind() == PK_NOTES)
|
2000-09-18 11:07:07 -05:00
|
|
|
nPgNum++;
|
|
|
|
|
|
|
|
pView->HideAllPages();
|
|
|
|
pView->ShowMasterPagePgNum(nPgNum, Point());
|
|
|
|
}
|
|
|
|
|
|
|
|
// damit TabBar aktualisiert wird
|
|
|
|
pViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_MASTERPAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-11-14 06:31:17 -06:00
|
|
|
pSelectedPage->SetAutoLayout(pSelectedPage->GetAutoLayout());
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-10-18 08:33:02 -05:00
|
|
|
// fake a mode change to repaint the page tab bar
|
2004-01-20 04:10:47 -06:00
|
|
|
if( pViewShell && pViewShell->ISA( DrawViewShell ) )
|
2000-10-18 08:33:02 -05:00
|
|
|
{
|
2004-01-20 04:10:47 -06:00
|
|
|
DrawViewShell* pDrawViewSh =
|
|
|
|
static_cast<DrawViewShell*>(pViewShell);
|
2000-10-18 08:33:02 -05:00
|
|
|
EditMode eMode = pDrawViewSh->GetEditMode();
|
2004-07-13 07:52:08 -05:00
|
|
|
BOOL bLayer = pDrawViewSh->IsLayerModeActive();
|
2000-10-18 08:33:02 -05:00
|
|
|
pDrawViewSh->ChangeEditMode( eMode, !bLayer );
|
|
|
|
pDrawViewSh->ChangeEditMode( eMode, bLayer );
|
|
|
|
}
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
pDocSh->SetWaitCursor( FALSE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Destruktor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
FuPresentationLayout::~FuPresentationLayout()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Layoutvorlage von einem StyleSheetPool in einen anderen uebertragen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void FuPresentationLayout::TransferLayoutTemplate(String aFromName,
|
|
|
|
String aToName,
|
|
|
|
SfxStyleSheetBasePool* pFrom,
|
|
|
|
SfxStyleSheetBasePool* pTo)
|
|
|
|
{
|
|
|
|
SfxStyleSheetBase* pHis = pFrom->Find(aFromName,SD_LT_FAMILY);
|
|
|
|
SfxStyleSheetBase* pMy = pTo->Find(aToName, SD_LT_FAMILY);
|
|
|
|
|
|
|
|
DBG_ASSERT(pHis, "neue Layoutvorlage nicht gefunden");
|
|
|
|
|
|
|
|
// gibt's noch nicht: neu anlegen
|
|
|
|
if (!pMy)
|
|
|
|
{
|
|
|
|
pMy = &(pTo->Make(aToName, SD_LT_FAMILY));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Inhalte neu setzen
|
|
|
|
if (pHis)
|
|
|
|
pMy->GetItemSet().Set(pHis->GetItemSet());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-01-20 04:10:47 -06:00
|
|
|
} // end of namespace sd
|