2010-10-12 15:57:08 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-12 17:02:47 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2011-12-10 15:44:59 -05:00
|
|
|
#include "basidesh.hrc"
|
|
|
|
#include "objdlg.hrc"
|
2006-09-16 23:29:44 +00:00
|
|
|
|
2011-12-10 15:44:59 -05:00
|
|
|
#include "basidesh.hxx"
|
|
|
|
#include "iderdll.hxx"
|
|
|
|
#include "iderdll2.hxx"
|
|
|
|
#include "objdlg.hxx"
|
2012-08-06 14:28:28 +02:00
|
|
|
#include <helpid.hrc>
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2011-12-10 15:44:59 -05:00
|
|
|
#include <sfx2/app.hxx>
|
|
|
|
#include <sfx2/dispatch.hxx>
|
|
|
|
#include <sfx2/request.hxx>
|
|
|
|
#include <sfx2/viewfrm.hxx>
|
|
|
|
#include <svl/itemset.hxx>
|
2011-11-21 23:33:54 -05:00
|
|
|
#include <vcl/msgbox.hxx>
|
2002-04-25 08:34:09 +00:00
|
|
|
#include <vcl/taskpanelist.hxx>
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-08-06 14:28:28 +02:00
|
|
|
ObjectCatalog::ObjectCatalog (Window* pParent) :
|
|
|
|
BasicDockingWindow(pParent),
|
|
|
|
aTitle(this),
|
|
|
|
aTree(this, IDEResId(RID_TLB_MACROS))
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-06 14:28:28 +02:00
|
|
|
SetHelpId("basctl:FloatingWindow:RID_BASICIDE_OBJCAT");
|
|
|
|
SetText(String(IDEResId(RID_BASICIDE_OBJCAT)));
|
|
|
|
|
|
|
|
// title
|
|
|
|
aTitle.SetText(String(IDEResId(RID_BASICIDE_OBJCAT)));
|
|
|
|
aTitle.SetStyle(WB_CENTER);
|
|
|
|
|
|
|
|
// tree list
|
|
|
|
aTree.Hide();
|
|
|
|
aTree.SetStyle(
|
|
|
|
WB_BORDER | WB_TABSTOP | WB_HSCROLL |
|
|
|
|
WB_HASLINES | WB_HASLINESATROOT |
|
|
|
|
WB_HASBUTTONS | WB_HASBUTTONSATROOT
|
|
|
|
);
|
|
|
|
aTree.SetAccessibleName(String(IDEResId(RID_STR_TLB_MACROS)));
|
|
|
|
aTree.SetHelpId(HID_BASICIDE_OBJECTCAT);
|
|
|
|
aTree.ScanAllEntries();
|
|
|
|
aTree.GrabFocus();
|
2000-09-29 10:02:42 +00:00
|
|
|
|
|
|
|
{
|
2011-08-22 11:39:37 +02:00
|
|
|
// centered after AppWin:
|
2012-08-06 14:28:28 +02:00
|
|
|
Window const& rParent = *GetParent();
|
|
|
|
Point aPos = rParent.OutputToScreenPixel(Point(0, 0));
|
|
|
|
Size const aParentSize = rParent.GetSizePixel();
|
|
|
|
Size const aSize = GetSizePixel();
|
|
|
|
aPos.X() += (aParentSize.Width() - aSize.Width()) / 2;
|
|
|
|
aPos.Y() += (aParentSize.Height() - aSize.Height()) / 2;
|
|
|
|
SetPosPixel(aPos);
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
2002-04-25 08:34:09 +00:00
|
|
|
|
|
|
|
// make object catalog keyboard accessible
|
2012-08-06 14:28:28 +02:00
|
|
|
GetParent()->GetSystemWindow()->GetTaskPaneList()->AddWindow(this);
|
2002-04-25 08:34:09 +00:00
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-08-06 14:28:28 +02:00
|
|
|
ObjectCatalog::~ObjectCatalog ()
|
2012-03-11 21:40:02 +01:00
|
|
|
{
|
2012-08-06 14:28:28 +02:00
|
|
|
GetParent()->GetSystemWindow()->GetTaskPaneList()->RemoveWindow(this);
|
2012-03-11 21:40:02 +01:00
|
|
|
}
|
|
|
|
|
2012-08-06 14:28:28 +02:00
|
|
|
// Resize() -- called by Window
|
|
|
|
void ObjectCatalog::Resize ()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-06 14:28:28 +02:00
|
|
|
// arranging the controls
|
|
|
|
ArrangeWindows();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-08-06 14:28:28 +02:00
|
|
|
// ToggleFloatingMode() -- called by DockingWindow when IsFloatingMode() changes
|
|
|
|
void ObjectCatalog::ToggleFloatingMode ()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-06 14:28:28 +02:00
|
|
|
// base class version
|
|
|
|
BasicDockingWindow::ToggleFloatingMode();
|
|
|
|
// rearranging the controls (title)
|
|
|
|
ArrangeWindows();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-08-06 14:28:28 +02:00
|
|
|
// ArrangeWindows() -- arranges the controls to the size of the ObjectCatalog
|
|
|
|
void ObjectCatalog::ArrangeWindows ()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-06 14:28:28 +02:00
|
|
|
Size const aSize = GetOutputSizePixel();
|
|
|
|
bool const bFloating = IsFloatingMode();
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-08-06 14:28:28 +02:00
|
|
|
// title
|
|
|
|
// (showing only if no title bar)
|
|
|
|
if (bFloating)
|
|
|
|
aTitle.Hide();
|
|
|
|
else
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-06 14:28:28 +02:00
|
|
|
Size aTitleSize = LogicToPixel(Size(3, 10), MAP_APPFONT);
|
|
|
|
aTitleSize.Width() = aSize.Width() - 2*aTitleSize.Width();
|
|
|
|
aTitle.SetPosPixel(LogicToPixel(Point(3, 3), MAP_APPFONT));
|
|
|
|
aTitle.SetSizePixel(aTitleSize);
|
|
|
|
aTitle.Show();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-08-06 14:28:28 +02:00
|
|
|
// tree
|
|
|
|
Point const aTreePos = LogicToPixel(Point(3, bFloating ? 3 : 16), MAP_APPFONT);
|
|
|
|
long const nMargin = aTreePos.X();
|
|
|
|
Size const aTreeSize(
|
|
|
|
aSize.Width() - 2*nMargin,
|
|
|
|
aSize.Height() - aTreePos.Y() - nMargin
|
|
|
|
);
|
|
|
|
if (aTreeSize.Height() > 0)
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-06 14:28:28 +02:00
|
|
|
aTree.SetPosSizePixel(aTreePos, aTreeSize);
|
|
|
|
aTree.Show();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
2012-08-06 14:28:28 +02:00
|
|
|
aTree.Hide();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-07-24 11:29:57 +02:00
|
|
|
void ObjectCatalog::SetCurrentEntry (IDEBaseWindow* pCurWin)
|
2004-07-23 11:07:23 +00:00
|
|
|
{
|
2012-08-06 14:28:28 +02:00
|
|
|
BasicEntryDescriptor aDescriptor;
|
2012-07-24 11:29:57 +02:00
|
|
|
if (pCurWin)
|
2012-08-06 14:28:28 +02:00
|
|
|
aDescriptor = pCurWin->CreateEntryDescriptor();
|
|
|
|
aTree.SetCurrentEntry(aDescriptor);
|
2002-07-03 14:53:24 +00:00
|
|
|
}
|
2010-10-12 15:57:08 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|