1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "inspagob.hxx"
22 #include "strings.hrc"
23 #include "res_bmp.hrc"
24 #include "sdresid.hxx"
25 #include "drawdoc.hxx"
26 #include "DrawDocShell.hxx"
27 #include "ViewShell.hxx"
28 #include "inspagob.hrc"
31 SdInsertPagesObjsDlg::SdInsertPagesObjsDlg(
33 const SdDrawDocument
* pInDoc
,
34 SfxMedium
* pSfxMedium
,
35 const String
& rFileName
)
36 : ModalDialog ( pWindow
, SdResId( DLG_INSERT_PAGES_OBJS
) ),
37 aLbTree ( this, SdResId( LB_TREE
) ),
38 aCbxLink ( this, SdResId( CBX_LINK
) ),
39 aCbxMasters ( this, SdResId( CBX_CHECK_MASTERS
) ),
40 aBtnOk ( this, SdResId( BTN_OK
) ),
41 aBtnCancel ( this, SdResId( BTN_CANCEL
) ),
42 aBtnHelp ( this, SdResId( BTN_HELP
) ),
43 pMedium ( pSfxMedium
),
49 aLbTree
.SetViewFrame( ( (SdDrawDocument
*) pInDoc
)->GetDocSh()->GetViewShell()->GetViewFrame() );
51 aLbTree
.SetSelectHdl( LINK( this, SdInsertPagesObjsDlg
, SelectObjectHdl
) );
55 SetText( String( SdResId( STR_INSERT_TEXT
) ) );
61 SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg()
66 * Fills the TreeLB dependent on the medium. Is not medium available, then
67 * it is a text and not a draw document.
69 void SdInsertPagesObjsDlg::Reset()
73 aLbTree
.SetSelectionMode( MULTIPLE_SELECTION
);
75 // transfer ownership of Medium
76 aLbTree
.Fill( mpDoc
, pMedium
, rName
);
80 Color
aColor( COL_WHITE
);
81 Bitmap
aBmpText( SdResId( BMP_DOC_TEXT
) );
82 Image
aImgText( aBmpText
, aColor
);
83 aLbTree
.InsertEntry( rName
, aImgText
, aImgText
);
86 aCbxMasters
.Check( sal_True
);
89 std::vector
<OUString
> SdInsertPagesObjsDlg::GetList( const sal_uInt16 nType
)
91 // With Draw documents, we have to return NULL on selection of the document
94 // to ensure that bookmarks are opened
95 // (when the whole document is selected)
96 aLbTree
.GetBookmarkDoc();
98 // If the document is selected (too) or nothing is selected,
99 // the whole document is inserted (but not more!)
100 if( aLbTree
.GetSelectionCount() == 0 ||
101 ( aLbTree
.IsSelected( aLbTree
.First() ) ) )
102 return std::vector
<OUString
>();
105 return aLbTree
.GetSelectEntryList( nType
);
111 sal_Bool
SdInsertPagesObjsDlg::IsLink()
113 return( aCbxLink
.IsChecked() );
119 sal_Bool
SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const
121 return( aCbxMasters
.IsChecked() );
125 * Enabled and selects end-color-LB
127 IMPL_LINK_NOARG(SdInsertPagesObjsDlg
, SelectObjectHdl
)
129 if( aLbTree
.IsLinkableSelected() )
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */