1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*efeef26fSAndrew Rist * distributed with this work for additional information
6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10*efeef26fSAndrew Rist *
11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*efeef26fSAndrew Rist *
13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17*efeef26fSAndrew Rist * specific language governing permissions and limitations
18*efeef26fSAndrew Rist * under the License.
19*efeef26fSAndrew Rist *
20*efeef26fSAndrew Rist *************************************************************/
21*efeef26fSAndrew Rist
22*efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION
28cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include <svl/style.hxx>
33cdf0e10cSrcweir #include <errhdl.hxx>
34cdf0e10cSrcweir #include <wrtsh.hxx>
35cdf0e10cSrcweir #ifndef _VIEW_HXX
36cdf0e10cSrcweir #include <view.hxx>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #ifndef _DOCSH_HXX
39cdf0e10cSrcweir #include <docsh.hxx>
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #include <docfnote.hxx>
42cdf0e10cSrcweir #include <impfnote.hxx>
43cdf0e10cSrcweir #include <ftninfo.hxx>
44cdf0e10cSrcweir #include <fmtcol.hxx>
45cdf0e10cSrcweir #include <pagedesc.hxx>
46cdf0e10cSrcweir #include <charfmt.hxx>
47cdf0e10cSrcweir #include <docstyle.hxx>
48cdf0e10cSrcweir #include <wdocsh.hxx>
49cdf0e10cSrcweir #include <uitool.hxx>
50cdf0e10cSrcweir #include <poolfmt.hxx>
51cdf0e10cSrcweir #include <swstyle.h>
52cdf0e10cSrcweir #ifndef _HELPID_H
53cdf0e10cSrcweir #include <helpid.h>
54cdf0e10cSrcweir #endif
55cdf0e10cSrcweir #ifndef _MISC_HRC
56cdf0e10cSrcweir #include <misc.hrc>
57cdf0e10cSrcweir #endif
58cdf0e10cSrcweir #ifndef _DOCFNOTE_HRC
59cdf0e10cSrcweir #include <docfnote.hrc>
60cdf0e10cSrcweir #endif
61cdf0e10cSrcweir #ifndef _FRMUI_HRC
62cdf0e10cSrcweir #include <frmui.hrc>
63cdf0e10cSrcweir #endif
64cdf0e10cSrcweir #include <SwStyleNameMapper.hxx>
65cdf0e10cSrcweir
SwFootNoteOptionDlg(Window * pParent,SwWrtShell & rS)66cdf0e10cSrcweir SwFootNoteOptionDlg::SwFootNoteOptionDlg( Window *pParent, SwWrtShell &rS ) :
67cdf0e10cSrcweir SfxTabDialog( pParent, SW_RES(DLG_DOC_FOOTNOTE) ),
68cdf0e10cSrcweir rSh( rS )
69cdf0e10cSrcweir {
70cdf0e10cSrcweir FreeResource();
71cdf0e10cSrcweir RemoveResetButton();
72cdf0e10cSrcweir
73cdf0e10cSrcweir aOldOkHdl = GetOKButton().GetClickHdl();
74cdf0e10cSrcweir GetOKButton().SetClickHdl( LINK( this, SwFootNoteOptionDlg, OkHdl ) );
75cdf0e10cSrcweir
76cdf0e10cSrcweir AddTabPage( TP_FOOTNOTEOPTION, SwFootNoteOptionPage::Create, 0 );
77cdf0e10cSrcweir AddTabPage( TP_ENDNOTEOPTION, SwEndNoteOptionPage::Create, 0 );
78cdf0e10cSrcweir }
79cdf0e10cSrcweir
PageCreated(sal_uInt16,SfxTabPage & rPage)80cdf0e10cSrcweir void SwFootNoteOptionDlg::PageCreated( sal_uInt16 /*nId*/, SfxTabPage &rPage )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir ((SwEndNoteOptionPage&)rPage).SetShell( rSh );
83cdf0e10cSrcweir }
84cdf0e10cSrcweir
~SwFootNoteOptionDlg()85cdf0e10cSrcweir SwFootNoteOptionDlg::~SwFootNoteOptionDlg()
86cdf0e10cSrcweir {
87cdf0e10cSrcweir }
88cdf0e10cSrcweir
IMPL_LINK(SwFootNoteOptionDlg,OkHdl,Button *,pBtn)89cdf0e10cSrcweir IMPL_LINK( SwFootNoteOptionDlg, OkHdl, Button *, pBtn )
90cdf0e10cSrcweir {
91cdf0e10cSrcweir SfxItemSet aDummySet(rSh.GetAttrPool(), 1, 1 );
92cdf0e10cSrcweir SfxTabPage *pPage = GetTabPage( TP_FOOTNOTEOPTION );
93cdf0e10cSrcweir if ( pPage )
94cdf0e10cSrcweir pPage->FillItemSet( aDummySet );
95cdf0e10cSrcweir pPage = GetTabPage( TP_ENDNOTEOPTION );
96cdf0e10cSrcweir if ( pPage )
97cdf0e10cSrcweir pPage->FillItemSet( aDummySet );
98cdf0e10cSrcweir aOldOkHdl.Call( pBtn );
99cdf0e10cSrcweir return 0;
100cdf0e10cSrcweir }
101cdf0e10cSrcweir
102cdf0e10cSrcweir
103cdf0e10cSrcweir //----------------------------------------------------------------------
104cdf0e10cSrcweir
105cdf0e10cSrcweir
SwEndNoteOptionPage(Window * pParent,sal_Bool bEN,const SfxItemSet & rSet)106cdf0e10cSrcweir SwEndNoteOptionPage::SwEndNoteOptionPage( Window *pParent, sal_Bool bEN,
107cdf0e10cSrcweir const SfxItemSet &rSet ) :
108cdf0e10cSrcweir SfxTabPage( pParent, SW_RES(bEN ? TP_ENDNOTEOPTION : TP_FOOTNOTEOPTION), rSet ),
109cdf0e10cSrcweir aNumFL (this, SW_RES( FL_NUM )),
110cdf0e10cSrcweir
111cdf0e10cSrcweir aNumTypeFT (this, SW_RES( FT_NUMTYPE )),
112cdf0e10cSrcweir aNumViewBox (this, SW_RES( LB_NUMVIEW ), INSERT_NUM_EXTENDED_TYPES),
113cdf0e10cSrcweir aOffsetLbl (this, SW_RES( FT_OFFSET )),
114cdf0e10cSrcweir aOffsetFld (this, SW_RES( FLD_OFFSET )),
115cdf0e10cSrcweir aNumCountFT (this, SW_RES( FT_NUMCOUNT )),
116cdf0e10cSrcweir aNumCountBox (this, SW_RES( LB_NUMCOUNT )),
117cdf0e10cSrcweir aPrefixFT (this, SW_RES( FT_PREFIX )),
118cdf0e10cSrcweir aPrefixED (this, SW_RES( ED_PREFIX )),
119cdf0e10cSrcweir aSuffixFT (this, SW_RES( FT_SUFFIX )),
120cdf0e10cSrcweir aSuffixED (this, SW_RES( ED_SUFFIX )),
121cdf0e10cSrcweir aPosFT (this, SW_RES( FT_POS )),
122cdf0e10cSrcweir aPosPageBox (this, SW_RES( RB_POS_PAGE )),
123cdf0e10cSrcweir aPosChapterBox (this, SW_RES( RB_POS_CHAPTER)),
124cdf0e10cSrcweir
125cdf0e10cSrcweir aTemplFL (this, SW_RES( FL_TEMPL )),
126cdf0e10cSrcweir aParaTemplLbl (this, SW_RES( FT_PARA_TEMPL)),
127cdf0e10cSrcweir aParaTemplBox (this, SW_RES( LB_PARA_TEMPL)),
128cdf0e10cSrcweir aPageTemplLbl (this, SW_RES( FT_PAGE_TEMPL)),
129cdf0e10cSrcweir aPageTemplBox (this, SW_RES( LB_PAGE_TEMPL)),
130cdf0e10cSrcweir
131cdf0e10cSrcweir aCharTemplFL( this, SW_RES(FL_CHAR_TEMPL)),
132cdf0e10cSrcweir aFtnCharAnchorTemplLbl( this, SW_RES( FT_ANCHR_CHARFMT)),
133cdf0e10cSrcweir aFtnCharAnchorTemplBox( this, SW_RES( LB_ANCHR_CHARFMT)),
134cdf0e10cSrcweir aFtnCharTextTemplLbl( this, SW_RES( FT_TEXT_CHARFMT)),
135cdf0e10cSrcweir aFtnCharTextTemplBox( this, SW_RES( LB_TEXT_CHARFMT)),
136cdf0e10cSrcweir
137cdf0e10cSrcweir aContFL (this, SW_RES( FL_CONT )),
138cdf0e10cSrcweir aContLbl (this, SW_RES( FT_CONT )),
139cdf0e10cSrcweir aContEdit (this, SW_RES( ED_CONT )),
140cdf0e10cSrcweir aContFromLbl (this, SW_RES( FT_CONT_FROM )),
141cdf0e10cSrcweir aContFromEdit (this, SW_RES( ED_CONT_FROM )),
142cdf0e10cSrcweir
143cdf0e10cSrcweir aNumDoc(aNumCountBox.GetEntry(FTNNUM_DOC)),
144cdf0e10cSrcweir aNumPage(aNumCountBox.GetEntry(FTNNUM_PAGE)),
145cdf0e10cSrcweir aNumChapter(aNumCountBox.GetEntry(FTNNUM_CHAPTER)),
146cdf0e10cSrcweir pSh( 0 ),
147cdf0e10cSrcweir bPosDoc(sal_False),
148cdf0e10cSrcweir bEndNote( bEN )
149cdf0e10cSrcweir {
150cdf0e10cSrcweir FreeResource();
151cdf0e10cSrcweir
152cdf0e10cSrcweir aPosPageBox.SetClickHdl(LINK(this, SwEndNoteOptionPage, PosPageHdl));
153cdf0e10cSrcweir aPosChapterBox.SetClickHdl(LINK(this, SwEndNoteOptionPage, PosChapterHdl));
154cdf0e10cSrcweir aNumCountBox.SetSelectHdl(LINK(this, SwEndNoteOptionPage, NumCountHdl));
155cdf0e10cSrcweir
156cdf0e10cSrcweir aPosPageBox.SetAccessibleRelationMemberOf(&aPosFT);
157cdf0e10cSrcweir aPosChapterBox.SetAccessibleRelationMemberOf(&aPosFT);
158cdf0e10cSrcweir }
159cdf0e10cSrcweir
Reset(const SfxItemSet &)160cdf0e10cSrcweir void SwEndNoteOptionPage::Reset( const SfxItemSet& )
161cdf0e10cSrcweir {
162cdf0e10cSrcweir SwEndNoteInfo *pInf = bEndNote ? new SwEndNoteInfo( pSh->GetEndNoteInfo() )
163cdf0e10cSrcweir : new SwFtnInfo( pSh->GetFtnInfo() );
164cdf0e10cSrcweir SfxObjectShell * pDocSh = SfxObjectShell::Current();
165cdf0e10cSrcweir sal_uInt16 i;
166cdf0e10cSrcweir
167cdf0e10cSrcweir if(PTR_CAST(SwWebDocShell, pDocSh))
168cdf0e10cSrcweir {
169cdf0e10cSrcweir aParaTemplLbl .Hide();
170cdf0e10cSrcweir aParaTemplBox .Hide();
171cdf0e10cSrcweir aPageTemplLbl .Hide();
172cdf0e10cSrcweir aPageTemplBox .Hide();
173cdf0e10cSrcweir aFtnCharTextTemplLbl.Hide();
174cdf0e10cSrcweir aFtnCharTextTemplBox.Hide();
175cdf0e10cSrcweir aFtnCharAnchorTemplLbl.Hide();
176cdf0e10cSrcweir aFtnCharAnchorTemplBox.Hide();
177cdf0e10cSrcweir aCharTemplFL .Hide();
178cdf0e10cSrcweir aTemplFL .Hide();
179cdf0e10cSrcweir }
180cdf0e10cSrcweir if ( bEndNote )
181cdf0e10cSrcweir {
182cdf0e10cSrcweir aPosPageBox.Hide();
183cdf0e10cSrcweir aPosChapterBox.Hide();
184cdf0e10cSrcweir aNumCountBox.Hide();
185cdf0e10cSrcweir aContLbl.Hide();
186cdf0e10cSrcweir aContEdit.Hide();
187cdf0e10cSrcweir aContFromLbl.Hide();
188cdf0e10cSrcweir aContFromEdit.Hide();
189cdf0e10cSrcweir aContFL.Hide();
190cdf0e10cSrcweir bPosDoc = sal_True;
191cdf0e10cSrcweir }
192cdf0e10cSrcweir else
193cdf0e10cSrcweir {
194cdf0e10cSrcweir const SwFtnInfo &rInf = pSh->GetFtnInfo();
195cdf0e10cSrcweir // Position (Seite, Kapitel) setzen
196cdf0e10cSrcweir if ( rInf.ePos == FTNPOS_PAGE )
197cdf0e10cSrcweir {
198cdf0e10cSrcweir aPosPageBox.Check();
199cdf0e10cSrcweir aPageTemplLbl.Enable(sal_False);
200cdf0e10cSrcweir aPageTemplBox.Enable(sal_False);
201cdf0e10cSrcweir }
202cdf0e10cSrcweir else // if ( rInf.ePos == FTNPOS_CHAPTER )
203cdf0e10cSrcweir {
204cdf0e10cSrcweir aPosChapterBox.Check();
205cdf0e10cSrcweir aNumCountBox.RemoveEntry(aNumPage);
206cdf0e10cSrcweir aNumCountBox.RemoveEntry(aNumChapter);
207cdf0e10cSrcweir bPosDoc = sal_True;
208cdf0e10cSrcweir }
209cdf0e10cSrcweir // Verweistexte
210cdf0e10cSrcweir aContEdit.SetText(rInf.aQuoVadis);
211cdf0e10cSrcweir aContFromEdit.SetText(rInf.aErgoSum);
212cdf0e10cSrcweir
213cdf0e10cSrcweir // gesammelt wo
214cdf0e10cSrcweir SelectNumbering(rInf.eNum);
215cdf0e10cSrcweir }
216cdf0e10cSrcweir
217cdf0e10cSrcweir // Numerierung
218cdf0e10cSrcweir // Art
219cdf0e10cSrcweir aNumViewBox.SelectNumberingType( pInf->aFmt.GetNumberingType());
220cdf0e10cSrcweir aOffsetFld.SetValue(pInf->nFtnOffset + 1);
221cdf0e10cSrcweir aPrefixED.SetText(pInf->GetPrefix());
222cdf0e10cSrcweir aSuffixED.SetText(pInf->GetSuffix());
223cdf0e10cSrcweir
224cdf0e10cSrcweir const SwCharFmt* pCharFmt = pInf->GetCharFmt(
225cdf0e10cSrcweir *pSh->GetView().GetDocShell()->GetDoc());
226cdf0e10cSrcweir aFtnCharTextTemplBox.SelectEntry(pCharFmt->GetName());
227cdf0e10cSrcweir aFtnCharTextTemplBox.SaveValue();
228cdf0e10cSrcweir
229cdf0e10cSrcweir pCharFmt = pInf->GetAnchorCharFmt( *pSh->GetDoc() );
230cdf0e10cSrcweir aFtnCharAnchorTemplBox.SelectEntry( pCharFmt->GetName() );
231cdf0e10cSrcweir aFtnCharAnchorTemplBox.SaveValue();
232cdf0e10cSrcweir
233cdf0e10cSrcweir // Vorlagen - Sonderbereiche
234cdf0e10cSrcweir // Absatz
235cdf0e10cSrcweir SfxStyleSheetBasePool* pStyleSheetPool = pSh->GetView().GetDocShell()->GetStyleSheetPool();
236cdf0e10cSrcweir pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA, SWSTYLEBIT_EXTRA);
237cdf0e10cSrcweir SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
238cdf0e10cSrcweir while(pStyle)
239cdf0e10cSrcweir {
240cdf0e10cSrcweir aParaTemplBox.InsertEntry(pStyle->GetName());
241cdf0e10cSrcweir pStyle = pStyleSheetPool->Next();
242cdf0e10cSrcweir }
243cdf0e10cSrcweir
244cdf0e10cSrcweir String sStr;
245cdf0e10cSrcweir SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(bEndNote ? RES_POOLCOLL_ENDNOTE
246cdf0e10cSrcweir : RES_POOLCOLL_FOOTNOTE), sStr );
247cdf0e10cSrcweir if(LISTBOX_ENTRY_NOTFOUND == aParaTemplBox.GetEntryPos( sStr ) )
248cdf0e10cSrcweir aParaTemplBox.InsertEntry( sStr );
249cdf0e10cSrcweir
250cdf0e10cSrcweir SwTxtFmtColl* pColl = pInf->GetFtnTxtColl();
251cdf0e10cSrcweir if( !pColl )
252cdf0e10cSrcweir aParaTemplBox.SelectEntry( sStr ); // Default
253cdf0e10cSrcweir else
254cdf0e10cSrcweir {
255cdf0e10cSrcweir ASSERT(!pColl->IsDefault(), "Defaultvorlage fuer Fussnoten ist falsch.");
256cdf0e10cSrcweir const sal_uInt16 nPos = aParaTemplBox.GetEntryPos(pColl->GetName());
257cdf0e10cSrcweir if( LISTBOX_ENTRY_NOTFOUND != nPos )
258cdf0e10cSrcweir aParaTemplBox.SelectEntryPos( nPos );
259cdf0e10cSrcweir else
260cdf0e10cSrcweir {
261cdf0e10cSrcweir aParaTemplBox.InsertEntry(pColl->GetName());
262cdf0e10cSrcweir aParaTemplBox.SelectEntry(pColl->GetName());
263cdf0e10cSrcweir }
264cdf0e10cSrcweir }
265cdf0e10cSrcweir
266cdf0e10cSrcweir // Seite
267cdf0e10cSrcweir for( i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i )
268cdf0e10cSrcweir aPageTemplBox.InsertEntry(SwStyleNameMapper::GetUIName( i, aEmptyStr ));
269cdf0e10cSrcweir
270cdf0e10cSrcweir sal_uInt16 nCount = pSh->GetPageDescCnt();
271cdf0e10cSrcweir for(i = 0; i < nCount; ++i)
272cdf0e10cSrcweir {
273cdf0e10cSrcweir const SwPageDesc &rPageDesc = pSh->GetPageDesc(i);
274cdf0e10cSrcweir if(LISTBOX_ENTRY_NOTFOUND == aPageTemplBox.GetEntryPos(rPageDesc.GetName()))
275cdf0e10cSrcweir aPageTemplBox.InsertEntry(rPageDesc.GetName());
276cdf0e10cSrcweir }
277cdf0e10cSrcweir
278cdf0e10cSrcweir aPageTemplBox.SelectEntry( pInf->GetPageDesc( *pSh->GetDoc() )->GetName());
279cdf0e10cSrcweir delete pInf;
280cdf0e10cSrcweir }
281cdf0e10cSrcweir
~SwEndNoteOptionPage()282cdf0e10cSrcweir SwEndNoteOptionPage::~SwEndNoteOptionPage()
283cdf0e10cSrcweir {
284cdf0e10cSrcweir }
285cdf0e10cSrcweir
Create(Window * pParent,const SfxItemSet & rSet)286cdf0e10cSrcweir SfxTabPage *SwEndNoteOptionPage::Create( Window *pParent, const SfxItemSet &rSet )
287cdf0e10cSrcweir {
288cdf0e10cSrcweir return new SwEndNoteOptionPage( pParent, sal_True, rSet );
289cdf0e10cSrcweir }
290cdf0e10cSrcweir
291cdf0e10cSrcweir /*------------------------------------------------------------------------
292cdf0e10cSrcweir Beschreibung: Unterschiedliche Arten der Numerierung; da die Listbox
293cdf0e10cSrcweir unterschiedlich viele Eintraege hat, hier Funktionen
294cdf0e10cSrcweir fuer das Setzen und Erfragen der gemeinten Art
295cdf0e10cSrcweir der Numerierung.
296cdf0e10cSrcweir ------------------------------------------------------------------------*/
SelectNumbering(int eNum)297cdf0e10cSrcweir void SwEndNoteOptionPage::SelectNumbering(int eNum)
298cdf0e10cSrcweir {
299cdf0e10cSrcweir String sSelect;
300cdf0e10cSrcweir switch(eNum)
301cdf0e10cSrcweir {
302cdf0e10cSrcweir case FTNNUM_DOC:
303cdf0e10cSrcweir sSelect = aNumDoc;
304cdf0e10cSrcweir break;
305cdf0e10cSrcweir case FTNNUM_PAGE:
306cdf0e10cSrcweir sSelect = aNumPage;
307cdf0e10cSrcweir break;
308cdf0e10cSrcweir case FTNNUM_CHAPTER:
309cdf0e10cSrcweir sSelect = aNumChapter;
310cdf0e10cSrcweir break;
311cdf0e10cSrcweir #ifdef DBG_UTIL
312cdf0e10cSrcweir default:
313cdf0e10cSrcweir DBG_ERROR("Which numbering type?");
314cdf0e10cSrcweir #endif
315cdf0e10cSrcweir }
316cdf0e10cSrcweir aNumCountBox.SelectEntry(sSelect);
317cdf0e10cSrcweir NumCountHdl( &aNumCountBox );
318cdf0e10cSrcweir }
319cdf0e10cSrcweir
320cdf0e10cSrcweir
321cdf0e10cSrcweir
GetNumbering() const322cdf0e10cSrcweir int SwEndNoteOptionPage::GetNumbering() const
323cdf0e10cSrcweir {
324cdf0e10cSrcweir const sal_uInt16 nPos = aNumCountBox.GetSelectEntryPos();
325cdf0e10cSrcweir return (int) bPosDoc? nPos + 1: nPos;
326cdf0e10cSrcweir }
327cdf0e10cSrcweir
328cdf0e10cSrcweir /*-----------------09.02.98 11:17-------------------
329cdf0e10cSrcweir
330cdf0e10cSrcweir --------------------------------------------------*/
SetShell(SwWrtShell & rShell)331cdf0e10cSrcweir void SwEndNoteOptionPage::SetShell( SwWrtShell &rShell )
332cdf0e10cSrcweir {
333cdf0e10cSrcweir pSh = &rShell;
334cdf0e10cSrcweir // Zeichenvorlagen sammeln
335cdf0e10cSrcweir aFtnCharTextTemplBox.Clear();
336cdf0e10cSrcweir aFtnCharAnchorTemplBox.Clear();
337cdf0e10cSrcweir ::FillCharStyleListBox(aFtnCharTextTemplBox,
338cdf0e10cSrcweir pSh->GetView().GetDocShell());
339cdf0e10cSrcweir
340cdf0e10cSrcweir ::FillCharStyleListBox(aFtnCharAnchorTemplBox,
341cdf0e10cSrcweir pSh->GetView().GetDocShell());
342cdf0e10cSrcweir }
343cdf0e10cSrcweir
344cdf0e10cSrcweir /*------------------------------------------------------------------------
345cdf0e10cSrcweir Beschreibung: Handler hinter dem Button fuer Sammeln der Fussnote
346cdf0e10cSrcweir auf der Seite.
347cdf0e10cSrcweir In diesem Fall koennen alle Numerierungsarten verwendet
348cdf0e10cSrcweir werden.
349cdf0e10cSrcweir ------------------------------------------------------------------------*/
350cdf0e10cSrcweir
351cdf0e10cSrcweir
IMPL_LINK(SwEndNoteOptionPage,PosPageHdl,Button *,EMPTYARG)352cdf0e10cSrcweir IMPL_LINK( SwEndNoteOptionPage, PosPageHdl, Button *, EMPTYARG )
353cdf0e10cSrcweir {
354cdf0e10cSrcweir const SwFtnNum eNum = (const SwFtnNum)GetNumbering();
355cdf0e10cSrcweir bPosDoc = sal_False;
356cdf0e10cSrcweir if(LISTBOX_ENTRY_NOTFOUND == aNumCountBox.GetEntryPos(aNumPage))
357cdf0e10cSrcweir {
358cdf0e10cSrcweir aNumCountBox.InsertEntry(aNumPage, FTNNUM_PAGE);
359cdf0e10cSrcweir aNumCountBox.InsertEntry(aNumChapter, FTNNUM_CHAPTER);
360cdf0e10cSrcweir SelectNumbering(eNum);
361cdf0e10cSrcweir }
362cdf0e10cSrcweir aPageTemplLbl.Enable(sal_False);
363cdf0e10cSrcweir aPageTemplBox.Enable(sal_False);
364cdf0e10cSrcweir
365cdf0e10cSrcweir return 0;
366cdf0e10cSrcweir }
367cdf0e10cSrcweir
368cdf0e10cSrcweir /*------------------------------------------------------------------------
369cdf0e10cSrcweir Beschreibung:
370cdf0e10cSrcweir ------------------------------------------------------------------------*/
371cdf0e10cSrcweir
372cdf0e10cSrcweir
IMPL_LINK(SwEndNoteOptionPage,NumCountHdl,ListBox *,EMPTYARG)373cdf0e10cSrcweir IMPL_LINK( SwEndNoteOptionPage, NumCountHdl, ListBox*, EMPTYARG )
374cdf0e10cSrcweir {
375cdf0e10cSrcweir sal_Bool bEnable = sal_True;
376cdf0e10cSrcweir if( aNumCountBox.GetEntryCount() - 1 != aNumCountBox.GetSelectEntryPos() )
377cdf0e10cSrcweir {
378cdf0e10cSrcweir bEnable = sal_False;
379cdf0e10cSrcweir aOffsetFld.SetValue(1);
380cdf0e10cSrcweir }
381cdf0e10cSrcweir aOffsetLbl.Enable(bEnable);
382cdf0e10cSrcweir aOffsetFld.Enable(bEnable);
383cdf0e10cSrcweir return 0;
384cdf0e10cSrcweir }
385cdf0e10cSrcweir
386cdf0e10cSrcweir /*------------------------------------------------------------------------
387cdf0e10cSrcweir Beschreibung: Handler hinter dem Button fuer Sammeln der Fussnote
388cdf0e10cSrcweir am Kapitel oder Dokumentende.
389cdf0e10cSrcweir In diesem Fall kann keine seitenweise Numerierung verwendet
390cdf0e10cSrcweir werden.
391cdf0e10cSrcweir ------------------------------------------------------------------------*/
392cdf0e10cSrcweir
393cdf0e10cSrcweir
IMPL_LINK_INLINE_START(SwEndNoteOptionPage,PosChapterHdl,Button *,EMPTYARG)394cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwEndNoteOptionPage, PosChapterHdl, Button *, EMPTYARG )
395cdf0e10cSrcweir {
396cdf0e10cSrcweir if ( !bPosDoc )
397cdf0e10cSrcweir SelectNumbering(FTNNUM_DOC);
398cdf0e10cSrcweir
399cdf0e10cSrcweir bPosDoc = sal_True;
400cdf0e10cSrcweir aNumCountBox.RemoveEntry(aNumPage);
401cdf0e10cSrcweir aNumCountBox.RemoveEntry(aNumChapter);
402cdf0e10cSrcweir aPageTemplLbl.Enable();
403cdf0e10cSrcweir aPageTemplBox.Enable();
404cdf0e10cSrcweir return 0;
405cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(SwEndNoteOptionPage,PosChapterHdl,Button *,EMPTYARG)406cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwEndNoteOptionPage, PosChapterHdl, Button *, EMPTYARG )
407cdf0e10cSrcweir
408cdf0e10cSrcweir SwCharFmt* lcl_GetCharFormat( SwWrtShell* pSh, const String& rCharFmtName )
409cdf0e10cSrcweir {
410cdf0e10cSrcweir SwCharFmt* pFmt = 0;
411cdf0e10cSrcweir sal_uInt16 nChCount = pSh->GetCharFmtCount();
412cdf0e10cSrcweir for(sal_uInt16 i = 0; i< nChCount; i++)
413cdf0e10cSrcweir {
414cdf0e10cSrcweir SwCharFmt& rChFmt = pSh->GetCharFmt(i);
415cdf0e10cSrcweir if(rChFmt.GetName() == rCharFmtName )
416cdf0e10cSrcweir {
417cdf0e10cSrcweir pFmt = &rChFmt;
418cdf0e10cSrcweir break;
419cdf0e10cSrcweir }
420cdf0e10cSrcweir }
421cdf0e10cSrcweir if(!pFmt)
422cdf0e10cSrcweir {
423cdf0e10cSrcweir SfxStyleSheetBasePool* pPool = pSh->GetView().GetDocShell()->GetStyleSheetPool();
424cdf0e10cSrcweir SfxStyleSheetBase* pBase;
425cdf0e10cSrcweir pBase = pPool->Find(rCharFmtName, SFX_STYLE_FAMILY_CHAR);
426cdf0e10cSrcweir if(!pBase)
427cdf0e10cSrcweir pBase = &pPool->Make(rCharFmtName, SFX_STYLE_FAMILY_CHAR);
428cdf0e10cSrcweir pFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
429cdf0e10cSrcweir }
430cdf0e10cSrcweir return pFmt;
431cdf0e10cSrcweir }
432cdf0e10cSrcweir
FillItemSet(SfxItemSet &)433cdf0e10cSrcweir sal_Bool SwEndNoteOptionPage::FillItemSet( SfxItemSet & )
434cdf0e10cSrcweir {
435cdf0e10cSrcweir SwEndNoteInfo *pInf = bEndNote ? new SwEndNoteInfo() : new SwFtnInfo();
436cdf0e10cSrcweir
437cdf0e10cSrcweir pInf->nFtnOffset = static_cast< sal_uInt16 >(aOffsetFld.GetValue() -1);
438cdf0e10cSrcweir pInf->aFmt.SetNumberingType(aNumViewBox.GetSelectedNumberingType() );
439cdf0e10cSrcweir pInf->SetPrefix(aPrefixED.GetText());
440cdf0e10cSrcweir pInf->SetSuffix(aSuffixED.GetText());
441cdf0e10cSrcweir
442cdf0e10cSrcweir pInf->SetCharFmt( lcl_GetCharFormat( pSh,
443cdf0e10cSrcweir aFtnCharTextTemplBox.GetSelectEntry() ) );
444cdf0e10cSrcweir pInf->SetAnchorCharFmt( lcl_GetCharFormat( pSh,
445cdf0e10cSrcweir aFtnCharAnchorTemplBox.GetSelectEntry() ) );
446cdf0e10cSrcweir
447cdf0e10cSrcweir // Absatzvorlage
448cdf0e10cSrcweir sal_uInt16 nPos = aParaTemplBox.GetSelectEntryPos();
449cdf0e10cSrcweir if(LISTBOX_ENTRY_NOTFOUND != nPos)
450cdf0e10cSrcweir {
451cdf0e10cSrcweir const String aFmtName( aParaTemplBox.GetSelectEntry() );
452cdf0e10cSrcweir SwTxtFmtColl *pColl = pSh->GetParaStyle(aFmtName, SwWrtShell::GETSTYLE_CREATEANY);
453cdf0e10cSrcweir ASSERT(pColl, "Absatzvorlage nicht gefunden.");
454cdf0e10cSrcweir pInf->SetFtnTxtColl(*pColl);
455cdf0e10cSrcweir }
456cdf0e10cSrcweir
457cdf0e10cSrcweir // Seitenvorlage
458cdf0e10cSrcweir pInf->ChgPageDesc( pSh->FindPageDescByName(
459cdf0e10cSrcweir aPageTemplBox.GetSelectEntry(), sal_True ) );
460cdf0e10cSrcweir
461cdf0e10cSrcweir if ( bEndNote )
462cdf0e10cSrcweir {
463cdf0e10cSrcweir if ( !(*pInf == pSh->GetEndNoteInfo()) )
464cdf0e10cSrcweir pSh->SetEndNoteInfo( *pInf );
465cdf0e10cSrcweir }
466cdf0e10cSrcweir else
467cdf0e10cSrcweir {
468cdf0e10cSrcweir SwFtnInfo *pI = (SwFtnInfo*)pInf;
469cdf0e10cSrcweir pI->ePos = aPosPageBox.IsChecked() ? FTNPOS_PAGE : FTNPOS_CHAPTER;
470cdf0e10cSrcweir pI->eNum = (SwFtnNum)GetNumbering();
471cdf0e10cSrcweir pI->aQuoVadis = aContEdit.GetText();
472cdf0e10cSrcweir pI->aErgoSum = aContFromEdit.GetText();
473cdf0e10cSrcweir if ( !(*pI == pSh->GetFtnInfo()) )
474cdf0e10cSrcweir pSh->SetFtnInfo( *pI );
475cdf0e10cSrcweir }
476cdf0e10cSrcweir delete pInf;
477cdf0e10cSrcweir return sal_True;
478cdf0e10cSrcweir }
479cdf0e10cSrcweir
SwFootNoteOptionPage(Window * pParent,const SfxItemSet & rSet)480cdf0e10cSrcweir SwFootNoteOptionPage::SwFootNoteOptionPage( Window *pParent, const SfxItemSet &rSet ) :
481cdf0e10cSrcweir SwEndNoteOptionPage( pParent, sal_False, rSet )
482cdf0e10cSrcweir {
483cdf0e10cSrcweir }
484cdf0e10cSrcweir
~SwFootNoteOptionPage()485cdf0e10cSrcweir SwFootNoteOptionPage::~SwFootNoteOptionPage()
486cdf0e10cSrcweir {
487cdf0e10cSrcweir }
488cdf0e10cSrcweir
Create(Window * pParent,const SfxItemSet & rSet)489cdf0e10cSrcweir SfxTabPage *SwFootNoteOptionPage::Create(Window *pParent, const SfxItemSet &rSet )
490cdf0e10cSrcweir {
491cdf0e10cSrcweir return new SwFootNoteOptionPage( pParent, rSet );
492cdf0e10cSrcweir }
493cdf0e10cSrcweir
494cdf0e10cSrcweir
495cdf0e10cSrcweir
496cdf0e10cSrcweir
497cdf0e10cSrcweir
498cdf0e10cSrcweir
499cdf0e10cSrcweir
500