merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / notes / NotesDockingWindow.cxx
blobdc93cd448686f0d97fd8c8cdfa1118d7bb89b682
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: NotesDockingWindow.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include "NotesDockingWindow.hxx"
35 #include "NotesChildWindow.hrc"
37 #include "EditWindow.hxx"
38 #include "TextLogger.hxx"
39 #include <svx/dlgctrl.hxx>
40 #include <sfx2/bindings.hxx>
41 #include <sfx2/dispatch.hxx>
42 #include <sfx2/viewfrm.hxx>
43 #include "DrawViewShell.hxx"
44 #ifndef SD_DRAW_DOC_HXX
45 #include "drawdoc.hxx"
46 #endif
47 #include "sdresid.hxx"
48 #include "ViewShellBase.hxx"
50 namespace sd { namespace notes {
52 NotesDockingWindow::NotesDockingWindow (
53 SfxBindings *_pBindings,
54 SfxChildWindow *pChildWindow,
55 Window* _pParent)
56 : SfxDockingWindow (_pBindings, pChildWindow, _pParent,
57 SdResId(FLT_WIN_NOTES))
59 ViewShellBase* pBase = ViewShellBase::GetViewShellBase (
60 _pBindings->GetDispatcher()->GetFrame());
61 if (pBase != NULL)
63 SdDrawDocument* pDocument = pBase->GetDocument();
64 mpEditWindow = new EditWindow (this, &pDocument->GetPool());
65 mpEditWindow->Show();
66 TextLogger::Instance().ConnectToEditWindow (mpEditWindow);
73 NotesDockingWindow::~NotesDockingWindow (void)
75 delete mpEditWindow;
81 void NotesDockingWindow::Paint (const Rectangle& rBoundingBox)
83 SfxDockingWindow::Paint (rBoundingBox);
85 Size aWindowSize (GetOutputSizePixel());
86 Rectangle aBBox;
87 Point aPosition(10,aWindowSize.Height()/2);
88 String aString (UniString::CreateFromAscii("Bottom Panel Docking Window"));
89 if (GetTextBoundRect (aBBox, aString))
90 aPosition = Point (
91 (aWindowSize.Width()-aBBox.GetWidth())/2,
92 (aWindowSize.Height()-aBBox.GetHeight())/2);
94 DrawText (aPosition, aString);
100 void NotesDockingWindow::Resize (void)
102 SfxDockingWindow::Resize();
104 Size aWinSize (GetOutputSizePixel());
106 if (mpEditWindow != NULL)
108 mpEditWindow->SetPosSizePixel (
109 Point(0,0),
110 aWinSize);
116 } } // end of namespace ::sd::notes