office-gobmx/sd/source/ui/dlg/inspagob.cxx

190 lines
5.7 KiB
C++
Raw Normal View History

2000-09-18 11:07:07 -05:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 11:07:07 -05:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 11:07:07 -05:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 11:07:07 -05:00
*
* This file is part of OpenOffice.org.
2000-09-18 11:07:07 -05:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 11:07:07 -05:00
*
* OpenOffice.org 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 version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 11:07:07 -05:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 11:07:07 -05:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sd.hxx"
#ifdef SD_DLLIMPLEMENTATION
#undef SD_DLLIMPLEMENTATION
#endif
2000-09-18 11:07:07 -05:00
#include "inspagob.hxx"
#include "strings.hrc"
#include "res_bmp.hrc"
#include "sdresid.hxx"
#include "drawdoc.hxx"
#include "DrawDocShell.hxx"
#include "ViewShell.hxx"
2000-09-18 11:07:07 -05:00
#include "inspagob.hrc"
/*************************************************************************
|*
|* Ctor
|*
\************************************************************************/
SdInsertPagesObjsDlg::SdInsertPagesObjsDlg(
::Window* pWindow,
const SdDrawDocument* pInDoc,
SfxMedium* pSfxMedium,
const String& rFileName )
: ModalDialog ( pWindow, SdResId( DLG_INSERT_PAGES_OBJS ) ),
aLbTree ( this, SdResId( LB_TREE ) ),
aCbxLink ( this, SdResId( CBX_LINK ) ),
aCbxMasters ( this, SdResId( CBX_CHECK_MASTERS ) ),
aBtnOk ( this, SdResId( BTN_OK ) ),
aBtnCancel ( this, SdResId( BTN_CANCEL ) ),
aBtnHelp ( this, SdResId( BTN_HELP ) ),
pMedium ( pSfxMedium ),
mpDoc ( pInDoc ),
rName ( rFileName )
2000-09-18 11:07:07 -05:00
{
FreeResource();
aLbTree.SetViewFrame( ( (SdDrawDocument*) pInDoc )->GetDocSh()->GetViewShell()->GetViewFrame() );
aLbTree.SetSelectHdl( LINK( this, SdInsertPagesObjsDlg, SelectObjectHdl ) );
// Text wird eingefuegt
if( !pMedium )
SetText( String( SdResId( STR_INSERT_TEXT ) ) );
Reset();
}
/*************************************************************************
|*
|* Dtor
|*
\************************************************************************/
SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg()
{
}
/*************************************************************************
|*
|* Fuellt die TreeLB in Abhaengigkeit des Mediums. Ist kein Medium
|* vorhanden, handelt es sich um ein Text- und kein Drawdokument
|*
\************************************************************************/
void SdInsertPagesObjsDlg::Reset()
{
if( pMedium )
{
aLbTree.SetSelectionMode( MULTIPLE_SELECTION );
// transfer ownership of Medium
aLbTree.Fill( mpDoc, pMedium, rName );
2000-09-18 11:07:07 -05:00
}
else
{
Color aColor( COL_WHITE );
2002-05-31 08:20:03 -05:00
Bitmap aBmpText( SdResId( BMP_DOC_TEXT ) );
Image aImgText( aBmpText, aColor );
Bitmap aBmpTextH( SdResId( BMP_DOC_TEXT_H ) );
Image aImgTextH( aBmpTextH, Color( COL_BLACK ) );
SvLBoxEntry* pEntry = aLbTree.InsertEntry( rName, aImgText, aImgText );
aLbTree.SetExpandedEntryBmp( pEntry, aImgTextH, BMP_COLOR_HIGHCONTRAST );
aLbTree.SetCollapsedEntryBmp( pEntry, aImgTextH, BMP_COLOR_HIGHCONTRAST );
2000-09-18 11:07:07 -05:00
}
aCbxMasters.Check( TRUE );
}
/*************************************************************************
|*
|* Liefert die Liste zurueck
|* nType == 0 -> Seiten
|* nType == 1 -> Objekte
|*
\************************************************************************/
List* SdInsertPagesObjsDlg::GetList( USHORT nType )
{
// Bei Draw-Dokumenten muss bei der Selektion des Dokumentes NULL
// zurueckgegeben werden
if( pMedium )
{
// Um zu gewaehrleisten, dass die Bookmarks geoeffnet sind
// (Wenn gesamtes Dokument ausgewaehlt wurde)
aLbTree.GetBookmarkDoc();
// Wenn das Dokument (mit-)selektiert oder nichst selektiert ist,
// wird das gesamte Dokument (und nicht mehr!) eingefuegt.
if( aLbTree.GetSelectionCount() == 0 ||
( aLbTree.IsSelected( aLbTree.First() ) ) )
//return( aLbTree.GetBookmarkList( nType ) );
return( NULL ); // #37350#
}
return( aLbTree.GetSelectEntryList( nType ) );
}
/*************************************************************************
|*
|* Ist Verknuepfung gechecked
|*
\************************************************************************/
BOOL SdInsertPagesObjsDlg::IsLink()
{
return( aCbxLink.IsChecked() );
}
/*************************************************************************
|*
|* Ist Verknuepfung gechecked
|*
\************************************************************************/
BOOL SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const
{
return( aCbxMasters.IsChecked() );
}
/*************************************************************************
|*
|* Enabled und selektiert Endfarben-LB
|*
\************************************************************************/
IMPL_LINK( SdInsertPagesObjsDlg, SelectObjectHdl, void *, EMPTYARG )
2000-09-18 11:07:07 -05:00
{
2002-12-06 09:51:18 -06:00
if( aLbTree.IsLinkableSelected() )
2000-09-18 11:07:07 -05:00
aCbxLink.Enable();
2002-12-06 09:51:18 -06:00
else
aCbxLink.Disable();
2000-09-18 11:07:07 -05:00
return( 0 );
}