/* -*- 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 .
*/
using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::Exception; using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::uno::Sequence; using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::uno::Any;
usingnamespace ::com::sun::star::report;
void ConditionalFormattingDialog::impl_setPrefHeight(bool bFirst)
{ if (!m_bConstructed && !bFirst) return;
//allow dialog to resize itself
size_t nCount = impl_getConditionCount(); if (!nCount) return;
auto nHeight = m_aConditions[0]->get_preferred_size().Height();
size_t nVisibleConditions = ::std::min(nCount, MAX_CONDITIONS);
nHeight *= nVisibleConditions;
nHeight += 2; if (nHeight != m_xScrollWindow->get_size_request().Height())
{
m_xScrollWindow->set_size_request(-1, nHeight); if (!bFirst)
m_xDialog->resize_to_request();
}
}
// do this in two steps, so we don't become inconsistent if any of the UNO actions fails
Any aMovedCondition;
std::unique_ptr<Condition> xMovedCondition; try
{
aMovedCondition = m_xCopy->getByIndex( static_cast<sal_Int32>(nOldConditionIndex) );
m_xCopy->removeByIndex( static_cast<sal_Int32>(nOldConditionIndex) );
void ConditionalFormattingDialog::impl_layoutAll()
{ // scrollbar visibility if ( m_aConditions.size() <= MAX_CONDITIONS ) // normalize the position, so it can, in all situations, be used as top index
m_xScrollWindow->vadjustment_set_value(0);
}
void ConditionalFormattingDialog::impl_initializeConditions()
{ try
{
sal_Int32 nCount = m_xCopy->getCount(); for ( sal_Int32 i = 0; i < nCount ; ++i )
{ auto xCon = std::make_unique<Condition>(m_xConditionPlayground.get(), m_xDialog.get(), *this, m_rController);
Reference< XFormatCondition > xCond( m_xCopy->getByIndex(i), UNO_QUERY );
m_xConditionPlayground->reorder_child(xCon->get_widget(), i);
xCon->setCondition(xCond);
xCon->updateToolbar(xCond);
m_aConditions.push_back(std::move(xCon));
}
} catch(Exception&)
{
OSL_FAIL("Can not access format condition!");
}
// we use this way to create undo actions
m_rController.executeUnChecked(_nCommandId,aArgs);
m_aConditions[ _nCondIndex ]->updateToolbar(xReportControlFormat);
} catch( Exception& )
{
DBG_UNHANDLED_EXCEPTION("reportdesign");
}
}
void ConditionalFormattingDialog::moveConditionUp( size_t _nCondIndex )
{
OSL_PRECOND( _nCondIndex > 0, "ConditionalFormattingDialog::moveConditionUp: cannot move up the first condition!" ); if ( _nCondIndex > 0 )
impl_moveCondition_nothrow( _nCondIndex, true );
}
void ConditionalFormattingDialog::moveConditionDown( size_t _nCondIndex )
{
OSL_PRECOND( _nCondIndex < impl_getConditionCount(), "ConditionalFormattingDialog::moveConditionDown: cannot move down the last condition!" ); if ( _nCondIndex < impl_getConditionCount() )
impl_moveCondition_nothrow( _nCondIndex, false );
}
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.