Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #ifdef SD_DLLIMPLEMENTATION
31 : : #undef SD_DLLIMPLEMENTATION
32 : : #endif
33 : :
34 : :
35 : : #include "inspagob.hxx"
36 : :
37 : : #include "strings.hrc"
38 : : #include "res_bmp.hrc"
39 : : #include "sdresid.hxx"
40 : : #include "drawdoc.hxx"
41 : : #include "DrawDocShell.hxx"
42 : : #include "ViewShell.hxx"
43 : : #include "inspagob.hrc"
44 : :
45 : :
46 : : /*************************************************************************
47 : : |*
48 : : |* Ctor
49 : : |*
50 : : \************************************************************************/
51 : :
52 : 0 : SdInsertPagesObjsDlg::SdInsertPagesObjsDlg(
53 : : ::Window* pWindow,
54 : : const SdDrawDocument* pInDoc,
55 : : SfxMedium* pSfxMedium,
56 : : const String& rFileName )
57 : : : ModalDialog ( pWindow, SdResId( DLG_INSERT_PAGES_OBJS ) ),
58 : : aLbTree ( this, SdResId( LB_TREE ) ),
59 : : aCbxLink ( this, SdResId( CBX_LINK ) ),
60 : : aCbxMasters ( this, SdResId( CBX_CHECK_MASTERS ) ),
61 : : aBtnOk ( this, SdResId( BTN_OK ) ),
62 : : aBtnCancel ( this, SdResId( BTN_CANCEL ) ),
63 : : aBtnHelp ( this, SdResId( BTN_HELP ) ),
64 : : pMedium ( pSfxMedium ),
65 : : mpDoc ( pInDoc ),
66 : 0 : rName ( rFileName )
67 : : {
68 : 0 : FreeResource();
69 : :
70 : 0 : aLbTree.SetViewFrame( ( (SdDrawDocument*) pInDoc )->GetDocSh()->GetViewShell()->GetViewFrame() );
71 : :
72 : 0 : aLbTree.SetSelectHdl( LINK( this, SdInsertPagesObjsDlg, SelectObjectHdl ) );
73 : :
74 : : // Text wird eingefuegt
75 : 0 : if( !pMedium )
76 : 0 : SetText( String( SdResId( STR_INSERT_TEXT ) ) );
77 : :
78 : 0 : Reset();
79 : 0 : }
80 : :
81 : : /*************************************************************************
82 : : |*
83 : : |* Dtor
84 : : |*
85 : : \************************************************************************/
86 : :
87 : 0 : SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg()
88 : : {
89 : 0 : }
90 : :
91 : : /*************************************************************************
92 : : |*
93 : : |* Fuellt die TreeLB in Abhaengigkeit des Mediums. Ist kein Medium
94 : : |* vorhanden, handelt es sich um ein Text- und kein Drawdokument
95 : : |*
96 : : \************************************************************************/
97 : :
98 : 0 : void SdInsertPagesObjsDlg::Reset()
99 : : {
100 : 0 : if( pMedium )
101 : : {
102 : 0 : aLbTree.SetSelectionMode( MULTIPLE_SELECTION );
103 : :
104 : : // transfer ownership of Medium
105 : 0 : aLbTree.Fill( mpDoc, pMedium, rName );
106 : : }
107 : : else
108 : : {
109 : 0 : Color aColor( COL_WHITE );
110 : 0 : Bitmap aBmpText( SdResId( BMP_DOC_TEXT ) );
111 : 0 : Image aImgText( aBmpText, aColor );
112 : 0 : aLbTree.InsertEntry( rName, aImgText, aImgText );
113 : : }
114 : :
115 : 0 : aCbxMasters.Check( sal_True );
116 : 0 : }
117 : :
118 : 0 : std::vector<rtl::OUString> SdInsertPagesObjsDlg::GetList( const sal_uInt16 nType )
119 : : {
120 : : // Bei Draw-Dokumenten muss bei der Selektion des Dokumentes NULL
121 : : // zurueckgegeben werden
122 : 0 : if( pMedium )
123 : : {
124 : : // Um zu gewaehrleisten, dass die Bookmarks geoeffnet sind
125 : : // (Wenn gesamtes Dokument ausgewaehlt wurde)
126 : 0 : aLbTree.GetBookmarkDoc();
127 : :
128 : : // Wenn das Dokument (mit-)selektiert oder nichst selektiert ist,
129 : : // wird das gesamte Dokument (und nicht mehr!) eingefuegt.
130 : 0 : if( aLbTree.GetSelectionCount() == 0 ||
131 : 0 : ( aLbTree.IsSelected( aLbTree.First() ) ) )
132 : 0 : return std::vector<rtl::OUString>();
133 : : }
134 : :
135 : 0 : return aLbTree.GetSelectEntryList( nType );
136 : : }
137 : :
138 : : /*************************************************************************
139 : : |*
140 : : |* Ist Verknuepfung gechecked
141 : : |*
142 : : \************************************************************************/
143 : :
144 : 0 : sal_Bool SdInsertPagesObjsDlg::IsLink()
145 : : {
146 : 0 : return( aCbxLink.IsChecked() );
147 : : }
148 : :
149 : : /*************************************************************************
150 : : |*
151 : : |* Ist Verknuepfung gechecked
152 : : |*
153 : : \************************************************************************/
154 : :
155 : 0 : sal_Bool SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const
156 : : {
157 : 0 : return( aCbxMasters.IsChecked() );
158 : : }
159 : :
160 : : /*************************************************************************
161 : : |*
162 : : |* Enabled und selektiert Endfarben-LB
163 : : |*
164 : : \************************************************************************/
165 : :
166 : 0 : IMPL_LINK_NOARG(SdInsertPagesObjsDlg, SelectObjectHdl)
167 : : {
168 : 0 : if( aLbTree.IsLinkableSelected() )
169 : 0 : aCbxLink.Enable();
170 : : else
171 : 0 : aCbxLink.Disable();
172 : :
173 : 0 : return( 0 );
174 : : }
175 : :
176 : :
177 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|