1*5b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5b190011SAndrew Rist * distributed with this work for additional information 6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance 9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10*5b190011SAndrew Rist * 11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*5b190011SAndrew Rist * 13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5b190011SAndrew Rist * software distributed under the License is distributed on an 15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the 17*5b190011SAndrew Rist * specific language governing permissions and limitations 18*5b190011SAndrew Rist * under the License. 19*5b190011SAndrew Rist * 20*5b190011SAndrew Rist *************************************************************/ 21*5b190011SAndrew Rist 22*5b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifdef SD_DLLIMPLEMENTATION 28cdf0e10cSrcweir #undef SD_DLLIMPLEMENTATION 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include "inspagob.hxx" 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include "strings.hrc" 35cdf0e10cSrcweir #include "res_bmp.hrc" 36cdf0e10cSrcweir #include "sdresid.hxx" 37cdf0e10cSrcweir #include "drawdoc.hxx" 38cdf0e10cSrcweir #include "DrawDocShell.hxx" 39cdf0e10cSrcweir #include "ViewShell.hxx" 40cdf0e10cSrcweir #include "inspagob.hrc" 41cdf0e10cSrcweir 42cdf0e10cSrcweir 43cdf0e10cSrcweir /************************************************************************* 44cdf0e10cSrcweir |* 45cdf0e10cSrcweir |* Ctor 46cdf0e10cSrcweir |* 47cdf0e10cSrcweir \************************************************************************/ 48cdf0e10cSrcweir 49cdf0e10cSrcweir SdInsertPagesObjsDlg::SdInsertPagesObjsDlg( 50cdf0e10cSrcweir ::Window* pWindow, 51cdf0e10cSrcweir const SdDrawDocument* pInDoc, 52cdf0e10cSrcweir SfxMedium* pSfxMedium, 53cdf0e10cSrcweir const String& rFileName ) 54cdf0e10cSrcweir : ModalDialog ( pWindow, SdResId( DLG_INSERT_PAGES_OBJS ) ), 55cdf0e10cSrcweir aLbTree ( this, SdResId( LB_TREE ) ), 56cdf0e10cSrcweir aCbxLink ( this, SdResId( CBX_LINK ) ), 57cdf0e10cSrcweir aCbxMasters ( this, SdResId( CBX_CHECK_MASTERS ) ), 58cdf0e10cSrcweir aBtnOk ( this, SdResId( BTN_OK ) ), 59cdf0e10cSrcweir aBtnCancel ( this, SdResId( BTN_CANCEL ) ), 60cdf0e10cSrcweir aBtnHelp ( this, SdResId( BTN_HELP ) ), 61cdf0e10cSrcweir pMedium ( pSfxMedium ), 62cdf0e10cSrcweir mpDoc ( pInDoc ), 63cdf0e10cSrcweir rName ( rFileName ) 64cdf0e10cSrcweir { 65cdf0e10cSrcweir FreeResource(); 66cdf0e10cSrcweir 67cdf0e10cSrcweir aLbTree.SetViewFrame( ( (SdDrawDocument*) pInDoc )->GetDocSh()->GetViewShell()->GetViewFrame() ); 68cdf0e10cSrcweir 69cdf0e10cSrcweir aLbTree.SetSelectHdl( LINK( this, SdInsertPagesObjsDlg, SelectObjectHdl ) ); 70cdf0e10cSrcweir 71cdf0e10cSrcweir // Text wird eingefuegt 72cdf0e10cSrcweir if( !pMedium ) 73cdf0e10cSrcweir SetText( String( SdResId( STR_INSERT_TEXT ) ) ); 74cdf0e10cSrcweir 75cdf0e10cSrcweir Reset(); 76cdf0e10cSrcweir } 77cdf0e10cSrcweir 78cdf0e10cSrcweir /************************************************************************* 79cdf0e10cSrcweir |* 80cdf0e10cSrcweir |* Dtor 81cdf0e10cSrcweir |* 82cdf0e10cSrcweir \************************************************************************/ 83cdf0e10cSrcweir 84cdf0e10cSrcweir SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg() 85cdf0e10cSrcweir { 86cdf0e10cSrcweir } 87cdf0e10cSrcweir 88cdf0e10cSrcweir /************************************************************************* 89cdf0e10cSrcweir |* 90cdf0e10cSrcweir |* Fuellt die TreeLB in Abhaengigkeit des Mediums. Ist kein Medium 91cdf0e10cSrcweir |* vorhanden, handelt es sich um ein Text- und kein Drawdokument 92cdf0e10cSrcweir |* 93cdf0e10cSrcweir \************************************************************************/ 94cdf0e10cSrcweir 95cdf0e10cSrcweir void SdInsertPagesObjsDlg::Reset() 96cdf0e10cSrcweir { 97cdf0e10cSrcweir if( pMedium ) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir aLbTree.SetSelectionMode( MULTIPLE_SELECTION ); 100cdf0e10cSrcweir 101cdf0e10cSrcweir // transfer ownership of Medium 102cdf0e10cSrcweir aLbTree.Fill( mpDoc, pMedium, rName ); 103cdf0e10cSrcweir } 104cdf0e10cSrcweir else 105cdf0e10cSrcweir { 106cdf0e10cSrcweir Color aColor( COL_WHITE ); 107cdf0e10cSrcweir Bitmap aBmpText( SdResId( BMP_DOC_TEXT ) ); 108cdf0e10cSrcweir Image aImgText( aBmpText, aColor ); 109cdf0e10cSrcweir Bitmap aBmpTextH( SdResId( BMP_DOC_TEXT_H ) ); 110cdf0e10cSrcweir Image aImgTextH( aBmpTextH, Color( COL_BLACK ) ); 111cdf0e10cSrcweir SvLBoxEntry* pEntry = aLbTree.InsertEntry( rName, aImgText, aImgText ); 112cdf0e10cSrcweir aLbTree.SetExpandedEntryBmp( pEntry, aImgTextH, BMP_COLOR_HIGHCONTRAST ); 113cdf0e10cSrcweir aLbTree.SetCollapsedEntryBmp( pEntry, aImgTextH, BMP_COLOR_HIGHCONTRAST ); 114cdf0e10cSrcweir } 115cdf0e10cSrcweir 116cdf0e10cSrcweir aCbxMasters.Check( sal_True ); 117cdf0e10cSrcweir } 118cdf0e10cSrcweir 119cdf0e10cSrcweir /************************************************************************* 120cdf0e10cSrcweir |* 121cdf0e10cSrcweir |* Liefert die Liste zurueck 122cdf0e10cSrcweir |* nType == 0 -> Seiten 123cdf0e10cSrcweir |* nType == 1 -> Objekte 124cdf0e10cSrcweir |* 125cdf0e10cSrcweir \************************************************************************/ 126cdf0e10cSrcweir 127cdf0e10cSrcweir List* SdInsertPagesObjsDlg::GetList( sal_uInt16 nType ) 128cdf0e10cSrcweir { 129cdf0e10cSrcweir // Bei Draw-Dokumenten muss bei der Selektion des Dokumentes NULL 130cdf0e10cSrcweir // zurueckgegeben werden 131cdf0e10cSrcweir if( pMedium ) 132cdf0e10cSrcweir { 133cdf0e10cSrcweir // Um zu gewaehrleisten, dass die Bookmarks geoeffnet sind 134cdf0e10cSrcweir // (Wenn gesamtes Dokument ausgewaehlt wurde) 135cdf0e10cSrcweir aLbTree.GetBookmarkDoc(); 136cdf0e10cSrcweir 137cdf0e10cSrcweir // Wenn das Dokument (mit-)selektiert oder nichst selektiert ist, 138cdf0e10cSrcweir // wird das gesamte Dokument (und nicht mehr!) eingefuegt. 139cdf0e10cSrcweir if( aLbTree.GetSelectionCount() == 0 || 140cdf0e10cSrcweir ( aLbTree.IsSelected( aLbTree.First() ) ) ) 141cdf0e10cSrcweir return( NULL ); // #37350# 142cdf0e10cSrcweir } 143cdf0e10cSrcweir return( aLbTree.GetSelectEntryList( nType ) ); 144cdf0e10cSrcweir } 145cdf0e10cSrcweir 146cdf0e10cSrcweir /************************************************************************* 147cdf0e10cSrcweir |* 148cdf0e10cSrcweir |* Ist Verknuepfung gechecked 149cdf0e10cSrcweir |* 150cdf0e10cSrcweir \************************************************************************/ 151cdf0e10cSrcweir 152cdf0e10cSrcweir sal_Bool SdInsertPagesObjsDlg::IsLink() 153cdf0e10cSrcweir { 154cdf0e10cSrcweir return( aCbxLink.IsChecked() ); 155cdf0e10cSrcweir } 156cdf0e10cSrcweir 157cdf0e10cSrcweir /************************************************************************* 158cdf0e10cSrcweir |* 159cdf0e10cSrcweir |* Ist Verknuepfung gechecked 160cdf0e10cSrcweir |* 161cdf0e10cSrcweir \************************************************************************/ 162cdf0e10cSrcweir 163cdf0e10cSrcweir sal_Bool SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const 164cdf0e10cSrcweir { 165cdf0e10cSrcweir return( aCbxMasters.IsChecked() ); 166cdf0e10cSrcweir } 167cdf0e10cSrcweir 168cdf0e10cSrcweir /************************************************************************* 169cdf0e10cSrcweir |* 170cdf0e10cSrcweir |* Enabled und selektiert Endfarben-LB 171cdf0e10cSrcweir |* 172cdf0e10cSrcweir \************************************************************************/ 173cdf0e10cSrcweir 174cdf0e10cSrcweir IMPL_LINK( SdInsertPagesObjsDlg, SelectObjectHdl, void *, EMPTYARG ) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir if( aLbTree.IsLinkableSelected() ) 177cdf0e10cSrcweir aCbxLink.Enable(); 178cdf0e10cSrcweir else 179cdf0e10cSrcweir aCbxLink.Disable(); 180cdf0e10cSrcweir 181cdf0e10cSrcweir return( 0 ); 182cdf0e10cSrcweir } 183cdf0e10cSrcweir 184cdf0e10cSrcweir 185