/* -*- 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 Control::CreateLayoutData() const
{
SAL_WARN_IF( mxLayoutData, "vcl", "Control::CreateLayoutData: should be called with non-existent layout data only!" );
mxLayoutData.emplace();
}
int nDisplayLines = m_aLineIndices.size(); if( nLine >= 0 && nLine < nDisplayLines )
{
aPair.A() = m_aLineIndices[nLine]; if( nLine+1 < nDisplayLines )
aPair.B() = m_aLineIndices[nLine+1]-1; else
aPair.B() = m_aDisplayText.getLength()-1;
} elseif( nLine == 0 && nDisplayLines == 0 && !m_aDisplayText.isEmpty() )
{ // special case for single line controls so the implementations // in that case do not have to fill in the line indices
aPair.A() = 0;
aPair.B() = m_aDisplayText.getLength()-1;
} return aPair;
}
void Control::ImplDrawFrame( OutputDevice* pDev, tools::Rectangle& rRect )
{ // use a deco view to draw the frame // However, since there happens a lot of magic there, we need to fake some (style) settings // on the device
AllSettings aOriginalSettings( pDev->GetSettings() );
// The *only known* clients of the Draw methods of the various VCL-controls are form controls: // During print preview, and during printing, Draw is called. Thus, drawing always happens with a // mono (colored) border
aStyle.SetOptions( aStyle.GetOptions() | StyleSettingsOptions::Mono );
aStyle.SetMonoColor( GetSettings().GetStyleSettings().GetMonoColor() );
aNewSettings.SetStyleSettings( aStyle ); // #i67023# do not call data changed listeners for this fake // since they may understandably invalidate on settings changed
pDev->OutputDevice::SetSettings( aNewSettings );
OutputDevice* Control::GetReferenceDevice() const
{ // tdf#118377 It can happen that mpReferenceDevice is already disposed and // stays disposed (see task, even when Dialog is closed). I have no idea if // this may be very bad - someone who knows more about lifetime of OutputDevice's // will have to decide. // To secure this, I changed all accesses to mpControlData->mpReferenceDevice to // use Control::GetReferenceDevice() - only use mpControlData->mpReferenceDevice // inside Control::SetReferenceDevice and Control::GetReferenceDevice(). // Control::GetReferenceDevice() will now reset mpReferenceDevice if it is already // disposed. This way all usages will do a kind of 'test-and-get' call. if(nullptr != mpReferenceDevice && mpReferenceDevice->isDisposed())
{ const_cast<Control*>(this)->SetReferenceDevice(nullptr);
}
Font
Control::GetUnzoomedControlPointFont() const
{
Font aFont(GetCanonicalFont(GetSettings().GetStyleSettings())); if (IsControlFont())
aFont.Merge(GetControlFont()); return aFont;
}
void Control::LogicInvalidate(const tools::Rectangle* pRectangle)
{
VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier(); if (!pParent || !dynamic_cast<vcl::DocWindow*>(GetParent()))
{ // if control doesn't belong to a DocWindow, the overridden base class // method has to be invoked
Window::LogicInvalidate(pRectangle); return;
}
// avoid endless paint/invalidate loop in Impress if (comphelper::LibreOfficeKit::isTiledPainting()) return;
tools::Rectangle aResultRectangle; if (!pRectangle)
{ // we have to invalidate the whole control area not the whole document
aResultRectangle = PixelToLogic(tools::Rectangle(GetPosPixel(), GetSizePixel()), MapMode(MapUnit::MapTwip));
} else
{
aResultRectangle = OutputDevice::LogicToLogic(*pRectangle, GetMapMode(), MapMode(MapUnit::MapTwip));
}
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.