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_sd.hxx" 30 31 #include "NotesDockingWindow.hxx" 32 #include "NotesChildWindow.hrc" 33 34 #include "EditWindow.hxx" 35 #include "TextLogger.hxx" 36 #include <svx/dlgctrl.hxx> 37 #include <sfx2/bindings.hxx> 38 #include <sfx2/dispatch.hxx> 39 #include <sfx2/viewfrm.hxx> 40 #include "DrawViewShell.hxx" 41 #ifndef SD_DRAW_DOC_HXX 42 #include "drawdoc.hxx" 43 #endif 44 #include "sdresid.hxx" 45 #include "ViewShellBase.hxx" 46 47 namespace sd { namespace notes { 48 49 NotesDockingWindow::NotesDockingWindow ( 50 SfxBindings *_pBindings, 51 SfxChildWindow *pChildWindow, 52 Window* _pParent) 53 : SfxDockingWindow (_pBindings, pChildWindow, _pParent, 54 SdResId(FLT_WIN_NOTES)) 55 { 56 ViewShellBase* pBase = ViewShellBase::GetViewShellBase ( 57 _pBindings->GetDispatcher()->GetFrame()); 58 if (pBase != NULL) 59 { 60 SdDrawDocument* pDocument = pBase->GetDocument(); 61 mpEditWindow = new EditWindow (this, &pDocument->GetPool()); 62 mpEditWindow->Show(); 63 TextLogger::Instance().ConnectToEditWindow (mpEditWindow); 64 } 65 } 66 67 68 69 70 NotesDockingWindow::~NotesDockingWindow (void) 71 { 72 delete mpEditWindow; 73 } 74 75 76 77 78 void NotesDockingWindow::Paint (const Rectangle& rBoundingBox) 79 { 80 SfxDockingWindow::Paint (rBoundingBox); 81 82 Size aWindowSize (GetOutputSizePixel()); 83 Rectangle aBBox; 84 Point aPosition(10,aWindowSize.Height()/2); 85 String aString (UniString::CreateFromAscii("Bottom Panel Docking Window")); 86 if (GetTextBoundRect (aBBox, aString)) 87 aPosition = Point ( 88 (aWindowSize.Width()-aBBox.GetWidth())/2, 89 (aWindowSize.Height()-aBBox.GetHeight())/2); 90 91 DrawText (aPosition, aString); 92 } 93 94 95 96 97 void NotesDockingWindow::Resize (void) 98 { 99 SfxDockingWindow::Resize(); 100 101 Size aWinSize (GetOutputSizePixel()); 102 103 if (mpEditWindow != NULL) 104 { 105 mpEditWindow->SetPosSizePixel ( 106 Point(0,0), 107 aWinSize); 108 } 109 } 110 111 112 113 } } // end of namespace ::sd::notes 114 115