xref: /aoo41x/main/sw/source/ui/envelp/syncbtn.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 
31 
32 
33 
34 #include <sfx2/viewfrm.hxx>
35 #include <sfx2/dispatch.hxx>
36 
37 #include "cmdid.h"
38 #include "swmodule.hxx"
39 #include "view.hxx"
40 #include "edtwin.hxx"
41 #include "label.hrc"
42 
43 #define _SYNCDLG
44 #include "syncbtn.hxx"
45 #include "swtypes.hxx"
46 
47 SFX_IMPL_FLOATINGWINDOW( SwSyncChildWin, FN_SYNC_LABELS )
48 
49 /*------------------------------------------------------------------------
50 	Beschreibung:
51 ------------------------------------------------------------------------*/
52 
53 SwSyncChildWin::SwSyncChildWin( Window* _pParent,
54 								sal_uInt16 nId,
55 								SfxBindings* pBindings,
56 								SfxChildWinInfo* pInfo ) :
57                                 SfxChildWindow( _pParent, nId )
58 {
59     pWindow = new SwSyncBtnDlg( pBindings, this, _pParent);
60 
61 	if (!pInfo->aSize.Width() || !pInfo->aSize.Height())
62 	{
63         SwView* pActiveView = ::GetActiveView();
64         if(pActiveView)
65         {
66             const SwEditWin &rEditWin = pActiveView->GetEditWin();
67             pWindow->SetPosPixel(rEditWin.OutputToScreenPixel(Point(0, 0)));
68         }
69         else
70             pWindow->SetPosPixel(_pParent->OutputToScreenPixel(Point(0, 0)));
71 		pInfo->aPos = pWindow->GetPosPixel();
72 		pInfo->aSize = pWindow->GetSizePixel();
73 	}
74 
75 	((SwSyncBtnDlg *)pWindow)->Initialize(pInfo);
76 
77 	pWindow->Show();
78 }
79 
80 /*------------------------------------------------------------------------
81 	Beschreibung:
82 ------------------------------------------------------------------------*/
83 
84 SwSyncBtnDlg::SwSyncBtnDlg( SfxBindings* _pBindings,
85 							SfxChildWindow* pChild,
86 							Window *pParent) :
87     SfxFloatingWindow(_pBindings, pChild, pParent, SW_RES(DLG_SYNC_BTN)),
88 	aSyncBtn    	(this, SW_RES(BTN_SYNC ))
89 {
90 	FreeResource();
91 	aSyncBtn.SetClickHdl(LINK(this, SwSyncBtnDlg, BtnHdl));
92 }
93 
94 /*------------------------------------------------------------------------
95 	Beschreibung:
96 ------------------------------------------------------------------------*/
97 
98 __EXPORT SwSyncBtnDlg::~SwSyncBtnDlg()
99 {
100 }
101 
102 /*--------------------------------------------------------------------
103 	Beschreibung:
104  --------------------------------------------------------------------*/
105 
106 IMPL_LINK( SwSyncBtnDlg, BtnHdl, PushButton *, EMPTYARG )
107 {
108 	SfxViewFrame::Current()->GetDispatcher()->Execute(FN_UPDATE_ALL_LINKS, SFX_CALLMODE_ASYNCHRON);
109 	return 0;
110 }
111 
112 
113