LCOV - code coverage report
Current view: top level - libreoffice/basctl/source/basicide - objdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 57 0.0 %
Date: 2012-12-27 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "basidesh.hrc"
      21             : #include "objdlg.hrc"
      22             : 
      23             : #include "basidesh.hxx"
      24             : #include "iderdll.hxx"
      25             : #include "iderdll2.hxx"
      26             : #include "objdlg.hxx"
      27             : #include "helpid.hrc"
      28             : 
      29             : #include <sfx2/app.hxx>
      30             : #include <sfx2/dispatch.hxx>
      31             : #include <sfx2/request.hxx>
      32             : #include <sfx2/viewfrm.hxx>
      33             : #include <svl/itemset.hxx>
      34             : #include <vcl/msgbox.hxx>
      35             : #include <vcl/taskpanelist.hxx>
      36             : 
      37             : namespace basctl
      38             : {
      39             : 
      40           0 : ObjectCatalog::ObjectCatalog (Window* pParent) :
      41             :     DockingWindow(pParent),
      42             :     aTitle(this),
      43           0 :     aTree(this, IDEResId(RID_TLB_MACROS))
      44             : {
      45           0 :     SetHelpId("basctl:FloatingWindow:RID_BASICIDE_OBJCAT");
      46           0 :     SetText(String(IDEResId(RID_BASICIDE_OBJCAT)));
      47             : 
      48             :     // title
      49           0 :     aTitle.SetText(String(IDEResId(RID_BASICIDE_OBJCAT)));
      50           0 :     aTitle.SetStyle(WB_CENTER);
      51             : 
      52             :     // tree list
      53           0 :     aTree.Hide();
      54             :     aTree.SetStyle(
      55             :         WB_BORDER | WB_TABSTOP | WB_HSCROLL |
      56             :         WB_HASLINES | WB_HASLINESATROOT |
      57             :         WB_HASBUTTONS | WB_HASBUTTONSATROOT
      58           0 :     );
      59           0 :     aTree.SetAccessibleName(String(IDEResId(RID_STR_TLB_MACROS)));
      60           0 :     aTree.SetHelpId(HID_BASICIDE_OBJECTCAT);
      61           0 :     aTree.ScanAllEntries();
      62           0 :     aTree.GrabFocus();
      63             : 
      64             :     {
      65             :         // centered after AppWin:
      66           0 :         Window const& rParent = *GetParent();
      67           0 :         Point aPos = rParent.OutputToScreenPixel(Point(0, 0));
      68           0 :         Size const aParentSize = rParent.GetSizePixel();
      69           0 :         Size const aSize = GetSizePixel();
      70           0 :         aPos.X() += (aParentSize.Width() - aSize.Width()) / 2;
      71           0 :         aPos.Y() += (aParentSize.Height() - aSize.Height()) / 2;
      72           0 :         SetPosPixel(aPos);
      73             :     }
      74             : 
      75             :     // make object catalog keyboard accessible
      76           0 :     GetParent()->GetSystemWindow()->GetTaskPaneList()->AddWindow(this);
      77           0 : }
      78             : 
      79           0 : ObjectCatalog::~ObjectCatalog ()
      80             : {
      81           0 :     GetParent()->GetSystemWindow()->GetTaskPaneList()->RemoveWindow(this);
      82           0 : }
      83             : 
      84             : // Resize() -- called by Window
      85           0 : void ObjectCatalog::Resize ()
      86             : {
      87             :     // arranging the controls
      88           0 :     ArrangeWindows();
      89           0 : }
      90             : 
      91             : // ToggleFloatingMode() -- called by DockingWindow when IsFloatingMode() changes
      92           0 : void ObjectCatalog::ToggleFloatingMode ()
      93             : {
      94             :     // base class version
      95           0 :     DockingWindow::ToggleFloatingMode();
      96             :     // rearranging the controls (title)
      97           0 :     ArrangeWindows();
      98           0 : }
      99             : 
     100             : // ArrangeWindows() -- arranges the controls to the size of the ObjectCatalog
     101           0 : void ObjectCatalog::ArrangeWindows ()
     102             : {
     103           0 :     Size const aSize = GetOutputSizePixel();
     104           0 :     bool const bFloating = IsFloatingMode();
     105             : 
     106             :     // title
     107             :     // (showing only if no title bar)
     108           0 :     if (bFloating)
     109           0 :         aTitle.Hide();
     110             :     else
     111             :     {
     112           0 :         Size aTitleSize = LogicToPixel(Size(3, 10), MAP_APPFONT);
     113           0 :         aTitleSize.Width() = aSize.Width() - 2*aTitleSize.Width();
     114           0 :         aTitle.SetPosPixel(LogicToPixel(Point(3, 3), MAP_APPFONT));
     115           0 :         aTitle.SetSizePixel(aTitleSize);
     116           0 :         aTitle.Show();
     117             :     }
     118             : 
     119             :     // tree
     120           0 :     Point const aTreePos = LogicToPixel(Point(3, bFloating ? 3 : 16), MAP_APPFONT);
     121           0 :     long const nMargin = aTreePos.X();
     122             :     Size const aTreeSize(
     123           0 :         aSize.Width() - 2*nMargin,
     124           0 :         aSize.Height() - aTreePos.Y() - nMargin
     125           0 :     );
     126           0 :     if (aTreeSize.Height() > 0)
     127             :     {
     128           0 :         aTree.SetPosSizePixel(aTreePos, aTreeSize);
     129           0 :         aTree.Show();
     130             :     }
     131             :     else
     132           0 :         aTree.Hide();
     133           0 : }
     134             : 
     135           0 : void ObjectCatalog::SetCurrentEntry (BaseWindow* pCurWin)
     136             : {
     137           0 :     EntryDescriptor aDescriptor;
     138           0 :     if (pCurWin)
     139           0 :         aDescriptor = pCurWin->CreateEntryDescriptor();
     140           0 :     aTree.SetCurrentEntry(aDescriptor);
     141           0 : }
     142             : 
     143             : 
     144             : } // namespace basctl
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10