xref: /aoo4110/main/sw/source/ui/envelp/syncbtn.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 
28 
29 
30 #include <sfx2/viewfrm.hxx>
31 #include <sfx2/dispatch.hxx>
32 
33 #include "cmdid.h"
34 #include "swmodule.hxx"
35 #include "view.hxx"
36 #include "edtwin.hxx"
37 #include "label.hrc"
38 
39 #define _SYNCDLG
40 #include "syncbtn.hxx"
41 #include "swtypes.hxx"
42 
SFX_IMPL_FLOATINGWINDOW(SwSyncChildWin,FN_SYNC_LABELS)43 SFX_IMPL_FLOATINGWINDOW( SwSyncChildWin, FN_SYNC_LABELS )
44 
45 /*------------------------------------------------------------------------
46 	Beschreibung:
47 ------------------------------------------------------------------------*/
48 
49 SwSyncChildWin::SwSyncChildWin( Window* _pParent,
50 								sal_uInt16 nId,
51 								SfxBindings* pBindings,
52 								SfxChildWinInfo* pInfo ) :
53                                 SfxChildWindow( _pParent, nId )
54 {
55     pWindow = new SwSyncBtnDlg( pBindings, this, _pParent);
56 
57 	if (!pInfo->aSize.Width() || !pInfo->aSize.Height())
58 	{
59         SwView* pActiveView = ::GetActiveView();
60         if(pActiveView)
61         {
62             const SwEditWin &rEditWin = pActiveView->GetEditWin();
63             pWindow->SetPosPixel(rEditWin.OutputToScreenPixel(Point(0, 0)));
64         }
65         else
66             pWindow->SetPosPixel(_pParent->OutputToScreenPixel(Point(0, 0)));
67 		pInfo->aPos = pWindow->GetPosPixel();
68 		pInfo->aSize = pWindow->GetSizePixel();
69 	}
70 
71 	((SwSyncBtnDlg *)pWindow)->Initialize(pInfo);
72 
73 	pWindow->Show();
74 }
75 
76 /*------------------------------------------------------------------------
77 	Beschreibung:
78 ------------------------------------------------------------------------*/
79 
SwSyncBtnDlg(SfxBindings * _pBindings,SfxChildWindow * pChild,Window * pParent)80 SwSyncBtnDlg::SwSyncBtnDlg( SfxBindings* _pBindings,
81 							SfxChildWindow* pChild,
82 							Window *pParent) :
83     SfxFloatingWindow(_pBindings, pChild, pParent, SW_RES(DLG_SYNC_BTN)),
84 	aSyncBtn    	(this, SW_RES(BTN_SYNC ))
85 {
86 	FreeResource();
87 	aSyncBtn.SetClickHdl(LINK(this, SwSyncBtnDlg, BtnHdl));
88 }
89 
90 /*------------------------------------------------------------------------
91 	Beschreibung:
92 ------------------------------------------------------------------------*/
93 
~SwSyncBtnDlg()94 __EXPORT SwSyncBtnDlg::~SwSyncBtnDlg()
95 {
96 }
97 
98 /*--------------------------------------------------------------------
99 	Beschreibung:
100  --------------------------------------------------------------------*/
101 
IMPL_LINK(SwSyncBtnDlg,BtnHdl,PushButton *,EMPTYARG)102 IMPL_LINK( SwSyncBtnDlg, BtnHdl, PushButton *, EMPTYARG )
103 {
104 	SfxViewFrame::Current()->GetDispatcher()->Execute(FN_UPDATE_ALL_LINKS, SFX_CALLMODE_ASYNCHRON);
105 	return 0;
106 }
107 
108 
109