1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: inspagob.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #ifdef SD_DLLIMPLEMENTATION
35 #undef SD_DLLIMPLEMENTATION
39 #include "inspagob.hxx"
41 #include "strings.hrc"
42 #include "res_bmp.hrc"
43 #include "sdresid.hxx"
44 #include "drawdoc.hxx"
45 #include "DrawDocShell.hxx"
46 #include "ViewShell.hxx"
47 #include "inspagob.hrc"
50 /*************************************************************************
54 \************************************************************************/
56 SdInsertPagesObjsDlg::SdInsertPagesObjsDlg(
58 const SdDrawDocument
* pInDoc
,
59 SfxMedium
* pSfxMedium
,
60 const String
& rFileName
)
61 : ModalDialog ( pWindow
, SdResId( DLG_INSERT_PAGES_OBJS
) ),
62 aLbTree ( this, SdResId( LB_TREE
) ),
63 aCbxLink ( this, SdResId( CBX_LINK
) ),
64 aCbxMasters ( this, SdResId( CBX_CHECK_MASTERS
) ),
65 aBtnOk ( this, SdResId( BTN_OK
) ),
66 aBtnCancel ( this, SdResId( BTN_CANCEL
) ),
67 aBtnHelp ( this, SdResId( BTN_HELP
) ),
68 pMedium ( pSfxMedium
),
74 aLbTree
.SetViewFrame( ( (SdDrawDocument
*) pInDoc
)->GetDocSh()->GetViewShell()->GetViewFrame() );
76 aLbTree
.SetSelectHdl( LINK( this, SdInsertPagesObjsDlg
, SelectObjectHdl
) );
78 // Text wird eingefuegt
80 SetText( String( SdResId( STR_INSERT_TEXT
) ) );
85 /*************************************************************************
89 \************************************************************************/
91 SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg()
95 /*************************************************************************
97 |* Fuellt die TreeLB in Abhaengigkeit des Mediums. Ist kein Medium
98 |* vorhanden, handelt es sich um ein Text- und kein Drawdokument
100 \************************************************************************/
102 void SdInsertPagesObjsDlg::Reset()
106 aLbTree
.SetSelectionMode( MULTIPLE_SELECTION
);
108 // transfer ownership of Medium
109 aLbTree
.Fill( mpDoc
, pMedium
, rName
);
113 Color
aColor( COL_WHITE
);
114 Bitmap
aBmpText( SdResId( BMP_DOC_TEXT
) );
115 Image
aImgText( aBmpText
, aColor
);
116 Bitmap
aBmpTextH( SdResId( BMP_DOC_TEXT_H
) );
117 Image
aImgTextH( aBmpTextH
, Color( COL_BLACK
) );
118 SvLBoxEntry
* pEntry
= aLbTree
.InsertEntry( rName
, aImgText
, aImgText
);
119 aLbTree
.SetExpandedEntryBmp( pEntry
, aImgTextH
, BMP_COLOR_HIGHCONTRAST
);
120 aLbTree
.SetCollapsedEntryBmp( pEntry
, aImgTextH
, BMP_COLOR_HIGHCONTRAST
);
123 aCbxMasters
.Check( TRUE
);
126 /*************************************************************************
128 |* Liefert die Liste zurueck
129 |* nType == 0 -> Seiten
130 |* nType == 1 -> Objekte
132 \************************************************************************/
134 List
* SdInsertPagesObjsDlg::GetList( USHORT nType
)
136 // Bei Draw-Dokumenten muss bei der Selektion des Dokumentes NULL
137 // zurueckgegeben werden
140 // Um zu gewaehrleisten, dass die Bookmarks geoeffnet sind
141 // (Wenn gesamtes Dokument ausgewaehlt wurde)
142 aLbTree
.GetBookmarkDoc();
144 // Wenn das Dokument (mit-)selektiert oder nichst selektiert ist,
145 // wird das gesamte Dokument (und nicht mehr!) eingefuegt.
146 if( aLbTree
.GetSelectionCount() == 0 ||
147 ( aLbTree
.IsSelected( aLbTree
.First() ) ) )
148 //return( aLbTree.GetBookmarkList( nType ) );
149 return( NULL
); // #37350#
151 return( aLbTree
.GetSelectEntryList( nType
) );
154 /*************************************************************************
156 |* Ist Verknuepfung gechecked
158 \************************************************************************/
160 BOOL
SdInsertPagesObjsDlg::IsLink()
162 return( aCbxLink
.IsChecked() );
165 /*************************************************************************
167 |* Ist Verknuepfung gechecked
169 \************************************************************************/
171 BOOL
SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const
173 return( aCbxMasters
.IsChecked() );
176 /*************************************************************************
178 |* Enabled und selektiert Endfarben-LB
180 \************************************************************************/
182 IMPL_LINK( SdInsertPagesObjsDlg
, SelectObjectHdl
, void *, EMPTYARG
)
184 if( aLbTree
.IsLinkableSelected() )