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