/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * 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 .
*/
void Draw3DBorder(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
{ // Use the System Style-Settings for my colours const StyleSettings& aSystemStyle = Application::GetSettings().GetStyleSettings();
// Black lines for bottom and right
rRenderContext.SetLineColor(aSystemStyle.GetDarkShadowColor());
rRenderContext.DrawLine(rRect.BottomLeft(), rRect.BottomRight());
rRenderContext.DrawLine(rRect.BottomRight(), rRect.TopRight());
// Dark grey lines over the black lines
rRenderContext.SetLineColor(aSystemStyle.GetShadowColor());
Point aEHvector(1, 1);
rRenderContext.DrawLine(rRect.BottomLeft() + Point(1, -1), rRect.BottomRight() - aEHvector);
rRenderContext.DrawLine(rRect.BottomRight() - aEHvector, rRect.TopRight() + Point(-1, 1));
// Light grey lines for top and left
rRenderContext.SetLineColor(aSystemStyle.GetLightColor());
rRenderContext.DrawLine(rRect.BottomLeft() + Point(1, -2), rRect.TopLeft() + aEHvector);
rRenderContext.DrawLine(rRect.TopLeft() + aEHvector, rRect.TopRight() + Point(-2, 1));
}
// Set background const StyleSettings& aSystemStyle = Application::GetSettings().GetStyleSettings();
SetBackground(Wallpaper(aSystemStyle.GetFaceColor())); // Set the text colour even though there is no text, // because derived classes might need it
SetTextColor(aSystemStyle.GetButtonTextColor());
EnableClipSiblings();
}
OTableWindow::~OTableWindow()
{
disposeOnce();
}
void OTableWindow::dispose()
{ if (m_xListBox)
{
OSL_ENSURE(m_xListBox->get_widget().n_children()==0,"Forgot to call EmptyListbox()!");
}
m_xListBox.disposeAndClear(); if ( m_pContainerListener.is() )
m_pContainerListener->dispose();
bool OTableWindow::Init()
{ // create list box if necessary if ( !m_xListBox )
{
m_xListBox = VclPtr<OTableWindowListBox>::Create(this);
assert(m_xListBox && "OTableWindow::Init() : CreateListBox returned NULL !");
m_xListBox->get_widget().set_selection_mode(SelectionMode::Multiple);
}
// Set the title
weld::Label& rLabel = m_xTitle->GetLabel();
rLabel.set_label(m_pData->GetWinName());
rLabel.set_tooltip_text(GetComposedName());
m_xTitle->Show();
m_xListBox->Show();
// add the fields to the ListBox
FillListBox();
m_xListBox->get_widget().unselect_all();
impl_updateImage();
returntrue;
}
void OTableWindow::DataChanged(const DataChangedEvent& rDCEvt)
{ if (rDCEvt.GetType() == DataChangedEventType::SETTINGS)
{ // In the worst-case the colours have changed so // adapt myself to the new colours const StyleSettings& aSystemStyle = Application::GetSettings().GetStyleSettings();
SetBackground(Wallpaper(aSystemStyle.GetFaceColor()));
SetTextColor(aSystemStyle.GetButtonTextColor());
}
}
void OTableWindow::setSizingFlag(const Point& _rPos)
{
Size aOutSize = GetOutputSizePixel(); // Set the flags when the mouse cursor is in the sizing area
m_nSizingFlags = SizingFlags::NONE;
OJoinTableView* pCont = getTableView(); if (pCont->getDesignView()->getController().isReadOnly()) return;
Point aPos = rEvt.GetPosPixel();
setSizingFlag(aPos);
PointerStyle aPointer = PointerStyle::Arrow;
// Set the mouse cursor when it is in the sizing area if ( m_nSizingFlags == SizingFlags::Top ||
m_nSizingFlags == SizingFlags::Bottom )
aPointer = PointerStyle::SSize; elseif ( m_nSizingFlags == SizingFlags::Left ||
m_nSizingFlags ==SizingFlags::Right )
aPointer = PointerStyle::ESize; elseif ( m_nSizingFlags == (SizingFlags::Left | SizingFlags::Top) ||
m_nSizingFlags == (SizingFlags::Right | SizingFlags::Bottom) )
aPointer = PointerStyle::SESize; elseif ( m_nSizingFlags == (SizingFlags::Right | SizingFlags::Top) ||
m_nSizingFlags == (SizingFlags::Left | SizingFlags::Bottom) )
aPointer = PointerStyle::NESize;
SetPointer( aPointer );
}
void OTableWindow::MouseButtonDown( const MouseEvent& rEvt )
{ // When resizing, the parent must be informed that // the window size of its child has changed if( m_nSizingFlags != SizingFlags::NONE )
getTableView()->BeginChildSizing( this, GetPointer() );
Window::MouseButtonDown( rEvt );
}
void OTableWindow::Resize()
{ // The window must not disappear so we enforce a minimum size
Size aOutSize = GetOutputSizePixel();
aOutSize = Size(CalcZoom(aOutSize.Width()),CalcZoom(aOutSize.Height()));
void OTableWindow::GetFocus()
{
Window::GetFocus(); // we have to forward the focus to our listbox to enable keystrokes if(m_xListBox)
m_xListBox->GrabFocus();
}
// This default implementation counts every item in the ListBox ... for any other behaviour it must be over-written
rTreeView.all_foreach([&rTreeView, &arrstrFields](weld::TreeIter& rEntry){
arrstrFields.push_back(rTreeView.get_text(rEntry)); returnfalse;
});
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.